This commit is contained in:
linfso 2024-11-17 21:52:58 +08:00
parent bb6cd5c349
commit 196ee2f64d
3 changed files with 47 additions and 9 deletions

View File

@ -25,14 +25,14 @@
</div>
<div v-if="blSupportKf" v-show="openOnlineKefu" style="position: absolute;top: 50px;padding: 0px;height: 500px;width: 80%;z-index: 9999;right: 10px;">
<div v-if="blSupportKf==1" style="width:10px;height: 0px;">
<iframe frameborder="0" :src="rlKefuURL" width="100%" height="100%" />
</div>
<div class="right-menu">
<!-- 在线客服 -->
<div v-if="blSupportKf" slot="reference" class="right-menu-item hover-effect" style="padding: 0 20px;" @click="showOnlineKefu" >
<div v-if="blSupportKf==1" class="right-menu-item hover-effect" style="padding: 0 20px;" @click="showOnlineKefu" >
<span class="kf-agent" title="在线客服">
<img src="" alt="" style="display: none;">
</span>
@ -111,11 +111,11 @@
</span>
</div> -->
<!-- <el-dialog title="在线客服" :visible.sync="openOnlineKefu" width="80%" class="kf-panel" append-to-body>
<el-dialog title="在线客服" :visible.sync="openOnlineKefu" width="80%" class="kf-panel" append-to-body>
<div style="padding:0px;height:500px">
<iframe frameborder="0" :src="rlKefuURL" width="100%" height="100%" />
</div>
</el-dialog> -->
</el-dialog>
</div>
<div class="kf_dialog_center">
@ -153,6 +153,7 @@
</template>
<script>
import {Notification} from "element-ui";
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
@ -212,6 +213,8 @@ export default {
appUrl:null,
user:{},
msgMap:null,
}
},
computed: {
@ -255,6 +258,7 @@ export default {
}
},
created(){
this.msgMap = new Map();
this.initOnlineKefu();
},
mounted() {
@ -271,12 +275,41 @@ export default {
},
initOnlineKefu(){
let that=this;
if(!this.blSupportKf){
return;
}
window.addEventListener('message', function(e) {
console.log(e,'OnlineKefu==>message')
let msgData=e.data;
// console.log('OnlineKefu==>message',e.data);
if(e.data.title == undefined){
return;
}
let msgKey=msgData.tag+'';
if(msgKey in that.msgMap) {
return;
}else{
that.msgMap[msgKey]=1;
}
Notification.info({
title: "通知:"+msgData.title,
dangerouslyUseHTMLString: true,
message: msgData.body,
position: 'top-right',
// type: 'success',
customClass:'notify-success',
duration: 0,
onClick: function () {
that.showOnlineKefu();
//self.warnDetailByWarnid(messageBody.warnId); //自定义回调,message为传的参数
// 点击跳转的页面
},
});
})
getKefuSsoToken().then(res=>{
@ -286,6 +319,10 @@ export default {
},
showOnlineKefu(){
if(this.openOnlineKefu){
return;
}
this.initOnlineKefu();
this.openOnlineKefu=true;
},

View File

@ -157,15 +157,13 @@ export default {
});
Notification.info({
title: "通知",
title: "系统通知",
dangerouslyUseHTMLString: true,
message: messageBody,
position: 'top-right',
// type: 'success',
customClass:'notify-success',
// duration: 0,
duration: 0,
onClick: function () {
//self.warnDetailByWarnid(messageBody.warnId); //自定义回调,message为传的参数
// 点击跳转的页面
},
});

View File

@ -7,6 +7,7 @@ const user = {
userId:'',
empCode:'',
empName:'',
blSupportKf:'0',
ownerSiteCode:'',
ownerSiteName:'',
ownerCountryCode:'',
@ -31,6 +32,8 @@ const user = {
state.ownerSiteCode = userInfo.ownerSiteCode;
state.ownerCountryCode = userInfo.countryCode;
state.ownerSiteName = userInfo.ownerSiteName;
state.blSupportKf = userInfo.blSupportKf;
},
SET_NICK_NAME: (state, nickName) => {
state.nickName = nickName