From 8914a51c54ae2ba1ac94512e27036da36218874a Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Tue, 3 Dec 2024 09:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/httpRequest3.js | 8 +- src/pages/login/index.vue | 61 ++++----- src/pages/setter/index.vue | 2 +- src/pages/setter/loginPwdUpdate.vue | 185 ++++++++++++++-------------- 4 files changed, 131 insertions(+), 125 deletions(-) diff --git a/src/api/httpRequest3.js b/src/api/httpRequest3.js index cc300aff..0966338d 100644 --- a/src/api/httpRequest3.js +++ b/src/api/httpRequest3.js @@ -48,10 +48,10 @@ function service(options = {}) { }) } // if (res.data.code == 1002000008) { - // uni.setStorageSync('username',options.data.username) - // uni.reLaunch({ - // url: '/pages/setter/loginPwdUpdate' - // }) + // uni.setStorageSync('username',options.data.username) + // uni.reLaunch({ + // url: '/pages/setter/loginPwdUpdate' + // }) // } if (res.data.msg) { if (res.data.msg.includes('get lock')) { diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index f6c8f562..83b99f2a 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -71,7 +71,7 @@ v-model="code" style="background-color: lightgray;padding-top: 40rpx;padding-bottom: 40rpx;margin-right: 20rpx;" /> --> - + @@ -119,8 +119,8 @@ imageSrc: "", code: "", uuid: "", - version: "", - needCode:false + version: "", + needCode: false } }, // computed: mapState(['forcedLogin', 'hasLogin']), @@ -128,11 +128,11 @@ this.tenantValue = this.tenantArray[0].value // uni.clearStorageSync() // uni.clearStorage(); //清除缓存 - + storage.clearStorage() if (process.env.NODE_ENV === 'development') { this.username = "admin" - this.password = "win123456"; + this.password = "CD_win09"; } uni.setNavigationBarColor({ frontColor: '#ffffff', @@ -157,21 +157,21 @@ } }, - onLoad() { - if(this.needCode){ - getCaptchaImage().then(res => { - if (res) { - var code = res.data.img; - let base64 = 'data:image/jpeg;base64,' + code - // console.log("图标", base64) - this.imageSrc = base64.replace(/[\r\n]/g, "") - this.uuid = res.data.uuid - } - }).catch(error => { - this.showErrorMessage(error); - }) + onLoad() { + if (this.needCode) { + getCaptchaImage().then(res => { + if (res) { + var code = res.data.img; + let base64 = 'data:image/jpeg;base64,' + code + // console.log("图标", base64) + this.imageSrc = base64.replace(/[\r\n]/g, "") + this.uuid = res.data.uuid + } + }).catch(error => { + this.showErrorMessage(error); + }) } - + this.getAppVersion() }, methods: { @@ -189,15 +189,13 @@ icon: 'none', mask: true }) - } - else if (this.needCode&&this.code === '') { + } else if (this.needCode && this.code === '') { uni.showToast({ title: '验证码不能为空', icon: 'none', mask: true }) - } - else { + } else { // console.log("用户名:", this.username, "密码:", this.password, this.tapstyle, this.smloginmsg) let logininfo = { username: "", @@ -232,7 +230,7 @@ title: "正在登录", mask: true }) - try{ + try { var result = await this.$store.dispatch('Login', logininfo); // await this.$store.dispatch('GetTenantIdInfo', this.tenantName) console.log(result) @@ -242,11 +240,11 @@ url: '/pages/index/index' }); uni.setStorageSync('username', this.username); - }catch(e){ + } catch (e) { uni.hideLoading() this.showErrorMessage(e) } - + }, @@ -262,7 +260,12 @@ showErrorMessage(message) { this.$refs.comMessage.showErrorMessage(message, res => { if (res) { - + if (message.includes("密码策略")) { + uni.setStorageSync('username', this.username); + uni.reLaunch({ + url: '/pages/setter/loginPwdUpdate' + }) + } } }); }, @@ -275,8 +278,8 @@ this.uuid = res.data.uuid } }).catch(error => { - this.showErrorMessage(error); - }) + this.showErrorMessage(error); + }) }, getAppVersion() { const systemInfo = uni.getSystemInfoSync(); diff --git a/src/pages/setter/index.vue b/src/pages/setter/index.vue index 3c666f75..19ae3524 100644 --- a/src/pages/setter/index.vue +++ b/src/pages/setter/index.vue @@ -143,7 +143,7 @@ } function modifiedPassWord() { uni.navigateTo({ - url:"./passwordpage" + url:"./loginPwdUpdate" }) } diff --git a/src/pages/setter/loginPwdUpdate.vue b/src/pages/setter/loginPwdUpdate.vue index 1f9bec84..6281e4f3 100644 --- a/src/pages/setter/loginPwdUpdate.vue +++ b/src/pages/setter/loginPwdUpdate.vue @@ -1,71 +1,72 @@ + \ No newline at end of file