1绑定相关。2首页修改开关阀提示。3.问题反馈相关功能
| | |
| | | // BASEURL = 'https://irrigate.dayuyanjiuyuan.top/' |
| | | // BASEURL = 'https://d4x9787456.vicp.fun/' |
| | | // BASEURL = 'http://127.0.0.1:8087/' |
| | | // BASEURL = 'http://192.168.40.166:8087/' |
| | | BASEURL = 'http://192.168.10.52:8087/' |
| | | BASEURL = 'http://192.168.40.166:8087/' |
| | | // BASEURL = 'http://192.168.10.52:8087/' |
| | | break |
| | | default: |
| | | BASEURL = '' |
| | |
| | | globalData: { |
| | | sessionId:2024102118013700009, |
| | | clientId:"", |
| | | tag:'test', |
| | | tag:'ym', |
| | | userInfo: null, |
| | | userId:"", |
| | | userCode:"", |
| | |
| | | "navigationBarBackgroundColor": "#1890FF" |
| | | }, |
| | | "componentFramework": "glass-easel", |
| | | "sitemapLocation": "sitemap.json" |
| | | "sitemapLocation": "sitemap.json", |
| | | "permission": { |
| | | "scope": { |
| | | "userLocation": { |
| | | "desc": "为了更好的为您服务,将获取您的位置信息" |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | const audio = wx.createInnerAudioContext() |
| | | const recorderManager = wx.getRecorderManager() |
| | | const { |
| | | get, |
| | | post |
| | | } = require('../../api/request.js'); |
| | | const { |
| | | BASEURL |
| | | } = require('../../api/config') |
| | | const app = getApp() |
| | |
| | | height: 160, |
| | | }, |
| | | originFiles: [], |
| | | feedBackList: Array(19).fill({ |
| | | createTime: "2023-05-06 12:36:25", |
| | | responseTime: "2023-05-07 12:36:25" |
| | | }), |
| | | contentValue: '', //反馈详情 |
| | | accSavePath: '', //上传的音频文件接口返回的地址 |
| | | photoSavePath: [] //上传的照片文件返回的地址 |
| | | |
| | | contentValue: '', //反馈详情 |
| | | accSavePath: [], //上传的音频文件接口返回的地址 |
| | | photoSavePath: [], //上传的照片文件返回的地址 |
| | | phoneNumber: "", |
| | | lat: "", |
| | | lng: "", |
| | | loading: false, |
| | | hasMore: true, |
| | | pageCurr: 1, |
| | | pageSize: 20, |
| | | listData: [], //已提问题列表 |
| | | }, |
| | | |
| | | onLoad() { |
| | |
| | | recorderManager.onError((err) => { |
| | | console.log('录音错误', err); |
| | | }); |
| | | wx.getLocation({ |
| | | type: 'wgs84', // 返回可以用于 `wx.openLocation` 的经纬度 |
| | | success: (res) => { |
| | | console.log('获取位置成功', res); |
| | | this.setData({ |
| | | lat: res.latitude, |
| | | lng: res.longitude, |
| | | }); |
| | | }, |
| | | fail: function (err) { |
| | | console.error('获取位置失败', err); |
| | | } |
| | | }); |
| | | }, |
| | | onReady() { |
| | | this.getList(); |
| | | }, |
| | | //上传音频文件 |
| | | upACC(tempFilePath) { |
| | |
| | | 'tag': app.globalData.tag, |
| | | 'appId': app.globalData.AppID, |
| | | }, |
| | | success: function (res) { //后台返回给前端识别后的文字 |
| | | success: (res) => { //后台返回给前端识别后的文字 |
| | | console.log('录音上传成功', res); |
| | | let jsonData = JSON.parse(res.data) |
| | | let audioObj = { |
| | | webPath: jsonData.content.webPath, |
| | | id: jsonData.content.id |
| | | }; |
| | | this.setData({ |
| | | accSavePath: [audioObj] |
| | | }) |
| | | }, |
| | | fail: (err) => { |
| | | // 处理上传失败的逻辑 |
| | |
| | | } |
| | | }) |
| | | }, |
| | | //删除图片 |
| | | handleRemove(e) { |
| | | console.log("handleRemove"); |
| | | const { |
| | |
| | | }); |
| | | originFiles.splice(index, 1); |
| | | this.setData({ |
| | | originFiles, |
| | | originFiles: originFiles, |
| | | }); |
| | | |
| | | }, |
| | |
| | | return { |
| | | ...item, |
| | | status: 'loading', |
| | | uploadTask: this.onUploadPhoto(e.detail.files[0].url) |
| | | uploadTask: this.onUploadPhoto(item.url) |
| | | }; // 保留所有其他字段,并添加 displayText 字段 |
| | | }); |
| | | // 更新列表数据 |
| | |
| | | */ |
| | | onUploadPhoto(imgPath) { |
| | | const uploadTask = wx.uploadFile({ |
| | | url: BASEURL + "wx/webFile/upPhone", // 仅为示例,非真实的接口地址 |
| | | url: BASEURL + "wx/webFile/upPhoto", // 仅为示例,非真实的接口地址 |
| | | filePath: imgPath, |
| | | name: 'file', |
| | | header: { |
| | |
| | | }, |
| | | success: (res) => { |
| | | console.log('图片上传成功', res); |
| | | let jsonData = JSON.parse(res.data) |
| | | // 更新图片上传成功状态 |
| | | const updatedFiles = this.data.originFiles.map((file) => { |
| | | console.log('图片上传成功》》updatedFiles', file + "++++++++++" + imgPath); |
| | | if (file.url === imgPath) { |
| | | return { |
| | | ...file, |
| | | status: undefined, // 上传成功状态 |
| | | uploadTask: undefined, // 清理上传任务 |
| | | webPath: jsonData.content.webPath, |
| | | id: jsonData.content.id |
| | | }; |
| | | } |
| | | return file; |
| | | }); |
| | | // 将创建的对象添加到images数组中 |
| | | this.setData({ |
| | | originFiles: updatedFiles, |
| | | }) |
| | | |
| | | }, |
| | | fail: (err) => { |
| | | // 处理上传失败的逻辑 |
| | |
| | | }); |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.setData({ |
| | | isRefreshing: false |
| | | }); |
| | | this.getList(true); |
| | | }, |
| | | feelBack() { |
| | | //上传问题 |
| | | feelBackPost() { |
| | | wx.showLoading({ |
| | | title: '正在提交...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | this.data.originFiles.map((file) => { |
| | | let imageObj = { |
| | | webPath: file.webPath, |
| | | id: file.id |
| | | }; |
| | | this.setData({ |
| | | photoSavePath: [...this.data.photoSavePath, imageObj] |
| | | }) |
| | | }) |
| | | const app = getApp(); |
| | | const data = { |
| | | content: this.data.contentValue, //取水口ID |
| | | image: this.data.vcId, //虚拟卡ID |
| | | operator: app.globalData.sessionId, //操作员 |
| | | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 |
| | | images: this.data.photoSavePath, |
| | | audios: this.data.accSavePath, |
| | | content: this.data.contentValue, |
| | | lng: this.data.lng, |
| | | lat: this.data.lat, |
| | | clientId: app.globalData.clientId, |
| | | phone: this.data.phoneNumber |
| | | }; |
| | | post({ |
| | | url: "operation/feedback/add", |
| | | url: "wx/issue/addIssueReport", |
| | | data: data |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | wx.showToast({ |
| | | title: '提交成功', |
| | | icon: 'success', |
| | | duration: 2000, |
| | | success() {} |
| | | }) |
| | | setTimeout(() => { |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, 2000); |
| | | |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | // if (error.code === "10005") { |
| | | // this.setData({ |
| | | // showDialog: false, |
| | | // showForceConfirm: true |
| | | // }) |
| | | // } else { |
| | | |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | |
| | | voiceTime: 0, |
| | | }) |
| | | }, |
| | | //提交 |
| | | submit() { |
| | | if (this.data.contentValue !== "" || this.data.photoSavePath.length>0 || this.data.accSavePath !== "") { |
| | | wx.showToast({ |
| | | title: '提交成功', |
| | | icon: 'success', |
| | | duration: 2000, |
| | | success() {} |
| | | }) |
| | | setTimeout(() => { |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, 2000); |
| | | if (this.data.contentValue !== "" || this.data.photoSavePath.length > 0 || this.data.accSavePath !== "") { |
| | | if (this.data.phoneNumber !== "" && this.data.phoneNumber.length !== 11) { |
| | | wx.showToast({ |
| | | title: '联系电话错误', |
| | | icon: 'error', |
| | | duration: 2000, |
| | | success() {} |
| | | }) |
| | | } else { |
| | | this.feelBackPost(); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请输入一项反馈内容', |
| | |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | //监听手机号的输入 |
| | | phoneInput(e) { |
| | | this.setData({ |
| | | phoneNumber: e.detail.value |
| | | }); |
| | | }, |
| | | //监听 |
| | | contentInput(e) { |
| | | this.setData({ |
| | | contentValue: e.detail.value |
| | | }); |
| | | }, |
| | | //获取已提问题列表 |
| | | getList(isRefresh) { |
| | | if (isRefresh) { |
| | | this.setData({ |
| | | isRefreshing: false, |
| | | pageCurr: 1, |
| | | }); |
| | | } |
| | | const app = getApp(); |
| | | const params = { |
| | | url: 'wx/issue/getIssueReports', |
| | | data: { |
| | | clientId: app.globalData.clientId |
| | | } |
| | | }; |
| | | get(params).then(data => { |
| | | const updatedList = data.content.obj.map(item => { |
| | | if (item.replyTime === "" || item.replyTime === null) { |
| | | item.replyTime = "未回复" |
| | | } |
| | | return item; |
| | | }); |
| | | this.setData({ |
| | | listData: [...this.data.listData, ...updatedList], |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | loading: false, |
| | | hasMore: this.data.pageCurr < data.content.pageTotal |
| | | }) |
| | | this.updateDisplayText(); |
| | | }).catch(err => { |
| | | // 错误回调 |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | loading: false |
| | | }) |
| | | wx.showToast({ |
| | | title: err.msg, |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | | }); |
| | | }, |
| | | //加载更多 |
| | | loadMore() { |
| | | if (this.data.hasMore && !this.data.loading) { |
| | | this.setData({ |
| | | loading: true, |
| | | pageCurr: this.data.pageCurr + 1 |
| | | }) |
| | | this.getList(); |
| | | } |
| | | }, |
| | | onDelete(e) { |
| | | const item = e.currentTarget.dataset.item; |
| | | const that = this; |
| | | wx.showLoading({ |
| | | title: '正在强制删除请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | that.setData({ |
| | | lastIntakeName: intakeName |
| | | }) |
| | | const data = { |
| | | vcNum: item.vcNum, //取水口ID |
| | | rtuAddr: item.rtuAddr, //阀控器地址 |
| | | }; |
| | | post({ |
| | | url: "wx/issue/deleteIssueReport", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //重新获取列表刷新数据 |
| | | this.getList(); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-upload": "tdesign-miniprogram/upload/upload" |
| | | "t-upload": "tdesign-miniprogram/upload/upload", |
| | | "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell" |
| | | }, |
| | | "navigationBarTitleText": "问题反馈", |
| | | "navigationBarTextStyle": "white" |
| | |
| | | <view class="container"> |
| | | <!-- 顶部 Tabs --> |
| | | <!-- <view class="tabs"> |
| | | <view class="tabs"> |
| | | <view class="tab" bindtap="switchTab" data-tab="0" id="tab0"> |
| | | 问题反馈 |
| | | <view class="indicator" wx:if="{{currentTab === 0}}"></view> |
| | |
| | | 已提问题 |
| | | <view class="indicator" wx:if="{{currentTab === 1}}"></view> |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | | <view class="container-feedBack" wx:if="{{currentTab === 0}}"> |
| | | <view class="container-item"> |
| | | <text class="fb-text">反馈详情:</text> |
| | | <textarea class="input-class" value="{{contentValue}}" /> |
| | | <textarea class="input-class" bindinput="contentInput" /> |
| | | </view> |
| | | <view class="divider"></view> |
| | | <view class="container-item"> |
| | |
| | | </view> |
| | | <!-- 录音中 --> |
| | | <view wx:if="{{isShowVoiceMask}}" class="voice_starting">录音中{{contDownTime}}秒</view> |
| | | <view class="container-phone"> |
| | | <text class="fb-text">手机号:</text> |
| | | <input class="input-phone" type="number" placeholder="联系电话(选填)" bindinput="phoneInput" maxlength="11" /> |
| | | </view> |
| | | <button class="fb-submit" bind:tap="submit">提交</button> |
| | | </view> |
| | | |
| | | <!-- <scroll-view class="container-scroll" wx:if="{{currentTab === 1}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh" refresher-triggered="{{isRefreshing}}"> |
| | | <block wx:for="{{feedBackList}}" wx:key="index"> |
| | | <scroll-view class="container-scroll" wx:if="{{currentTab === 1}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh" refresher-triggered="{{isRefreshing}}" bindscrolltolower="loadMore"> |
| | | <block wx:for="{{listData}}" wx:key="index"> |
| | | <t-swipe-cell style="width: 100%;" class="swipe-cell-base"> |
| | | <view class="item"> |
| | | <view class="item-data"> |
| | | <text>提问时间:</text> |
| | | <text>{{item.createTime}}</text> |
| | | <text>{{item.reportTime}}</text> |
| | | </view> |
| | | <view class="item-data"> |
| | | <text>响应时间:</text> |
| | | <text>{{item.responseTime}}</text> |
| | | <text>{{item.replyTime}}</text> |
| | | </view> |
| | | </view> |
| | | <view slot="right" class="delete-btn" bind:tap="onDelete" data-item="{{item}}">删除</view> |
| | | </t-swipe-cell> |
| | | </block> |
| | | <view wx:if="{{feedBackList.length === 0}}" class="noMore-View"> |
| | | <image class="noMore-img" src="/images/no_more.svg" /> |
| | | <text class="noMore-text">没有数据</text> |
| | | </view> |
| | | </scroll-view> --> |
| | | <view wx:if="{{loading}}" class="loading">加载中...</view> <!-- 加载指示器 --> |
| | | </scroll-view> |
| | | |
| | | |
| | | </view> |
| | |
| | | background-color: #1890FF; |
| | | font-size: 35rpx; |
| | | color: white; |
| | | margin-top: 200rpx; |
| | | margin-top: 100rpx; |
| | | } |
| | | |
| | | .voice_img { |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | flex-grow: 1; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | |
| | | .item-data text { |
| | | font-size: 30rpx; |
| | | } |
| | | } |
| | | |
| | | .container-phone { |
| | | display: flex; |
| | | align-items: center; /* 垂直居中 */ |
| | | margin-bottom: 10px; /* 可选:为容器添加一些底部间距 */ |
| | | margin-top: 30rpx; |
| | | } |
| | | |
| | | .fb-text { |
| | | flex: 0 0 auto; /* 不扩展也不收缩,自动宽度 */ |
| | | margin-right: 10px; /* 可选:为文本和输入框之间添加一些间距 */ |
| | | } |
| | | |
| | | .input-phone { |
| | | flex: 1 1 auto; /* 扩展以填充剩余空间,但最小宽度为自动 */ |
| | | border: 1px solid #ccc; /* 可选:为输入框添加边框 */ |
| | | padding: 5px; /* 可选:为输入框添加内边距 */ |
| | | border-radius: 4px; /* 可选:为输入框添加圆角 */ |
| | | border: 2rpx solid #000000; |
| | | } |
| | | |
| | | .delete-btn { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 120rpx; |
| | | height: 100%; |
| | | color: white; |
| | | background-color: #e34d59; |
| | | } |
| | |
| | | lastIntakeName: "", |
| | | isLogin: false, //是否已经登录 |
| | | showInfoDialog: false, |
| | | |
| | | showTipDialog: false, |
| | | options: '', |
| | | }, |
| | | |
| | | openValve: function (e) { |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | // 使用 wx.nextTick 等待页面渲染完成 |
| | | wx.nextTick(() => { |
| | | this.calculateScrollViewHeight(); |
| | | }); |
| | | //当开阀成功后调用刷新 |
| | | console.log("onLoad:" + options.param); |
| | | if (options.param) { |
| | | wx.showToast({ |
| | | title: '开阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }) |
| | | this.setData({ |
| | | isLogin: true |
| | | options: options, |
| | | isLogin: true, |
| | | }) |
| | | this.getOpenList(); |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | } else { |
| | | //本地没有缓存微信登录 |
| | | this.wxLogin(); |
| | | } |
| | | if (this.data.options.param) { |
| | | this.setData({ |
| | | |
| | | showTipDialog: true, |
| | | tipData: "开阀命令下发成功,稍后请刷新快速关阀列表查看执行结果。" |
| | | }) |
| | | this.getOpenList(); |
| | | } |
| | | }, |
| | | wxLogin() { |
| | |
| | | this.setData({ |
| | | showConfirm: false, |
| | | showErrorDialog: false, |
| | | showForceConfirm: false |
| | | showForceConfirm: false, |
| | | showTipDialog: false |
| | | }); |
| | | }, |
| | | cancelDialog() { |
| | | this.setData({ |
| | | showForceConfirm: false, |
| | | showConfirm: false |
| | | showConfirm: false, |
| | | showTipDialog: false |
| | | }); |
| | | }, |
| | | /** |
| | |
| | | wx.hideLoading(); |
| | | this.getOpenList(); |
| | | if (response.content.data.success) { |
| | | wx.showToast({ |
| | | title: '关阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | this.setData({ |
| | | isLogin: true, |
| | | showTipDialog: true, |
| | | tipData: "关阀命令下发成功,稍后请刷新快速关阀列表查看执行结果。" |
| | | }) |
| | | this.getOpenList(); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '关阀失败', |
| | | title: '命令执行失败', |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | |
| | | unbind() { |
| | | //清空数据 |
| | | this.setData({ |
| | | userPhone: "请登录", |
| | | userName: "未登录", |
| | | userPhone: "未登录", |
| | | userName: "请登录", |
| | | listData: [] |
| | | }) |
| | | wx.showLoading({ |
| | |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-avatar": "tdesign-miniprogram/avatar/avatar", |
| | | "t-switch": "tdesign-miniprogram/switch/switch", |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog", |
| | | "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell", |
| | | "t-button": "tdesign-miniprogram/button/button" |
| | |
| | | <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> |
| | | </view> |
| | | <view> |
| | | <!-- <t-switch class="switch" data-item="{{item}}" bindchange="handleChange" value="{{true}}" label="{{['开', '关']}}" slot="note" /> --> |
| | | |
| | | <text class="item-button" bind:tap="handleChange" data-item="{{item}}">关阀</text> |
| | | </view> |
| | | </view> |
| | |
| | | <!-- 适配skyline,增加type="list" --> |
| | | <scroll-view slot="content" type="list" scroll-y class="long-content"> |
| | | <view class="content-container"> |
| | | 1.网络等不可抗力因素可能导致设备状态显示延迟或错误。 |
| | | 2.当提示您操作失败后您可稍后尝试重新操作。 |
| | | 3.在定时或定量开阀的预约式开阀过程中,系统仅显示取消状态。当用户点击取消时,程序会尝试执行取消操作,但可能因网络等不可抗力因素而失败。 |
| | | 4.我们诚挚地邀请您通过意见反馈渠道提出宝贵的建议或意见。 |
| | | <text class="content-container"> |
| | | 1.网络等不可抗力因素可能导致设备状态显示延迟或错误。 |
| | | 2.当提示您操作失败后您可稍后尝试重新操作。 |
| | | 3.在定时或定量开阀的预约式开阀过程中,系统仅显示取消状态。当用户点击取消时,程序会尝试执行取消操作,但可能因网络等不可抗力因素而失败。 |
| | | 4.我们诚挚地邀请您通过意见反馈渠道提出宝贵的建议或意见。 |
| | | </text> |
| | | |
| | | </view> |
| | | </scroll-view> |
| | | </t-dialog> |
| | | <t-dialog class="dialog" title="通知结果" visible="{{showTipDialog}}" content="{{tipData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="cancelDialog" /> |
| | | |
| | | </view> |
| | |
| | | this.setData({ |
| | | vcId: item.id, |
| | | }) |
| | | if (this.data.intakeName === "") { |
| | | // 选择虚拟卡后 |
| | | this.initDialogData(); |
| | | } else { |
| | | if (this.data.intakeName) { |
| | | //扫码开阀逻辑 |
| | | this.postOpenValva(false); |
| | | } else { |
| | | // 选择虚拟卡后 |
| | | this.initDialogData(); |
| | | } |
| | | |
| | | } |
| | |
| | | get({ |
| | | url: 'wx/intake/used_intakes', |
| | | data: { |
| | | operator: getApp().globalData.sessionId |
| | | operatorId: getApp().globalData.sessionId |
| | | } |
| | | }) |
| | | .then((data) => { |
| | |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-avatar": "tdesign-miniprogram/avatar/avatar", |
| | | "t-switch": "tdesign-miniprogram/switch/switch", |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog" |
| | | }, |
| | |
| | | phoneCode: '', |
| | | codeSent: false, |
| | | countdown: 60, |
| | | isButtonEnabled: false |
| | | isButtonEnabled: false, |
| | | showErrorDialog: false, |
| | | errorData: "", |
| | | errorDialogTitle: "错误提示", |
| | | confirmBtn: { |
| | | content: '确认' |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | |
| | |
| | | } |
| | | // 在这里处理发送验证码的逻辑,可以调用后台接口实现 |
| | | this.postCode(); |
| | | this.setData({ |
| | | codeSent: true, |
| | | }); |
| | | // 启动倒计时 |
| | | this.startCountdown(); |
| | | |
| | | }, |
| | | //倒计时 |
| | | startCountdown: function () { |
| | |
| | | icon: 'success', |
| | | duration: 2000, |
| | | }); |
| | | this.setData({ |
| | | codeSent: true, |
| | | }); |
| | | // 启动倒计时 |
| | | this.startCountdown(); |
| | | }) |
| | | .catch((error) => { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | }) |
| | | console.error('Failed to add item:', error); |
| | | }); |
| | | }, |
| | |
| | | }; |
| | | post(params) |
| | | .then((data) => { |
| | | getApp().globalData.sessionId = data.content.sessionId |
| | | storage.setItem("sessionId", data.content.sessionId) |
| | | getApp().globalData.clientId = data.content.clientId |
| | | storage.setItem("clientId", data.content.clientId) |
| | | getApp().globalData.sessionId = String(data.content.sessionId) |
| | | storage.setItem("sessionId", String(data.content.sessionId)) |
| | | getApp().globalData.clientId = String(data.content.clientId) |
| | | storage.setItem("clientId", String(data.content.clientId)) |
| | | this.bindSuccess(); |
| | | }) |
| | | .catch((error) => { |
| | |
| | | }); |
| | | console.error('Failed to add item:', error); |
| | | }); |
| | | }, |
| | | closeDialog() { |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | } |
| | | }) |
| | |
| | | { |
| | | { "component": true, |
| | | "usingComponents": { |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog", |
| | | "t-button": "tdesign-miniprogram/button/button" |
| | | }, |
| | | "navigationBarTitleText": "农户绑定", |
| | | "navigationBarTextStyle": "white" |
| | | } |
| | |
| | | </view> |
| | | </view> |
| | | <button class="button {{isButtonEnabled ? 'button-active' : 'button-disabled'}}" bindtap="bind">绑定微信</button> |
| | | <t-dialog class="error-dialog" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" /> |
| | | </view> |
| | |
| | | width: 38%; |
| | | font-size: 28rpx; |
| | | margin-left: 15rpx; |
| | | } |
| | | } |
| | | |
| | | .error-dialog { |
| | | --td-dialog-title-color: red; |
| | | --td-dialog-title-font-size: 40rpx; |
| | | } |