登录修改
This commit is contained in:
@@ -261,11 +261,11 @@ export default {
|
|||||||
description: '初次登录需要设置密码',
|
description: '初次登录需要设置密码',
|
||||||
duration: 4
|
duration: 4
|
||||||
})
|
})
|
||||||
|
Vue.ls.set('temporaryUserInfo', response)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/user/alteration',
|
path: '/user/alteration',
|
||||||
query: {
|
query: {
|
||||||
isFirstLogin: 'true',
|
isFirstLogin: 'true'
|
||||||
userInfo: JSON.stringify(response)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class='alteration-content'>
|
<div class='alteration-content'>
|
||||||
<a-form :form="form">
|
<a-form :form="form">
|
||||||
<span class='setPassword'>设置密码</span>
|
<span class='setPassword'>设置密码</span>
|
||||||
<a-row>
|
<a-row v-if="$route.query.isFirstLogin !== 'true'">
|
||||||
<a-col :span='22'>
|
<a-col :span='22'>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
label="手机"
|
label="手机"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span='6'></a-col>
|
<a-col :span='6'></a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row>
|
<a-row v-if="$route.query.isFirstLogin !== 'true'">
|
||||||
<a-col :span='22'>
|
<a-col :span='22'>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
class='captcha'
|
class='captcha'
|
||||||
@@ -105,6 +105,7 @@ import { getRSAPublicKey } from '@api/login'
|
|||||||
import { JSEncrypt } from 'jsencrypt'
|
import { JSEncrypt } from 'jsencrypt'
|
||||||
import { timeFix } from '@/utils/util'
|
import { timeFix } from '@/utils/util'
|
||||||
import { mapActions } from 'vuex'
|
import { mapActions } from 'vuex'
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -146,36 +147,51 @@ export default {
|
|||||||
time: 60,
|
time: 60,
|
||||||
smsSendBtn: false
|
smsSendBtn: false
|
||||||
},
|
},
|
||||||
userList: {}
|
userList: {},
|
||||||
|
temporaryUserInfo: null, // 临时用户数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
document.title = '标准所协同工作平台'
|
document.title = '标准所协同工作平台'
|
||||||
|
// 初次登录直接获取公钥
|
||||||
|
if (this.$route.query.isFirstLogin === 'true') {
|
||||||
|
this.getPublicKey()
|
||||||
|
this.temporaryUserInfo = Vue.ls.get('temporaryUserInfo')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['FirstPhoneLogin']),
|
...mapActions(['FirstPhoneLogin']),
|
||||||
submit() {
|
submit() {
|
||||||
|
|
||||||
let that = this
|
let that = this
|
||||||
that.loading = true
|
that.loading = true
|
||||||
this.form.validateFields((err, values) => {
|
this.form.validateFields((err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
let params = {}
|
let params = {}
|
||||||
console.log(values, '======values')
|
|
||||||
params.rsaPublicKey = this.rsaPublicKey
|
params.rsaPublicKey = this.rsaPublicKey
|
||||||
let encrypt = new JSEncrypt()
|
let encrypt = new JSEncrypt()
|
||||||
encrypt.setPublicKey(params.rsaPublicKey)
|
encrypt.setPublicKey(params.rsaPublicKey)
|
||||||
params.phone = encrypt.encrypt(values.phone)
|
let url = ''
|
||||||
params.password = encrypt.encrypt(values.password)
|
// 不是初次登录需要手机号验证码
|
||||||
params.verifyCode = values.captcha
|
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)
|
params.verifyPassword = encrypt.encrypt(values.confirmPassword)
|
||||||
postAction('/company/verificationChangePassword', params).then((res) => {
|
postAction(url, params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
that.loading = false
|
that.loading = false
|
||||||
if (this.$route.query.isFirstLogin === 'true') {
|
if (this.$route.query.isFirstLogin === 'true') {
|
||||||
let loginResponse = JSON.parse(that.$route.query.userInfo)
|
that.FirstPhoneLogin(that.temporaryUserInfo).then(res => {
|
||||||
that.FirstPhoneLogin(loginResponse).then(res => {
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
that.FirstPhoneLogin(loginResponse)
|
that.FirstPhoneLogin(that.temporaryUserInfo)
|
||||||
// 进入首页
|
// 进入首页
|
||||||
this.$router.push({ path: '/' }).catch(() => {
|
this.$router.push({ path: '/' }).catch(() => {
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user