| 
					
				 | 
			
			
				@@ -99,21 +99,47 @@ const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const { username, password } = userInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return new Promise((resolve, reject) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       login({ username: username.trim(), password: password }).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const { data, msg } = response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (msg !== 'ok') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            message: data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            type: 'error', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            duration: 5 * 1000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          reject(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        commit('SET_TOKEN', data.token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (Cookies == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        setToken(data.token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // ============================= 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const fullURL = window.location.href; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 使用正则表达式提取code参数的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const codeMatch = fullURL.match(/[\?&]access=([^&]+)/); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('codeMatch===>',codeMatch) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (codeMatch) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 如果匹配成功,将code的值存储在组件的data中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          var code = codeMatch[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //TODO 保存token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 去除后面的#/login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if ( code &&  code.includes("#/login")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            code =  code.replace("#/login", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log('token',code) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           //base64解密this.cose 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log('解密token',atob(code)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let token = atob(code) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            commit('SET_TOKEN', token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setToken(token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let url = window.location.href; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 使用split方法将URL拆分为数组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let jmpurl = url.split('?')[0]+'#/dashboard' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            window.open(jmpurl, "_self"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // ============================= 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // const { data, msg } = response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // if (msg !== 'ok') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     message: data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     type: 'error', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     duration: 5 * 1000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   reject(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // commit('SET_TOKEN', data.token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // if (Cookies == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   console.log(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // setToken(data.token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }).catch(error => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         reject(error) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,7 +160,33 @@ const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // roles must be a non-empty array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!role || role.length <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          reject('getInfo: roles must be a non-null array!') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          reject('该用户未分配角色!') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log('no=============') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          setTimeout(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            commit('SET_BUTTONS', []) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // console.log('-------------', state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            commit('SET_TOKEN', '') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            commit('SET_ROLES', []) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Cookies.remove('employename') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Cookies.remove('employeid') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Cookies.remove('pastureid') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            removeToken() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resetRouter() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // const url = process.env.VUE_APP_BASE_API 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // const url = 'http://192.168.61.41/' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // const url = 'http://tmrwatch.cn:8082/' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var url = process.env.VUE_APP_BASE_API 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //获取当前url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(url.indexOf('/')==0 && url.length==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              url= window.location.protocol + "//"+window.location.host+url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url="+url+ '&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 使用 $router.push 进行页面跳转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            window.open(externalURL, "_self"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          },2000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': username }}).then(response => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -222,7 +274,20 @@ const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         removeToken() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         resetRouter() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        location.reload() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // const url = process.env.VUE_APP_BASE_API 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // const url = 'http://192.168.61.41/' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // const url = 'http://tmrwatch.cn:8082/' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        var url = process.env.VUE_APP_BASE_API 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取当前url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(url.indexOf('/')==0 && url.length==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          url= window.location.protocol + "//"+window.location.host+url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url=" + url + '&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 使用 $router.push 进行页面跳转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        window.open(externalURL, "_self"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // location.reload() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }).catch(error => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         reject(error) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 |