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

admin首次登录需绑定手机

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