| | |
| | | "pages/waterUses/waterUses", |
| | | "pages/devicelogs/devicelogs", |
| | | "pages/repairTicketDetail/repairTicketDetail", |
| | | "pages/repair/repair" |
| | | "pages/repair/repair", |
| | | "pages/personSet/personSet", |
| | | "pages/changePsw/changePSW" |
| | | ], |
| | | "permission": { |
| | | "scope.userLocation": { |
| | |
| | | "window": { |
| | | "backgroundTextStyle": "light", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "navigationBarTitleText": "普悦联营商管家", |
| | | "navigationBarTitleText": "普悦物联小助手", |
| | | "navigationBarTextStyle": "black", |
| | | "enablePullDownRefresh": false |
| | | }, |
| | |
| | | { |
| | | "pagePath": "pages/workOrder/workOrder", |
| | | "text": "工单", |
| | | "iconPath": "/images/person(1).png", |
| | | "selectedIconPath": "/images/person.png" |
| | | "iconPath": "/images/workUnselect.png", |
| | | "selectedIconPath": "/images/workSelect.png" |
| | | }, |
| | | { |
| | | "pagePath": "pages/person/person", |
| | |
| | | font-weight: 600; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | |
| | | @font-face { |
| | | font-family: 'iconfont'; /* Project id 4273872 */ |
| | | src: url('//at.alicdn.com/t/c/font_4273872_67kc4zemovw.woff2?t=1696494290609') format('woff2'), |
| | | url('//at.alicdn.com/t/c/font_4273872_67kc4zemovw.woff?t=1696494290609') format('woff'), |
| | | url('//at.alicdn.com/t/c/font_4273872_67kc4zemovw.ttf?t=1696494290609') format('truetype'); |
| | | src: url('//at.alicdn.com/t/c/font_4273872_eish33ts9mc.woff2?t=1696732954345') format('woff2'), |
| | | url('//at.alicdn.com/t/c/font_4273872_eish33ts9mc.woff?t=1696732954345') format('woff'), |
| | | url('//at.alicdn.com/t/c/font_4273872_eish33ts9mc.ttf?t=1696732954345') format('truetype'); |
| | | } |
| | | |
| | | .iconfont { |
| | |
| | | .icon-kaiguan:before { |
| | | content: "\e872"; |
| | | } |
| | | |
| | |
| | | !show && this.stopLoading(); |
| | | } |
| | | }, |
| | | options: { |
| | | styleIsolation: 'apply-shared' |
| | | }, |
| | | methods: { |
| | | onConfirm() { |
| | | this.handleAction('confirm'); |
| New file |
| | |
| | | // pages/changePsw/changePSW.js |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | |
| | | old: '', |
| | | new: '', |
| | | newTwo: '' |
| | | |
| | | }, |
| | | change1(e) { |
| | | // console.log(e); |
| | | this.setData({ |
| | | old: e.detail |
| | | }) |
| | | }, |
| | | change2(e) { |
| | | // console.log(e); |
| | | this.setData({ |
| | | new: e.detail |
| | | }) |
| | | }, |
| | | change3(e) { |
| | | // console.log(e); |
| | | this.setData({ |
| | | newTwo: e.detail |
| | | }) |
| | | }, |
| | | changePSW(e) { |
| | | console.log(this.data); |
| | | if (!this.data.old || !this.data.new || !this.data.newTwo) { |
| | | wx.showToast({ |
| | | title: '请补充信息', |
| | | icon: 'none' |
| | | }) |
| | | } else if (this.data.new != this.data.newTwo) { |
| | | wx.showToast({ |
| | | title: "两次输入的密码不一致", |
| | | icon: 'none' |
| | | }) |
| | | } else { |
| | | wx.request({ |
| | | url: `https://puyue.yhupai.com/prod-api/system/user/profile/updatePwd?oldPassword=${this.data.old}&newPassword=${this.data.new}`, |
| | | method: 'PUT', |
| | | header: { |
| | | "Access-Control-Allow-Headers": 'token', |
| | | Authorization: `Bearer ${wx.getStorageSync('token')}` |
| | | }, |
| | | dataType: 'json', |
| | | success: (res, header) => { |
| | | // console.log(resdata.msg); |
| | | if (res.data.code != 200) { |
| | | wx.showToast({ |
| | | title: res.data.msg, |
| | | icon:'none' |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.data.msg, |
| | | icon:'none' |
| | | }) |
| | | setTimeout(() => { |
| | | wx.navigateTo({ |
| | | url: '/pages/personSet/personSet', |
| | | }) |
| | | }, 1000); |
| | | |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | |
| | | } |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | } |
| | | }) |
| New file |
| | |
| | | { |
| | | "usingComponents": { |
| | | "van-field": "/miniprogram_npm/vant-weapp/field/index" |
| | | }, |
| | | "navigationBarTitleText": "修改密码", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#007CFE" |
| | | } |
| New file |
| | |
| | | <!--pages/changePsw/changePSW.wxml--> |
| | | <!-- <text>pages/changePsw/changePSW.wxml</text> --> |
| | | <van-cell-group> |
| | | <van-field value="{{ old }}" type="password" bind:change="change1" required clearable label="旧密码" placeholder="" /> |
| | | <van-field value="{{ new }}" type="password" bind:change="change2" clearable label="新密码" placeholder="" required /> |
| | | <van-field value="{{ newTwo }}" type="password" bind:change="change3" clearable label="确认密码" placeholder="" required /> |
| | | </van-cell-group> |
| | | <view style="width: 94%;height: 40px;line-height: 40px;background-color: #007CFE;color: #fff;margin-left: 3%;margin-top: 20px;text-align: center;border-radius: 2px;" bind:tap="changePSW"> |
| | | 确认修改 |
| | | </view> |
| New file |
| | |
| | | /* pages/changePsw/changePSW.wxss */ |
| | |
| | | */ |
| | | data: { |
| | | menuList: [ |
| | | { title: '滤芯状态', img: '', url: '/pages/filterStatus/filterStatus', icon: 'iconfont icon-shebeizhuangtai' }, |
| | | { title: '用水统计', img: '', url: '/pages/waterUses/waterUses', icon: 'iconfont icon_function_tongji' }, |
| | | { title: '设备日志', img: '', url: '/pages/devicelogs/devicelogs', icon: 'iconfont icon-rizhi' }, |
| | | { title: '故障报修', img: '', url: '/pages/repair/repair', icon: 'iconfont icon-baoxiu' }, |
| | | { title: '滤芯状态', img: '', url: '/pages/filterStatus/filterStatus', icon: 'iconfont icon-shebeizhuangtai',img:'/images/status.png' }, |
| | | { title: '用水统计', img: '', url: '/pages/waterUses/waterUses', icon: 'iconfont icon-icon_function_tongji' ,img:'/images/tj.png'}, |
| | | { title: '设备日志', img: '', url: '/pages/devicelogs/devicelogs', icon: 'iconfont icon-zhuanxierizhi' ,img:'/images/log.png'}, |
| | | { title: '故障报修', img: '', url: '/pages/repair/repair', icon: 'iconfont icon-baoxiu',img:'/images/repire.png' }, |
| | | |
| | | ] |
| | | |
| | |
| | | </view> |
| | | <view class="main"> |
| | | <view class="info"> |
| | | <view style="color: #6ACED3;">剩余天数</view> |
| | | <view style="font-size: 18px;color: #6ACED3;margin: 5px 0 20px;">111</view> |
| | | <view style="color: #007CFE;">剩余天数</view> |
| | | <view style="font-size: 18px;color: #007CFE;margin: 5px 0 20px;">111</view> |
| | | <view style="width: 90%;height: 2px;background-color: #808080;margin-left: 5%;"></view> |
| | | <view style="margin-top: 20px;">开机</view> |
| | | <view style="margin-top: 20px;color: #007CFE;">开机</view> |
| | | </view> |
| | | </view> |
| | | <view class="footer" style="width: 100%;"> |
| | | <view class="tds" style="width:94%;display: flex;justify-content: space-between;position: relative;top: -10px;left: 3%;"> |
| | | <view class="tds1" style="width: 100px;height: 50px;background-color: #007CFE;color: #fff;border-radius: 25px;text-align: center;"> |
| | | <view>原水TDS</view> |
| | | <view>111</view> |
| | | </view> |
| | | <view class="tds2" style="width: 100px;height: 50px;background-color: #007CFE;color: #fff;border-radius: 25px;text-align: center;"> |
| | | <view class="tds" style="width:94%px;display: flex;justify-content: space-between;position: relative;top: -10px;"> |
| | | <view class="tds2" style="width: 110px;height: 50px;background-color: #007CFE;color: #fff;border-radius: 25px;text-align: center;"> |
| | | <!-- <image src="/images/water-drop.png" mode="" /> --> |
| | | <view style="width: 20px;height: 20px;background-color: #fff;border-radius: 50%;position: relative;top: 15px;left: 10px;"></view> |
| | | <view style="margin-left: 15px;margin-top: 5px;"> |
| | | <view>纯水TDS</view> |
| | | <view>111</view> |
| | | </view> |
| | | |
| | | </view> |
| | | <view style="text-align: center;margin: 10px 0;color: aqua;">水质正常</view> |
| | | <view class="tds2" style="width: 110px;height: 50px;background-color: #007CFE;color: #fff;border-radius: 25px;text-align: center;"> |
| | | <!-- <image src="/images/water-drop.png" mode="" /> --> |
| | | <view style="width: 20px;height: 20px;background-color: #fff;border-radius: 50%;position: relative;top: 15px;left: 10px;"></view> |
| | | <view style="margin-left: 15px;margin-top: 5px;"> |
| | | <view>原水TDS</view> |
| | | <view>111</view> |
| | | </view> |
| | | |
| | | </view> |
| | | |
| | | </view> |
| | | |
| | | </view> |
| | | <view style="text-align: center;margin: 10px 0;color: #007CFE;">水质正常</view> |
| | | <view style="width:60px;height:60px;margin:20px auto;text-align: center"> |
| | | <!-- <image src="/images/address.png" style="width:60px;height:60px;" mode="" /> --> |
| | | <text class="iconfont icon-kaiguan" style="font-size: 30px;color: aqua;"></text> |
| | | </view> |
| | | <text class="iconfont icon-kaiguan" style="font-size: 30px;color: #007CFE;"></text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="menu"> |
| | | <view class="item" wx:for="{{menuList}}" wx:key="title" data-item="{{item}}" bind:tap="goItem"> |
| | | <!-- <view bind:tap="goItem"></view> --> |
| | | <text class="iconfont icon-kaiguan" style="font-size: 50px;width: 50px;height: 50px;"></text> |
| | | <image src="{{item.img}}" mode="" /> |
| | | <!-- <text class="{{item.icon}}" style="font-size: 50px;width: 50px;height: 50px;"></text> --> |
| | | <view class="title" >{{item.title}}</view> |
| | | </view> |
| | | </view> |
| | |
| | | .header .main { |
| | | width: 200px; |
| | | height: 200px; |
| | | border: 5px solid #007CFE; |
| | | border: 8px solid #007CFE; |
| | | border-radius: 50%; |
| | | margin-top: 30px; |
| | | margin-left: calc(50% - 100px); |
| | |
| | | padding-top: 30px; |
| | | text-align: center; |
| | | /* padding-left: 50px; */ |
| | | } |
| | | .footer .tds2{ |
| | | display: flex; |
| | | |
| | | } |
| | | .footer image{ |
| | | width: 50px; |
| | | height: 50px; |
| | | /* position: absolute; |
| | | top: 0; |
| | | left: 2px; */ |
| | | } |
| | | |
| | | .menu { |
| | |
| | | width: 25%; |
| | | margin: 5px 0; |
| | | text-align: center; |
| | | color: #A1A2A4; |
| | | color: #007CFE; |
| | | } |
| | | .menu .item image{ |
| | | width: 50px; |
| | | height: 50px; |
| | | } |
| | |
| | | "usingComponents": { |
| | | "van-notice-bar":"/miniprogram_npm/vant-weapp/notice-bar" |
| | | }, |
| | | "navigationBarTitleText": "悦物联智能系统", |
| | | "navigationBarTitleText": "首页", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#007CFE" |
| | | } |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | userName: 'admin', |
| | | psw: 'admin123', |
| | | userName: 'sdlys', |
| | | psw: '123456', |
| | | codeNum: '', |
| | | loginImg: '/images/login.png', |
| | | uuid: '', |
| | |
| | | }, |
| | | // 绑定密码 |
| | | bindPSW(e) { |
| | | console.log(e); |
| | | this.setData({ |
| | | psw: e.detail.value |
| | | }) |
| | | }, |
| | | // 验证码 |
| | | bindCodeNum(e) { |
| | | console.log(e); |
| | | this.setData({ |
| | | codeNum: e.detail.value |
| | | }) |
| | | console.log(this.data.codeNum); |
| | | }, |
| | | |
| | | // 登录 |
| | | login() { |
| | | // wx.showLoading({ |
| | | // title: '登录中', |
| | | // }) |
| | | console.log(this.data); |
| | | wx.showLoading({ |
| | | title: '登录中', |
| | | }) |
| | | |
| | | // loginRequest(this.data.userName, this.data.psw, this.data.codeNum, this.data.uuid).then(res => { |
| | | // console.log(res); |
| | | // if (res.data.code != 200) { |
| | | // wx.showToast({ |
| | | // title: res.data.msg, |
| | | // icon: "none" |
| | | // }) |
| | | // } else { |
| | | // wx.setStorageSync('token', res.data.token) |
| | | // wx.showToast({ |
| | | // title: '登录成功!', |
| | | // icon: 'none' |
| | | // }); |
| | | loginRequest(this.data.userName, this.data.psw, this.data.codeNum, this.data.uuid).then(res => { |
| | | console.log(res); |
| | | if (res.data.code != 200) { |
| | | wx.showToast({ |
| | | title: res.data.msg, |
| | | icon: "none" |
| | | }) |
| | | } else { |
| | | wx.setStorageSync('token', res.data.token) |
| | | wx.showToast({ |
| | | title: '登录成功!', |
| | | icon: 'none' |
| | | }); |
| | | |
| | | // // console.log(res); |
| | | // this.$store.dispatch('setUserData', { |
| | |
| | | // this.$Router.pushTab({ |
| | | // path: '/pages/home/index', |
| | | // }); |
| | | // app.setUser(res.data) |
| | | app.setUser(res.data) |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.switchTab({ |
| | |
| | | // }) |
| | | // } |
| | | |
| | | // } |
| | | // }).catch(() => { |
| | | } |
| | | }).catch(() => { |
| | | |
| | | // }) |
| | | }) |
| | | }, |
| | | //忘记密码 |
| | | goForgot() { |
| | |
| | | // pages/person/person.js |
| | | import {LogOut} from '../../utils/network' |
| | | // import Dialog from '../../miniprogram_npm/vant-weapp/dialog/index'; |
| | | |
| | | |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | |
| | | */ |
| | | data: { |
| | | username: '', |
| | | part: '' |
| | | part: '', |
| | | show: false, |
| | | }, |
| | | |
| | | openDialog() { |
| | | this.setData({ |
| | | show: true |
| | | }) |
| | | }, |
| | | options: { |
| | | styleIsolation: 'shared' |
| | | }, |
| | | goPersonSet(){ |
| | | wx.navigateTo({ |
| | | url: '/pages/personSet/personSet', |
| | | }) |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | |
| | | |
| | | }, |
| | | |
| | |
| | | url: '/pages/fixpwd/fixpwd', |
| | | }) |
| | | }, |
| | | |
| | | onClose() { |
| | | this.setData({ show: false }); |
| | | }, |
| | | // 退出登录 |
| | | logout() { |
| | | wx.showLoading({ |
| | | title: '正在退出', |
| | | }) |
| | | console.log(111); |
| | | LogOut().then((res)=>{ |
| | | // wx.showLoading({ |
| | | // title: '正在退出', |
| | | // }) |
| | | if(res.data.TimeOutFlag){ |
| | | wx.removeStorage({ |
| | | key: 'user', |
| | | success() { |
| | | // console.log(111); |
| | | wx.setStorageSync('token', '') |
| | | wx.redirectTo({ |
| | | url: '/pages/login/logn', |
| | | url: '/pages/login/login', |
| | | }) |
| | | } |
| | | }) |
| | | wx.showToast({ |
| | | title: '登录超时,您已下线', |
| | | }) |
| | | } else { |
| | | if(res.data.Data === 1){ |
| | | wx.setStorageSync('token', '') |
| | | wx.removeStorage({ |
| | | key: 'user', |
| | | success() { |
| | | wx.hideLoading() |
| | | wx.setStorageSync('token', '') |
| | | wx.redirectTo({ |
| | | url: '/pages/login/logn', |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow: function () { |
| | | console.log(app); |
| | | this.setData({ |
| | | username: app.username, |
| | | part: app.part, |
| | | headUrl: app.headUrl |
| | | headUrl: app.headUrl, |
| | | show: false |
| | | }) |
| | | }, |
| | | |
| | |
| | | { |
| | | "usingComponents": {}, |
| | | "usingComponents": { |
| | | "van-dialog": "/miniprogram_npm/vant-weapp/dialog/index" |
| | | }, |
| | | "navigationBarTitleText": "我的", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#1E90FF" |
| | |
| | | <view class="header"> |
| | | <image class="hImg" src="{{headUrl}}" mode="" /> |
| | | <view> |
| | | <view>仁软科技</view> |
| | | <view style="font-size: 18px;">仁软科技</view> |
| | | <view>136666666</view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="list"> |
| | | <view class="item"> |
| | | <view class="text"> 个人设置</view> |
| | | <view icon> > </view> |
| | | <view class="item" bind:tap="goPersonSet"> |
| | | <view class="text"><image src="/images/me.png" mode=""/> 个人设置</view> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="text"> 系统消息</view> |
| | | <view icon> > </view> |
| | | <view class="text"><image src="/images/xtnews.png" mode=""/> 系统消息</view> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="text"> 联系客服</view> |
| | | <view icon> > </view> |
| | | <view class="text"><image src="/images/kefu.png" mode=""/> 联系客服</view> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="text"> 退出登录</view> |
| | | <view icon> > </view> |
| | | <view class="item" bind:tap="openDialog"> |
| | | <view class="text"><image src="/images/logout.png" mode=""/> 退出登录</view> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | </view> |
| | | <van-dialog id="van-dialog" title="退出登录" message="确认退出登录?" show="{{ show }}" show-cancel-button bind:confirm="logout" bind:close="onClose" /> |
| | |
| | | background-color: #fff; |
| | | margin: 10px 0; |
| | | display: flex; |
| | | |
| | | |
| | | } |
| | | .header image { |
| | | width: 80px; |
| | |
| | | |
| | | .list .item{ |
| | | width: 100%; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | font-size: 20px; |
| | | margin: 10px 0; |
| | | height: 50px; |
| | | line-height: 50px; |
| | | /* font-size: 18px; */ |
| | | /* margin: 10px 0 0; */ |
| | | background-color: #fff; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | .list .item .text{ |
| | | margin-left: 10px; |
| | | /* font-weight: 600; */ |
| | | display: flex; |
| | | } |
| | | .list .item .icon{ |
| | | .list .item .text image{ |
| | | width: 30px; |
| | | height: 30px; |
| | | margin-top: 10px; |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | .list .item .iconfont{ |
| | | margin-right: 10px; |
| | | color: #AFAFAF; |
| | | } |
| | | .van-dialog__cancel, .van-dialog__confirm { |
| | | border: 0!important; |
| | | width: 100%; |
| | | padding: 0; |
| | | } |
| | | .van-dialog__button { |
| | | |
| | | flex: 1; |
| | | width: 50%; |
| | | margin: 0 auto; |
| | | } |
| New file |
| | |
| | | // pages/personSet/personSet.js |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | personInfo: {}, |
| | | |
| | | |
| | | }, |
| | | getUser() { |
| | | wx.request({ |
| | | url: `https://puyue.yhupai.com/prod-api/system/user/profile`, |
| | | method: 'GET', |
| | | header: { |
| | | "Access-Control-Allow-Headers": 'token', |
| | | Authorization: `Bearer ${wx.getStorageSync('token')}` |
| | | }, |
| | | dataType: 'json', |
| | | success: (res, header) => { |
| | | // console.log(res); |
| | | if (res.data.code != 200) { |
| | | |
| | | } else { |
| | | console.log(res.data.data); |
| | | this.setData({ |
| | | personInfo: res.data.data |
| | | }) |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | }, |
| | | |
| | | goChangePSW() { |
| | | wx.navigateTo({ |
| | | url: '/pages/changePsw/changePSW', |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | this.getUser() |
| | | // console.log(app); |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | } |
| | | }) |
| New file |
| | |
| | | { |
| | | "usingComponents": { |
| | | "van-dialog": "/miniprogram_npm/vant-weapp/dialog/index", |
| | | "van-field": "/miniprogram_npm/vant-weapp/field/index" |
| | | }, |
| | | "navigationBarTitleText": "个人设置", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#007CFE" |
| | | } |
| New file |
| | |
| | | <!--pages/personSet/personSet.wxml--> |
| | | <view class="list"> |
| | | <view class="item" style="height: 80px;line-height:80px;" bind:tap="goPersonSet"> |
| | | <view class="text"> |
| | | 用户头像 |
| | | </view> |
| | | <view style="height: 80px;line-height:80px;display: flex;"> |
| | | <image src="/images/heard.png" mode="" /> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="item"> |
| | | <view class="text"> |
| | | 用户名 |
| | | </view> |
| | | <text class="" style="margin-right: 10px;"> {{personInfo.createBy?personInfo.createBy:'--'}}</text> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="text"> |
| | | 手机号 |
| | | </view> |
| | | <!-- <text class="iconfont icon-xiangyoujiantou"></text> --> |
| | | <text class="" style="margin-right: 10px;"> {{personInfo.phonenumber?personInfo.phonenumber:'--'}}</text> |
| | | </view> |
| | | <view class="item" bind:tap="openDialog"> |
| | | <view class="text"> |
| | | 住址 |
| | | </view> |
| | | <text class="" style="margin-right: 10px;"> {{personInfo.address?personInfo.address:'--'}}</text> |
| | | |
| | | <!-- <text class="iconfont icon-xiangyoujiantou"></text> --> |
| | | </view> |
| | | <view class="item" bind:tap="goChangePSW"> |
| | | <view class="text"> |
| | | 修改密码 |
| | | </view> |
| | | <text class="iconfont icon-xiangyoujiantou"></text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- confirm-button-open-type --> |
| | | <!-- <van-dialog use-slot title="修改密码" show="{{ editPSW }}" show-cancel-button bind:confirm="changePSW" bind:cancel="onClosePSW" bind:beforeClose="onBeforeClose"> |
| | | <van-cell-group> |
| | | <van-field value="{{ password.old }}" required clearable label="旧密码" placeholder="" /> |
| | | <van-field value="{{ password.new }}" clearable label="新密码" placeholder="" required /> |
| | | <van-field value="{{ password.newTwo }}" clearable label="确认密码" placeholder="" required /> |
| | | </van-cell-group> |
| | | </van-dialog> --> |
| New file |
| | |
| | | /* pages/personSet/personSet.wxss */ |
| | | .list .item { |
| | | width: 100%; |
| | | height: 50px; |
| | | line-height: 50px; |
| | | /* font-size: 18px; */ |
| | | /* margin: 10px 0 0; */ |
| | | background-color: #fff; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | |
| | | .list .item .text { |
| | | margin-left: 10px; |
| | | /* font-weight: 600; */ |
| | | display: flex; |
| | | } |
| | | |
| | | .list .item image { |
| | | width: 50px; |
| | | height: 50px; |
| | | margin-top: 10px; |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | .list .item .iconfont { |
| | | margin-right: 10px; |
| | | color: #AFAFAF; |
| | | } |
| | | .van-dialog__cancel, .van-dialog__confirm { |
| | | border: 0!important; |
| | | width: 100%; |
| | | padding: 0; |
| | | } |
| | | .van-dialog__button { |
| | | |
| | | flex: 1; |
| | | width: 50%; |
| | | margin: 0 auto; |
| | | } |
| | |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | imgSrc: "data:image/gif;base64," + res.data.img |
| | | }) |
| | | this.setData({ |
| | | imgSrc: "data:image/gif;base64," + res.data.img, |
| | | uuid: res.data.uuid |
| | | }) |
| | | // this.imgSrc = "data:image/gif;base64," + res.data.img |
| | |
| | | { |
| | | "usingComponents": {} |
| | | "usingComponents": {}, |
| | | "navigationBarTitleText": "注册账户", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#007CFE" |
| | | } |
| New file |
| | |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | | */ |
| | | properties: { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 组件的初始数据 |
| | | */ |
| | | data: { |
| | | test: [ |
| | | [], |
| | | [], |
| | | [], |
| | | [], |
| | | [], |
| | | ], |
| | | selectvalue: [1, 2, 3, 4, 5], |
| | | date: '', |
| | | time:'01-01' |
| | | }, |
| | | |
| | | /** |
| | | * 组件的方法列表 |
| | | */ |
| | | methods: { |
| | | formatNumber(n){ |
| | | n = n.toString() |
| | | return n[1] ? n : '0' + n |
| | | }, |
| | | formatDate(date){ |
| | | const year = date.getFullYear() |
| | | const month = date.getMonth() + 1 |
| | | const day = date.getDate() |
| | | return [year, month, day].map(this.formatNumber).map(this.formatNumber).join('-') |
| | | }, |
| | | // 可以封装为获取某年某月的天数 |
| | | mGetDate(year, month) { |
| | | let d = new Date(year, month, 0); |
| | | return d.getDate(); |
| | | }, |
| | | //多列滚动选择器滚动时触发事件 |
| | | bindcolumnchange(e) { |
| | | let column = e.detail.column |
| | | let temp = this.data.selectvalue |
| | | switch (column) { |
| | | case 0: |
| | | temp[0] = e.detail.value |
| | | this.setData({ |
| | | selectvalue: temp |
| | | }, () => { |
| | | let day = this.mGetDate(this.data.selectvalue[0], this.data.selectvalue[1]) |
| | | let days = [] |
| | | for (let i = 1; i <= day; i++) { |
| | | days.push(i + '日') |
| | | } |
| | | let temp_1 = this.data.test |
| | | temp_1[2] = days |
| | | this.setData({ |
| | | test: temp_1 |
| | | }) |
| | | }) |
| | | break; |
| | | case 1: |
| | | temp[1] = e.detail.value |
| | | this.setData({ |
| | | selectvalue: temp |
| | | }, () => { |
| | | let day = this.mGetDate((this.data.selectvalue[0] + 1), (this.data.selectvalue[1] + 1)) |
| | | let days = [] |
| | | for (let i = 1; i <= day; i++) { |
| | | days.push(i + '日') |
| | | } |
| | | let temp_1 = this.data.test |
| | | temp_1[2] = days |
| | | this.setData({ |
| | | test: temp_1 |
| | | }) |
| | | }) |
| | | break; |
| | | case 2: |
| | | temp[2] = e.detail.value |
| | | this.setData({ |
| | | selectvalue: temp |
| | | }) |
| | | break; |
| | | case 3: |
| | | temp[3] = e.detail.value |
| | | this.setData({ |
| | | selectvalue: temp |
| | | }) |
| | | break; |
| | | case 4: |
| | | temp[4] = e.detail.value |
| | | this.setData({ |
| | | selectvalue: temp |
| | | }) |
| | | break; |
| | | } |
| | | |
| | | // console.log("第" + e.detail.column + "列", "第" + e.detail.value + "个") |
| | | }, |
| | | // 确定选择日期 |
| | | bindchange() { |
| | | let temp = this.data.selectvalue |
| | | let year = (this.data.test[0][temp[0]]).substr(0, (this.data.test[0][temp[0]]).length - 1) |
| | | year = this.addzero(year) |
| | | let month = (this.data.test[1][temp[1]]).substr(0, (this.data.test[1][temp[1]]).length - 1) |
| | | month = this.addzero(month) |
| | | let day = this.data.test[2][temp[2]].substr(0, (this.data.test[2][temp[2]]).length - 1) |
| | | day = this.addzero(day) |
| | | let hour = this.data.test[3][temp[3]].substr(0, (this.data.test[3][temp[3]]).length - 1) |
| | | hour = this.addzero(hour) |
| | | let minute = this.data.test[4][temp[4]].substr(0, (this.data.test[4][temp[4]]).length - 1) |
| | | minute = this.addzero(minute) |
| | | this.setData({ |
| | | date: year + "-" + month + "-" + day, |
| | | time: hour + ":" + minute, |
| | | all: year + "-" + month + "-" + day + '' + hour + ":" + minute, |
| | | }, _ => { |
| | | this.triggerEvent("pConfirm", { |
| | | date: year + "-" + month + "-" + day, |
| | | time: hour + ":" + minute, |
| | | all: year + "-" + month + "-" + day + '' + hour + ":" + minute, |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | //+0 |
| | | addzero(str){ |
| | | if(str.length==1){ |
| | | return "0"+str |
| | | }else { |
| | | return str |
| | | } |
| | | }, |
| | | }, |
| | | ready() { |
| | | // 获取当前日期(年,月,日) |
| | | let DATE = (this.formatDate(new Date())).split('-') |
| | | let year = parseInt(DATE[0]) |
| | | let month = parseInt(DATE[1]) |
| | | let day_1 = parseInt(DATE[2]) |
| | | this.setData({ |
| | | selectvalue: [0, month - 1, day_1 - 1, 0, 0], |
| | | date: year + "-" + month + "-" + day_1 |
| | | }) |
| | | let years = [] |
| | | let months = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] |
| | | let days = [] |
| | | let hours = [] |
| | | let minutes = [] |
| | | //判断当前月份天数 |
| | | let day = this.mGetDate(year, month) |
| | | for (let i = 1; i <= day; i++) { |
| | | days.push(i + '日') |
| | | } |
| | | for (let i = 0; i < 30; i++) { |
| | | years.push(year + i + '年') |
| | | } |
| | | for (let i = 1; i < 25; i++) { |
| | | hours.push(i + "点") |
| | | } |
| | | for (let i = 0; i < 61; i++) { |
| | | minutes.push(i + "分") |
| | | } |
| | | this.setData({ |
| | | test: [years, months, days, hours, minutes] |
| | | }) |
| | | } |
| | | }) |
| | | |
| New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": {} |
| | | } |
| New file |
| | |
| | | <!--pages/repairTicketDetail/datePicker.wxml--> |
| | | <!-- 组件 --> |
| | | <view> |
| | | <picker range="{{test}}" mode="multiSelector" bindcolumnchange='bindcolumnchange' value="{{selectvalue}}" bindchange="bindchange"> |
| | | {{date}} {{time}} |
| | | </picker> |
| | | </view> |
| | | |
| New file |
| | |
| | | /* pages/repairTicketDetail/datePicker.wxss */ |
| | |
| | | // pages/repairTicketDetail/repairTicketDetail.js |
| | | var util = require('../../utils/network'); |
| | | const DatePickerUtil = require('../../utils/DatePicker.js') |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | columns: ['请选择', '漏水', '制水时间过长', '其它'], |
| | | showDate: false, |
| | | selectDate: '', |
| | | |
| | | // currentDate: new Date().getTime(), |
| | | currentDate: '', |
| | | minDate: new Date().getTime(), |
| | | formatter(type, value) { |
| | | // console.log(type,value); |
| | | if (type === 'year') { |
| | | return `${value}年`; |
| | | } |
| | | if (type === 'month') { |
| | | return `${value}月`; |
| | | } |
| | | if (type === 'day') { |
| | | return `${value}日`; |
| | | } |
| | | if (type === 'hour') { |
| | | return `${value}时`; |
| | | } |
| | | if (type === 'minute') { |
| | | return `${value}分`; |
| | | } |
| | | return value; |
| | | }, |
| | | show:'none', |
| | | info:'', |
| | | |
| | | time:'选择预约时间', |
| | | multiArray:[],//piker的item项 |
| | | multiIndex:[],//当前选择列的下标 |
| | | year:'',//选择的年 |
| | | month:'',//选择的月 |
| | | day:'',//选择的日 |
| | | hour:'',//选择的时 |
| | | minute:'',//选择的分 |
| | | }, |
| | | openShowType() { |
| | | this.setData({ |
| | | showType: true |
| | | }) |
| | | }, |
| | | openShowDate() { |
| | | this.setData({ |
| | | showDate: true |
| | | }) |
| | | }, |
| | | onInput(event) { |
| | | let arr1=this.data.currentDate.slice(0,3) |
| | | let arr2=this.data.currentDate.slice(3) |
| | | console.log(arr1,arr2); |
| | | let date = (arr1.join('-')+ ' ' +arr2.join(':')).replace(/[\u4e00-\u9fa5]/g, "") |
| | | this.setData({ |
| | | selectDate: date, |
| | | showDate:false |
| | | }); |
| | | |
| | | }, |
| | | onChangeDate(event) { |
| | | this.setData({ |
| | | currentDate: event.detail.getValues(), |
| | | }) |
| | | // console.log(event.detail.getValues()); |
| | | }, |
| | | onChangeType(event) { |
| | | const { picker, value, index } = event.detail; |
| | |
| | | showType: false |
| | | }) |
| | | }, |
| | | closeType(){ |
| | | this.setData({ |
| | | showType: false |
| | | }) |
| | | }, |
| | | openShowDate(){ |
| | | this.setData({ |
| | | showDate: true |
| | | }) |
| | | }, |
| | | |
| | | |
| | | bindMultiPickerChange: function(e) { //时间日期picker选择改变后,点击确定 |
| | | // console.log('picker发送选择改变,携带值为', e.detail.value) |
| | | this.setData({ |
| | | multiIndex: e.detail.value |
| | | }) |
| | | const index = this.data.multiIndex; // 当前选择列的下标 |
| | | const year = this.data.multiArray[0][index[0]]; |
| | | const month = this.data.multiArray[1][index[1]]; |
| | | const day = this.data.multiArray[2][index[2]]; |
| | | const hour = this.data.multiArray[3][index[3]]; |
| | | const minute = this.data.multiArray[4][index[4]]; |
| | | // console.log(`${year}-${month}-${day} ${hour}:${minute}`); |
| | | |
| | | this.setData({ |
| | | time: (year+ month+ day + ' ' + hour.replace('时','')+':'+minute.replace('分','')).replace('年','-').replace('月','-').replace('日',''), |
| | | year:year, //记录选择的年 |
| | | month:month, //记录选择的月 |
| | | day:day, //记录选择的日 |
| | | hour:hour, //记录选择的时 |
| | | minute:minute, //记录选择的分 |
| | | }) |
| | | console.log(this.data.time); |
| | | }, |
| | | bindMultiPickerColumnChange: function(e) { //监听picker的滚动事件 |
| | | |
| | | // console.log('修改的列为', e.detail.column, ',值为', e.detail.value); |
| | | |
| | | let getCurrentDate = DatePickerUtil.getCurrentDate();//获取现在时间 |
| | | let currentYear = parseInt(getCurrentDate.substring(0,4)); |
| | | let currentMonth = parseInt(getCurrentDate.substring(5,7)); |
| | | let currentDay = parseInt(getCurrentDate.substring(8,10)); |
| | | let currentHour = parseInt(getCurrentDate.substring(11,13)); |
| | | let currentMinute = parseInt(getCurrentDate.substring(14,16)); |
| | | |
| | | if (e.detail.column == 0) {//修改年份列 |
| | | |
| | | let yearSelected = parseInt(this.data.multiArray[e.detail.column][e.detail.value]);//当前选择的年份 |
| | | |
| | | this.setData({ |
| | | multiIndex:[0,0,0,0,0] ,//设置pickerIndex |
| | | year:yearSelected //当前选择的年份 |
| | | }); |
| | | |
| | | if(yearSelected == currentYear){//当前选择的年份==当前年份 |
| | | var loadPickerData=DatePickerUtil.loadPickerData(); |
| | | |
| | | this.setData({ |
| | | multiArray:loadPickerData,//picker数组赋值 |
| | | multiIndex:[0,0,0,0,0] //设置pickerIndex |
| | | }); |
| | | |
| | | }else{ // 选择的年份!=当前年份 |
| | | |
| | | // 处理月份 |
| | | let monthArr=DatePickerUtil.loadMonths(1,12) |
| | | // 处理日期 |
| | | let dayArr=DatePickerUtil.loadDays(currentYear,currentMonth,1) |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(0,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | |
| | | // 给每列赋值回去 |
| | | this.setData({ |
| | | ['multiArray[1]']: monthArr, |
| | | ['multiArray[2]']: dayArr, |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | } |
| | | if (e.detail.column == 1) {//修改月份列 |
| | | let mon = parseInt(this.data.multiArray[e.detail.column][e.detail.value]); //当前选择的月份 |
| | | this.setData({ |
| | | month:mon // 记录当前列 |
| | | }) |
| | | |
| | | if(mon==currentMonth){//选择的月份==当前月份 |
| | | if(this.data.year==currentYear){ |
| | | |
| | | // 处理日期 |
| | | let dayArr=DatePickerUtil.loadDays(currentYear,mon,currentDay) |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(currentHour,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(currentMinute,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[2]']:dayArr, |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }) |
| | | }else{ |
| | | // 处理日期 |
| | | let dayArr=DatePickerUtil.loadDays(currentYear,mon,1) |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(0,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[2]']:dayArr, |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | }else{ // 选择的月份!=当前月份 |
| | | // 处理日期 |
| | | let dayArr = DatePickerUtil.loadDays(currentYear,mon,1) // 传入当前年份,当前选择的月份去计算日 |
| | | // 处理hour |
| | | let hourArr = DatePickerUtil.loadHours(0,24); |
| | | // 处理minute |
| | | let minuteArr = DatePickerUtil.loadMinutes(0,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[2]']:dayArr, |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | } |
| | | if(e.detail.column == 2) {//修改日 |
| | | let dd = parseInt(this.data.multiArray[e.detail.column][e.detail.value]);//当前选择的日 |
| | | this.setData({ |
| | | day:dd |
| | | }) |
| | | if(dd==currentDay){//选择的日==当前日 |
| | | if(this.data.year==currentYear&&this.data.month==currentMonth){//选择的是今天 |
| | | |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(currentHour,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(currentMinute,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | |
| | | }else{ //选择的不是今天 |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(0,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | }else{ // 选择的日!=当前日 |
| | | // 处理hour |
| | | let hourArr=DatePickerUtil.loadHours(0,24); |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | |
| | | this.setData({ |
| | | ['multiArray[3]']: hourArr, |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | } |
| | | if(e.detail.column == 3) {//修改时 |
| | | let hh = parseInt(this.data.multiArray[e.detail.column][e.detail.value]); //当前选择的时 |
| | | this.setData({ |
| | | hour:hh |
| | | }) |
| | | if(hh==currentHour){//选择的时==当前时 |
| | | if(this.data.year==currentYear&&this.data.month==currentMonth&&this.data.month==currentMonth){ // 选择的是今天 |
| | | |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(currentMinute,60) |
| | | this.setData({ |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | }else{ // 选择的不是今天 |
| | | |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | this.setData({ |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | }else{//选择的时!=当前时 |
| | | // 处理minute |
| | | let minuteArr=DatePickerUtil.loadMinutes(0,60) |
| | | this.setData({ |
| | | ['multiArray[4]']: minuteArr |
| | | }); |
| | | } |
| | | } |
| | | var data = { |
| | | multiArray: this.data.multiArray, |
| | | multiIndex: this.data.multiIndex |
| | | }; |
| | | |
| | | // console.log('修改的列为', e.detail.column, ',值为', e.detail.value); |
| | | data.multiIndex[e.detail.column] = e.detail.value; //将值赋回去 |
| | | |
| | | this.setData(data); //将值赋回去 |
| | | }, |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | var time = util.formatTime(new Date()); |
| | | // 再通过setData更改Page()里面的data,动态更新页面的数据 |
| | | this.setData({ |
| | | selectDate: time |
| | | }); |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | var loadPickerData=DatePickerUtil.loadPickerData() |
| | | var getCurrentDate=DatePickerUtil.getCurrentDate() |
| | | var GetMultiIndex=DatePickerUtil.GetMultiIndex() |
| | | |
| | | //这里写的是为了记录当前时间 |
| | | let year=parseInt(getCurrentDate.substring(0,4)); |
| | | let month=parseInt(getCurrentDate.substring(5,7)); |
| | | let day=parseInt(getCurrentDate.substring(8,10)); |
| | | let hour=parseInt(getCurrentDate.substring(11,13)); |
| | | let minute=parseInt(getCurrentDate.substring(14,16)); |
| | | this.setData({ |
| | | multiArray:loadPickerData,//picker数组赋值,格式 [years, months, days, hours, minutes] |
| | | multiIndex:GetMultiIndex,//设置pickerIndex,[0,0,0,0,0] |
| | | time:getCurrentDate.replace('年','-').replace('月','-').replace('日',' '), //设置当前时间 ,currentYears+'-'+mm+'-'+dd+' '+hh+':'+min |
| | | year:year,//记录选择的年 |
| | | month:month,//记录选择的月 |
| | | day:day,//记录选择的日 |
| | | hour:hour,//记录选择的时 |
| | | minute:minute,//记录选择的分 |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | |
| | | "van-field": "/miniprogram_npm/vant-weapp/field/index", |
| | | "van-picker": "/miniprogram_npm/vant-weapp/picker/index", |
| | | "van-popup": "/miniprogram_npm/vant-weapp/popup/index", |
| | | "van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index" |
| | | "van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index", |
| | | "picker-date":"./components/datePicker" |
| | | }, |
| | | "navigationBarTitleText": "报修单详情", |
| | | "navigationBarTextStyle": "white", |
| | |
| | | 预约时间 |
| | | </view> |
| | | <view class="right" bind:tap="openShowDate"> |
| | | {{selectDate}} > |
| | | |
| | | <picker bindtap="clickSelectTime" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}"> |
| | | {{time}} |
| | | <view class="triangle_border_down"> </view> |
| | | </picker> |
| | | |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <view>故障描述</view> |
| | | <van-field class="info" |
| | | value="{{ message }}" |
| | | label="" |
| | | type="textarea" |
| | | placeholder="请输入设备故障的基本描述" |
| | | autosize |
| | | |
| | | /> |
| | | <!-- <van-field value="{{info }}" type="textarea" placeholder="" border style="margin-top: 10px;" /> --> |
| | | |
| | | <view style="display: flex;justify-content: space-between;"> |
| | | <view style="margin-left: 5px;">故障描述</view> |
| | | <view style="width: calc(100% - 80px);"> |
| | | <van-field class="info" style="min-height: 200px;" value="{{ message }}" label="" type="textarea" placeholder="请输入设备故障的基本描述" autosize /> |
| | | </view> |
| | | </view> |
| | | <view style="width: 90%;margin-left: 5%;height: 40px;line-height: 40px;background-color: #007CFE;text-align: center;color: #fff;margin-top: 10px;">提交报修单</view> |
| | | </view> |
| | | <van-popup show="{{ showType }}" position="bottom" custom-style="height: 40%;" bind:close="onClose"> |
| | | <van-picker columns="{{ columns }}" bind:change="onChangeType" /> |
| | | <van-picker columns="{{ columns }}" show-toolbar bind:cancel="closeType" bind:confirm="onChangeType" /> |
| | | </van-popup> |
| | | |
| | | <van-popup show="{{ showDate }}" position="bottom" custom-style="height: 40%;" bind:close="onClose"> |
| | | <van-datetime-picker type="year-month-time" value="{{ currentDate }}" bind:confirm="onInput" bind:change="onChangeDate" min-date="{{ minDate }}" formatter="{{ formatter }}" /> |
| | | </van-popup> |
| | | <!-- <van-popup show="{{ showDate }}" position="bottom" custom-style="height: 40%;" bind:close="onClose"> --> |
| | | <!-- <picker-date bind:pConfirm='pConfirm'></picker-date> --> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- </van-popup> --> |
| | |
| | | margin-top: 10px; |
| | | |
| | | } |
| | | .van-field__input--textarea{ |
| | | height: 200px !important; |
| | | padding-top: 5px !important; |
| | | } |
| | |
| | | code:'', |
| | | |
| | | }, |
| | | scanCode() { |
| | | let that = this |
| | | |
| | | wx.scanCode({ |
| | | success(res) { |
| | | // return res.result |
| | | // console.log(res.result, this) |
| | | // codenum = res.result |
| | | wx.showToast({ |
| | | title: '扫码成功', |
| | | icon: "none" |
| | | }) |
| | | that.setData({ |
| | | code: res.result |
| | | }) |
| | | }, |
| | | fail(err) { |
| | | wx.showToast({ |
| | | title: '扫码失败,请重新尝试', |
| | | icon: "none" |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | |
| | | </view> |
| | | <view class="main"> |
| | | <van-field value="{{ code }}" placeholder="请输入设备id" style="width: 75%;" /> |
| | | <view class="scan">扫码</view> |
| | | <view class="scan" bind:tap="scanCode">扫码</view> |
| | | </view> |
| | | <!-- <view > --> |
| | | <view class="add">添加设备</view> |
| | |
| | | .info{ |
| | | margin: 5px 0; |
| | | } |
| | | .van-dialog__cancel, .van-dialog__confirm { |
| | | border: 0!important; |
| | | width: 100%; |
| | | padding: 0; |
| | | } |
| | | .van-dialog__button { |
| | | |
| | | flex: 1; |
| | | width: 50%; |
| | | margin: 0 auto; |
| | | } |
| New file |
| | |
| | | const formatNumber = n => { |
| | | n = n.toString() |
| | | return n[1] ? n : '0' + n |
| | | } |
| | | function getCurrentDate(){// 获取当前时间 |
| | | let date = new Date(); |
| | | let currentYears=date.getFullYear(); |
| | | let currentMonths=date.getMonth()+1; |
| | | let currentDay=date.getDate(); |
| | | let currentHours=date.getHours(); |
| | | let currentMinute=date.getMinutes(); |
| | | |
| | | var mm=[currentMonths].map(formatNumber) |
| | | var dd=[currentDay].map(formatNumber) |
| | | var hh=[currentHours].map(formatNumber) |
| | | var min=[currentMinute].map(formatNumber) |
| | | |
| | | return currentYears+'年'+mm+'月'+dd+'日'+hh+':'+min; |
| | | } |
| | | |
| | | function GetMultiIndex(){ //一点开picker的选中设置 |
| | | |
| | | return [0,0,0,0,0]; //现在全部列,默认选第一个选项,其实这一步多余,可以直接在data里面定义 |
| | | } |
| | | |
| | | function loadYears(startYear,endYear){//获取年份 |
| | | /** |
| | | * params参数 |
| | | * startYear 当前年份 |
| | | * endYear 循环结束月份 ,比如 5 年内 newDate().getFullYear() + 4,客户说只能预约两年内 |
| | | * return 年份数组 |
| | | */ |
| | | let years=[]; |
| | | for (let i = startYear; i <= endYear; i++) { |
| | | years.push("" + i+"年"); |
| | | } |
| | | return years;//返回年份数组 |
| | | } |
| | | |
| | | |
| | | function loadMonths(startMonth,endMonth){//获取月份 |
| | | /** |
| | | * params参数 |
| | | * startMonth 当前月份 |
| | | * endMonth 循环结束月份,一般为 12个月 |
| | | * return 月份数组 |
| | | */ |
| | | let months=[]; |
| | | for (let i = startMonth; i <= endMonth; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | months.push("" + i+"月"); |
| | | } |
| | | return months;//返回月份数组 |
| | | } |
| | | |
| | | |
| | | function loadDays(currentYears,selectedMonths,startDay){ //获取日期 |
| | | /** |
| | | * params参数 |
| | | * currentYears 当前年份 |
| | | * selectedMonths 当前选择的月份 |
| | | * startDay 循环开始日 一般为1号, 希望从当前月份开始 ,startDay=currentDay |
| | | * return 日期数组 |
| | | */ |
| | | let days=[]; |
| | | if (selectedMonths == 1 || selectedMonths == 3 || selectedMonths == 5 || selectedMonths == 7 || selectedMonths == 8 || selectedMonths == 10 || selectedMonths == 12) { //判断31天的月份,可以用正则简化 |
| | | for (let i = startDay; i <= 31; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | days.push("" + i+'日'); |
| | | } |
| | | } else if (selectedMonths == 4 || selectedMonths == 6 || selectedMonths == 9 || selectedMonths == 11) { //判断30天的月份 |
| | | for (let i = startDay; i <= 30; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | days.push("" + i+'日'); |
| | | } |
| | | } else if (selectedMonths == 2) { //判断2月份天数 |
| | | let year = currentYears |
| | | if (((year % 400 == 0) || (year % 100 != 0)) && (year % 4 == 0)) {//闰年 |
| | | for (let i = startDay; i <= 29; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | days.push("" + i+'日'); |
| | | } |
| | | |
| | | } else {//不是闰年 |
| | | for (let i = startDay; i <= 28; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | days.push("" + i+'日'); |
| | | } |
| | | } |
| | | } |
| | | return days;//返回日期数组 |
| | | } |
| | | |
| | | |
| | | function loadHours(startHour,endHour){//获取小时 |
| | | /** |
| | | * params参数 |
| | | * startHour 循环开始小时 一般为 0点, 希望从当前小时开始 startHour=currentHours |
| | | * endHour 循环当前小时 ,一般为24个小时 |
| | | * return 小时数组 |
| | | */ |
| | | let hours=[]; |
| | | for (let i = startHour; i < endHour ; i++) { |
| | | // if (i < 10) {//看需求要不要加在前面+‘0’ |
| | | // i = "0" + i; |
| | | // } |
| | | hours.push("" + i+"时"); |
| | | } |
| | | return hours;//返回小时数组 |
| | | } |
| | | |
| | | |
| | | function loadMinutes(startMinute,endMinute){//获取分钟 |
| | | /** |
| | | * params参数 |
| | | * startMinute 循环开始分钟 一般为 0 开始,从当前分钟开始 startMinute=currentMinutes |
| | | * endMinute 循环当前秒 ,一般为60分钟 |
| | | * return 分钟数组 |
| | | */ |
| | | let minutes=[]; |
| | | for (let i = startMinute; i < endMinute ; i++) { |
| | | if (i < 10) { |
| | | i = "0" + i; |
| | | } |
| | | minutes.push("" + i+"分"); |
| | | } |
| | | return minutes;//返回分钟数组 |
| | | } |
| | | |
| | | //我没有用到秒,可以参考分钟的写法 |
| | | |
| | | function loadPickerData(){ //将Picker初始数据,开始时间设置为当前时间 |
| | | let date1 = new Date(); |
| | | let currentYears=date1.getFullYear(); |
| | | let currentMonths=date1.getMonth()+1; |
| | | let currentDay=date1.getDate(); |
| | | let currentHours=date1.getHours(); |
| | | let currentMinute=date1.getMinutes(); |
| | | |
| | | // 下面调用 自定义方法 |
| | | |
| | | //获取年份 loadYears(startYear,endYear) |
| | | //获取月份 loadMonths(startMonth,endMonth) |
| | | //获取日期 loadDays(currentYears,currentMonths,startDay) |
| | | //获取小时 loadHours(startHour,endHour) |
| | | //获取分钟 loadMinutes(startMinute,endMinute) |
| | | |
| | | let years = loadYears(currentYears,date1.getFullYear() + 1) //客户说只能预约两年内,+1 |
| | | let months = loadMonths(currentMonths,12) |
| | | let days = loadDays(currentYears,currentMonths,currentDay) |
| | | let hours = loadHours(currentHours,24) |
| | | let minutes = loadMinutes(currentMinute,60) |
| | | |
| | | return [years, months, days, hours, minutes] |
| | | } |
| | | |
| | | //导出 |
| | | module.exports = { |
| | | loadPickerData:loadPickerData, |
| | | getCurrentDate:getCurrentDate, |
| | | GetMultiIndex:GetMultiIndex, |
| | | loadYears:loadYears, |
| | | loadMonths:loadMonths, |
| | | loadDays:loadDays, |
| | | loadHours:loadHours, |
| | | loadMinutes:loadMinutes |
| | | } |
| | | |
| | |
| | | // console.log(wx.getStorageSync('token')) |
| | | return new Promise(function (resolve, reject) { |
| | | wx.request({ |
| | | url: host + '/LoginOut/LoginOut', |
| | | // https://puyue.yhupai.com/prod-api/logout |
| | | url: 'https://puyue.yhupai.com/' + '/prod-api/logout', |
| | | data: { |
| | | token: wx.getStorageSync('token') |
| | | }, |