247 lines
7.0 KiB
JavaScript
247 lines
7.0 KiB
JavaScript
|
||
history.pushState(null, null, document.URL);
|
||
window.addEventListener('popstate', function () {
|
||
console.log(document.URL);
|
||
history.pushState(null, null, document.URL);
|
||
});
|
||
|
||
setInterval(checkUser,5000);
|
||
|
||
var home = { template: '<div>welcome home page</div>' }
|
||
|
||
var routes = [
|
||
{ path: '/info', component: window.Wellcomponent_en },
|
||
{ path: '/history', component: window.WellHistorycomponent_en },
|
||
{ path: '/user', component: window.Usercomponent },
|
||
{ path: '/auth',component: window.authComponent},
|
||
{ path: '/mh', component: window.mhComponent_en},
|
||
{ path: '/mhs', component: window.mhsComponent_en},
|
||
{ path: '/ms', component: window.msComponent_en},
|
||
{ path: '/mss', component: window.mssComponent_en},
|
||
{ path: '/uh', component: window.Uhcomponent1},
|
||
{ path: '/ts', component: window.tsComponent_en},
|
||
{ path: '/fr', component: window.frComponent_en},
|
||
{ path: '/wt', component: window.Welltypecomponent_en},
|
||
{ path: '/es', component: window.eSerivicecomponent_en},
|
||
{ path: '/authll', component: window.authllComponent},
|
||
{ path: '/lcm', component: window.lcmComponent_en},
|
||
{ path: '/nb', component: window.nbComponent_en},
|
||
{ path: '/nbs', component: window.nbsComponent_en},
|
||
{ path: '/cmp', component: window.cmpcomponent_en},
|
||
{ path: '/srr', component: window.srrcomponent_en},
|
||
{ path: '/tools', component: window.toolscomponent_en},
|
||
{ path: '/dev', component: window.devcomponent_en},
|
||
{ path: '/ps', component: window.pscomponent_en},
|
||
|
||
{ path: '*', redirect: '/info'},
|
||
]
|
||
|
||
var router = new VueRouter({
|
||
routes: routes
|
||
})
|
||
|
||
/*
|
||
router.beforeEach((to,from,next)=>{
|
||
if (to.path == '/nop'){
|
||
next();
|
||
return;
|
||
}
|
||
if (localStorage.getItem("level")==4) {
|
||
if (to.path != '/info') {
|
||
next({path:'/nop'});
|
||
}else{
|
||
next();
|
||
}
|
||
} else{
|
||
next();
|
||
}
|
||
})*/
|
||
ELEMENT.locale(ELEMENT.lang.en);
|
||
new Vue(
|
||
{
|
||
el:"#app",
|
||
data(){
|
||
|
||
return{
|
||
ifhidden:false,
|
||
onlineuser:localStorage.getItem("online_user"),
|
||
NavigateItem:[],
|
||
if_show:false,
|
||
notify_data:'',
|
||
if_show_notify:false,
|
||
|
||
editableTabsValue: '',
|
||
editableTabs: [],
|
||
tabIndex: 2,
|
||
}
|
||
},
|
||
router:router,
|
||
methods:{
|
||
tab_click(item){
|
||
//console.log(item)
|
||
this.$router.push({
|
||
path:item.name,
|
||
})
|
||
},
|
||
removeTab(targetName) {
|
||
let tabs = this.editableTabs;
|
||
let activeName = this.editableTabsValue;
|
||
if (activeName === targetName) {
|
||
tabs.forEach((tab, index) => {
|
||
if (tab.name === targetName) {
|
||
let nextTab = tabs[index + 1] || tabs[index - 1];
|
||
if (nextTab) {
|
||
activeName = nextTab.name;
|
||
this.$router.push({
|
||
path:activeName,
|
||
})
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
this.editableTabsValue = activeName;
|
||
this.editableTabs = tabs.filter(tab => tab.name !== targetName);
|
||
},
|
||
// ÿ<>ε<EFBFBD><CEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
||
addMenuBreadcrumb (menu_item) {
|
||
console.log(menu_item)
|
||
// let newTabName = ++this.tabIndex + '';
|
||
var flag = false;
|
||
for (var i = 0; i< this.editableTabs.length; ++i) {
|
||
if(this.editableTabs[i].name == menu_item.index){
|
||
flag=true;
|
||
this.editableTabsValue = menu_item.index;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!flag){
|
||
this.editableTabs.push({
|
||
title: menu_item.title,
|
||
name: menu_item.index,
|
||
content: ''
|
||
});
|
||
this.editableTabsValue = menu_item.index;
|
||
}
|
||
|
||
},
|
||
|
||
handleCommand(command) {
|
||
if (command === 'exit') {
|
||
loginout();
|
||
}else if (command === 'help'){
|
||
var url = 'help-en.html';
|
||
url = encodeURI(url);
|
||
window.open(url, "");
|
||
}else if (command === 'setting'){
|
||
//this.$router.push('/ps')
|
||
|
||
var flag = false;
|
||
for (var i = 0; i< this.editableTabs.length; ++i) {
|
||
if(this.editableTabs[i].name == '/ps'){
|
||
flag=true;
|
||
this.editableTabsValue = '/ps';
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!flag){
|
||
this.editableTabs.push({
|
||
title: "<22><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>",
|
||
name: '/ps',
|
||
content: ''
|
||
});
|
||
this.editableTabsValue ='/ps';
|
||
}
|
||
|
||
this.$router.push('/ps')
|
||
}
|
||
},
|
||
|
||
getnotify(){
|
||
var _this = this;
|
||
axios.post('/deescloud/getNotify_en', {
|
||
username: localStorage.getItem("online_user"),
|
||
})
|
||
.then(function (response) {
|
||
if(response.data.data ==""){
|
||
_this.$data.if_show_notify = false;
|
||
}else{
|
||
_this.$data.if_show_notify = true;
|
||
}
|
||
_this.$data.notify_data = response.data.data;
|
||
})
|
||
.catch(function (error) {
|
||
console.log(error);
|
||
});
|
||
}
|
||
},
|
||
mounted() {
|
||
var _this = this;
|
||
axios.post('/deescloud/getMenu_en', {
|
||
username: localStorage.getItem("online_user"),
|
||
})
|
||
.then(function (response) {
|
||
_this.$data.NavigateItem = response.data.data;
|
||
|
||
console.log(_this.$data.NavigateItem);
|
||
_this.$data.if_show = true;
|
||
|
||
console.log("path:",_this.$route.path)
|
||
if(_this.$route.path !="")
|
||
{
|
||
if(_this.$route.path == '/ps'){
|
||
_this.editableTabs=[];
|
||
_this.editableTabs.push({
|
||
title: '<27><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>',
|
||
name: _this.$route.path,
|
||
content: ''
|
||
});
|
||
_this.editableTabsValue = _this.$route.path;
|
||
}else{
|
||
for(var i =0; i < _this.$data.NavigateItem.length;++i){
|
||
for(var j =0; j < _this.$data.NavigateItem[i].items.length;++j){
|
||
//console.log(_this.$data.NavigateItem[i].items[j].index)
|
||
if (_this.$route.path == _this.$data.NavigateItem[i].items[j].index)
|
||
{
|
||
_this.editableTabs=[];
|
||
_this.editableTabs.push({
|
||
title: _this.$data.NavigateItem[i].items[j].title,
|
||
name: _this.$route.path,
|
||
content: ''
|
||
});
|
||
_this.editableTabsValue = _this.$route.path;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
})
|
||
.catch(function (error) {
|
||
console.log(error);
|
||
});
|
||
|
||
axios.post('/deescloud/getNotify_en', {
|
||
username: localStorage.getItem("online_user"),
|
||
})
|
||
.then(function (response) {
|
||
if(response.data.data ==""){
|
||
_this.$data.if_show_notify = false;
|
||
}else{
|
||
_this.$data.if_show_notify = true;
|
||
}
|
||
_this.$data.notify_data = response.data.data;
|
||
|
||
_this.$data.if_show = true;
|
||
})
|
||
.catch(function (error) {
|
||
console.log(error);
|
||
});
|
||
|
||
setInterval(_this.getnotify,60000);
|
||
}
|
||
}
|
||
); |