| | |
| | | showForceConfirm: false, //是否强制开阀 |
| | | lastIntakeName: "", |
| | | isLogin: false, //是否已经登录 |
| | | showInfoDialog: false, |
| | | |
| | | }, |
| | | |
| | | openValve: function (e) { |
| | |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | calculateScrollViewHeight: function () { |
| | | wx.createSelectorQuery().selectAll('.list-item').boundingClientRect((rects) => { |
| | |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | |
| | | }, |
| | | //获取用户数据 |
| | | getUserData() { |
| | |
| | | const app = getApp(); |
| | | storage.getItem('sessionId').then((data) => { |
| | | app.globalData.sessionId = data; |
| | | this.setData({ |
| | | isLogin: true |
| | | }) |
| | | if (app.globalData.sessionId) { |
| | | this.getOpenList(); |
| | | this.getUserDataBySession(); |
| | |
| | | * 获取为关阀记录 |
| | | */ |
| | | getOpenList() { |
| | | if (this.data.isLogin) { |
| | | const app = getApp(); |
| | | const params = { |
| | | url: 'wx/valve/get', |
| | |
| | | duration: 3000 |
| | | }) |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | /** |
| | | * 确认关闭回调 |
| | |
| | | * 扫码开阀 |
| | | */ |
| | | scenCode() { |
| | | if (this.data.isLogin) { |
| | | const that = this; |
| | | wx.scanCode({ |
| | | success(res) { |
| | |
| | | console.error('Error parsing JSON:', error); |
| | | } |
| | | } else { |
| | | that.postOppenValva(res.result) |
| | | wx.navigateTo({ |
| | | url: '/pages/openCard/openCard?intakeName=' + res.result, |
| | | }) |
| | | // that.postOppenValva() |
| | | } |
| | | }, |
| | | fail(err) { |
| | | console.error(err); |
| | | } |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | confirmForceDialog() { |
| | | console.log("confirmForceDialog"); |
| | |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | }); |
| | | }, |
| | | //点击提示按钮 |
| | | infoShow() { |
| | | this.setData({ |
| | | showInfoDialog: true |
| | | }) |
| | | }, |
| | | //提示窗确认按钮 |
| | | confirmBtnInfoDialog() { |
| | | this.setData({ |
| | | showInfoDialog: false |
| | | }) |
| | | } |
| | | }) |