diff --git a/src/api/index.js b/src/api/index.js index ad5a019..70ff281 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -7,23 +7,23 @@ let host3 = 'http://192.168.31.137:9000'//陈 export default { // 登录注册 - logins: `${host3}/users/users/user/login`, - verification:`${host3}/users/users/user/captcha`, + logins: `/users/users/user/login`, + verification:`${Setting.apiBaseURL}/users/users/user/captcha`, // 公用接口 - queryProvince: `${host3}/nakadai/nakadai/province/queryProvince`, - queryCity: `${host3}/nakadai/nakadai/city/queryCity`, + queryProvince: `/nakadai/nakadai/province/queryProvince`, + queryCity: `/nakadai/nakadai/city/queryCity`, queryWorkNumberIsExist:`evaluation/tms/userInfo/queryWorkNumberIsExist`, queryStaffWorkNumberIsExist:`evaluation/tms/system/queryStaffWorkNumberIsExist`, - querySchool: `${host3}/nakadai/nakadai/school/querySchool`, - queryCourseDiscipline: `${host2}/nakadai/nakadai/discipline/queryDiscipline`, - queryCourseProfessionalClass: `${host2}/nakadai/nakadai/professionalClass/queryProfessionalClass`, - queryCourseProfessional: `${host2}/nakadai/nakadai/professional/queryProfessional`, + querySchool: `/nakadai/nakadai/school/querySchool`, + queryCourseDiscipline: `/nakadai/nakadai/discipline/queryDiscipline`, + queryCourseProfessionalClass: `/nakadai/nakadai/professionalClass/queryProfessionalClass`, + queryCourseProfessional: `/nakadai/nakadai/professional/queryProfessional`, // 个人中心 - uploadUserAvatars: `${host1}/users/users/userAccount/updateUserAvatars`, - userInfo:`${host1}/users/users/userInfo/getUserInfo`, - updateUser:`${host1}/users/users/userInfo/updateUser`, + uploadUserAvatars: `/users/users/userAccount/updateUserAvatars`, + userInfo:`/users/users/userInfo/getUserInfo`, + updateUser:`/users/users/userInfo/updateUser`, findPasswordByEmail:`/users/users/userAccount/findPasswordByEmail`, findPasswordByPhone:`/users/users/userAccount/findPasswordByPhone`, bingEmail:`evaluation/tms/user/bingEmail`, @@ -39,17 +39,18 @@ export default { // 用户管理 saveUser: `/users/users/data/user/save`, getUserList: `/users/users/data/user/getUserList`, - getUserTotalBySchoolId: `${host1}/users/users/data/user/getUserTotalBySchoolId`, + getUserTotalBySchoolId: `/users/users/data/user/getUserTotalBySchoolId`, checkAccount:`/users/users/data/user/checkAccount`, getDetail:`/users/users/data/user/getDetail`, modifyUser:`/users/users/data/user/modify`, export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`, uploadFile:`${Setting.apiBaseURL}/users/users/data/user/uploadFile`, - deleteUser:`${Setting.apiBaseURL}/users/users/data/user/delete`, - resetPwd: `${host2}/users/users/userAccount/resetPwd`, - sendPhoneOrEmailCode: `${host2}/users/users/userAccount/sendPhoneOrEmailCode`, - bindPhoneOrEmail: `${host2}/users/users/userAccount/bindPhoneOrEmail`, - examinePassword: `${host1}/users/users/userAccount/examinePassword`, + deleteUser:`/users/users/data/user/delete`, + resetPwd: `/users/users/userAccount/resetPwd`, + sendPhoneOrEmailCode: `/users/users/userAccount/sendPhoneOrEmailCode`, + bindPhoneOrEmail: `/users/users/userAccount/bindPhoneOrEmail`, + examinePassword: `/users/users/userAccount/examinePassword`, + userTemplate: `http://39.108.250.202/template/%E6%95%B0%E6%8D%AE%E5%B9%B3%E5%8F%B0%E7%94%A8%E6%88%B7%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx`, // 角色管理 batchRemove:`/data/data/role/batchRemove`, @@ -71,20 +72,20 @@ export default { getIdQueryTable:`/data/data/table/getIdQueryTable`, getTableByClassification:`/data/data/table/getTableByClassification`, getTableByCondition:`/data/data/table/getTableByCondition`, - downloadData:`${host1}/data/data/download`, - previewData:`${host1}/data/data/preview`, - downloadRecord:`${host1}/data/data/myDownload/downloadRecord`, + downloadData:`${Setting.apiBaseURL}/data/data/download`, + previewData:`/data/data/preview`, + downloadRecord:`/data/data/myDownload/downloadRecord`, getDownloadRecord:`/data/data/myDownload/getDownloadRecord`, - downloadAgain:`${host1}/data/data/downloadAgain`, - isDownload:`${host1}/data/data/product/isDownload`, + downloadAgain:`/data/data/downloadAgain`, + isDownload:`/data/data/product/isDownload`, // 数据操作记录 - queryAccumulate:`${host1}/data/data/dataRecord/queryAccumulate`, - queryDatabaseInfo:`${host1}/data/data/dataRecord/queryDatabaseInfo`, - queryDatabaseInfoByMonth:`${host1}/data/data/dataRecord/queryDatabaseInfoByMonth`, - saveRecord:`${host1}/data/data/dataRecord/saveRecord`, - databaseInfoExport:`${host1}/data/data/dataRecord/databaseInfoExport`, - databaseInfoByMonthExport:`${host1}/data/data/dataRecord/databaseInfoByMonthExport`, - onlineNumber:`${host1}/data/data/dataRecord/onlineNumber`, - getProductInfoBySchoolId:`${host1}/data/data/product/getProductInfoBySchoolId`, + queryAccumulate:`/data/data/dataRecord/queryAccumulate`, + queryDatabaseInfo:`/data/data/dataRecord/queryDatabaseInfo`, + queryDatabaseInfoByMonth:`/data/data/dataRecord/queryDatabaseInfoByMonth`, + saveRecord:`/data/data/dataRecord/saveRecord`, + databaseInfoExport:`/data/data/dataRecord/databaseInfoExport`, + databaseInfoByMonthExport:`/data/data/dataRecord/databaseInfoByMonthExport`, + onlineNumber:`/data/data/dataRecord/onlineNumber`, + getProductInfoBySchoolId:`/data/data/product/getProductInfoBySchoolId`, } \ No newline at end of file diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index e1d88f0..33a6497 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -7,14 +7,14 @@
- +
- + {{userName}}
- 个人资料 + 个人资料 退出登录
@@ -49,7 +49,7 @@ export default { components: { navbar }, computed: { ...mapState('user', [ - 'avatar','isManager','schoolId' + 'avatar','isManager','schoolId','isCustomer' ]), ...mapState('auth', [ 'routes' @@ -64,17 +64,19 @@ export default { ]), getUserInfo(){ this.$get(this.api.userInfo).then(res => { - let userInfo = res.userInfo - let isManager = userInfo.roleId != '0' + let userInfo = res.userInfo ? res.userInfo : {} + let userAccount = res.userAccount + let isManager = userAccount.roleId != '0' this.isUser = isManager let mg = this.$route.query.mg if(mg && atob(decodeURI(mg)) === 'true'){ this.showSetting = false } - this.userName = userInfo.userName + this.userName = userAccount.account + this.setInfo({ avatar: userInfo.userAvatars, - schoolId: res.userAccount.schoolId, + schoolId: userAccount.schoolId, }) this.setManager(isManager) }).catch(err => {}) @@ -148,6 +150,9 @@ export default { .action{ display: inline-flex; align-items: center; + .icon{ + cursor: pointer; + } .user-wrap { display: inline-flex; align-items: center; diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 0b2aa13..dd988a2 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -4,28 +4,48 @@
-

或然数据网

+

或然数据平台

-
登录
- +
    +
  • {{item.label}}
  • +
+ - + - + - + 登录
+ + + + + + + +
+ + {{phoneBtnText}} +
+
+
+ + 取 消 + 确 定 + +
@@ -33,21 +53,38 @@ import { mapActions } from 'vuex' import vHead from '@/layouts/header' import util from '@/libs/util' +import Setting from '@/setting' export default { data: function() { return { + tabList: [ + { + id: '1', + label: '账号登录' + },{ + id: '2', + label: '手机号/邮箱登录' + } + ], verificationIMG: '', - loginForm: { + form: { + distinguish: '1', account: 'admin', password: '111aaa', random: '', code: '' }, - loginRules: { - account: [{ required: true, message: '请输入用户名', trigger: 'blur' }], + rules: { + account: [{ required: true, message: '请输入账号', trigger: 'blur' }], password: [{ required: true, message: '请输入密码', trigger: 'blur' }], code: [{ required: true, message: '请输入验证码', trigger: 'blur' }], }, + phoneVisible: false, + phone: '', + phoneCode: '', + phoneDisabled: false, + phoneTimer: null, + phoneBtnText: '发送验证码' }; }, components: {vHead}, @@ -56,28 +93,105 @@ export default { }, methods: { ...mapActions('user', [ - 'login' + 'login','setToken' ]), + typeClick(item){ + this.form.account = '' + this.form.distinguish = item.id + this.$refs.login.clearValidate() + this.rules.account[0].message = item.id == 1 ? '请输入账号' : '请输入手机号/邮箱' + }, submitForm() { this.$refs.login.validate(valid => { if (valid) { - this.login(this.loginForm).then(() => { + this.login(this.form).then(() => { let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index' this.$router.replace(redirect) }).catch(res => { + if(res && res.status == 30001){ + this.phoneVisible = true + } this.getVerImg() - this.loginForm.code = '' + this.form.code = '' }) } }) }, getVerImg(){ - if(!this.loginForm.account){ + if(!this.form.account){ return this.verificationIMG = '' } - this.loginForm.random = Math.floor(Math.random()*999999999) - this.verificationIMG = this.api.verification+'?random='+`${this.loginForm.random}` - } + this.form.random = Math.floor(Math.random()*999999999) + this.verificationIMG = this.api.verification+'?random='+`${this.form.random}` + }, + phoneCountdown(){ + let count = 60 + if(!this.phoneTimer){ + this.phoneDisabled = true + this.phoneTimer = setInterval(() => { + console.log('倒计时中') + if(count > 0){ + count-- + this.phoneBtnText = `${count}秒后重试` + }else{ + this.phoneDisabled = false + clearInterval(this.phoneTimer) + this.phoneTimer = null + this.phoneBtnText = `发送验证码` + } + },1000) + } + }, + closePhone(){ + if(!this.emailDisabled){ + this.emailCode = '' + } + }, + sendPhoneCode(){ + if(!this.phone) return util.warningMsg('请输入手机号') + if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号') + let data = { + phone: this.phone, + types: 2 + } + this.$post(this.api.sendPhoneOrEmailCode,data).then(res => { + if(res.message.opener){ + this.phoneCountdown() + this.phoneOpener = res.message.opener + }else{ + util.errorMsg(res.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.setToken(res.token) + util.local.set(Setting.tokenKey,res.token,43200000) + util.successMsg('登录成功') + setTimeout(() => { + this.$post(this.api.saveRecord,{ + type: 3, + }).then(res => {}).catch(res => {}) + },3000) + this.$router.push('/index/list') + }).catch(res => {}) + }, }, }; @@ -106,24 +220,21 @@ export default { margin-top: 30px; border-radius: 10px; background-color: #fff; - .title{ - position: relative; + .tab{ + display: flex; + justify-content: center; + align-items: center; margin-bottom: 30px; - text-align: center; - span{ - display: inline-block; + border-bottom: 2px solid #e0e0e0; + li{ padding: 9px 20px; + margin-bottom: -1px; color: #555; - border-bottom: 2px solid $main-color; - } - &:after{ - content: ''; - position: absolute; - left: 0; - bottom: -1px; - width: 100%; - height: 1px; - background-color: #e0e0e0; + cursor: pointer; + border-bottom: 2px solid transparent; + &.active{ + border-bottom-color: $main-color; + } } } .el-form{ diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue index 0831466..dc7ab13 100644 --- a/src/pages/index/list/index.vue +++ b/src/pages/index/list/index.vue @@ -1,6 +1,6 @@