From a3eb4e845b96d1b2913b737afbed9245186776fb Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Thu, 12 Dec 2024 15:58:14 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=88=A0=E9=99=A4=E4=B8=8D=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/AuthStore.js | 29 +++++++++-------------------- src/stores/SnippetStore.js | 2 +- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index 32a1cff..6da48c4 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -19,7 +19,9 @@ const useAuthStore = create(devtools((set, get) => ({ email: '', openId: '', accountList: [], - permissionList: [], + emailList: [], + whatsAppBusiness: '', + accountName: '', }, loginStatus: 0, @@ -31,6 +33,7 @@ const useAuthStore = create(devtools((set, get) => ({ return ['599', '495', '143', '370', '639', '513', '654', '404', '383', '227'].includes(loginUser.userId) } + // 导入邮件消息,需要配置才能使用 if (perm === PERM_IMPORT_EMAIL && window.localStorage.getItem('PERM_IMPORT_EMAIL')) { return true } @@ -43,16 +46,7 @@ const useAuthStore = create(devtools((set, get) => ({ return ['79', '383', '404', '227'].includes(loginUser.userId) } // 以上是 Hardcode 判断 - // 以下是权限列表从数据库读取后使用的方法 - // return this.permissionList.some((value, key, arry) => { - // if (value.indexOf(WILDCARD_TOKEN) > -1) { - // return true; - // } - // if (value === perm) { - // return true; - // } - // return false; - // }); + // 动态权限列表参考海外供应商平台实现 }, login: async (authCode) => { @@ -60,7 +54,7 @@ const useAuthStore = create(devtools((set, get) => ({ setLoginStatus(200) - // TODO 正式上线要切换地址 + // TODO: LYJ 正式上线要切换地址 const json = await fetchJSON( 'http://202.103.68.144:889/dingtalk/dingtalkwork/WhatsAppAuth', //`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`, @@ -143,7 +137,9 @@ const useAuthStore = create(devtools((set, get) => ({ email: '', openId: '', accountList: [], - permissionList: [], + emailList: [], + whatsAppBusiness: '', + accountName: '', }, })) }, @@ -176,13 +172,6 @@ const useAuthStore = create(devtools((set, get) => ({ ) }, - copyUserSession: () => { - const sessionData = window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER') - if (sessionData !== null) { - navigator.clipboard.writeText(sessionData) - } - }, - setWhatsAppBusiness: async (userId, whatsAppBusiness) => { const { loginUser, saveUserSession } = get() const postWABAUrl = `${API_HOST}/v2/set_whatsapp_info` diff --git a/src/stores/SnippetStore.js b/src/stores/SnippetStore.js index 7183294..d4bb4e7 100644 --- a/src/stores/SnippetStore.js +++ b/src/stores/SnippetStore.js @@ -2,7 +2,7 @@ import { create } from 'zustand' import { devtools } from 'zustand/middleware' import { fetchJSON, postForm } from '@/utils/request' import { API_HOST } from '@/config' -import { isNotEmpty, copy } from '@/utils/commons' +import { copy } from '@/utils/commons' const useSnippetStore = create(devtools((set, get) => ({