diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index ff81047..724f6cc 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -261,11 +261,11 @@ export default { description: '初次登录需要设置密码', duration: 4 }) + Vue.ls.set('temporaryUserInfo', response) this.$router.push({ path: '/user/alteration', query: { - isFirstLogin: 'true', - userInfo: JSON.stringify(response) + isFirstLogin: 'true' } }) } else { diff --git a/src/views/user/alteration/Alteration.vue b/src/views/user/alteration/Alteration.vue index bb9b2ef..0a79e2f 100644 --- a/src/views/user/alteration/Alteration.vue +++ b/src/views/user/alteration/Alteration.vue @@ -10,7 +10,7 @@
设置密码 - + - + { if (!err) { let params = {} - console.log(values, '======values') params.rsaPublicKey = this.rsaPublicKey let encrypt = new JSEncrypt() encrypt.setPublicKey(params.rsaPublicKey) - params.phone = encrypt.encrypt(values.phone) - params.password = encrypt.encrypt(values.password) - params.verifyCode = values.captcha + let url = '' + // 不是初次登录需要手机号验证码 + if (this.$route.query.isFirstLogin !== 'true') { + params.phone = encrypt.encrypt(values.phone) + params.verifyCode = values.captcha + params.password = encrypt.encrypt(values.password) + url = '/company/verificationChangePassword' + } else { + params.newPassword = encrypt.encrypt(values.password) + // 用password存了token + params.password = that.temporaryUserInfo.result.token + url = '/company/changePasswordWithToken' + } params.verifyPassword = encrypt.encrypt(values.confirmPassword) - postAction('/company/verificationChangePassword', params).then((res) => { + postAction(url, params).then((res) => { if (res.success) { that.loading = false if (this.$route.query.isFirstLogin === 'true') { - let loginResponse = JSON.parse(that.$route.query.userInfo) - that.FirstPhoneLogin(loginResponse).then(res => { + that.FirstPhoneLogin(that.temporaryUserInfo).then(res => { if (res.code === 200) { - that.FirstPhoneLogin(loginResponse) + that.FirstPhoneLogin(that.temporaryUserInfo) // 进入首页 this.$router.push({ path: '/' }).catch(() => { })