|  | @@ -99,47 +99,46 @@ const actions = {
 | 
	
		
			
				|  |  |      const { username, password } = userInfo
 | 
	
		
			
				|  |  |      return new Promise((resolve, reject) => {
 | 
	
		
			
				|  |  |        login({ username: username.trim(), password: password }).then(response => {
 | 
	
		
			
				|  |  | -        // =============================
 | 
	
		
			
				|  |  | -        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)
 | 
	
		
			
				|  |  | +        // 单点登录=============================
 | 
	
		
			
				|  |  | +        // 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", "");
 | 
	
		
			
				|  |  | +        //   }
 | 
	
		
			
				|  |  | +        //  //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");
 | 
	
		
			
				|  |  |          // }
 | 
	
		
			
				|  |  | -        // setToken(data.token)
 | 
	
		
			
				|  |  | -        // resolve()
 | 
	
		
			
				|  |  | +        // =============================
 | 
	
		
			
				|  |  | +        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)
 | 
	
		
			
				|  |  |        })
 | 
	
	
		
			
				|  | @@ -173,19 +172,17 @@ const actions = {
 | 
	
		
			
				|  |  |              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
 | 
	
		
			
				|  |  | +            // 单点登录
 | 
	
		
			
				|  |  | +            // 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");
 | 
	
		
			
				|  |  | +            // 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)
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -274,19 +271,18 @@ const actions = {
 | 
	
		
			
				|  |  |          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");
 | 
	
		
			
				|  |  | +        // 单点登录
 | 
	
		
			
				|  |  | +        // var url = process.env.VUE_APP_BASE_API
 | 
	
		
			
				|  |  | +        // console.log(url,'url')
 | 
	
		
			
				|  |  | +        // //获取当前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)
 |