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