diff --git a/src/router/index.js b/src/router/index.js index f23ae2a..e2dadd4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,6 @@ import { createRouter, createWebHashHistory } from "vue-router"; import http from "@/utils/request.js"; import tools from "@/utils/tools"; import { namespaceContextKey } from "element-plus"; - const routerHistory = createWebHashHistory(); const router = createRouter({ @@ -126,13 +125,7 @@ router.beforeEach((to, form, next) => { // tools.data.set('token', token) // next(); // } - let type = tools.data.get("type"); - if (type) { - next(); - } else { - window.location.href = "http://localhost:8080/#/guide"; - next(); - } + next(); }); export default router; diff --git a/src/utils/request.js b/src/utils/request.js index 33b0fb6..4c94fa7 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -33,9 +33,13 @@ axios.interceptors.response.use( // console.log(error.response,"响应拦截器失败") ElMessage.error("请重新登录!"); // window.location.href = '/#/login?returnURL=' + window.location.href - window.location.href = - "http://220.191.238.50:996/api/login?returnURL=" + - window.location.href; + // window.location.href = + // "http://220.191.238.50:996/api/login?returnURL=" + + // window.location.href; + router.replace({ + path: '/guide' + }); + } else if (error.response.status == 404) { ElMessage.error("Status:404,正在请求不存在的服务器记录!"); } else if (error.response.status == 500) { diff --git a/src/view/guide.vue b/src/view/guide.vue index 1d4ba05..86a2f7f 100644 --- a/src/view/guide.vue +++ b/src/view/guide.vue @@ -63,7 +63,6 @@ import { ref, onMounted, onUnmounted, reactive } from "vue"; import { useRouter, useRoute } from "vue-router"; import http from "@/utils/request.js"; import dd from "gdt-jsapi"; - import tab1 from "@/assets/guide/tab1.png"; import tab2 from "@/assets/guide/tab2.png"; import tab3 from "@/assets/guide/tab3.png"; @@ -72,7 +71,6 @@ import tab5 from "@/assets/guide/tab5.png"; import tab6 from "@/assets/guide/tab6.png"; import tab7 from "@/assets/guide/tab7.png"; import tab8 from "@/assets/guide/tab8.png"; - import png1 from "@/assets/guide/Dp/1.png"; import png2 from "@/assets/guide/Dp/2.png"; import png3 from "@/assets/guide/Dp/3.png"; @@ -83,7 +81,6 @@ import png7 from "@/assets/guide/Dp/7.png"; import png8 from "@/assets/guide/Dp/8.png"; import { ElMessage } from "element-plus"; import tools from "@/utils/tools"; - const router = useRouter(); const routers = useRoute(); @@ -139,16 +136,6 @@ const getCookie = (cname) => { }; // 登录 const login = () => { - // this.loading = true; - // let ua = navigator.userAgent.toLowerCase(); - // let env = "pc"; - // const isMobile = - // /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/i.test( - // ua - // ); - // env = isMobile ? "move" : "pc"; - // console.log(ua, env, 333); - console.log(111, dd.getAuthCode); dd.getAuthCode() .then((res) => { // let auth__code = env == "pc" ? res.auth_code : res.code; @@ -157,8 +144,9 @@ const login = () => { .post(`/api/sign_in/one_click_login?authCode=${res.auth_code}`) .then((response) => { if (response.code == 200) { - console.log(1111, response); tools.data.set("token", response.data.token); + tools.data.set("type", 1); + // console.log(1111, response); // this.loading = false; // // 登录成功 // if (!response.data.is_bind) { @@ -174,11 +162,11 @@ const login = () => { // this.$message.success("登录成功"); // this.$router.replace("/home"); // } - tools.data.set("type", 1); + } else { // 跳转未绑定页面 router.push({ - path: `error/noPermission.vue`, + path: `error/noPermission`, }); } }); @@ -186,6 +174,7 @@ const login = () => { .catch((err) => { console.log(err); var token = getCookie("lytoken"); + // var token = '6b0e380b4a8f46baae4923f83faf670d'; // console.log('token', token) if (!token) { window.location.href = diff --git a/src/view/home.vue b/src/view/home.vue index e0bc185..f2ac5da 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -58,7 +58,7 @@ window.addEventListener("resize", function () {