diff --git a/src/assets/img/login/workNumber.png b/src/assets/img/login/workNumber.png new file mode 100644 index 0000000..48f98fa Binary files /dev/null and b/src/assets/img/login/workNumber.png differ diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 45f82f3..b2310b2 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -7,26 +7,42 @@
  • {{item.label}}
  • - - - - - - - - - - - - - + +
    +
    + + + + + + + 设置为默认学校 +
    +
    + + + + + + + + + + + +
    +
    + + + + - - - + + + - + - + 教师端 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{ diff --git a/src/pages/setting/person/info.vue b/src/pages/setting/person/info.vue index 14d781a..ee3e833 100644 --- a/src/pages/setting/person/info.vue +++ b/src/pages/setting/person/info.vue @@ -142,7 +142,8 @@
  • - 更换 + {{ form.phone ? '更换' : '绑定' }} + 解绑
  • @@ -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 }, diff --git a/src/setting.js b/src/setting.js index eca22f3..5a3fdaf 100644 --- a/src/setting.js +++ b/src/setting.js @@ -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"; // 赓 }