- 啥类目让用?
小程序后台找不到 [图片] 别人发的连接加不了 [图片]
2022-12-14 - 为啥找不到腾讯语音识别的插件?
[图片]
2022-12-14 - 如何改变函数的执行顺序?
app.js collectpy : function(){ wx.cloud.callFunction({ name:'collectgroup', success: res => { let r = res.result.list if (this.testCallBack){this.testCallBack(r)} wx.setStorageSync('collectgroup', r) console.log('a') }, }); }, order.js app.collectpy(), console.log('b') 程序是先输出的"b",后输出的"a",如何先输出"a",再输出"b",让程序按顺序执行
2022-12-05 - 云开发续费了,但是数据库还是不给用啊?
客服去哪里找?续费了读取数据还是要求续费。
2022-11-21 - 调用云函数失败?
两个云函数有一个调用成功,另一个报错,下面为调用失败的云函数。 // 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() // 云函数入口函数 const db = cloud.database() const MAX_LIMIT = 100 exports.main = async (event, context) => { const new_name = event.a // 先取出集合记录总数 const countResult = await db.collection(new_name).count() const total = countResult.total // 计算需分几次取 const batchTimes = Math.ceil(total / 100) // 承载所有读操作的 promise 的数组 const tasks = [] for (let i = 0; i < batchTimes; i++) { const promise = db.collection(new_name).skip(i * MAX_LIMIT).limit(MAX_LIMIT).get() tasks.push(promise) } // 等待所有 return (await Promise.all(tasks)).reduce((acc, cur) => { return { data: acc.data.concat(cur.data), errMsg: acc.errMsg, } }) } wx.cloud.callFunction({ name:'tichu', data: { a: 'allplayers' }, success: res => { console.log(res) }, fail :err => {console.log(err)} }); /* 捕获的错误为 Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: Error: collection.count:fail -501003 exceed request limit. [ResourceUnavailable.ResourceOverdue] Resource has expired. Please renewal fee, but if the problem cannot be solved, contact us. at Object.toSDKError (:43397/var/user/node_modules/wx-server-sdk/index.js:8064) at Object.checkError (:43397/var/user/node_modules/wx-server-sdk/index.js:1421) at :43397/var/user/node_modules/wx-server-sdk/index.js:1557 at processTicksAndRejections (:43397/appservice/internal/process/task_queues.js:97) (callId: 1669034947614-0.22814895692167214) (trace: 20:49:7 start->20:49:7 app show->20:49:8 system error (Error: errCode: -504002 functions execute fail | errMsg: Error: collection.count:fail -501003 exceed request limit. [ResourceUnavailable.ResourceOverdue] Resource has expired. Please renewal fee, but if the problem cannot be solved, contact us. at Object.toSDKError (:43397/var/user/node_modules/wx-server-sdk/index.js:8064) at Object.checkError (:43397/var/user/node_modules/wx-server-sdk/index.js:1421) at :43397/var/user/node_modules/wx-server-sdk/index.js:1557 at processTicksAndRejections (:43397/appservice/internal/process/task_queues.js:97)), abort) at k (VM30 WAService.js:1) at VM30 WAService.js:1 */ 本地调试的错误为: [error] 函数执行失败(耗时 107ms) Error: collection.count:fail -501003 exceed request limit. [ResourceUnavailable.ResourceOverdue] Resource has expired. Please renewal fee, but if the problem cannot be solved, contact us. at Object.toSDKError (/Users/admin/Desktop/tichu-opentest/cloudfunctions/tichu/node_modules/wx-server-sdk/index.js:8064:19) at Object.checkError (/Users/admin/Desktop/tichu-opentest/cloudfunctions/tichu/node_modules/wx-server-sdk/index.js:1421:23) at /Users/admin/Desktop/tichu-opentest/cloudfunctions/tichu/node_modules/wx-server-sdk/index.js:1557:33 at processTicksAndRejections (node:internal/process/task_queues:96:5) [图片][图片]
2022-11-21 - 获取头像按钮点了无效?
<view data-weui-theme="{{theme}}"> <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar"> <image class="avatar" src="{{avatarUrl}}"></image> </button> <view> 姓名:<input type="nickname" class="weui-input" placeholder="请输入昵称"/> </view> </view> button按钮点了没有任何反应
2022-07-31 - 怎么取得return返回的data值啊?
const db = wx.cloud.database() const MAX_LIMIT = 100 exports.main = async (event, context) => { // 先取出集合记录总数 const countResult = await db.collection('building').count() const total = countResult.total // 计算需分几次取 const batchTimes = Math.ceil(total / 100) // 承载所有读操作的 promise 的数组 const tasks = [] for (let i = 0; i < batchTimes; i++) { const promise = db.collection('building').skip(i * MAX_LIMIT).limit(MAX_LIMIT).get() tasks.push(promise) } // 等待所有 return (await Promise.all(tasks)).reduce((acc, cur) => { return { data: acc.data.concat(cur.data), errMsg: acc.errMsg, } }) }
2022-01-22 - 为什么不能重置data里的某些数据?
let initteam = { p1:{name:"", bg:0, sg:0, dw:0, checked: 0}, p2:{name:"", bg:0, sg:0, dw:0, checked: 0}, p3:{name:"", bg:0, sg:0, dw:0, checked: 0}, p4:{name:"", bg:0, sg:0, dw:0, checked: 0}, }; let initsc = { team1:"", team2:"" }; Page({ data: { team:{ }, sc: { }, }, onLoad: function(option){ const eventChannel = this.getOpenerEventChannel() const that = this eventChannel.on('acceptDataFromOpenerPage', function(data) { let all = data.data initteam.p1.name = all[0] initteam.p2.name = all[1] initteam.p3.name = all[2] initteam.p4.name = all[3] that.clean() //这个可以设置初始data }) }, clean() { let that = this that.setData({team:initteam}) that.setData({sc:initsc}) }, formSubmit(e){ let that = this let sc = that.data.sc let team = that.data.team let score = e.detail.value let first = 0 let fenshu = [0,0] let allsc = that.data.score for (const key in team) { if (team.hasOwnProperty(key)) { first += team[key].checked } } if (sc.team1 == "" && team.p1.dw != true && team.p3.dw != true) { console.log("请填分数") } else if (first == 0) { console.log("请填头游") } else { that.tichuscore(fenshu,team,sc) that.addsc(allsc,fenshu) that.setData({score:allsc}) that.clean() //这里就不能重置data的数据 } }, 为什么onload里clean()可以设置data数据,forSubmit里clean()确无效?有没有什么方法在提交表单后把data里面team和sc的数据恢复?并且把所有switch、radio、input等表单的状态恢复。
2021-05-07 - setData用变量怎么赋值?
data: { team:{ p1:{name:"", bg:0, sg:0, checked: 0}, p2:{name:"", bg:0, sg:0, checked: 0}, p3:{name:"", bg:0, sg:0, checked: 0}, p4:{name:"", bg:0, sg:0, checked: 0}, }, switchChange(e) { let that = this let id = e.currentTarget.dataset.id let py = "p1" let tichu = "bg" let value = e.detail.value == true ? 1 : 0 that.setData({team.py.tichu:value}) console.log(that.data.team) // py和tichu是两个字符串,怎么用两个字符串给data.team赋值?
2021-04-30