diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..262321a --- /dev/null +++ b/.env.development @@ -0,0 +1,8 @@ +# 后端 api地址 +VITE_API_BASE_URL=http://192.168.2.22:8101 +# 注册地址 +VITE_REGISTER_API_URL=http://192.168.2.22:48080 +# pk api地址 +VITE_PK_MINI_API_URL=http://192.168.2.22:8086 +# 商店地址 +VITE_SHOP_URL=http://192.168.2.128:8085 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..07c1b2f --- /dev/null +++ b/.env.production @@ -0,0 +1,8 @@ +# 后端 api地址 +VITE_API_BASE_URL=https://crawlclient.api.yolozs.com +# 注册地址 +VITE_REGISTER_API_URL=https://backstageapi.yolozs.com +# pk api地址 +VITE_PK_MINI_API_URL=https://pk.hanxiaokj.cn +# 商店地址 +VITE_SHOP_URL=https://待填写 diff --git a/src/api/notice.js b/src/api/notice.js index aa332c8..8e6e911 100644 --- a/src/api/notice.js +++ b/src/api/notice.js @@ -2,5 +2,5 @@ import { getAxios } from '@/utils/axios.js' // 获取当前生效的公告列表 export function getActiveNotices() { - return getAxios({ url: '/api/notice/active' }) + return getAxios({ url: '/api/common/notice' }) } diff --git a/src/api/pk-mini.js b/src/api/pk-mini.js index 6cb9250..84d1484 100644 --- a/src/api/pk-mini.js +++ b/src/api/pk-mini.js @@ -4,27 +4,26 @@ */ import axios from 'axios' import { ElMessage } from 'element-plus' +import { ENV } from '@/config' // 创建独立的 axios 实例 const pkAxios = axios.create({ - baseURL: 'http://192.168.2.22:8086/', - // baseURL: 'https://pk.hanxiaokj.cn/', + baseURL: ENV.PK_MINI_API_URL + '/', timeout: 60000, headers: { 'Content-Type': 'application/json' } }) -// 请求拦截器 - 使用主项目的 vvtoken +// 请求拦截器 - PK Mini 后端使用 vvtoken 请求头 pkAxios.interceptors.request.use((config) => { - // 优先使用 vvtoken - const vvtoken = localStorage.getItem('token') - if (vvtoken) { - config.headers['vvtoken'] = vvtoken + const token = localStorage.getItem('token') + if (token) { + config.headers['vvtoken'] = token } else { // 兼容:尝试从 user_data 获取 const userData = JSON.parse(localStorage.getItem('user_data') || '{}') - if (userData.token) { + if (userData.tokenValue) { config.headers['vvtoken'] = userData.tokenValue } } diff --git a/src/api/register.js b/src/api/register.js index 1c037ba..32c1c25 100644 --- a/src/api/register.js +++ b/src/api/register.js @@ -1,4 +1,5 @@ import axios from 'axios' +import { ENV } from '@/config' // 创建独立的 axios 实例,避免被全局拦截器影响 const registerAxios = axios.create({ @@ -7,9 +8,7 @@ const registerAxios = axios.create({ }) // 注册接口使用 tkNewAdmin 后端 -const REGISTER_BASE_URL = process.env.NODE_ENV === 'development' - ? 'http://192.168.2.22:48080' - : 'https://backstageapi.yolozs.com' +const REGISTER_BASE_URL = ENV.REGISTER_API_URL /** * 租户注册 diff --git a/src/assets/placeholder-webai.png b/src/assets/placeholder-webai.png index 72ca72e..79a95a6 100644 Binary files a/src/assets/placeholder-webai.png and b/src/assets/placeholder-webai.png differ diff --git a/src/components/HostListDialog.vue b/src/components/HostListDialog.vue index 89ef770..31bc431 100644 --- a/src/components/HostListDialog.vue +++ b/src/components/HostListDialog.vue @@ -16,6 +16,10 @@
欢迎使用 Yolo 系统,如有问题请联系管理员。
', category: 'info' }, + { id: 2, title: '系统维护通知', content: '系统将于本周六凌晨 2:00-4:00 进行维护升级,届时服务将暂停,请提前做好安排。
', category: 'warning' }, + { id: 3, title: '紧急安全通知', content: '请所有用户立即更新客户端至最新版本。
', category: 'danger' }, ] lastFetchTime.value = Date.now() } @@ -66,6 +77,8 @@ export const useNoticeStore = defineStore('notice', () => { // 状态 notices, activeNotices, + infoNotices, + alertNotices, hasNotices, isLoading, useMock, diff --git a/src/stores/pk-mini/notice.js b/src/stores/pk-mini/notice.js index 4ffdb36..c629520 100644 --- a/src/stores/pk-mini/notice.js +++ b/src/stores/pk-mini/notice.js @@ -43,3 +43,20 @@ export const pkIMloginStore = defineStore('pkIMlogin', { } } }) + +export const pkUnreadStore = defineStore('pkUnread', { + state: () => { + return { count: 0 } + }, + actions: { + setCount(count) { + this.count = count + }, + decrease(num = 1) { + this.count = Math.max(0, this.count - num) + }, + clear() { + this.count = 0 + } + } +}) diff --git a/src/utils/axios.js b/src/utils/axios.js index 7e6e67d..643b163 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -8,24 +8,13 @@ import router from '@/router' import { ElMessage } from 'element-plus'; import { usePythonBridge, } from '@/utils/pythonBridge' +import { ENV } from '@/config' const { stopScript } = usePythonBridge(); // 请求地址前缀 -let baseURL = '' -if (process.env.NODE_ENV === 'development') { - // 生产环境 - // baseURL = "https://api.tkpage.yolozs.com" - baseURL = "http://192.168.2.22:8101" - // baseURL = "https://crawlclient.api.yolozs.com" -} else { - // 测试环境 - // baseURL = "http://120.26.251.180:8085/" - // 开发环境 - baseURL = "https://crawlclient.api.yolozs.com" - // baseURL = "http://api.tkpage.vvtiktok.cn" -} +const baseURL = ENV.API_BASE_URL // 请求拦截器 axios.interceptors.request.use((config) => { diff --git a/src/utils/pk-mini/goeasy.js b/src/utils/pk-mini/goeasy.js index e468191..ff27394 100644 --- a/src/utils/pk-mini/goeasy.js +++ b/src/utils/pk-mini/goeasy.js @@ -96,6 +96,7 @@ export function goEasyGetConversations() { return new Promise((resolve, reject) => { im.latestConversations({ onSuccess: function (result) { + console.log('会话列表', result) resolve(result) }, onFailed: function (error) { diff --git a/src/views/pk-mini/Message.vue b/src/views/pk-mini/Message.vue index 057fb6b..86b1162 100644 --- a/src/views/pk-mini/Message.vue +++ b/src/views/pk-mini/Message.vue @@ -1,9 +1,9 @@