mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-10 16:55:00 +08:00
优化登录 mock ,通过请求头里的 token 信息判断用户
This commit is contained in:
parent
c74f435bc6
commit
58d4a56663
10
.stylelintrc
10
.stylelintrc
@ -11,11 +11,11 @@
|
||||
"rules": {
|
||||
"stylistic/max-line-length": null,
|
||||
"stylistic/block-closing-brace-newline-after": [
|
||||
"always",
|
||||
{
|
||||
"ignoreAtRules": ["if", "else"]
|
||||
}
|
||||
],
|
||||
"always",
|
||||
{
|
||||
"ignoreAtRules": ["if", "else"]
|
||||
}
|
||||
],
|
||||
"at-rule-no-unknown": null,
|
||||
"no-descending-specificity": null,
|
||||
"property-no-unknown": null,
|
||||
|
@ -8,7 +8,7 @@ export default [
|
||||
status: 1,
|
||||
data: {
|
||||
account: option.body.account,
|
||||
token: '@string',
|
||||
token: `${option.body.account}_@string`,
|
||||
failure_time: Math.ceil(new Date().getTime() / 1000) + 24 * 60 * 60,
|
||||
},
|
||||
}
|
||||
@ -19,7 +19,7 @@ export default [
|
||||
method: 'get',
|
||||
response: (option: any) => {
|
||||
let permissions: string[] = []
|
||||
if (option.query.account === 'admin') {
|
||||
if (option.headers.token.indexOf('admin') === 0) {
|
||||
permissions = [
|
||||
'permission.browse',
|
||||
'permission.create',
|
||||
@ -27,7 +27,7 @@ export default [
|
||||
'permission.remove',
|
||||
]
|
||||
}
|
||||
else if (option.query.account === 'test') {
|
||||
else if (option.headers.token.indexOf('test') === 0) {
|
||||
permissions = [
|
||||
'permission.browse',
|
||||
]
|
||||
|
@ -55,9 +55,6 @@ const useUserStore = defineStore(
|
||||
// 通过 mock 获取权限
|
||||
const res = await api.get('member/permission', {
|
||||
baseURL: '/mock/',
|
||||
params: {
|
||||
account: account.value,
|
||||
},
|
||||
})
|
||||
permissions.value = res.data.permissions
|
||||
return permissions.value
|
||||
@ -68,7 +65,6 @@ const useUserStore = defineStore(
|
||||
newpassword: string
|
||||
}) {
|
||||
await api.post('member/edit/password', {
|
||||
account: account.value,
|
||||
password: data.password,
|
||||
newpassword: data.newpassword,
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user