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. 109
      pages/oncs/onservice.vue

18
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;

4
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;

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

3
i18n/lang/zh-TW.json

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

40
pages/base/home.vue

@ -713,8 +713,9 @@
<img src="@/static/img/pages6.png">
<view class="color-light">{{ $t("base.c6") }}</view>
</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">
<span class="circle-pulse1" v-if="newscount!==0">{{newscount>=100?'99+':newscount}}</span>
<view class="color-light">{{$t('common.service')}}</view>
</v-link>
</view>
@ -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 @@
};
</script>
<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 {
// background-color: $bg;
// }

109
pages/oncs/onservice.vue

@ -2,47 +2,120 @@
<v-page>
<v-header :title="$t('common.service')"></v-header>
<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>
</v-page>
</template>
<script>
import Member from "@/api/member";
import Home from "@/api/home";
export default {
data() {
return {
csurl:"https://sc.moabwalletss.com/chat/?toid=",
csurl: "",
isLoad: false
}
},
mounted() {
onLoad() {
this.mkcslinks()
},
methods: {
// build
mkcslinks(){
mkcslinks() {
let user = uni.getStorageSync('user')
if(user){
console.log(user)
if (user) {
let ustr = JSON.parse(user)
console.log(ustr)
this.csurl += ustr.referrer+"&room_id="+ustr.account;
console.log("user",this.csurl)
// let ustr = JSON.parse(user)
// Member.getUnameByUid({user_id:ustr.referrer}).then(rfres=>{
// this.csurl += rfres.username+"&room_id="+ustr.account+"&usid="+ustr.user_id;
// })
// console.log("user",this.csurl)
Member.getUnameByUid({user_id: 1}).then(rfres => {
let rfu = rfres.data;
// query referr uname
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;
// console.log("dd",chaturl);
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>
<style>
</style>
<style scoped>
.onsczone {
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;
}
<style lang="less" scoped>
.onsczone{
margin-top: 12rem;
@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>
Loading…
Cancel
Save