Browse Source

新增客服提示

master
liaoxinyu 1 year ago
parent
commit
907fff12d6
  1. 12
      src/api/home.js
  2. 39
      src/components/CommonFooter.vue

12
src/api/home.js

@ -32,6 +32,18 @@ class Home {
static online(){ static online(){
return server.get('/online',{config:{loading:false}}) return server.get('/online',{config:{loading:false}})
} }
/*
* 获取未读消息
*/
static chat(){
return server.get('/user/chat',{config:{loading:false}})
}
/*
* 已读消息
*/
static chatRead(){
return server.get('/user/chatRead',{config:{loading:false}})
}
} }
export default Home; export default Home;

39
src/components/CommonFooter.vue

@ -4,6 +4,7 @@
<!-- customer service zone --> <!-- customer service zone -->
<div class="cszone"> <div class="cszone">
<a href="javascript:void(0);" @click="scbox()"><img src="../assets/img/home/kefu.png"></a> <a href="javascript:void(0);" @click="scbox()"><img src="../assets/img/home/kefu.png"></a>
<span class="circle-pulse1" v-if="newscount!==0">{{newscount>=100?'99+':newscount}}</span>
</div> </div>
<div class="content"> <div class="content">
@ -283,6 +284,7 @@
import College from "@/api/college"; import College from "@/api/college";
import ContactUs from "@/api/contactUs"; import ContactUs from "@/api/contactUs";
import Member from "@/api/member"; import Member from "@/api/member";
import Home from "@/api/home";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
data() { data() {
@ -359,7 +361,8 @@ export default {
url: require("../assets/img/tw.jpg"), url: require("../assets/img/tw.jpg"),
}, },
], ],
showMenu: false showMenu: false,
newscount:0
}; };
}, },
computed: { computed: {
@ -452,6 +455,7 @@ export default {
this.ifurl ="https://cs.btcaholic.com/chat/?toid="+rfres.username+"&room_id="+user.account+"&usid="+user.user_id; this.ifurl ="https://cs.btcaholic.com/chat/?toid="+rfres.username+"&room_id="+user.account+"&usid="+user.user_id;
// show popup // show popup
this.ispopup = ! this.ispopup this.ispopup = ! this.ispopup
this.chatRead()
}) })
} }
@ -461,7 +465,6 @@ export default {
// //
this.$router.push({ path: '/sign-in' }); this.$router.push({ path: '/sign-in' });
} }
}, },
// close // close
closebox(){ closebox(){
@ -469,14 +472,28 @@ export default {
this.ispopup = false this.ispopup = false
} }
this.ispopup =false this.ispopup =false
} },
chat(){
Home.chat().then(res => {
this.newscount = res.count;
})
},
chatRead(){
Home.chatRead().then(res => {
console.log(res,'已读');
})
}
}, },
created() { created() {
this.getCollegeLinks(); this.getCollegeLinks();
this.getServiceLink(); this.getServiceLink();
// console.log(this.service); // console.log(this.service);
this.getEmial(); this.getEmial();
if(this.isLogin){
this.chatcount = setInterval(()=>{
this.chat()
},2000)
}
}, },
}; };
</script> </script>
@ -730,5 +747,19 @@ export default {
} }
} }
.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: -20%;
top: -10px;
color: #fff;
}
</style> </style>
Loading…
Cancel
Save