
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,
							
							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);
						},
						// 每次点击左侧菜单，调用添加标签方法
						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.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: "显示设置",
									   name: '/ps',
									   content: ''
									 });
									 this.editableTabsValue ='/ps';
								}
								
								this.$router.push('/ps')
							}else if (command ==='updatepwd'){

							}

						},
						
						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;
							
							console.log("path:",_this.$route.path)
							if(_this.$route.path !="")
							{
								if(_this.$route.path == '/ps'){
									_this.editableTabs=[];
									_this.editableTabs.push({
									  title: '显示设置',
									  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', {
						      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);
					}
				}
			);