|
|
|
<html lang="cn">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="author" content="陶士涵">
|
|
|
|
<title>GO语言开源客服系统-GOFLY</title>
|
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css">
|
|
|
|
<link rel="stylesheet" href="/static/css/common.css">
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
|
|
|
|
<script src="/static/js/functions.js"></script>
|
|
|
|
<style>
|
|
|
|
html,
|
|
|
|
body {
|
|
|
|
height: 100%;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
body {
|
|
|
|
overflow: hidden;
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-aside{
|
|
|
|
height: 100%;
|
|
|
|
background: #fff;
|
|
|
|
border: solid 1px #e6e6e6;
|
|
|
|
}
|
|
|
|
.el-aside .el-menu{
|
|
|
|
border-right: none;
|
|
|
|
}
|
|
|
|
.mainLogo{
|
|
|
|
font-size: 20px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.mainMain{
|
|
|
|
background: #fff;
|
|
|
|
margin-left: 10px;
|
|
|
|
margin-bottom: 60px;
|
|
|
|
}
|
|
|
|
.mainIframe{
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.el-card__body{
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body class="text-center">
|
|
|
|
<div id="app">
|
|
|
|
<template>
|
|
|
|
{{template "nav" }}
|
|
|
|
<iframe class="mainIframe" v-bind:src="iframeUrl" frameborder="0"></iframe>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
delimiters:["<{","}>"],
|
|
|
|
data: {
|
|
|
|
window:window,
|
|
|
|
iframeUrl:"",
|
|
|
|
mailTotal:0,
|
|
|
|
adminAvator:"",
|
|
|
|
adminRole:"",
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
focusWindow(){
|
|
|
|
var _this=this;
|
|
|
|
window.addEventListener('message',function(e){
|
|
|
|
var redata=e.data;
|
|
|
|
console.log(redata);
|
|
|
|
notify(redata.name, {
|
|
|
|
body: redata.body,
|
|
|
|
icon: redata.icon
|
|
|
|
}, function(notification) {
|
|
|
|
//可直接打开通知notification相关联的tab窗口
|
|
|
|
window.focus();
|
|
|
|
notification.close();
|
|
|
|
_this.openIframeUrl("/chat_main");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
openIframeUrl(url){
|
|
|
|
this.iframeUrl=url;
|
|
|
|
},
|
|
|
|
//退出
|
|
|
|
logout(){
|
|
|
|
localStorage.removeItem("token");
|
|
|
|
this.openIframeUrl('/login');
|
|
|
|
},
|
|
|
|
//跳转
|
|
|
|
openUrl(url){
|
|
|
|
window.location.href=url;
|
|
|
|
},
|
|
|
|
GetQueryString(name){
|
|
|
|
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
|
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
|
if(r!=null)return unescape(r[2]); return null;
|
|
|
|
},
|
|
|
|
checkAuth(){
|
|
|
|
let _this=this;
|
|
|
|
$.ajax({
|
|
|
|
type:"post",
|
|
|
|
url:"/check_auth",
|
|
|
|
headers:{
|
|
|
|
"token":localStorage.getItem("token")
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data.code != 200) {
|
|
|
|
window.location.href="/login";
|
|
|
|
} else {
|
|
|
|
_this.adminAvator=data.result.avator;
|
|
|
|
_this.adminRole=data.result.role_name;
|
|
|
|
_this.iframeUrl = "/chat_main";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
this.checkAuth();
|
|
|
|
this.focusWindow();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
$(window).bind("focus",function(e){
|
|
|
|
//alert(1);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</html>
|