Browse Source

新增客服提示

master
liaoxinyu 1 year ago
parent
commit
eb57fc3c6e
  1. 46
      App.vue
  2. 12
      api/home.js
  3. 41
      pages/base/home.vue
  4. 9
      pages/oncs/onservice.vue

46
App.vue

@ -189,6 +189,52 @@ export default {
color: $text-color; color: $text-color;
} }
.circle-pulse {
background: red;
width: 7px;
height: 7px;
border-radius: 50%;
position: absolute;
right: -10px;
top: 10px;
}
.circle-pulse:after {
background-color: red;
content: "";
display: table;
border-radius: 50%;
position: absolute;
animation-name: pulse1;
animation-duration: 0.9s;
animation-iteration-count: infinite;
animation-timing-function: ease-out;
}
@keyframes pulse1 {
0% {
opacity: 1;
width: 7px;
height: 7px;
left: 0;
top: 0;
}
95% {
opacity: 0.1;
left: -10.5px;
top: -10.5px;
width: 28px;
height: 28px;
}
100% {
opacity: 0;
width: 7px;
height: 7px;
left: 0;
top: 0;
}
}
/* #ifdef H5 */ /* #ifdef H5 */
.layout-page { .layout-page {
height: 100%!important; height: 100%!important;

12
api/home.js

@ -27,6 +27,18 @@ class Home {
static online(){ static online(){
return Serve.get('/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;

41
pages/base/home.vue

@ -5,6 +5,7 @@
<template #left> <template #left>
<!-- <van-icon name="user-circle-o" class="fn-25 color-theme-1" style="color: #D0712F;" /> --> <!-- <van-icon name="user-circle-o" class="fn-25 color-theme-1" style="color: #D0712F;" /> -->
<image src="@/assets/img/home/top.png" mode="aspectFit" style="width: 36rpx;height: 36rpx;"></image> <image src="@/assets/img/home/top.png" mode="aspectFit" style="width: 36rpx;height: 36rpx;"></image>
<span class="circle-pulse" v-if="newscount!==0"></span>
</template> </template>
<template #title> <template #title>
<view style="color: #ffffff; font-size: 30rpx;">{{$t("base.d0")}}</view> <view style="color: #ffffff; font-size: 30rpx;">{{$t("base.d0")}}</view>
@ -636,8 +637,9 @@
<view class="color-light">{{ $t("base.c6") }}</view> <view class="color-light">{{ $t("base.c6") }}</view>
</v-link> </v-link>
<!-- customer service --> <!-- customer service -->
<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="@/static/img/cs_w.svg"> <img src="@/static/img/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>
@ -691,6 +693,8 @@
}, },
data() { data() {
return { return {
newscount:0,
chatcount:null,
infoActive: 1, // infoActive: 1, //
marketList: [], marketList: [],
marketListHe: [], marketListHe: [],
@ -753,6 +757,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({
@ -1052,6 +1063,7 @@
}) })
.then(() => { .then(() => {
this.outLogin(); this.outLogin();
clearInterval(this.chatcount);
}) })
.catch(() => {}); .catch(() => {});
}) })
@ -1093,6 +1105,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() {
@ -1102,6 +1124,9 @@
this.getCurrencyExCny(); this.getCurrencyExCny();
this.getHelpList(); this.getHelpList();
if (this.isLogin) { if (this.isLogin) {
this.chatcount = setInterval(()=>{
this.chat()
},2000)
this.createWalletAddress(); this.createWalletAddress();
this.getAuthInfo() this.getAuthInfo()
this.personalAssets(); this.personalAssets();
@ -1117,6 +1142,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;
// } // }

9
pages/oncs/onservice.vue

@ -13,6 +13,7 @@
<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 {
@ -38,9 +39,17 @@
// console.log("dd",chaturl); // console.log("dd",chaturl);
this.csurl = chaturl; this.csurl = chaturl;
this.isLoad = true; this.isLoad = true;
if(this.isLoad===true){
this.chatRead()
}
}) })
console.log("user", this.csurl) console.log("user", this.csurl)
} }
},
chatRead(){
Home.chatRead().then(res => {
console.log(res,'已读');
})
} }
} }
} }

Loading…
Cancel
Save