用户登录问题修改

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('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload) Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview) Vue.component('ImagePreview', ImagePreview)
import { get } from '@/utils/config' // 引入get方法
Vue.use(directive) Vue.use(directive)
Vue.use(plugins) Vue.use(plugins)
Vue.use(VueMeta) Vue.use(VueMeta)
@ -84,3 +84,4 @@ new Vue({
store, store,
render: h => h(App) render: h => h(App)
}) })

View File

@ -90,6 +90,7 @@ const user = {
commit('SET_TOKEN', access_token) commit('SET_TOKEN', access_token)
setExpiresIn(expires_in) setExpiresIn(expires_in)
commit('SET_EXPIRES_IN', expires_in) commit('SET_EXPIRES_IN', expires_in)
return res;
}) })
.catch(error => Promise.reject(error)) .catch(error => Promise.reject(error))
}, },

View File

@ -112,7 +112,7 @@
size="medium" size="medium"
type="primary" type="primary"
style="width: 100%;" style="width: 100%;"
@click="loginMethod === 'password' ?IsAdmin():isLogin()" @click="loginMethod === 'password' ?IsAdmin():handleLogin()"
> >
<span v-if="!loading"> </span> <span v-if="!loading"> </span>
<span v-else> 中...</span> <span v-else> 中...</span>
@ -122,7 +122,7 @@
size="medium" size="medium"
type="primary" type="primary"
style="width: 100%;" style="width: 100%;"
@click="isLogin()" @click="handleLogin()"
> >
<span v-if="!loading"> </span> <span v-if="!loading"> </span>
<span v-else> 中...</span> <span v-else> 中...</span>
@ -257,7 +257,22 @@ export default {
} }
this.loginForm.loginMethod = this.loginMethod this.loginForm.loginMethod = this.loginMethod
this.$store.dispatch('Login', this.loginForm) 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(() => { .catch(() => {
this.loading = false this.loading = false
if (this.captchaEnabled) this.getCode() if (this.captchaEnabled) this.getCode()
@ -272,7 +287,7 @@ export default {
this.isAdmin = res.data this.isAdmin = res.data
this.$message.success('检测到您是超级管理账号,需进行手机检验') this.$message.success('检测到您是超级管理账号,需进行手机检验')
} else { } else {
this.isLogin() this.handleLogin()
} }
}) })
}, },

View File

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

View File

@ -105,7 +105,14 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<span>{{scope.row.approvalStatus==0?"未审批":"已审批" }}</span> <span>{{scope.row.approvalStatus==0?"未审批":"已审批" }}</span>
</template> </template>
@ -209,7 +216,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{
dict.label dict.label
@ -253,6 +260,15 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-col> </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-row> <el-row>
<el-col :span="24"> <el-col :span="24">
@ -314,7 +330,7 @@ import {validateNewPassword } from '@/utils/validate'
export default { export default {
name: 'User', 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 }, components: { Treeselect },
data() { data() {
return { return {
@ -408,7 +424,9 @@ export default {
trigger: ['blur', 'change'] trigger: ['blur', 'change']
} }
], ],
deptId:[ { required: true, message: '请选择归属部门', trigger: 'blur' }],
phonenumber: [ phonenumber: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码', 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: { watch: {
// //
deptName(val) { deptName(val) {