// pages/operation/deviceUnbind.js const util = require('../../utils/util.js'); const app = getApp(); Page({ /** * 页面的初始数据 */ data: { scanCode: '', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, unbundling(){//解绑设备 util.request(util.api.unbundling,{deviceSn:this.data.scanCode}, "POST", true, true,app.globalData.token).then((res)=>{ if (res.code == 200) { util.toast('设备解绑成功'); } }).catch((res) => {}) }, scanCodeEvent() { var that = this; wx.scanCode({ onlyFromCamera: true, // 只允许从相机扫码 success(res) { console.log("扫码成功:" + JSON.stringify(res)) that.setData({ scanCode: res.result }) } }) }, })