用户登录问题修改

This commit is contained in:
jiang 2024-11-05 14:43:17 +08:00
parent 580626e5fd
commit 33cab82ec6
5 changed files with 57 additions and 14 deletions

View File

@ -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)
})

View File

@ -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))
},

View File

@ -112,7 +112,7 @@
size="medium"
type="primary"
style="width: 100%;"
@click="loginMethod === 'password' ?IsAdmin():isLogin()"
@click="loginMethod === 'password' ?IsAdmin():handleLogin()"
>
<span v-if="!loading"> </span>
<span v-else> 中...</span>
@ -122,7 +122,7 @@
size="medium"
type="primary"
style="width: 100%;"
@click="isLogin()"
@click="handleLogin()"
>
<span v-if="!loading"> </span>
<span v-else> 中...</span>
@ -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()
}
})
},

View File

@ -58,7 +58,7 @@
</div>
</el-form-item>
<el-form-item prop="verificationCode">
<el-form-item v-show="config.registersConfig.verificationCode" prop="verificationCode">
<el-input v-model="registerForm.verificationCode" :readonly="!isSendingCode" placeholder="请输入验证码">
<template slot="append">
<el-button
@ -112,7 +112,8 @@ export default {
config() {
return JSON.parse(localStorage.getItem('systemConfig')) || {registersConfig: {
phoneRegisters: true,
emailRegisters: true
emailRegisters: true,
verificationCode:true
}}; // JSON
},
},
@ -224,10 +225,7 @@ export default {
}
this.$store.dispatch('GetPhoneCode', this.registerForm)
.then(res => {
if (!res.hasOwnProperty('code')) {
res = JSON.parse(decryptCBC(res))
}
this.loginForm.phoneUuid = res.data
console.log(res)
this.isSendingCode = true
this.countdown = 60
const timer = setInterval(() => {

View File

@ -105,7 +105,14 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center">
<el-table-column label="账号时效" align="center">
<template slot-scope="scope">
<span>{{scope.row.isPermanent==0?"长期账号":"临时账号" }}</span>
</template>
</el-table-column>
<el-table-column v-if="config.registersConfig.approvalStatus" label="审批状态" align="center">
<template slot-scope="scope">
<span>{{scope.row.approvalStatus==0?"未审批":"已审批" }}</span>
</template>
@ -253,6 +260,15 @@
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="账号时效" prop="isPermanent">
<el-radio-group v-model="form.isPermanent">
<el-radio v-for="dict in dict.type.sys_user_permanent" :key="dict.value" :label="dict.value">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
@ -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) {