153 lines
4.3 KiB
JavaScript
153 lines
4.3 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 首页</div>' }
|
|
|
|
var routes = [
|
|
{ path: '/info', component: window.Wellcomponent },
|
|
{ path: '/history', component: window.WellHistorycomponent },
|
|
{ path: '/user', component: window.Usercomponent },
|
|
{ path: '/auth',component: window.authComponent},
|
|
{ path: '/mh', component: window.mhComponent},
|
|
{ path: '/mhs', component: window.mhsComponent},
|
|
{ path: '/ms', component: window.msComponent},
|
|
{ path: '/mss', component: window.mssComponent},
|
|
{ path: '/uh', component: window.Uhcomponent1},
|
|
{ path: '/ts', component: window.tsComponent},
|
|
{ path: '/fr', component: window.frComponent},
|
|
{ path: '/wt', component: window.Welltypecomponent},
|
|
{ path: '/es', component: window.eSerivicecomponent},
|
|
{ path: '/authll', component: window.authllComponent},
|
|
{ path: '/lcm', component: window.lcmComponent},
|
|
{ path: '/nb', component: window.nbComponent},
|
|
{ path: '/nbs', component: window.nbsComponent},
|
|
{ path: '/cmp', component: window.cmpcomponent},
|
|
{ path: '/srr', component: window.srrcomponent},
|
|
{ path: '/tools', component: window.toolscomponent},
|
|
{ path: '/dev', component: window.devcomponent},
|
|
{ path: '/up_off_well', component: window.upoffwellcomponent},
|
|
{ path: '/ps', component: window.pscomponent},
|
|
{ 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();
|
|
}
|
|
})*/
|
|
|
|
new Vue(
|
|
{
|
|
el:"#app",
|
|
data(){
|
|
|
|
return{
|
|
ifhidden:false,
|
|
onlineuser:localStorage.getItem("online_user"),
|
|
NavigateItem:[],
|
|
if_show:false,
|
|
notify_data:'',
|
|
if_show_notify:false,
|
|
|
|
MenuList: [{
|
|
index: '/page2',
|
|
content: '数据目录管理',
|
|
icon: '\ue619'
|
|
},
|
|
{
|
|
index: '/page3',
|
|
content: '数据产品管理',
|
|
icon: '\ue625'
|
|
}],
|
|
|
|
}
|
|
},
|
|
router:router,
|
|
methods:{
|
|
handleCommand(command) {
|
|
if (command === 'exit') {
|
|
loginout();
|
|
}else if (command === 'help'){
|
|
var url = 'help.html';
|
|
url = encodeURI(url);
|
|
window.open(url, "");
|
|
}else if (command === 'setting'){
|
|
this.$router.push('/ps')
|
|
}
|
|
},
|
|
|
|
getnotify(){
|
|
var _this = this;
|
|
axios.post('/deescloud/getNotify', {
|
|
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', {
|
|
username: localStorage.getItem("online_user"),
|
|
})
|
|
.then(function (response) {
|
|
_this.$data.NavigateItem = response.data.data;
|
|
|
|
console.log(_this.$data.NavigateItem);
|
|
_this.$data.if_show = true;
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
|
|
axios.post('/deescloud/getNotify', {
|
|
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);
|
|
}
|
|
}
|
|
); |