Commit 779ed00a authored by Zhang Xiaojie's avatar Zhang Xiaojie

admin首次登录需绑定手机

parent a3fb702d
......@@ -88,7 +88,11 @@ router.beforeEach((to, from, next) => {
} else {
if (oldRole == eRole.platform_management) {
// console.log(2)
if(getUserMsg()?.phone){
next({ name: 'platformUserManagement' })
}else{
next({name:'changePhone'})
}
} else {
// console.log(3)
next({ name: 'home' })
......
......@@ -17,21 +17,28 @@
</a-form-model-item>
<a-form-model-item
label="账号密码"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
prop="pwd"
>
<a-input v-model="changeSecurityPhoneForm.pwd" type="password" />
<a-input
v-model="changeSecurityPhoneForm.pwd"
type="password"
class="w-200"
/>
</a-form-model-item>
<a-form-model-item
label="新手机号码"
prop="newPhoneNumber"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
>
<a-input v-model="changeSecurityPhoneForm.newPhoneNumber" />
<a-input
v-model="changeSecurityPhoneForm.newPhoneNumber"
class="w-200"
/>
</a-form-model-item>
<a-form-model-item
label="验证码"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
prop="codeToConfirmChange"
ref="changePhoneCode2"
:autoLink="false"
......@@ -58,28 +65,32 @@
>
<a-form-model-item
label="手机号码"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
prop="phone"
>
<a-input v-model="confrimPhoneForm.phone" />
<a-input class="w-200" v-model="confrimPhoneForm.phone" />
</a-form-model-item>
<a-form-model-item
label="账号密码"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
prop="pwd"
>
<a-input v-model="confrimPhoneForm.pwd" type="password" />
<a-input
v-model="confrimPhoneForm.pwd"
class="w-200"
type="password"
/>
</a-form-model-item>
<a-form-model-item
label="验证码"
:wrapper-col="{ span: 4, offset: 0 }"
:wrapper-col="{ span: 3, offset: 0 }"
prop="verify_code"
ref="changePhoneCode2"
:autoLink="false"
>
<code-input :phone="confrimPhoneForm.phone" @getCode="getCode" />
</a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 1, offset: 10 }">
<a-form-model-item :wrapper-col="{ span: 1, offset: 11 }">
<a-button type="primary" @click="handleSubmission">提交</a-button>
</a-form-model-item>
</a-form-model>
......@@ -102,10 +113,18 @@ export default Vue.extend({
default: "",
},
},
mounted() {
if(!this.userPhone){
Modal.info({
title: "安全设置",
content: "首次登陆,请先绑定手机号!",
});
}
},
data() {
const userPhone = getUserMsg()?.phone;
return {
labelCol: { span: 10 },
labelCol: { span: 11 },
wrapperCol: { span: 10 },
userPhone,
changeSecurityPhoneForm: {
......@@ -182,11 +201,11 @@ export default Vue.extend({
},
isValid() {
let result;
let form
if(this.userPhone){
form = this.$refs.changeSecurityPhoneForm as FormModel
}else {
form = this.$refs.confirmPhoneForm as FormModel
let form;
if (this.userPhone) {
form = this.$refs.changeSecurityPhoneForm as FormModel;
} else {
form = this.$refs.confirmPhoneForm as FormModel;
}
form.validate((valid) => {
if (valid) {
......@@ -201,7 +220,7 @@ export default Vue.extend({
const that = this;
if (this.isValid()) {
//换绑手机
if(this.userPhone){
if (this.userPhone) {
const ret = await UserService.getInstance().changePhone({
phone: this.changeSecurityPhoneForm.newPhoneNumber,
pwd: this.changeSecurityPhoneForm.pwd,
......@@ -223,7 +242,7 @@ export default Vue.extend({
onOk() {},
});
}
}else {
} else {
// 绑定手机
const ret = await UserService.getInstance().adminAddPhone({
phone: this.confrimPhoneForm.phone,
......@@ -232,18 +251,19 @@ export default Vue.extend({
});
if (ret.code == 200) {
Modal.info({
title: "手机号绑定成功",
title: "安全设置",
content: "手机号绑定成功",
});
// 设置localstroage
// setUserMsg({
// token: accessToken,
// newRole: this.adminLogin
// ? eNewRoleRelatedToBackEnd.PlatformAdmin
// : role,
// level: level,
// phone,
// userType,
// });
this.userPhone = this.confrimPhoneForm.phone;
const { ...iUserMsg } = getUserMsg();
setUserMsg({
token: iUserMsg.token,
newRole: iUserMsg.newRole,
level: iUserMsg.level,
phone: this.userPhone,
userType: iUserMsg.userType,
});
} else {
Modal.error({
title: "手机号修改失败",
......@@ -259,4 +279,7 @@ export default Vue.extend({
</script>
<style scoped>
.w-200 {
width: 200px;
}
</style>
\ No newline at end of file
......@@ -10,7 +10,7 @@
>
<a-form-model-item
label="绑定手机号"
:wrapper-col="{ span: 8, offset: 0 }"
:wrapper-col="{ span: 1, offset: 0 }"
>
<span>{{ userPhone }}</span>
</a-form-model-item>
......@@ -48,7 +48,7 @@
/>
</a-form-model-item>
</a-form-model>
<a-form-model-item :wrapper-col="{ span: 1, offset: 10 }">
<a-form-model-item :wrapper-col="{ span: 1, offset: 11 }">
<a-button type="primary" @click="handleSubmission">提交</a-button>
</a-form-model-item>
</div>
......@@ -87,7 +87,7 @@ export default Vue.extend({
};
const userPhone = getUserMsg()?.phone
return {
labelCol: { span: 10 },
labelCol: { span: 11 },
wrapperCol: { span: 10 },
changeByCodeForm,
rules: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment