登录及解绑手机号

dev_2022-04-07
yujialong 3 years ago
parent eb66e79c8e
commit 4eff988c3a
  1. BIN
      src/assets/img/login/workNumber.png
  2. 303
      src/pages/account/login/index.vue
  3. 14
      src/pages/setting/person/info.vue
  4. 4
      src/setting.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

@ -7,26 +7,42 @@
<li v-for="(item,index) in tabList" :key="index" :class="{active: form.distinguish == item.id}" @click="typeClick(item)">{{item.label}}</li>
</ul>
<el-form :model="form" :rules="loginRules" ref="form" style="margin-top: 20px">
<el-form-item prop="school">
<label class="school"></label>
<el-select v-model="form.schoolId" clearable filterable placeholder="请选择学校">
<el-option v-for="(item, i) in schoolList" :key="i" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="form.distinguish == '1'" prop="account">
<label class="account"></label>
<el-input v-model.trim="form.account" placeholder="请输入学号"></el-input>
</el-form-item>
<el-form-item v-if="form.distinguish == '2'" prop="account">
<label class="account"></label>
<el-input v-model.trim="form.account" placeholder="请输入工号"></el-input>
<!-- 学号工号 -->
<div v-show="!form.distinguish">
<div class="items" style="margin-bottom: 20px">
<el-form-item class="school-select" prop="schoolId">
<label class="label school"></label>
<el-select v-model="form.schoolId" clearable filterable placeholder="请选择学校">
<el-option v-for="(item, i) in schoolList" :key="i" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
</el-form-item>
<el-checkbox v-model="setDefault">设置为默认学校</el-checkbox>
</div>
<div class="items">
<el-form-item prop="type" style="width: 35%;margin-right: 15px">
<label class="label workNumber"></label>
<el-select v-model="form.type" placeholder="请选择类型" @change="typeChange">
<el-option label="学生学号" :value="1"></el-option>
<el-option label="老师工号" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="workNumber">
<label class="label account"></label>
<el-input v-model.trim="form.workNumber" :placeholder="'请输入' + (form.type ? '学生学号' : '老师工号')"></el-input>
</el-form-item>
</div>
</div>
<!-- 手机号登录 -->
<el-form-item v-show="form.distinguish === 1" prop="account">
<label class="label account"></label>
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item v-if="form.distinguish == '3'" prop="account">
<label class="account"></label>
<el-input v-model.trim="form.account" placeholder="请输入手机号/邮箱"></el-input>
<el-form-item v-show="form.distinguish === 2" prop="account">
<label class="label account"></label>
<el-input v-model.trim="form.account" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item prop="password">
<label class="password"></label>
<label class="password label"></label>
<el-input
type="password"
placeholder="请输入密码"
@ -35,7 +51,7 @@
</el-input>
</el-form-item>
<el-form-item prop="code">
<label class="code"></label>
<label class="label code"></label>
<el-input
placeholder="请输入验证码"
v-model.trim="form.code"
@ -114,29 +130,34 @@ export default {
return {
tabList: [
{
id: '1',
label: '学生学号登录'
id: 0,
label: '学号/工号登录'
}, {
id: '2',
label: '老师工号登录'
id: 1,
label: '学校管理员登录'
}, {
id: '3',
id: 2,
label: '手机号/邮箱'
}
],
setDefault: !!util.local.get('schoolId'),
verificationIMG: "",
schoolList: [],
form: {
account: "",
schoolId: '',
workNumber: '',
account: '',
password: "",
code: "", //
random: "", //
distinguish: 1, // ,1,2
distinguish: 0, // ,1,2
type: 1, // 0-> 1-> 2->
platform: Setting.platformId
},
loginRules: {
account: [{ required: true, message: "请输入账号", trigger: "blur" }],
schoolId: [{ required: true, message: "请选择学校", trigger: "change" }],
workNumber: [{ required: true, message: "请输入学生学号", trigger: "blur" }],
account: [{ required: false, message: "请输入账号", trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
code: [{ required: true, message: "请输入验证码", trigger: "blur" }]
},
@ -155,11 +176,9 @@ export default {
components: {
vFooter
},
created() {
this.getVerImg();
},
mounted() {
// this.getSchool()
this.getVerImg()
this.getSchool()
//
this.$once("hook:beforeDestroy", function() {
clearInterval(this.phoneTimer);
@ -179,22 +198,36 @@ export default {
cityId: ''
}).then(res => {
this.schoolList = res.list
const schoolId = util.local.get('schoolId')
if (schoolId) this.form.schoolId = schoolId
}).catch(res => {})
},
getVerImg() { //
this.form.random = Math.floor(Math.random() * 999999999);
this.verificationIMG = this.api.verification + "?random=" + `${this.form.random}`;
},
typeClick(tab) { //
//
typeClick(tab) {
const { id } = tab
this.form.distinguish = id
this.form.account = "";
this.$refs.form.clearValidate();
this.loginRules.account[0].message = id === '1' ?
'请输入学号' :
id === '2' ?
'请输入工号' :
'请输入手机号/邮箱'
const form = this.form
//
form.account = ''
form.workNumber = ''
form.schoolId = ''
form.type = 1
form.distinguish = id
this.$refs.form.clearValidate()
//
const rules = this.loginRules
rules.account[0].required = id === 1
rules.schoolId[0].required = id === 0
rules.workNumber[0].required = id === 0
},
//
typeChange(id) {
this.loginRules.workNumber[0].message = id === 1 ?
'请输入学生学号' :
'请输入老师工号'
},
//
reloadIndex() {
@ -211,21 +244,24 @@ export default {
submit() { //
this.$refs.form.validate(valid => {
if (valid) {
this.form.distinguish = Number(this.form.distinguish);
this.$post(this.api.logins, this.form).then(({ status, data, message }) => {
const form = this.form
if (!form.distinguish && this.setDefault) util.local.set('schoolId', form.schoolId)
this.$post(this.api.logins, form).then(({ status, data, message }) => {
//
if (status == 30001) {
this.phoneVisible = true
this.getVerImg()
this.form.code = ''
form.code = ''
} else if (status == 200) {
const { token } = data
this.token = token
//
// this.setLogin()
axios.get(this.api.isClient, {
headers: {
token
}
}).then(res => {
}).then(({ data }) => {
//
if (data.customer) {
this.SET_CUSTOMERNAME(data.customerName)
@ -239,7 +275,7 @@ export default {
}
}).catch(res => {
this.getVerImg()
this.form.code = ''
form.code = ''
})
}
});
@ -256,7 +292,7 @@ export default {
})
this.reloadIndex()
//
location.href = process.env.NODE_ENV === 'development' ?
location.href = Setting.isDev ?
'http://192.168.31.125:8081/#/redirect?auth=' + btoa(this.token) :
`${location.origin}/admin/#/redirect?auth=${window.btoa(this.token)}`
}
@ -308,7 +344,7 @@ export default {
code: this.phoneCode,
opener: this.phoneOpener,
platform: Setting.platformId,
account: this.form.account
account: this.form.workNumber
};
this.$post(this.api.bindPhoneOrEmail, data).then(res => {
util.successMsg("绑定成功");
@ -336,6 +372,32 @@ export default {
url(../../../assets/img/shapes/shape4.png) (right 50%)/auto no-repeat,
url(../../../assets/img/shapes/shape5.png) (right 80%)/auto no-repeat,
url(../../../assets/img/shapes/shape6.png) (right bottom)/auto no-repeat;
.tab{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
border-bottom: 2px solid #E1E6F2;
li{
padding: 18px 0;
margin-bottom: -1px;
font-size: 16px;
color: #555;
cursor: pointer;
border-bottom: 4px solid transparent;
&:last-child{
margin-right: 0;
}
&.active{
color: $main-color;;
border-bottom-color: $main-color;
}
}
}
.items {
display: flex;
align-items: center;
}
.form{
width: 436px;
padding: 38px 38px 60px;
@ -348,89 +410,72 @@ export default {
color: #0B1D30;
letter-spacing: 4px;
}
.tab{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
border-bottom: 2px solid #E1E6F2;
li{
padding: 18px 0;
margin-bottom: -1px;
font-size: 18px;
color: #555;
cursor: pointer;
border-bottom: 4px solid transparent;
&:last-child{
margin-right: 0;
}
&.active{
color: $main-color;;
border-bottom-color: $main-color;
}
}
}
.label{
margin-bottom: 10px;
color: #105CB2;
}
/deep/.el-form-item{
margin-bottom: 20px;
}
/deep/.el-input__inner{
position: relative;
height: 52px;
padding: 0 20px 0 34px;
line-height: 50px;
background-color: #FBFBFB;
border: 1px solid #E1E6F2;
border-radius: 4px !important;
}
.el-select {
width: 100%;
}
label {
z-index: 1;
position: absolute;
top: 17px;
left: 11px;
width: 18px;
height: 18px;
background: url(../../../assets/img/login/account.png) 0 0/100% 100% no-repeat;
}
.school{
background-image: url(../../../assets/img/login/school.png);
}
.password{
top: 18px;
background-image: url(../../../assets/img/login/password.png);
}
.code{
top: 18px;
background-image: url(../../../assets/img/login/code.png);
}
.ver-img{
position: absolute;
top: 1px;
right: 1px;
}
/deep/.el-form-item__error{
top: 105%;
left: auto;
right: 0;
color: #FFA94E;
}
.submit{
width: 100%;
height: 48px;
margin-top: 30px;
line-height: 48px;
padding: 0;
font-size: 20px;
background-color: $main-color;
border-radius: 4px;
border: 0;
}
}
/deep/.el-form-item{
margin-bottom: 20px;
}
/deep/.el-input__inner{
position: relative;
height: 52px;
padding: 0 20px 0 34px;
line-height: 50px;
background-color: #FBFBFB;
border: 1px solid #E1E6F2;
border-radius: 4px !important;
}
.school-select {
flex: 1;
margin-right: 10px;
margin-bottom: 0;
}
.el-select {
width: 100%;
}
.label {
z-index: 1;
position: absolute;
top: 17px;
left: 11px;
width: 18px;
height: 18px;
background: url(../../../assets/img/login/account.png) 0 0/100% 100% no-repeat;
}
.school{
background-image: url(../../../assets/img/login/school.png);
}
.workNumber{
width: 17px;
background-image: url(../../../assets/img/login/workNumber.png);
}
.password{
top: 18px;
background-image: url(../../../assets/img/login/password.png);
}
.code{
top: 18px;
background-image: url(../../../assets/img/login/code.png);
}
.ver-img{
position: absolute;
top: 1px;
right: 1px;
}
/deep/.el-form-item__error{
top: 105%;
left: auto;
right: 0;
color: #FFA94E;
}
.submit{
width: 100%;
height: 48px;
margin-top: 30px;
line-height: 48px;
padding: 0;
font-size: 20px;
background-color: $main-color;
border-radius: 4px;
border: 0;
}
}
.copyright{

@ -142,7 +142,8 @@
<li>
<label>手机号</label>
<el-input class="m-r-10" type="text" size="small" v-model="form.phone" disabled></el-input>
<el-button type="text" size="small" @click="bindPhone">更换</el-button>
<el-button type="text" size="small" @click="bindPhone">{{ form.phone ? '更换' : '绑定' }}</el-button>
<el-button v-if="form.phone" type="text" size="small" @click="unbind">解绑</el-button>
</li>
</div>
<div class="line info imp">
@ -542,6 +543,17 @@ export default {
bindPhone() {
this.phoneVisible = true
},
//
unbind() {
this.$confirm('确定要解绑该手机号吗?', '提示', {
type: 'warning'
}).then(() => {
this.$get(this.api.unbindMobilePhone).then(res => {
this.$message.success('解绑成功')
this.getdata()
}).catch(res => {})
}).catch(() => {})
},
bindPassword() {
this.passwordVisible = true
},

@ -30,8 +30,8 @@ if (isHh) {
} else if (isDev) {
// 本地
systemPath = `http://192.168.31.125:8093`
host = "http://39.108.250.202:9000/"; // 中台测试服
// host = "http://192.168.31.151:9000/"; // 榕
// host = "http://39.108.250.202:9000/"; // 中台测试服
host = "http://192.168.31.151:9000/"; // 榕
// host = "http://192.168.31.137:9000"; // 赓
}

Loading…
Cancel
Save