diff --git a/.env.development.example b/.env.development.example deleted file mode 100644 index c26c7fb..0000000 --- a/.env.development.example +++ /dev/null @@ -1,3 +0,0 @@ - -# 请求域名 -VITE_APP_BASE_URL='' \ No newline at end of file diff --git a/.env.production.example b/.env.production.example deleted file mode 100644 index c26c7fb..0000000 --- a/.env.production.example +++ /dev/null @@ -1,3 +0,0 @@ - -# 请求域名 -VITE_APP_BASE_URL='' \ No newline at end of file diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..d4fb1fa --- /dev/null +++ b/.env.test @@ -0,0 +1,11 @@ +#mode 环境 +VITE_MODE = test + +#服务器域名 +VITE_HOST = https://test.szxgl.cn/ + +# 请求域名 +VITE_APP_BASE_URL='https://test.szxgl.cn/ai-agent-admin-server' + +#静态资源目录 +VITE_CDN_DIR = 'https://agent-admin-test.szxgl.cn/' \ No newline at end of file diff --git a/package.json b/package.json index 8f01c05..597aaaf 100644 --- a/package.json +++ b/package.json @@ -56,9 +56,10 @@ "github-markdown-css": "5.2.0", "highlight.js": "11.0.0", "howler": "2.2.4", + "js-base64": "^3.7.5", + "js-cookie": "^3.0.5", "js-mp3": "0.1.0", "jsonc-parser": "3.2.1", - "js-base64": "^3.7.5", "lodash-es": "4.17.21", "markdown-it": "^13.0.1", "markdown-it-math": "4.1.1", diff --git a/src/App.vue b/src/App.vue index 01e75b0..fc93526 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,6 +8,7 @@ import { useSharedId } from './hooks/useShareMessage' import { SHARE_ID, USER_SN } from './enums/constantEnums' import { strToParams } from './utils/util' import cache from './utils/cache' +import Cookies from 'js-cookie' const appStore = useAppStore() const { getUser } = useUserStore() @@ -44,6 +45,9 @@ const setH5WebIcon = () => { //#endif const getConfig = async () => { + + await setLocalStorage() + // 获取配置信息 await appStore.getConfig() //处理关闭h5渠道 // #ifdef H5 @@ -55,6 +59,40 @@ const getConfig = async () => { // #endif } + +// 企微登录 +const setLocalStorage = async () => { + const isWeCom = isWechatWork() + + // 获取localStorage中的配置信息 + const token = localStorage.getItem('app_token') + const cookiesToken = Cookies.get('token') + + if (!cookiesToken) { + if (isWeCom) { + // 写入cookie + const redirect = location.href + Cookies.set('redirect', redirect) + location.href = `${import.meta.env.VITE_APP_BASE_URL}/qywx/getWxUserByInside?terminal=3` + return + } + } else { + const obj = { expire: "", value: cookiesToken } + console.log('obj', obj); + console.log('写入前 token', token); + localStorage.setItem("app_token", JSON.stringify(obj)); + } + +} + + +// 判断是否为企微环境 +const isWechatWork = () => { + const ua = navigator.userAgent.toLowerCase(); + // 同时匹配 "micromessenger"(微信内核)和 "wxwork"(企业微信标识) + return ua.includes('micromessenger') && ua.includes('wxwork'); +} + onLaunch(async (opinion) => { getConfig() getTheme() @@ -72,5 +110,4 @@ onShow(() => { }) +// diff --git a/src/components/agreement/agreement.vue b/src/components/agreement/agreement.vue index 199bb33..f1e67e9 100644 --- a/src/components/agreement/agreement.vue +++ b/src/components/agreement/agreement.vue @@ -1 +1,79 @@ - \ No newline at end of file + + + + diff --git a/src/components/chat-plugins/vip-use.vue b/src/components/chat-plugins/vip-use.vue index 1106541..5c2d644 100644 --- a/src/components/chat-plugins/vip-use.vue +++ b/src/components/chat-plugins/vip-use.vue @@ -1,8 +1,6 @@