{{ $t('home.announcements') || '公告中心' }}
+{{ $t('home.latestTitle') || '最新公告' }}
+{{ announcement.title }}
+ ++ {{ announcement.summary }} +
+{{ $t('home.noData') || '暂无公告' }}
+diff --git a/mining-pool/dist.zip b/mining-pool/dist.zip index 14db860..aae10c6 100644 Binary files a/mining-pool/dist.zip and b/mining-pool/dist.zip differ diff --git a/mining-pool/src/api/staticDocumentManagement.js b/mining-pool/src/api/staticDocumentManagement.js new file mode 100644 index 0000000..17ccb94 --- /dev/null +++ b/mining-pool/src/api/staticDocumentManagement.js @@ -0,0 +1,33 @@ +import request from '../utils/request' + + +//新增文档页面 +export function addDocument(data) { + return request({ + url: `manage/documents/addDocument`, + method: 'post', + data + }) +} + + +//业务系统获取对应文档列表 +export function documentsList(data) { + return request({ + url: `manage/documents/findCatalogueDocumentList`, + method: 'post', + data + }) +} + + +//从列表获取文档详情 +export function findDataInfo(data) { + return request({ + url: `manage/documents/findDataInfo`, + method: 'post', + data + }) +} + + diff --git a/mining-pool/src/components/ChatWidget.vue b/mining-pool/src/components/ChatWidget.vue index f56544b..dbbbb8b 100644 --- a/mining-pool/src/components/ChatWidget.vue +++ b/mining-pool/src/components/ChatWidget.vue @@ -203,6 +203,7 @@ :disabled="connectionStatus !== 'connected'" /> +
@@ -309,11 +310,12 @@ export default { lastErrorTime: 0, // 最后一次错误时间 lastConnectedEmail: null, // 最后连接的用户email,用于防止重复连接 userViewHistory: false, // 是否在查看历史消息 - customerIsOnline: true, // 保存客服在线状态 + customerIsOnline: false, // 保存客服在线状态 jurisdiction: { roleKey: "", }, + token: "", }; }, computed: { @@ -375,8 +377,19 @@ export default { // === 移除 markMessagesAsRead 调用,防止切换窗口时误清未读 === } }, + token(val) { + console.log("token变化打印",val); + + if (!val) { + this.forceDisconnectAll() + this.$nextTick(() => { + this.determineUserType() + }) + } + }, }, + async created() { let jurisdiction = localStorage.getItem("jurisdiction"); try { @@ -410,6 +423,11 @@ export default { } this.jurisdiction = jurisdiction; + let customerIsOnline = localStorage.getItem("customerIsOnline"); + this.customerIsOnline = JSON.parse(customerIsOnline); + let token = localStorage.getItem("token"); + this.token = JSON.parse(token); + window.addEventListener("setItem", () => { let jurisdiction = localStorage.getItem("jurisdiction"); try { @@ -420,6 +438,12 @@ export default { jurisdiction = { roleKey: "" }; } this.jurisdiction = jurisdiction; + + + let customerIsOnline = localStorage.getItem("customerIsOnline"); + this.customerIsOnline = JSON.parse(customerIsOnline); + let token = localStorage.getItem("token"); + this.token = JSON.parse(token); }); // 添加页面卸载事件监听 @@ -542,6 +566,7 @@ export default { this.jurisdiction.roleKey =="customer_service" || this.jurisdiction.roleKey == "admin" || this.jurisdiction.roleKey == "back_admin" + ) return; // 获取用户ID和未读消息数 const userData = await this.fetchUserid({ email: this.userEmail }); @@ -586,6 +611,9 @@ export default { // 确定用户类型和邮箱 async determineUserType() { + + console.log("token",this.token); + try { const token = localStorage.getItem("token"); // console.log("token", token); @@ -638,7 +666,7 @@ export default { this.userEmail = email; - if (userInfo.roleKey === "customer_service") { + if (userInfo.roleKey === "customer_service" || userInfo.roleKey === "admin") { // 客服用户 this.userType = 2; this.userEmail = ""; @@ -1061,7 +1089,7 @@ export default { // console.log("🔌 处理连接断开..."); - // === 如果用户已经打开聊天窗口,确保保持打开状态 === + // === 移除自动保持对话框打开的逻辑,只有用户主动打开才保持打开 === // if (this.isChatOpen) { // console.log("📱 聊天窗口已打开,保持打开状态"); // // 不改变 isChatOpen 和 isMinimized 状态 @@ -1098,7 +1126,7 @@ export default { // `🔄 尝试重连 (${this.reconnectAttempts}/${this.maxReconnectAttempts})...` // ); - // === 在自动重连期间,如果聊天窗口打开,显示连接中状态 === + // === 在自动重连期间,如果聊天窗口已经打开,才显示连接中状态 === if (this.isChatOpen) { this.connectionStatus = "connecting"; } @@ -1208,6 +1236,11 @@ export default { }, // 发送消息 sendMessage() { + + + + + // 网络断开时阻止发送消息并提示 if (this.networkStatus !== "online") { this.$message({ @@ -1631,21 +1664,16 @@ export default { // 修改 fetchUserid 方法,添加 token 检查 async fetchUserid(params) { try { - // 先检查是否有 token - // const token = localStorage.getItem("token"); - // if (!token) { - // console.log("用户未登录,不发起 getUserid 请求"); - // // 对于未登录用户,可以生成一个临时 ID - // this.roomId = `guest_${Date.now()}`; - // this.receivingEmail = "customer_service@example.com"; // 或默认客服邮箱 - // return null; - // } + const res = await getUserid(params); if (res && res.code == 200) { // console.log("获取用户ID成功:", res); this.receivingEmail = res.data.userEmail; this.roomId = res.data.id; + this.customerIsOnline = res.data.customerIsOnline; + localStorage.setItem(`customerIsOnline`,JSON.stringify(this.customerIsOnline)) + return res.data; } else { console.warn("获取用户ID未返回有效数据"); @@ -1991,7 +2019,7 @@ export default { // connectionStatus: this.connectionStatus, // isWebSocketConnected: this.isWebSocketConnected, // }); - + this.fetchUserid({ email: this.userEmail }) const wasOpen = this.isChatOpen; this.isChatOpen = !this.isChatOpen; @@ -2455,14 +2483,14 @@ export default { }, /** - * 优化:重试连接按钮处理 - 保持对话框打开,直接重连 + * 优化:重试连接按钮处理 - 直接重连,不自动打开对话框 */ async handleRetryConnect() { try { // console.log("🔄 用户点击重试连接..."); // === 多窗口切换:抢占活跃权 === - this.setWindowActive(); + // this.setWindowActive(); // 移除此方法调用,因为setWindowActive方法在代码中没有定义 // === 重置连接状态,立即显示连接中 === this.connectionStatus = "connecting"; @@ -2730,9 +2758,9 @@ export default { this.isReconnecting = false; this.showRefreshButton = false; // 不显示刷新按钮,用户只需关闭多余窗口 - // === 确保聊天对话框保持打开状态 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; this.$forceUpdate(); // console.log("🔥 连接数上限错误处理完成,提示用户关闭多余窗口"); @@ -3042,9 +3070,9 @@ export default { this.isHandlingError = true; this.lastErrorTime = now; - // === 确保聊天对话框保持打开状态 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; // 清除验证定时器 this.clearConnectionVerification(); @@ -3073,9 +3101,9 @@ export default { // console.error("❌ 重新连接失败:", error); this.isHandlingError = false; - // === 连接失败时确保对话框仍然打开 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; this.connectionStatus = "error"; this.showRefreshButton = true; }); @@ -3098,9 +3126,9 @@ export default { this.isHandlingError = true; this.lastErrorTime = now; - // === 确保聊天对话框保持打开状态 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; // === 增加重连次数并检查限制 === this.reconnectAttempts++; @@ -3138,9 +3166,9 @@ export default { console.error("❌ 超时重连失败:", error); this.isHandlingError = false; - // === 重连失败时确保对话框仍然打开 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; this.connectionStatus = "error"; this.connectionError = this.$t("chat.reconnectFailed") || "重连失败,请稍后重试"; @@ -3159,9 +3187,9 @@ export default { console.error("❌ 强制断开连接失败:", error); this.isHandlingError = false; - // === 处理失败时确保对话框仍然打开 === - this.isChatOpen = true; - this.isMinimized = false; + // === 移除自动打开对话框的逻辑,只有用户主动点击才打开 === + // this.isChatOpen = true; + // this.isMinimized = false; this.connectionStatus = "error"; this.connectionError = this.$t("chat.connectionFailed") || "连接处理失败,请稍后重试"; diff --git a/mining-pool/src/components/HorizontalBroadcast.vue b/mining-pool/src/components/HorizontalBroadcast.vue new file mode 100644 index 0000000..39ad45c --- /dev/null +++ b/mining-pool/src/components/HorizontalBroadcast.vue @@ -0,0 +1,724 @@ + ++ {{ announcement.summary }} +
+{{ $t('home.noData') || '暂无公告' }}
+$1
')
+ .replace(/`([^`]*)`/gim, '$1
')
+ // 链接
+ .replace(/\[([^\]]*)\]\(([^)]*)\)/gim, '$1')
+
+ // 处理段落和换行(避免影响表格)
+ const parts = html.split(/(
-
- {{ $t(`home.describeTitle`) }}
-
-