|  |  | 
 |  |  |             <view class="icons"> | 
 |  |  |                <uni-icons type="person" size="20"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |             <text>账号:</text> | 
 |  |  |             <input type="text" placeholder="请输入账号!" v-model="user.userName" | 
 |  |  |             <text>手机号:</text> | 
 |  |  |             <input type="text" placeholder="请输入账号!" v-model="user.phone" | 
 |  |  |                placeholder-style="font-size:14px;color:#ccc;"> | 
 |  |  |          </view> | 
 |  |  |          <view class="user-info-item shadow-warp"> | 
 |  |  |             <view class="icons"> | 
 |  |  |                <uni-icons type="locked" size="20"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |             <text>密码:</text> | 
 |  |  |             <input :password="!showPassword" v-model="user.password" placeholder="请输入密码!" | 
 |  |  |             <text>验证码:</text> | 
 |  |  |             <input :password="!showPassword" v-model="user.code" placeholder="请输入验证码!" | 
 |  |  |                placeholder-style="font-size:14px;color:#ccc;"> | 
 |  |  |             <view class="showPassword" v-if="showPassword" @click="changePassword"> | 
 |  |  |             <view style="font-size: 24rpx;" > | 
 |  |  |                <text @click="getCode" v-show="!codeTimeShow">获取验证码</text> | 
 |  |  |                <text v-show="codeTimeShow">{{codeTime}}秒后重获</text> | 
 |  |  |             </view> | 
 |  |  |             <!-- <view class="showPassword" v-if="showPassword" @click="changePassword"> | 
 |  |  |                <uni-icons type="eye" size="20"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |             <view class="showPassword" v-if="!showPassword" @click="changePassword"> | 
 |  |  |                <uni-icons type="eye-slash" size="20"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |             </view> --> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  |       <!-- 登录按钮 --> | 
 |  |  |       <view class="loging"> | 
 |  |  |          <button class="button" @click="onLogin()" :loading="load.loading">{{load.btnText}}</button> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <view> | 
 |  |  |          <!-- 提示窗示例 --> | 
 |  |  |          <uni-popup ref="upVersion" type="dialog"> | 
 |  |  |             <uni-popup-dialog :type="msgType" title="通知" :content="dialogContent" @confirm="dialogConfirm" | 
 |  |  |                @close="dialogClose"></uni-popup-dialog> | 
 |  |  |          </uni-popup> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <!-- #ifdef APP-PLUS --> | 
 |  |  |       <view class="version"> | 
 |  |  |          当前版本: {{version}} | 
 |  |  | 
 |  |  |       data() { | 
 |  |  |          return { | 
 |  |  |             version: '', | 
 |  |  |             showPassword: false, | 
 |  |  |             showPassword: true, | 
 |  |  |             user: { | 
 |  |  |                userName: '', | 
 |  |  |                password: '', | 
 |  |  |                phone: '', | 
 |  |  |                code: '', | 
 |  |  |             }, | 
 |  |  |             load: { | 
 |  |  |                loading: false, | 
 |  |  |                btnText: '登录' | 
 |  |  |             }, | 
 |  |  |             msgType: 'success', | 
 |  |  |             filename: '', | 
 |  |  |             dialogContent: '', | 
 |  |  |             codeTime: 60, | 
 |  |  |             codeTimeShow: false | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       onLoad: function() { | 
 |  |  | 
 |  |  |             that.version = wgtinfo.version | 
 |  |  |          }); | 
 |  |  |          // #endif | 
 |  |  |       }, | 
 |  |  |       onShow() { | 
 |  |  |          this.getVersion() | 
 |  |  |  | 
 |  |  |       }, | 
 |  |  |       methods: { | 
 |  |  |          // 获取验证码 | 
 |  |  |          getCode() { | 
 |  |  |             let _this = this | 
 |  |  |             uni.request({ | 
 |  |  |                url: `${_this.baseUrl}/smsCode/sendCode`, | 
 |  |  |                header: {'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'}, | 
 |  |  |                data: {phone: _this.user.phone}, | 
 |  |  |                sslVerify: false, | 
 |  |  |                method: 'POST', | 
 |  |  |                success(res) { | 
 |  |  |                   res = res.data  | 
 |  |  |                   console.log(res); | 
 |  |  |                   _this.codeTimeShow = true | 
 |  |  |                   let time = setInterval(()=>{ | 
 |  |  |                      _this.codeTime-- | 
 |  |  |                   },1000) | 
 |  |  |                   setTimeout(()=>{ | 
 |  |  |                      _this.codeTimeShow = false | 
 |  |  |                      clearTimeout(time); | 
 |  |  |                      _this.codeTime = 60 | 
 |  |  |                   },60000) | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |          }, | 
 |  |  |          changePassword: function() { | 
 |  |  |             this.showPassword = !this.showPassword; | 
 |  |  |          }, | 
 |  |  |          //检测当前平台,如果是安卓则启动安卓更新 | 
 |  |  |          getVersion() { | 
 |  |  |             let that = this; | 
 |  |  |             uni.getSystemInfo({ | 
 |  |  |                success: (res) => { | 
 |  |  |                   //检测当前平台,如果是安卓则启动安卓更新   | 
 |  |  |                   if (res.platform == "android") { | 
 |  |  |                      that.AndroidCheckUpdate(); | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |          }, | 
 |  |  |          // 获取当前版本号 | 
 |  |  |          AndroidCheckUpdate() { | 
 |  |  |             let that = this; | 
 |  |  |             plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => { | 
 |  |  |                that.version = wgtinfo.version //客户端版本号 | 
 |  |  |                console.log('当前app版本信息:' + that.version); | 
 |  |  |             }) | 
 |  |  |             that.getUpdateVersion() | 
 |  |  |             setTimeout(()=>{ | 
 |  |  |                that.getUpdateVersion() | 
 |  |  |             },100) | 
 |  |  |          }, | 
 |  |  |          // 校验版本 | 
 |  |  |          getUpdateVersion() { | 
 |  |  |             let that = this | 
 |  |  |             let type = 0 | 
 |  |  |             if (that.baseUrl == 'http://undefined:undefined/undefined') { | 
 |  |  |                return | 
 |  |  |             } | 
 |  |  | 				 | 
 |  |  |             let url = that.baseUrl + '/appVersion/checkUpdate/' + that.version + '/' + type | 
 |  |  |             uni.request({ | 
 |  |  |                url: url, | 
 |  |  |                method: 'GET', | 
 |  |  |                success(res) { | 
 |  |  |                   console.log(res); | 
 |  |  |                   var res = res.data | 
 |  |  |                   if (res.data) { | 
 |  |  |                      that.filename = res.data.path | 
 |  |  |                      that.dialogContent = '发现新版本:' + res.data.version + ', 是否立即更新' | 
 |  |  |                      that.$refs.upVersion.open() | 
 |  |  |                   } else { | 
 |  |  |                      uni.showToast({ | 
 |  |  |                         title: res.msg, | 
 |  |  |                         icon: "none", | 
 |  |  |                         position: 'top' | 
 |  |  |                      }) | 
 |  |  |                   } | 
 |  |  | 						 | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |          }, | 
 |  |  |          dialogConfirm() { | 
 |  |  |             this.$refs.upVersion.close() | 
 |  |  |             this.downWgt() | 
 |  |  |          }, | 
 |  |  |          dialogClose() { | 
 |  |  |             this.$refs.upVersion.close() | 
 |  |  |          }, | 
 |  |  |          downWgt() { | 
 |  |  |             let that = this; | 
 |  |  |             // 获取当前app版本信息 | 
 |  |  |             return | 
 |  |  |             that.$req.get("/appUpdate/queryUpdate", {}, {}).then(function(res) { | 
 |  |  |                console.log('res.data:' + JSON.stringify(res.data)) | 
 |  |  |                console.log("现在的版本" + that.version + "数据库版本" + res.data.data.version + "进入查找app版本"); | 
 |  |  |                if (res.data.data.version > that.version) { | 
 |  |  |                   // 这里下载apkurl从/appUpdate/queryUpdate接口请求返回数据中获取 | 
 |  |  |                   that.downloadUrl = BaseUrl + '/' + res.data.data.androidUrl | 
 |  |  |                   // 是否强制更新(0 否;1 是) | 
 |  |  |                   that.isForceUpdate = res.data.data.isForceUpdate | 
 |  |  |                   uni.showModal({ | 
 |  |  |                  // 更新提醒 | 
 |  |  |                      title: '发现新版本,是否更新', | 
 |  |  |                      content: '此版本号:' + that.version + '\xa0\xa0\xa0' + '待更新版本号:' + res.data.data | 
 |  |  |                         .version, | 
 |  |  |                      success: res => { | 
 |  |  |                       if (res.confirm) { | 
 |  |  |                            that.downWgt(); //下载文件 | 
 |  |  |                            // that.showdownLine = true; | 
 |  |  |                            // plus.runtime.openURL(androidUrl) | 
 |  |  |                         } else if (res.cancel) { | 
 |  |  |                            console.log('that.isForceUpdate:' + that.isForceUpdate); | 
 |  |  |                            // 不更新强制退出app | 
 |  |  |                            if (that.isForceUpdate == 1) { | 
 |  |  |                               console.log('that.isForceUpdate1:' + that.isForceUpdate); | 
 |  |  |                               uni.showModal({ | 
 |  |  |                                  // 更新提醒 | 
 |  |  |                                  title: '发现新版本,是否更新', | 
 |  |  |                                  content: '此版本为强制更新版本如不升级将退出APP', | 
 |  |  |                                  success: res => { | 
 |  |  |                                     if (res.confirm) { | 
 |  |  |                                        console.log('不更新强制退出app'); | 
 |  |  |                                        plus.runtime.quit(); | 
 |  |  |                                     } else if (res.cancel) { | 
 |  |  |                                        that.AndroidCheckUpdate(); | 
 |  |  |                                     } | 
 |  |  |             const downloadUrl = that.baseUrl + "/appVersion/downloadApp/" + that.filename | 
 |  |  |             uni.showLoading({ | 
 |  |  |                title: '更新中……' | 
 |  |  |             }) | 
 |  |  |             const downloadTask = uni.downloadFile({ //执行下载 | 
 |  |  |                url: downloadUrl, //下载地址 | 
 |  |  |                timeout: 1000 * 30, //30秒超时时间 | 
 |  |  |                success: downloadResult => { //下载成功 | 
 |  |  |                   console.log(downloadResult); | 
 |  |  |                   that.showdownLine = false | 
 |  |  |                   uni.hideLoading(); | 
 |  |  |                   if (downloadResult.statusCode == 200) { | 
 |  |  |                      uni.showModal({ | 
 |  |  |                         title: '', | 
 |  |  |                         content: '更新成功,确定现在重启吗?', | 
 |  |  |                         confirmText: '重启', | 
 |  |  |                         confirmColor: '#EE8F57', | 
 |  |  |                         success: function(res) { | 
 |  |  |                            if (res.confirm == true) { | 
 |  |  |                               plus.runtime.install( //安装 | 
 |  |  |                                  downloadResult.tempFilePath, { | 
 |  |  |                                     force: true | 
 |  |  |                                  }, | 
 |  |  |                                  function(res) { | 
 |  |  |                                     utils.showToast('更新成功,重启中'); | 
 |  |  |                                     plus.runtime.restart(); | 
 |  |  |                                  } | 
 |  |  |                               }); | 
 |  |  |                               ); | 
 |  |  |                            } | 
 |  |  |                         } | 
 |  |  |                      } | 
 |  |  |                   }); | 
 |  |  |                   //dtask.start();    | 
 |  |  |                      }); | 
 |  |  |                   } else { | 
 |  |  |                      uni.hideLoading(); | 
 |  |  |                      that.showdownLine = false | 
 |  |  |                      uni.showToast({ | 
 |  |  |                         title:'请先上传安装包', | 
 |  |  |                         icon: 'error' | 
 |  |  |                      }) | 
 |  |  |                   } | 
 |  |  |                }, | 
 |  |  |                fail: err => { | 
 |  |  |                   uni.hideLoading(); | 
 |  |  |                   that.showdownLine = false | 
 |  |  |                   that.$u.toast(downloadResult.errMsg) | 
 |  |  |                }, | 
 |  |  |                complete: com => { | 
 |  |  | 						 | 
 |  |  |                   console.log(com) | 
 |  |  |                } | 
 |  |  |             }).catch(error => { | 
 |  |  |                uni.showToast({ | 
 |  |  |                   title: '调用请求失败', | 
 |  |  |                   mask: false, | 
 |  |  |                   duration: 5000, | 
 |  |  |                   icon: "none" | 
 |  |  |                }); | 
 |  |  |             }); | 
 |  |  |             complete: () => {} | 
 |  |  | 			 | 
 |  |  |             // 下载进度 | 
 |  |  |             downloadTask.onProgressUpdate(res => { | 
 |  |  |                that.downloadNum = res.progress | 
 |  |  |                console.log('下载进度' + that.downloadNum); | 
 |  |  |             }); | 
 |  |  |          }, | 
 |  |  |          onLogin() { | 
 |  |  |             let that = this | 
 |  |  |             if (that.user.phone == '') { | 
 |  |  |                uni.showToast({ title: '请输入手机号', icon: "none" }) | 
 |  |  |                return | 
 |  |  |             } | 
 |  |  |             if (that.user.code == '') { | 
 |  |  |                uni.showToast({ title: '验证码不能为空', icon: "none" }) | 
 |  |  |                return | 
 |  |  |             } | 
 |  |  |             uni.request({ | 
 |  |  |                url: that.baseUrl + '/login.action', | 
 |  |  |                url: that.baseUrl + '/smsLogin.action', | 
 |  |  |                fail(result) { | 
 |  |  |                   uni.showToast({ | 
 |  |  |                      icon: 'error', | 
 |  |  | 
 |  |  |                   }) | 
 |  |  |                }, | 
 |  |  |                data: { | 
 |  |  |                   username: that.user.userName, | 
 |  |  |                   password: md5.hex_md5(that.user.password) | 
 |  |  |                   phone: that.user.phone, | 
 |  |  |                   code: that.user.code | 
 |  |  |                }, | 
 |  |  |                header: { | 
 |  |  |                   "content-type": "application/json" | 
 |  |  |                }, | 
 |  |  |                header: { "content-type": "application/json" }, | 
 |  |  |                success(result) { | 
 |  |  |                   if (result.statusCode === 404) { | 
 |  |  |                      uni.showToast({ | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    .user-info-item>input { | 
 |  |  |       width: 400rpx; | 
 |  |  |       width: 300rpx; | 
 |  |  |       color: #606266; | 
 |  |  |       font-weight: 500; | 
 |  |  |       caret-color: #606266; // 光标颜色 |