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>
<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%" /> <iframe frameborder="0" :src="rlKefuURL" width="100%" height="100%" />
</div> </div>
<div class="right-menu"> <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="在线客服"> <span class="kf-agent" title="在线客服">
<img src="" alt="" style="display: none;"> <img src="" alt="" style="display: none;">
</span> </span>
@ -111,11 +111,11 @@
</span> </span>
</div> --> </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"> <div style="padding:0px;height:500px">
<iframe frameborder="0" :src="rlKefuURL" width="100%" height="100%" /> <iframe frameborder="0" :src="rlKefuURL" width="100%" height="100%" />
</div> </div>
</el-dialog> --> </el-dialog>
</div> </div>
<div class="kf_dialog_center"> <div class="kf_dialog_center">
@ -153,6 +153,7 @@
</template> </template>
<script> <script>
import {Notification} from "element-ui";
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav' import TopNav from '@/components/TopNav'
@ -212,6 +213,8 @@ export default {
appUrl:null, appUrl:null,
user:{}, user:{},
msgMap:null,
} }
}, },
computed: { computed: {
@ -255,6 +258,7 @@ export default {
} }
}, },
created(){ created(){
this.msgMap = new Map();
this.initOnlineKefu(); this.initOnlineKefu();
}, },
mounted() { mounted() {
@ -271,12 +275,41 @@ export default {
}, },
initOnlineKefu(){ initOnlineKefu(){
let that=this;
if(!this.blSupportKf){ if(!this.blSupportKf){
return; return;
} }
window.addEventListener('message', function(e) { 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=>{ getKefuSsoToken().then(res=>{
@ -286,6 +319,10 @@ export default {
}, },
showOnlineKefu(){ showOnlineKefu(){
if(this.openOnlineKefu){
return;
}
this.initOnlineKefu(); this.initOnlineKefu();
this.openOnlineKefu=true; this.openOnlineKefu=true;
}, },

View File

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

View File

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