Browse Source

修改客服接口、新增未读数量

master
liaoxinyu 3 months ago
parent
commit
2ea6a4d4d3
  1. 18
      api/home.js
  2. 4
      api/member.js
  3. 3
      i18n/lang/en.json
  4. 3
      i18n/lang/zh-TW.json
  5. 40
      pages/base/home.vue
  6. 97
      pages/oncs/onservice.vue

18
api/home.js

@ -20,6 +20,24 @@ class Home {
static option(data){ static option(data){
return Serve.post('/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; export default Home;

4
api/member.js

@ -143,6 +143,10 @@ class Member {
static getUnameByUid(data){ static getUnameByUid(data){
return server.get(`/user/getUserName`, data); return server.get(`/user/getUserName`, data);
} }
// 查询用户的帐号
static getUnameByUid(data){
return server.get(`/user/getUserName`, data);
}
} }
export default Member; export default Member;

3
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.", "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", "c6": "Increase ratio",
"c7": "Current valuation", "c7": "Current valuation",
"GraphicValidation": "Graphical verification" "GraphicValidation": "Graphical verification",
"loading": "loading"
}, },
"base": { "base": {
"a0": "Title", "a0": "Title",

3
i18n/lang/zh-TW.json

@ -109,7 +109,8 @@
"c5": "您的劃轉訂單已提交成功,請耐心等待,劃轉結果會以簡訊或郵件的管道通知。請注意查收,如有疑問請及時聯系客服", "c5": "您的劃轉訂單已提交成功,請耐心等待,劃轉結果會以簡訊或郵件的管道通知。請注意查收,如有疑問請及時聯系客服",
"c6": "漲幅比例", "c6": "漲幅比例",
"c7": "當前估值", "c7": "當前估值",
"GraphicValidation": "圖形驗證" "GraphicValidation": "圖形驗證",
"loading": "加载中"
}, },
"base": { "base": {
"a0": "標題", "a0": "標題",

40
pages/base/home.vue

@ -713,8 +713,9 @@
<img src="@/static/img/pages6.png"> <img src="@/static/img/pages6.png">
<view class="color-light">{{ $t("base.c6") }}</view> <view class="color-light">{{ $t("base.c6") }}</view>
</v-link> </v-link>
<v-link :to="isLogin?'/pages/oncs/onservice':'/pages/login/index'" tag="div" class="manage_text"> <v-link :to="isLogin?'/pages/oncs/onservice':'/pages/login/index'" tag="div" class="manage_text" style="position: relative;">
<img src="@/assets/img/home/cs_w.svg"> <img src="@/assets/img/home/cs_w.svg">
<span class="circle-pulse1" v-if="newscount!==0">{{newscount>=100?'99+':newscount}}</span>
<view class="color-light">{{$t('common.service')}}</view> <view class="color-light">{{$t('common.service')}}</view>
</v-link> </v-link>
</view> </view>
@ -767,6 +768,8 @@
}, },
data() { data() {
return { return {
newscount:0,
chatcount:null,
infoActive: 1, // infoActive: 1, //
marketList: [], marketList: [],
marketListHe: [], marketListHe: [],
@ -855,6 +858,13 @@
}, },
watch: { watch: {
isShow(n) { isShow(n) {
if(n&&this.isLogin){
this.chatcount = setInterval(()=>{
this.chat()
},2000)
} else if(!n){
clearInterval(this.chatcount);
}
if (n) { if (n) {
this.indexData() this.indexData()
this.ws.send({ this.ws.send({
@ -1162,6 +1172,7 @@
}) })
.then(() => { .then(() => {
this.outLogin(); this.outLogin();
clearInterval(this.chatcount);
}) })
.catch(() => {}); .catch(() => {});
}) })
@ -1203,6 +1214,16 @@
// #ifdef H5 // #ifdef H5
window.open('https://app.ajcoins.com/download/index.html', '_blank') // window.open('https://app.ajcoins.com/download/index.html', '_blank') //
// #endif // #endif
},
chat(){
Home.chat().then(res => {
if(res.code==200){
this.newscount = res.data.count;
}else{
// console.log('1111');
clearInterval(this.chatcount);
}
})
} }
}, },
mounted() { mounted() {
@ -1212,6 +1233,9 @@
this.getCurrencyExCny(); this.getCurrencyExCny();
this.getHelpList(); this.getHelpList();
if (this.isLogin) { if (this.isLogin) {
this.chatcount = setInterval(()=>{
this.chat()
},5000)
this.createWalletAddress(); this.createWalletAddress();
this.getAuthInfo() this.getAuthInfo()
this.personalAssets(); this.personalAssets();
@ -1221,6 +1245,20 @@
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.circle-pulse1 {
background: red;
display: flex;
justify-content: center;
align-items: center;
min-width: 20px;
height: 20px;
font-size: 12px;
border-radius: 50%;
position: absolute;
right: 25%;
top: -10px;
color: #fff;
}
// .colbg { // .colbg {
// background-color: $bg; // background-color: $bg;
// } // }

97
pages/oncs/onservice.vue

@ -2,21 +2,26 @@
<v-page> <v-page>
<v-header :title="$t('common.service')"></v-header> <v-header :title="$t('common.service')"></v-header>
<view class="onsczone"> <view class="onsczone">
<web-view :src="csurl" style="margin-top: 3rem;"></web-view> <web-view v-if="isLoad" :src="csurl" style="margin-top: 3rem;"></web-view>
<view style="display: flex;justify-content: center;align-items: center;" v-else>
<div class="loader"></div>
<div style="font-size: 20px;margin-left: 10px;">{{$t('common.loading')}}<span>...</span></div>
</view>
</view> </view>
</v-page> </v-page>
</template> </template>
<script> <script>
import Member from "@/api/member"; import Member from "@/api/member";
import Home from "@/api/home";
export default { export default {
data() { data() {
return { return {
csurl:"https://sc.moabwalletss.com/chat/?toid=", csurl: "",
isLoad: false
} }
}, },
mounted() { onLoad() {
this.mkcslinks() this.mkcslinks()
}, },
methods: { methods: {
@ -24,25 +29,93 @@
mkcslinks() { mkcslinks() {
let user = uni.getStorageSync('user') let user = uni.getStorageSync('user')
if (user) { if (user) {
console.log(user)
let ustr = JSON.parse(user) let ustr = JSON.parse(user)
console.log(ustr) console.log(ustr)
this.csurl += ustr.referrer+"&room_id="+ustr.account; Member.getUnameByUid({user_id: 1}).then(rfres => {
console.log("user",this.csurl) let rfu = rfres.data;
// let ustr = JSON.parse(user) // query referr uname
// Member.getUnameByUid({user_id:ustr.referrer}).then(rfres=>{ let chaturl = "https://cs.moabwalletss.com/chat/?toid=" + rfu.username + "&room_id=" + ustr.account + "&usid=" + ustr.user_id;
//this.csurl += rfres.username+"&room_id="+ustr.account+"&usid="+ustr.user_id; //this.csurl += rfres.username+"&room_id="+ustr.account+"&usid="+ustr.user_id;
// }) // console.log("dd",chaturl);
// console.log("user",this.csurl) this.csurl = chaturl;
this.isLoad = true;
if(this.isLoad===true){
this.chatRead()
} }
})
console.log("user", this.csurl)
}
},
chatRead(){
Home.chatRead().then(res => {
console.log(res,'已读');
})
} }
} }
} }
</script> </script>
<style>
<style lang="less" scoped> </style>
<style scoped>
.onsczone { .onsczone {
margin-top: 12rem; margin-top: 12rem;
}
.loader {
width: 50px;
aspect-ratio: 1;
display: grid;
border: 4px solid #0000;
border-radius: 50%;
border-right-color: #25b09b;
animation: l15 1s infinite linear;
}
.loader::before,
.loader::after {
content: "";
grid-area: 1/1;
margin: 2px;
border: inherit;
border-radius: 50%;
animation: l15 2s infinite;
}
.loader::after {
margin: 8px;
animation-duration: 3s;
}
@keyframes l15 {
100% {
transform: rotate(1turn)
}
}
span {
display: inline-block;
height: 1em;
line-height: 1;
text-align: left;
vertical-align: -.25em;
overflow: hidden;
}
span::before {
display: block;
content: '...\A..\A.';
white-space: pre-wrap;
animation: dot 3s infinite step-start both;
}
@keyframes dot {
33% {
transform: translateY(-2em);
}
66% {
transform: translateY(-1em);
}
} }
</style> </style>
Loading…
Cancel
Save