Merge remote-tracking branch 'origin/main'

dev/emitter
Lei OT 10 months ago
commit 4b6bd11130

@ -19,7 +19,9 @@ const useAuthStore = create(devtools((set, get) => ({
email: '', email: '',
openId: '', openId: '',
accountList: [], accountList: [],
permissionList: [], emailList: [],
whatsAppBusiness: '',
accountName: '',
}, },
loginStatus: 0, 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) 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')) { if (perm === PERM_IMPORT_EMAIL && window.localStorage.getItem('PERM_IMPORT_EMAIL')) {
return true return true
} }
@ -43,16 +46,7 @@ const useAuthStore = create(devtools((set, get) => ({
return ['79', '383', '404', '227'].includes(loginUser.userId) return ['79', '383', '404', '227'].includes(loginUser.userId)
} }
// 以上是 Hardcode 判断 // 以上是 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) => { login: async (authCode) => {
@ -60,7 +54,7 @@ const useAuthStore = create(devtools((set, get) => ({
setLoginStatus(200) setLoginStatus(200)
// TODO 正式上线要切换地址 // TODO: LYJ 正式上线要切换地址
const json = await fetchJSON( const json = await fetchJSON(
'http://202.103.68.144:889/dingtalk/dingtalkwork/WhatsAppAuth', 'http://202.103.68.144:889/dingtalk/dingtalkwork/WhatsAppAuth',
//`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`, //`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`,
@ -143,7 +137,9 @@ const useAuthStore = create(devtools((set, get) => ({
email: '', email: '',
openId: '', openId: '',
accountList: [], 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) => { setWhatsAppBusiness: async (userId, whatsAppBusiness) => {
const { loginUser, saveUserSession } = get() const { loginUser, saveUserSession } = get()
const postWABAUrl = `${API_HOST}/v2/set_whatsapp_info` const postWABAUrl = `${API_HOST}/v2/set_whatsapp_info`

@ -2,7 +2,7 @@ import { create } from 'zustand'
import { devtools } from 'zustand/middleware' import { devtools } from 'zustand/middleware'
import { fetchJSON, postForm } from '@/utils/request' import { fetchJSON, postForm } from '@/utils/request'
import { API_HOST } from '@/config' import { API_HOST } from '@/config'
import { isNotEmpty, copy } from '@/utils/commons' import { copy } from '@/utils/commons'
const useSnippetStore = create(devtools((set, get) => ({ const useSnippetStore = create(devtools((set, get) => ({

Loading…
Cancel
Save