bug修改
This commit is contained in:
parent
bc13169c25
commit
41579ccd28
|
|
@ -13,6 +13,18 @@ export function login(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isLogin(data) {
|
||||||
|
return request({
|
||||||
|
url: '/auth/isLogin',
|
||||||
|
headers: {
|
||||||
|
isToken: false,
|
||||||
|
repeatSubmit: false
|
||||||
|
},
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function getPhoneCode(payload) {
|
export function getPhoneCode(payload) {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/getPhoneCode',
|
url: '/auth/getPhoneCode',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { login, logout, getInfo, refreshToken, getPhoneCode } from '@/api/login'
|
import { login, logout, getInfo, refreshToken, getPhoneCode, isLogin } from '@/api/login'
|
||||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
|
|
@ -36,6 +36,34 @@ const user = {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
IsLogin({ commit }, userInfo) {
|
||||||
|
let payload = {}
|
||||||
|
const loginType = userInfo.loginType
|
||||||
|
if (loginType === 'password') {
|
||||||
|
payload = {
|
||||||
|
username: userInfo.username.trim(),
|
||||||
|
password: userInfo.password,
|
||||||
|
uuid: userInfo.uuid,
|
||||||
|
code: userInfo.code,
|
||||||
|
loginType: loginType
|
||||||
|
}
|
||||||
|
} else if (loginType === 'mobile') {
|
||||||
|
payload = {
|
||||||
|
mobile: userInfo.mobile.trim(),
|
||||||
|
verificationCode: userInfo.verificationCode,
|
||||||
|
uuid: userInfo.uuid,
|
||||||
|
code: userInfo.code,
|
||||||
|
loginType: loginType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
isLogin(payload).then(res => {
|
||||||
|
resolve(res);
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// 登录
|
// 登录
|
||||||
Login({ commit }, userInfo) {
|
Login({ commit }, userInfo) {
|
||||||
let payload = {}
|
let payload = {}
|
||||||
|
|
@ -78,7 +106,6 @@ const user = {
|
||||||
code: userInfo.code,
|
code: userInfo.code,
|
||||||
mobileCodeType: userInfo.mobileCodeType
|
mobileCodeType: userInfo.mobileCodeType
|
||||||
}
|
}
|
||||||
console.log(payload)
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getPhoneCode(payload).then(res => {
|
getPhoneCode(payload).then(res => {
|
||||||
resolve()
|
resolve()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ import { blobValidate, tansParams } from '@/utils/bonus'
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import { decryptCBC, encryptCBC } from '@/utils/aescbc'
|
import { decryptCBC, encryptCBC } from '@/utils/aescbc'
|
||||||
import { hashWithSM3AndSalt } from '@/utils/sm' // 导入SM3哈希函数
|
import { hashWithSM3AndSalt } from '@/utils/sm'
|
||||||
|
import data from '@/views/system/dict/data.vue' // 导入SM3哈希函数
|
||||||
|
|
||||||
let downloadLoadingInstance
|
let downloadLoadingInstance
|
||||||
export let isRelogin = { show: false }
|
export let isRelogin = { show: false }
|
||||||
|
|
@ -117,12 +118,12 @@ service.interceptors.request.use(
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
(res) => {
|
(res) => {
|
||||||
// 自动解密响应数据
|
// 自动解密响应数据
|
||||||
if (res.data.decrypt) {
|
/* if (res.data.decrypt) {
|
||||||
res.data = JSON.parse(decryptCBC(res.data.data))
|
res.data = JSON.parse(decryptCBC(res.data.data))
|
||||||
} else if (typeof res.data.code === 'undefined') {
|
} else if (typeof res.data.code === 'undefined') {
|
||||||
res.data = res.data.data
|
res.data = res.data.data
|
||||||
}
|
} */
|
||||||
|
console.log(res.data.code)
|
||||||
// 获取状态码
|
// 获取状态码
|
||||||
const code = res.data.code || 200
|
const code = res.data.code || 200
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
|
|
@ -150,6 +151,7 @@ service.interceptors.response.use(
|
||||||
}
|
}
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
|
console.log(data)
|
||||||
Message({ message: msg, type: 'error' })
|
Message({ message: msg, type: 'error' })
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code === 601) {
|
} else if (code === 601) {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="verificationCode">
|
<el-form-item prop="verificationCode">
|
||||||
<el-input v-model="loginForm.verificationCode" :readonly="!isSendingCode" placeholder="请输入验证码">
|
<el-input v-model="loginForm.verificationCode" placeholder="请输入验证码">
|
||||||
<template slot="append">
|
<template slot="append">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
size="medium"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
@click.native.prevent="handleLogin"
|
@click.native.prevent="isLogin"
|
||||||
>
|
>
|
||||||
<span v-if="!loading">登 录</span>
|
<span v-if="!loading">登 录</span>
|
||||||
<span v-else>登 录 中...</span>
|
<span v-else>登 录 中...</span>
|
||||||
|
|
@ -225,13 +225,42 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
isLogin() {
|
||||||
|
this.$refs.loginForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.loading = true
|
||||||
|
if (this.loginForm.rememberMe) {
|
||||||
|
Cookies.set('username', this.loginForm.username, { expires: 30 })
|
||||||
|
Cookies.set('password', encrypt(this.loginForm.password), { expires: 30 })
|
||||||
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 })
|
||||||
|
} else {
|
||||||
|
Cookies.remove('username')
|
||||||
|
Cookies.remove('password')
|
||||||
|
Cookies.remove('rememberMe')
|
||||||
|
}
|
||||||
|
let that = this
|
||||||
|
this.loginForm.loginType = this.loginMethod
|
||||||
|
this.$store.dispatch('IsLogin', this.loginForm)
|
||||||
|
.then(res => {
|
||||||
|
if (res.data) {
|
||||||
|
this.$modal.confirm('账号已在其他地方登录是否继续登录!!!!').then(function() {
|
||||||
|
return that.handleLogin()
|
||||||
|
}).then(() => {
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.handleLogin()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
if (this.captchaEnabled) this.getCode()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
sendCode() {
|
sendCode() {
|
||||||
let form = new FormData
|
|
||||||
|
|
||||||
form.append('13123', '123123')
|
|
||||||
console.log(form.getAll("13123"))
|
|
||||||
|
|
||||||
|
|
||||||
if (!this.loginForm.code) {
|
if (!this.loginForm.code) {
|
||||||
this.$message.error('请先填写验证码')
|
this.$message.error('请先填写验证码')
|
||||||
return
|
return
|
||||||
|
|
@ -249,7 +278,7 @@ export default {
|
||||||
this.countdown -= 1
|
this.countdown -= 1
|
||||||
if (this.countdown <= 0) {
|
if (this.countdown <= 0) {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
/* this.isSendingCode = false */
|
this.isSendingCode = false
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
@ -259,12 +288,12 @@ export default {
|
||||||
if (this.captchaEnabled) {
|
if (this.captchaEnabled) {
|
||||||
this.getCode()
|
this.getCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其他失败处理逻辑
|
// 其他失败处理逻辑
|
||||||
this.isSendingCode = false
|
this.isSendingCode = false
|
||||||
this.countdown = 0
|
this.countdown = 0
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
|
,
|
||||||
toggleLoginMethod() {
|
toggleLoginMethod() {
|
||||||
this.loginMethod = this.loginMethod === 'password' ? 'mobile' : 'password'
|
this.loginMethod = this.loginMethod === 'password' ? 'mobile' : 'password'
|
||||||
this.loginForm.username = ''
|
this.loginForm.username = ''
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,19 @@
|
||||||
:default-expand-all="isExpandAll"
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
<el-table-column prop="deptName" label="部门名称" min-width="260"></el-table-column>
|
||||||
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
<el-table-column prop="orderNum" label="排序" min-width="200"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" width="100">
|
<el-table-column prop="status" label="状态" min-width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
<el-table-column label="创建时间" align="center" prop="createTime" min-width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" min-width="200" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
|
||||||
|
|
@ -56,26 +56,26 @@
|
||||||
:default-expand-all="isExpandAll"
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
<el-table-column prop="menuName" label="菜单名称" align="center" :show-overflow-tooltip="true" width="160"></el-table-column>
|
||||||
<el-table-column prop="icon" label="图标" align="center" width="100">
|
<el-table-column prop="icon" label="图标" align="center" min-width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon :icon-class="scope.row.icon" />
|
<svg-icon :icon-class="scope.row.icon" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
|
<el-table-column prop="orderNum" align="center" label="排序" min-width="60"></el-table-column>
|
||||||
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="perms" align="center" label="权限标识" min-width="60" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="component" align="center" label="组件路径" :show-overflow-tooltip="true" min-width="60"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" width="80">
|
<el-table-column prop="status" align="center" label="状态" min-width="60">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" min-width="60" prop="createTime">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" min-width="60" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue