登录修改

dev_2022-04-07
yujialong 3 years ago
parent 706aa577d6
commit 665c4c1630
  1. 136
      src/pages/account/login/index.vue
  2. 2
      src/pages/setting/person/info.vue
  3. 4
      src/pages/user/list/index.vue

@ -14,9 +14,6 @@
<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>
<div class="default-check">
<el-checkbox v-model="setDefault">设置为默认学校</el-checkbox>
</div>
</el-form-item>
<el-form-item prop="workNumber">
<label class="label account"></label>
@ -64,6 +61,9 @@
<img @click="getVerImg" :src="verificationIMG" class="ver-img" alt="">
</el-form-item>
</template>
<div v-show="!form.distinguish" class="default-check">
<el-checkbox v-model="setDefault">设置为默认学校</el-checkbox>
</div>
<el-button class="submit" type="primary" @click="submit">登录</el-button>
</el-form>
</div>
@ -73,12 +73,12 @@
<p class="tips">依据国家政策法规需绑定手机号进行网络实名才可登录使用本平台</p>
<el-form ref="form" label-width="60px">
<el-form-item label="手机号">
<el-input style="width: 394px;" placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input>
<el-input style="width: 394px;" placeholder="请输入手机号" v-model="phone" maxlength="11" @change="phoneChange"></el-input>
</el-form-item>
<el-form-item label="验证码">
<div class="flex">
<el-input v-model="phoneCode" placeholder="请输入验证码" maxlength="6"></el-input>
<el-button style="margin-left: 10px" type="text" @click="sendPhoneCode" :disabled="phoneDisabled">{{phoneBtnText}}</el-button>
<el-button style="margin-left: 10px" type="text" @click="sendPhoneCode(1)" :disabled="phoneDisabled">{{phoneBtnText}}</el-button>
</div>
</el-form-item>
</el-form>
@ -158,9 +158,12 @@ export default {
phoneCode: '',
phoneDisabled: false,
phoneTimer: null,
phoneOpener: '',
phoneBtnText: '发送验证码',
userVisible: false,
users: []
users: [],
accountIds: [],
binding: true
};
},
components: {vHead,vFooter},
@ -322,11 +325,37 @@ export default {
sendPhoneCodeLogin() {
const phone = this.form.account
if (!this.verifyPhone(phone)) return false
this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}`).then(({ message }) => {
this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=0`).then(({ message }) => {
util.successMsg(message)
this.phoneCountdownLogin()
}).catch(res => {})
},
//
phoneChange() {
this.$post(`${this.api.getOtherAccountByPhone}?phone=${this.phone}&platform=${Setting.platformId}`).then(({ userAccounts }) => {
const list = userAccounts
if (list) {
const msg = []
list.map(e => {
msg.push(`${e.userName}${e.schoolName},学号${e.workNumber}`)
})
this.accountIds = list.map(e => e.id)
this.$confirm(`该手机号已与${msg.join(';')}的用户绑定,是否为本人?选择否,则解绑以上用户信息,并授权手机号绑定新用户信息。`, '提示', {
type: 'warning',
confirmButtonText: '是',
cancelButtonText: '否'
}).then(() => {
debugger
this.binding = true
this.sendPhoneCode(1)
}).catch(() => {
debugger
this.binding = false
this.sendPhoneCode(0)
})
}
}).catch(res => {})
},
phoneCountdown(){
let count = 60
@ -346,42 +375,68 @@ export default {
},1000)
}
},
sendPhoneCode(){
const { phone } = this
if (!this.verifyPhone(phone)) return false
let data = {
phone,
types: 2 // 12
}
this.$post(this.api.sendPhoneOrEmailCode,data).then(res => {
if(res.message.opener){
this.phoneCountdown()
this.phoneOpener = res.message.opener
}else{
util.errorMsg(res.message)
}
//
sendPhoneCode(bind) {
const { phone } = this
if (!this.verifyPhone(phone)) return false
//
if (bind) {
this.$post(this.api.sendPhoneOrEmailCode, {
platform: Setting.platformId,
phone,
types: 2
}).then(({ message }) => {
if (message.opener) {
this.phoneCountdown()
this.phoneOpener = message.opener
} else {
util.errorMsg(message)
}
}).catch(res => {})
},
phoneSubmit(){
if(!this.phone) return util.warningMsg('请输入手机号')
if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号')
if(!this.phoneCode) return util.warningMsg('请输入验证码')
let data = {
phone: this.phone,
types: 2,
code: this.phoneCode,
opener: this.phoneOpener,
platform: Setting.platformId,
account: this.form.account
}
this.$post(this.api.bindPhoneOrEmail,data).then(res => {
util.successMsg('绑定成功')
this.form.phone = this.phone
this.phoneVisible = false
this.setLogin()
} else {
this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=1`).then(({ message }) => {
this.phoneCountdown()
}).catch(res => {})
}
},
//
unbind() {
const { password, platform, schoolId, type, workNumber } = this.form
this.$post(this.api.unbindAccounts, {
accountIds: this.accountIds,
code: this.phoneCode,
password,
phone: this.phone,
platform,
schoolId,
type,
workNumber,
}).then(({ token }) => {
this.token = token
this.setLogin()
}).catch(res => {})
},
//
phoneSubmit() {
const { phone, phoneCode } = this
if (!this.verifyPhone(phone)) return false
if (!phoneCode) return util.warningMsg('请输入验证码')
if (this.binding) {
this.$post(this.api.bindPhoneOrEmail, {
phone,
types: 2,
code: phoneCode,
opener: this.phoneOpener,
platform: Setting.platformId,
account: this.form.workNumber
}).then(({ token }) => {
this.token = token
this.setLogin()
}).catch(res => {})
} else {
this.unbind()
}
}
},
};
</script>
@ -452,7 +507,6 @@ export default {
border-radius: 4px !important;
}
.default-check {
margin-top: -6px;
text-align: right;
}
.el-select {

@ -176,7 +176,7 @@
<el-dialog :title="form.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" @close="closePhone" width="30%">
<el-form ref="form" :model="form" label-width="60px">
<el-form-item label="手机号">
<el-input style="width: 394px;" placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input>
<el-input placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input>
</el-form-item>
<el-form-item label="验证码">
<div class="flex">

@ -107,10 +107,10 @@
<el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="form.email" placeholder="请输入邮箱" @change="emailChange"></el-input>
<el-input v-model="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model="form.phone" maxlength="11" @change="phoneChange"></el-input>
<el-input v-model="form.phone" maxlength="11"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">

Loading…
Cancel
Save