1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- const APP = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- setInfo: null,//设置信息
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function () {
- this.getOther(APP.getCurrentDevice().deviceId);
- },
- /**
- * 获取设备自动接听设置
- */
- getOther: function (deviceId) {
- const that = this;
- const params = {
- deviceId: deviceId,
- }
- APP.Get(APP.Url.getOther, params).then(res => {
- that.setData({
- setInfo: res.data,
- })
- })
- },
- /**
- * 监听自动接听开关
- */
- handleAutoAnswerChange: function (event) {
- const that = this;
- const params = {
- deviceId: that.data.setInfo.deviceId,
- autoAnswer: event.detail.value === true ? 1 : 0
- }
- APP.Post(APP.Url.setAutoAnswer, params).then(res => {
- that.getOther(params.deviceId)
- APP.Modal.tips("设置成功!")
- }).catch(res => {
- console.log(res)
- APP.Modal.tips("设置失败!")
- })
- },
- /**
- * 监听持续定位
- */
- handleContinueChange: function (event) {
- const that = this;
- const params = {
- deviceId: that.data.setInfo.deviceId,
- // highFreq: event.detail.value === true ? 1 : 0,
- highFreq: 1
- }
- APP.Post(APP.Url.setContinue, params).then(res => {
- that.getOther(params.deviceId)
- APP.Modal.tips("设置成功!")
- }).catch(res => {
- console.log(res)
- APP.Modal.tips("设置失败!")
- })
- },
- /**
- * 跳转至子页面页面
- */
- routeTo: function (event) {
- const path = event.currentTarget.dataset.path;
- APP.Route.routeTo(APP.Route.path[path])
- },
- })
|