From 2ea6a4d4d371c50a71e68cac97d2b3d2faa3827e Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Tue, 16 Sep 2025 17:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=9C=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=81=E6=96=B0=E5=A2=9E=E6=9C=AA=E8=AF=BB=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/home.js | 18 +++++++ api/member.js | 4 ++ i18n/lang/en.json | 3 +- i18n/lang/zh-TW.json | 3 +- pages/base/home.vue | 40 +++++++++++++- pages/oncs/onservice.vue | 111 ++++++++++++++++++++++++++++++++------- 6 files changed, 157 insertions(+), 22 deletions(-) diff --git a/api/home.js b/api/home.js index 7fdb8f6..0962190 100644 --- a/api/home.js +++ b/api/home.js @@ -20,6 +20,24 @@ class Home { static option(data){ return Serve.post('/option',data) } + /* + * 获取用户在线接口 + */ + static online(){ + return Serve.get('/online') + } + /* + * 获取未读消息 + */ + static chat(){ + return Serve.get('/user/chat') + } + /* + * 已读消息 + */ + static chatRead(){ + return Serve.get('/user/chatRead') + } } export default Home; \ No newline at end of file diff --git a/api/member.js b/api/member.js index 188f88a..73378c3 100644 --- a/api/member.js +++ b/api/member.js @@ -143,6 +143,10 @@ class Member { static getUnameByUid(data){ return server.get(`/user/getUserName`, data); } + // 查询用户的帐号 + static getUnameByUid(data){ + return server.get(`/user/getUserName`, data); + } } export default Member; diff --git a/i18n/lang/en.json b/i18n/lang/en.json index 55ac1d2..c1ce80a 100644 --- a/i18n/lang/en.json +++ b/i18n/lang/en.json @@ -109,7 +109,8 @@ "c5": "your transfer order has been submitted successfully,please wait patiently,and the transfer result will be notified by SMS or e-mail. Please check it carefully. If you have any questions,please contact the customer service in time.", "c6": "Increase ratio", "c7": "Current valuation", - "GraphicValidation": "Graphical verification" + "GraphicValidation": "Graphical verification", + "loading": "loading" }, "base": { "a0": "Title", diff --git a/i18n/lang/zh-TW.json b/i18n/lang/zh-TW.json index b7c830b..73011d7 100644 --- a/i18n/lang/zh-TW.json +++ b/i18n/lang/zh-TW.json @@ -109,7 +109,8 @@ "c5": "您的劃轉訂單已提交成功,請耐心等待,劃轉結果會以簡訊或郵件的管道通知。請注意查收,如有疑問請及時聯系客服", "c6": "漲幅比例", "c7": "當前估值", - "GraphicValidation": "圖形驗證" + "GraphicValidation": "圖形驗證", + "loading": "加载中" }, "base": { "a0": "標題", diff --git a/pages/base/home.vue b/pages/base/home.vue index a9a51a3..070778f 100644 --- a/pages/base/home.vue +++ b/pages/base/home.vue @@ -713,8 +713,9 @@ {{ $t("base.c6") }} - + + {{newscount>=100?'99+':newscount}} {{$t('common.service')}} @@ -767,6 +768,8 @@ }, data() { return { + newscount:0, + chatcount:null, infoActive: 1, // 详情选中 marketList: [], marketListHe: [], @@ -855,6 +858,13 @@ }, watch: { isShow(n) { + if(n&&this.isLogin){ + this.chatcount = setInterval(()=>{ + this.chat() + },2000) + } else if(!n){ + clearInterval(this.chatcount); + } if (n) { this.indexData() this.ws.send({ @@ -1162,6 +1172,7 @@ }) .then(() => { this.outLogin(); + clearInterval(this.chatcount); }) .catch(() => {}); }) @@ -1203,6 +1214,16 @@ // #ifdef H5 window.open('https://app.ajcoins.com/download/index.html', '_blank') // 打开一个新标签 // #endif + }, + chat(){ + Home.chat().then(res => { + if(res.code==200){ + this.newscount = res.data.count; + }else{ + // console.log('1111'); + clearInterval(this.chatcount); + } + }) } }, mounted() { @@ -1212,6 +1233,9 @@ this.getCurrencyExCny(); this.getHelpList(); if (this.isLogin) { + this.chatcount = setInterval(()=>{ + this.chat() + },5000) this.createWalletAddress(); this.getAuthInfo() this.personalAssets(); @@ -1221,6 +1245,20 @@ }; + \ No newline at end of file