个人案例
- 通过button按钮转发,为什么没有返回值?
onShareAppMessage: function (res) { if (res.from === 'button') { } return { title: '改革开放前的历史证明,邻里关系好,有助于家庭稳定!', path: '/pages/community/propertyAdimn/repairman/repairman?orderDetail=' + JSON.stringify(this.data.orderDetail), imageUrl: '../../../../images/150-8.jpg', success: function (res) { console.log(res) }, fail: function (res) { console.log(res) } } }
2020-07-14 - 云函数使用switch()函数报错?
云函数使用switch()函数报错 [图片] exports.main = async (event, context) => { const wxContext = cloud.getWXContext() switch (req_type) { case 'Add': { return await db.collection('RepairOrder').add({ data: { date: event.date, time: event.time, communityId: event.communityId, orderType: event.orderType, orderProgress: event.orderProgress, projectName: event.projectName, projectType: event.projectType, projectPrice: event.projectPrice, descValue: event.descValue, address: event.address, contactInfo: event.contactInfo, status: event.status, userId: wxContext.OPENID, userInfo: event.userInfo, createAt: new Date() } }).then( res => { console.log(res) return res }) } case 'Recall' : { return await db.collection('RepairOrder').where({ _id: event._id }) .update({ data: { status: event.status, deleteAt: new Date() } }).then( res => { console.log(res) return res }) } case 'Repairman' : { return await db.collection('RepairOrder').where({ _id: event._id }) .update({ data: { orderProgress: _.push(event.progressItem), } }).then( res => { console.log(res) return res }) } default: { return } } js文件 wx.cloud.callFunction({ name: 'add_RepairOrder', data: { req_type: 'Add', date: this.data.date, time: this.data.time, communityId: this.data.communityId, orderType: this.data.orderType, orderProgress: this.data.orderProgress, projectName: this.data.projectName, projectType: this.data.projectType, projectPrice: this.data.projectPrice, descValue: this.data.descValue, address: this.data.address, contactInfo: this.data.contactInfo, status: this.data.status, userInfo: app.globalData.userInfo } }).then( res => { console.log(res) // 强制刷新上一页 var pages = getCurrentPages(); // 获取页面栈 var prevPage = pages[pages.length - 2]; // 上一个页面 prevPage.setData({ update: true }) wx.hideLoading() wx.navigateBack({ delta: 1 }) })
2020-07-13 - 云函数提交数据时,有空数据该如何处理?
请问提交数据时出现空数据该如何处理? [图片] formSubmit: function (e) { if (this.data.serviceTypes == 'Free') { const freeTemp = { name: this.data.serviceValue, desc: this.data.descValue, } this.setData({ freeObj: freeTemp, }) } else { const chargeTemp = { price: this.data.priceValue, name: this.data.serviceValue, desc: this.data.descValue, } this.setData({ chargeObj: chargeTemp, }) } this.setData({ inputValue: '', }) wx.showLoading() this._send() wx.hideLoading() }, // 提交数据到服务器 _send() { wx.cloud.callFunction({ name: 'add_Project', data: { _id: this.data.adminInfo._id, freeObj: this.data.freeObj, chargeObj: this.data.chargeObj } }).then(res => { wx.hideLoading() console.log(res) }) }, [图片]
2020-07-08 - 开发工具无法登录?
1.03.2006091/mac,突然提示重新登录。退出再打开就这样了,网络正常 [图片]
2020-07-08 - 为什么云函数调用成功,返回结果null?
云函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext() try { return await db.collection('Community').doc('event._id') .update({ data: { managers: event.managers } }) } catch (err) { console.log(err) } } [图片]
2020-07-04 - 给globalData赋值失败?
app.js(console.log("用户身份", this.globalData.propertyAdmin))已经成功获取到新的值,为什么赋值不成功。 globalData: { userInfo: null, openid: null, propertyAdmin: 0, //(runnerType)0用户,66管理员 propertyInfo: null, //跑腿员个人信息 }, onLaunch: function (options) { console.log(this.globalData.propertyAdmin) if (!wx.cloud) { console.error('请使用 2.2.3 或以上的基础库以使用云能力') } else { wx.cloud.init({ env: 'msy-150cm-ixpt', // 开发环境 traceUser: true, }) } this.getOpenid(); this._getUserInfo(); this._getPropertyAdmin() }, //获取用户身份 _getPropertyAdmin: function (openid) { //请求自己后台获取用户身份 wx.cloud.callFunction({ name: "fetchAdmin", data: { action: "getAdmin" } }).then(res => { console.log(res) if (res.result && res.result.data && res.result.data[0]) { let admin = res.result.data[0]; this.globalData.propertyInfo = admin.adminType; this.globalData.propertyAdmin = admin.propertyAdmin; console.log("用户身份", this.globalData.propertyAdmin) } else { this.globalData.propertyAdmin = 0; } }).catch(error => {}) }, [图片]
2020-07-03 - 云函数add()成功后返回空数据?
云函数add()成功后返回空数据? 云函数 [图片] js函数 [图片] 返回结果 [图片]
2020-07-02 - 调用图片安全检测api报错?
请问调用图片安全检测API报(openapi.security.imgSecCheck:fail system error hint: [LjOCMbMre-dD01na])该如何解决啊。 上传的是gif格式 [图片]
2020-06-30 - 信息发布成功后返回上一页面刷新列表?
为什么返回后数据没有刷新? _send() { var that = this var temperature = this.data.currentTemperature var content = this.data.currentContent var contactWay = this.data.currentContactWay var type = this.data.typesOf wx.getLocation({ type: 'gcj02', success(location) { const latitude = location.latitude const longitude = location.longitude wx.cloud.callFunction({ // 云函数名称 name: 'addPublishTask', // 传给云函数的参数 data: { temperature: temperature, longitude: longitude, latitude: latitude, type: type, content: content, contentImages: uploadImageList, contactWay: contactWay }, }).then(res => { console.log(res.result) if (res.result.errCode) { // // 发布失败 that._sendFail(res.result) return } localImageList = [] uploadImageList = [] wx.hideLoading() // 刷新首页的列表 that._postRefreshHomeList() wx.navigateBack() }).catch(error => { wx.hideLoading() that._sendFail(error) }) } }) }, console.log(prePage)已经成功获取到数据 _postRefreshHomeList(e) { var pages = getCurrentPages(); var prePage = pages[pages.length - 2] // prePage.fetchMyCommunityActivityFollower() console.log(prePage) },
2020-06-30 - 请问有社区团购云开发的案例吗?
请问有社区团购云开发的案例吗?
2020-06-29