- request调用setcd就报错?
setCD : function(){ // 获取页面数据 let ruku = this.data.ruku; let chuku = this.data.chuku; let os = this.data.os; let arm = this.data.arm; let clipboardData = ''; let tempVariableA = new Date().toLocaleString(); let tempVariableB = ""; let tempVariableC = ""; let fault = this.data.choiseId; if (fault) { if (chuku.some(item => item.id === fault)) { tempVariableB = "出库"; } else if (ruku.some(item => item.id === fault)) { tempVariableB = "入库"; } else if (os.some(item => item.id === fault)) { tempVariableB = ""; } }; if (arm) { tempVariableC = ruku.find(item => item.id === arm)?.name || ""; }; clipboardData = tempVariableA + "\n" + tempVariableB + tempVariableC + "发生故障"; wx.setClipboardData({ data: clipboardData, success (res) { wx.getClipboardData({ success (res) { wx.showToast({ title: '故障信息已经复制到粘贴板', icon: 'success', duration: 3000 }); } }) } }); }, wx.request({ url: this.data.url, method: 'POST', data: jsonData, success: function(res) { console.log(res.data); this.setCD(); wx.showToast({ title: '提交成功', icon: 'success', duration: 3000 }); }, fail: function(error) { console.log(error); } }); request调用setcd就报错
2023-08-30 - 小程序在调试时,能够正常request到目标地址。但是发布后request没有反应?
小程序在调试时,能够正常request到目标地址。但是发布后request没有反应。 如何监听,和怎么才知道为啥没有推送到目标的网站 request到https://api.hiflow.tencent.com/engine/webhook/31/16906763423433432432
2023-08-28 - 小程序里为什么调用js的find方法和数组length都会出现报错?
https://developers.weixin.qq.com/s/4gakXqm87Af6 dataClassify: function () { let that = this; for (let index = 0; index < that.listData.length; index++) { if (that.idNumber.find(that.listData[index].orderId) == null) { that.idNumber.push(that.listData[index].orderId); } } } TypeError: Cannot read property 'length' of undefined at ye.dataClassify (checkout.js? [sm]:89) at checkout.js? [sm]:80 TypeError: Cannot read property 'length' of undefined at ye.dataClassify (checkout.js? [sm]:89) at checkout.js? [sm]:80 我试过改过,还是不行 dataClassify: function () { let that = this; for (let index = 0; index < that.data.listData.length; index++) { if (that.data.idNumber.find(that.data.listData[index].orderId) == null) { that.data.idNumber.push(that.data.listData[index].orderId); } } }
2020-02-26 - 可以利用小程序对用户进行有偿开通对应的小程序功能吗?
可以利用小程序对用户进行有偿开通对应的小程序功能吗?
2020-02-11 - setDAta后,data数据已经改变了,但是wxml对应用for循环的列表数据没有变化,什么原因?
{{index+1}} {{item.towsName}} {{item.net}} https://developers.weixin.qq.com/s/ONnbpOmw7ZeR https://developers.weixin.qq.com/s/ONnbpOmw7ZeR
2020-02-01 - setdata如何赋值给集合中的数组?
for(var i = 0 ;i < that.data.towsClass.length;i++){ console.log('I第'+i) console.log(that.data.towsClass[i].towsName) console.log(that.data.listData.length) for(var j = 0; j < that.data.listData.length;j++){ console.log('J第'+j) console.log(that.data.listData[j].towsName) console.log(that.data.towsClass[i].id) let a = that.data.listData[j].towsName let b = that.data.towsClass[i].id let c = that.data.towsClass[i].towsName console.log(a) console.log(b) console.log(c) if (Number(a) == Number(b)) { listData[j].towsName = c that.setData({ listData }) console.log('更改成功') } } } VM185:1 thirdScriptError listData is not defined;at api request success callback function ReferenceError: listData is not defined at success (http://127.0.0.1:46289/appservice/pages/checkoutlist/checkoutlist.js:61:19) at Function.o.<computed> (WAService.js:1:1116874) at WAService.js:1:102889 at C (WAService.js:1:422326) at i.<anonymous> (WAService.js:1:741526) at i.emit (WAService.js:1:444906) at Rs (WAService.js:1:742134) at WAService.js:1:743355 at WAService.js:1:455576 at n (http://127.0.0.1:46289/appservice/__dev__/asdebug.js:1:3068)
2020-02-01 - console data里面的数组为什么会是空呢?
// pages/checkoutlist/checkoutlist.js const app = getApp(); var net, gross, bianhao = 0; var packNum, towsName; var bianhao_list = []; Page({ /** * 页面的初始数据 */ data: { orderId: 0, btnuse: true }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { if (options.orderId == app.orderId) { this.setData({ orderId: options.orderId }) } else { this.setData({ orderId: app.orderId }) } }, onShow: function() { this.initTowsData() }, scanCode: function() { var that = this wx.scanCode({ success: function(res) { net = res.result.substring(20, 23) console.log("net = ", net) gross = res.result.substring(17, 20) console.log("gross = ", gross) towsName = res.result.substring(3, 7) console.log("towsName = ", towsName) packNum = res.result.substring(7, 17) console.log("packNum = ", packNum) wx.request({ url: 'https://hn2.api.okayapi.com/?&s=App.Table.CheckCreate&model_name=towsdata&data={"orderId":"' + app.orderId + '","packNum":"' + packNum + '","towsName":"0","gross":"' + gross + '","net":"' + net + '"}&check_field=packNum&app_key=88DE911C912A3CBB6279020C73DFC327', header: { 'content-type': 'application/json' // 默认值 }, success: function(res) { console.log(res.data); if (res.data.data.err_code == 3) { wx.showToast({ title: '数据已存在', }) } else { wx.showToast({ title: '上传成功', }) } } }) that.setData({ net: res.result.substring(20, 23), }) }, fail: function(res) { console.log("扫码失败 ") }, }) }, upLoad: function(e) { wx.showModal({ title: '提示', content: '是否全部扫码完成', success(res) { if (res.confirm) { console.log('用户点击确定') var util = require('../../utils/util.js') var fache = util.formatTime(new Date()); var state = 1 wx.request({ url: 'https://hn2.api.okayapi.com/?&s=App.Table.CheckCreate&model_name=towsLog&data={"orderId":"' + app.orderId + '","lic":"' + lic + '","fache":"' + fache + '","state":"' + state + '"}&check_field=packNum&app_key=88DE911C912A3CBB6279020C73DFC327', header: { 'content-type': 'application/json' // 默认值 }, success: function (res) { } }) } else if (res.cancel) { console.log('用户点击取消') } } }) }, initTowsData: function () { var that = this wx.request({ url: 'https://hn2.api.okayapi.com/?&s=App.Table.FreeQuery&model_name=towsdata&logic=and&where=[["id", ">", "1"]]&page=1&perpage=50&is_real_total=1&app_key=88DE911C912A3CBB6279020C73DFC327', header: { 'content-type': 'application/json' // 默认值 }, success: function(res) { that.setData({ listData: res.data.data.list }); } }) wx.request({ url: 'https://hn2.api.okayapi.com/?&s=App.Table.FreeQuery&model_name=towsClass&logic=and&where=[["id", ">", "0"]]&page=1&perpage=50&is_real_total=1&app_key=88DE911C912A3CBB6279020C73DFC327', header: { 'content-type': 'application/json' // 默认值 }, success: function(res) { that.setData({ towsClass: res.data.data.list }) } }) console.log(that.data) console.log(that.data.listData) } }) [图片] [图片] [图片]
2020-01-20 - 为什么总是upate不到数据?
// miniprogram/pages/checkout.js Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { const db = wx.cloud.database() const banner= db.collection('orderData') const _ = db.command banner.doc('aaa').update({ data:{ ccc:'kkkkkkkk' } }) .then(res=>{ console.log(res) }) .catch(err=>{ console.log(err) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, jump_orderID: function () { const db = wx.cloud.database() const banner= db.collection('orderData') const _ = db.command banner.doc('aaa').update({ data:{ ccc:'kkkkkkkk' } }) .then(res=>{ console.log(res) }) .catch(err=>{ console.log(err) }) } }) // miniprogram/pages/checkout.js Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { const db = wx.cloud.database() const banner= db.collection('orderData') const _ = db.command banner.doc('aaa').update({ data:{ ccc:'kkkkkkkk' } }) .then(res=>{ console.log(res) }) .catch(err=>{ console.log(err) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, jump_orderID: function () { const db = wx.cloud.database() const banner= db.collection('orderData') const _ = db.command banner.doc('aaa').update({ data:{ ccc:'kkkkkkkk' } }) .then(res=>{ console.log(res) }) .catch(err=>{ console.log(err) }) } })
2020-01-14 - 如何在一个集合里面不断嵌套object?
如何在一个集合里面不断嵌套object? 同一个集合,不断往里面增加object,然后object里面继续嵌套object,应该如何插入?push试过不行
2020-01-11 - 如何设置tabbar被选中后,字体色和背景色调换?
[图片]后面两个按钮是正常未被选中,现在选中了第一个后,后面的背景 与图标一致,无法看出,有什么办法把这一格子的图片背景单独变成另外一种颜色
2020-01-11