From 58d4a56663d8199779bb9a466021bdaede931bd3 Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Wed, 12 Apr 2023 00:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95=20mock=20?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E8=BF=87=E8=AF=B7=E6=B1=82=E5=A4=B4=E9=87=8C?= =?UTF-8?q?=E7=9A=84=20token=20=E4=BF=A1=E6=81=AF=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .stylelintrc | 10 +++++----- src/mock/member.ts | 6 +++--- src/store/modules/user.ts | 4 ---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.stylelintrc b/.stylelintrc index c76b4220..66938459 100644 --- a/.stylelintrc +++ b/.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, diff --git a/src/mock/member.ts b/src/mock/member.ts index 5f36cb41..55f68342 100644 --- a/src/mock/member.ts +++ b/src/mock/member.ts @@ -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', ] diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index e4921eb3..56ba4478 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -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, }, {