update mini program doc

This commit is contained in:
royye62
2020-02-11 21:28:17 +08:00
parent 7850f8f9e6
commit 3a4a3672d4
8 changed files with 38 additions and 67 deletions

View File

@@ -5,11 +5,11 @@ App({
productId: "U2LPAXBT2C", // 产品ID
deviceName: "royye_light", // 设备名称
// 腾讯云控制台-访问管理-访问密钥-API密钥管理中获取 SecretId, secretKey
secretId: "AKIDxZ2LTTi84eaR3OfS8hnfxd4JHzQatFpF",
secretKey: "UigMrA9rJXUCeoiBQP8dsJuJ6sYzmNjs",
// 接口 Region 字段
secretId: "xxx",
secretKey: "xxx",
// 接口 Region 字段。一般不需要修改
region: "ap-guangzhou",
// 云开发的环境名称。此处需要替换为云开发创建的环境名称
// 云开发的环境ID。此处需要替换为云开发创建的环境ID
env: "tos-demo"
},
onLaunch: function () {

View File

@@ -60,18 +60,27 @@ Page({
region: app.globalData.region,
}
console.log(queryData);
// 调用云函数query
wx.cloud.callFunction({
name: 'query',
data: queryData,
success: res => {
wx.showToast({
title: '调用成功',
})
let deviceData = JSON.parse(res.result.Data)
this.setData({
deviceData: deviceData
})
console.log("result:", deviceData)
try {
let deviceData = JSON.parse(res.result.Data)
this.setData({
deviceData: deviceData
})
console.log("result:", deviceData)
wx.showToast({
title: '调用成功',
})
} catch (e) {
wx.showToast({
icon: 'none',
title: '调用失败',
})
console.log(res.result.Data, e)
}
},
fail: err => {
wx.showToast({
@@ -101,7 +110,7 @@ Page({
data: JSON.stringify(data),
}
console.log(controlData);
// 调用云函数control
wx.cloud.callFunction({
name: 'control',
data: controlData,