diff --git a/src/main.js b/src/main.js index 6070bb34..a691e07a 100644 --- a/src/main.js +++ b/src/main.js @@ -57,7 +57,7 @@ Vue.component('Editor', Editor) Vue.component('FileUpload', FileUpload) Vue.component('ImageUpload', ImageUpload) Vue.component('ImagePreview', ImagePreview) - +import { get } from '@/utils/config' // 引入get方法 Vue.use(directive) Vue.use(plugins) Vue.use(VueMeta) @@ -84,3 +84,4 @@ new Vue({ store, render: h => h(App) }) + diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 6d79bc22..b660b65c 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -90,6 +90,7 @@ const user = { commit('SET_TOKEN', access_token) setExpiresIn(expires_in) commit('SET_EXPIRES_IN', expires_in) + return res; }) .catch(error => Promise.reject(error)) }, diff --git a/src/views/login1.vue b/src/views/login1.vue index 8695259d..e1448ee7 100644 --- a/src/views/login1.vue +++ b/src/views/login1.vue @@ -112,7 +112,7 @@ size="medium" type="primary" style="width: 100%;" - @click="loginMethod === 'password' ?IsAdmin():isLogin()" + @click="loginMethod === 'password' ?IsAdmin():handleLogin()" > 登 录 登 录 中... @@ -122,7 +122,7 @@ size="medium" type="primary" style="width: 100%;" - @click="isLogin()" + @click="handleLogin()" > 登 录 登 录 中... @@ -257,7 +257,22 @@ export default { } this.loginForm.loginMethod = this.loginMethod this.$store.dispatch('Login', this.loginForm) - .then(() => this.$router.push({ path: this.redirect || '/' })) + .then(res => { + console.log(res) + if (res.code===200){ + if (res.isLogin){ + this.$modal.confirm('账号已在其他地方登录是否继续登录!!!!').then(function() { + return this.$router.push({ path: this.redirect || '/' }); + }).then(() => { + this.loading = false + }).catch(() => { + this.loading = false + }) + }else { + this.$router.push({ path: this.redirect || '/' }); + } + } + }) .catch(() => { this.loading = false if (this.captchaEnabled) this.getCode() @@ -272,7 +287,7 @@ export default { this.isAdmin = res.data this.$message.success('检测到您是超级管理账号,需进行手机检验') } else { - this.isLogin() + this.handleLogin() } }) }, diff --git a/src/views/register1.vue b/src/views/register1.vue index d2f844c4..1cc83335 100644 --- a/src/views/register1.vue +++ b/src/views/register1.vue @@ -58,7 +58,7 @@ - + - + + + + + + @@ -209,7 +216,7 @@ - + {{ dict.label @@ -253,6 +260,15 @@ + + + + + {{ dict.label }} + + + + @@ -314,7 +330,7 @@ import {validateNewPassword } from '@/utils/validate' export default { name: 'User', - dicts: ['sys_normal_disable', 'sys_user_sex', 'sys_login_type'], + dicts: ['sys_normal_disable', 'sys_user_sex', 'sys_login_type','sys_user_permanent'], components: { Treeselect }, data() { return { @@ -408,7 +424,9 @@ export default { trigger: ['blur', 'change'] } ], + deptId:[ { required: true, message: '请选择归属部门', trigger: 'blur' }], phonenumber: [ + { required: true, message: '手机号不能为空', trigger: 'blur' }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', @@ -428,6 +446,16 @@ export default { } } }, + computed: { + config() { + return JSON.parse(localStorage.getItem('systemConfig')) || {registersConfig: { + phoneRegisters: true, + emailRegisters: true, + verificationCode:true, + approvalStatus:true, + }}; // 获取 JSON 对象 + } + }, watch: { // 根据名称筛选部门树 deptName(val) {