Browse Source

新增客服

master
liaoxinyu 11 months ago
parent
commit
f91568372f
  1. 13
      src/api/home.js
  2. 4
      src/api/member.js
  3. 2
      src/api/server/index.js
  4. BIN
      src/assets/img/home/kefu.png
  5. 117
      src/components/CommonFooter.vue

13
src/api/home.js

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

4
src/api/member.js

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

2
src/api/server/index.js

@ -90,6 +90,8 @@ let loading = null;
server.interceptors.request.use(
config => {
let token = localStorage.getItem("token");
config.headers["authorization"] = `bearer ${token}`
// 剔除部分高频接口 主要是交易时的后台操作
if (!exclude.find(item => config.url.includes(item))) {
if (!config.config || config.config.loading) {

BIN
src/assets/img/home/kefu.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

117
src/components/CommonFooter.vue

@ -1,6 +1,10 @@
<template>
<!-- colto-section -->
<footer class="footer" @click="toggleMenu($event,2)">
<div class="cszone" v-if="isLogin&&getUserInfo.is_agency!=1">
<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 class="content">
<div class="footer-upper-section">
<!-- logo -->
@ -242,6 +246,10 @@
<img src="@/assets/img/home/qrcode.png" alt="" style="width: 120px;height: 120px;">
<div style="font-size: 16px; color: #9c9c9c;margin-top: 12px;text-align: center;">{{ $t("homeNewText.cc3") }}</div>
</div>
<div class="cspopup" :class='{"hidden":ispopup?"":"none"}'>
<a href="javascript:void(0);" class="close_btn" @click="closebox();">x</a>
<iframe width="100%" height="100%" class="my-modal-body" :src="ifurl" frameborder="0" style="border-radius: 10px;background-color: #fff;"></iframe>
</div>
</div>
</footer>
</template>
@ -255,6 +263,11 @@ export default {
service: [],
college: [],
email: "",
ispopup:false,
ifurl:"",
showMenu: false,
newscount:0,
getUserInfo:JSON.parse(localStorage.getItem('auth')),
list: [
{ src: "https://www.rsncoin.com/static/flag/discord.png" },
{ src: "https://www.rsncoin.com/static/flag/telegram.png" },
@ -398,12 +411,54 @@ export default {
})
.catch((err) => {});
},
scbox(e){
// under login
if (this.isLogin) {
let user_str = localStorage.getItem("auth");
if(user_str!=""){
let user = JSON.parse(user_str);
//
Member.getUnameByUid({user_id:user.referrer}).then(rfres=>{
// query referr uname
this.ifurl ="https://cs.bitewiz.com/chat/?toid="+rfres.username+"&room_id="+user.account+"&usid="+user.user_id;
// show popup
this.ispopup = ! this.ispopup
this.chatRead()
})
}
}else{
//
console.log("login fisrt!!")
this.$router.push({ path: '/sign-in' });
}
},
closebox(){
if(this.ispopup){
this.ispopup = false
}
this.ispopup =false
},
chat(){
Home.chat().then(res => {
this.newscount = res.count;
})
},
chatRead(){
Home.chatRead().then(res => {
console.log('已读');
})
}
},
created() {
this.getCollegeLinks();
this.getServiceLink();
console.log(this.service);
// console.log(this.service);
this.getEmial();
if(this.isLogin){
this.chatcount = setInterval(()=>{
this.chat()
},5000)
}
},
};
</script>
@ -412,6 +467,52 @@ export default {
background-color: #121212;
border-top: none;
.cszone{
width:48px;
position:fixed;
bottom:10%;
right:26px;
z-index:999;
background-color: #ccc;
border-radius: 10px;
}
.cszone img{
text-align:center;
width:48px;
height:48px;
}
.cspopup{
position:fixed;
top:50%;
left:50%;
transform: translate(-50%, -50%);
width:560px;
height:560px;
z-index:999;
.close_btn{
width:35px;
height:35px;
font-size:20px;
font-weight:500;
line-height:30px;
text-align:center;
display:block;
color:#fff;
background:#553646;
border-radius:50%;
position:absolute;
right:-10px;
top:-10px;
z-index:1000;
}
}
.hidden{
display:none;
}
.content{
display: flex;
justify-content: space-between;
@ -591,4 +692,18 @@ 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>

Loading…
Cancel
Save