登录修改

This commit is contained in:
zhaoxiao
2021-10-11 18:34:55 +08:00
parent dff69922bd
commit 8fc390048d
2 changed files with 29 additions and 13 deletions
+2 -2
View File
@@ -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 {
+27 -11
View File
@@ -10,7 +10,7 @@
<div class='alteration-content'>
<a-form :form="form">
<span class='setPassword'>设置密码</span>
<a-row>
<a-row v-if="$route.query.isFirstLogin !== 'true'">
<a-col :span='22'>
<a-form-item
label="手机"
@@ -26,7 +26,7 @@
</a-col>
<a-col :span='6'></a-col>
</a-row>
<a-row>
<a-row v-if="$route.query.isFirstLogin !== 'true'">
<a-col :span='22'>
<a-form-item
class='captcha'
@@ -105,6 +105,7 @@ import { getRSAPublicKey } from '@api/login'
import { JSEncrypt } from 'jsencrypt'
import { timeFix } from '@/utils/util'
import { mapActions } from 'vuex'
import Vue from 'vue'
export default {
@@ -146,36 +147,51 @@ export default {
time: 60,
smsSendBtn: false
},
userList: {}
userList: {},
temporaryUserInfo: null, // 临时用户数据
}
},
created() {
document.title = '标准所协同工作平台'
// 初次登录直接获取公钥
if (this.$route.query.isFirstLogin === 'true') {
this.getPublicKey()
this.temporaryUserInfo = Vue.ls.get('temporaryUserInfo')
}
},
methods: {
...mapActions(['FirstPhoneLogin']),
submit() {
let that = this
that.loading = true
this.form.validateFields((err, values) => {
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(() => {
})