From 496057ae5ca5705c1e29222160146fbad4b4cbe4 Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Wed, 25 Sep 2024 15:56:00 +0800 Subject: [PATCH] gx --- src/router/index.js | 143 ++++++++++++++++++++++++------------------- src/utils/request.js | 2 + src/view/guide.vue | 105 ++++++++++++++++++++++++++----- 3 files changed, 172 insertions(+), 78 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 6acb453..db27235 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,6 +1,7 @@ -import { createRouter, createWebHashHistory } from 'vue-router' +import { createRouter, createWebHashHistory } from "vue-router"; import http from "@/utils/request.js"; -import tools from '@/utils/tools' +import tools from "@/utils/tools"; +import { namespaceContextKey } from "element-plus"; const routerHistory = createWebHashHistory(); @@ -8,83 +9,88 @@ const router = createRouter({ history: routerHistory, routes: [ { - path: '/', - redirect: '/guide' + path: "/", + redirect: "/guide", }, { - name: '引导页', - path: '/guide', - component: () => import('../view/guide.vue'), + name: "引导页", + path: "/guide", + component: () => import("../view/guide.vue"), }, { - path: '/home', - component: () => import('../view/home.vue'), + path: "/home", + component: () => import("../view/home.vue"), children: [ + // { + // name: '登录', + // path: '/login/index', + // component: () => import('../view/login/LoginZZD.vue'), + // }, { - name: '首页', - path: '/home/index', - component: () => import('../view/sy.vue'), + name: "首页", + path: "/home/index", + component: () => import("../view/sy.vue"), }, { - name: '养老', - path: '/home/yl', - component: () => import('../view/yl.vue'), + name: "养老", + path: "/home/yl", + component: () => import("../view/yl.vue"), }, { - name: '卫生', - path: '/home/hygiene', - component: () => import('../view/hygiene.vue'), + name: "卫生", + path: "/home/hygiene", + component: () => import("../view/hygiene.vue"), }, { - name: '教育', - path: '/home/education', - component: () => import('../view/education.vue'), + name: "教育", + path: "/home/education", + component: () => import("../view/education.vue"), }, { - name: '就业补助', - path: '/home/work', - component: () => import('../view/work.vue'), + name: "就业补助", + path: "/home/work", + component: () => import("../view/work.vue"), }, { - name: '智能分析', - path: '/home/analyze', - component: () => import('../view/analyze.vue'), + name: "智能分析", + path: "/home/analyze", + component: () => import("../view/analyze.vue"), }, { - name: '首页地图', - path: '/home/index/map', - component: () => import('../view/sy_map.vue'), + name: "首页地图", + path: "/home/index/map", + component: () => import("../view/sy_map.vue"), }, { - name: '首页表格', - path: '/home/index/table', - component: () => import('../view/sy_table.vue'), + name: "首页表格", + path: "/home/index/table", + component: () => import("../view/sy_table.vue"), }, { - name: '首页表格详情', - path: '/home/index/table/details', - component: () => import('../view/sy_details.vue'), + name: "首页表格详情", + path: "/home/index/table/details", + component: () => import("../view/sy_details.vue"), }, { - name: '人物图', - path: '/home/index/person', - component: () => import('../view/person/index.vue'), + name: "人物图", + path: "/home/index/person", + component: () => import("../view/person/index.vue"), }, // { // name: '地图编辑', // path: '/home/index/mapEdit', // component: () => import('../view/sy_map_fb.vue'), // }, - ] + ], }, - ] -}) + ], +}); function getCookie(cname) { - var cn = cname - const cookies = document.cookie.split('; '); + var cn = cname; + const cookies = document.cookie.split("; "); for (let i = 0; i < cookies.length; i++) { - const [name, value] = cookies[i].split('='); + const [name, value] = cookies[i].split("="); if (name === cn) { return value; } @@ -100,26 +106,35 @@ function getCookie(cname) { } router.beforeEach((to, form, next) => { - var token = getCookie('lytoken') - // console.log('token', token) - if (token == '') { - window.location.href = - 'http://220.191.238.50:996/api/login?returnURL=' + - window.location.href + // var token = getCookie('lytoken') + // // console.log('token', token) + // if (token == '') { + // window.location.href = + // 'http://220.191.238.50:996/api/login?returnURL=' + + // window.location.href + // } else { + // // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => { + // // if (res.code == '500') { + // // window.location.href = + // // 'http://220.191.238.50:996/api/login?returnURL=' + + // // window.location.href + // // } else { + // // tools.data.set('token',token) + // next(); + // // } + // // }); + // tools.data.set('token', token) + // next(); + // } + let type = tools.data.get("type"); + if (type) { + console.log(1111); + + next(); } else { - // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => { - // if (res.code == '500') { - // window.location.href = - // 'http://220.191.238.50:996/api/login?returnURL=' + - // window.location.href - // } else { - // tools.data.set('token',token) - // next(); - // } - // }); - tools.data.set('token', token) + window.location.href = "http://localhost:8080/#/guide"; next(); } -}) +}); -export default router \ No newline at end of file +export default router; diff --git a/src/utils/request.js b/src/utils/request.js index ca4868b..33b0fb6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,6 +1,8 @@ import axios from "axios"; import { ElMessage } from "element-plus"; import tools from "@/utils/tools"; + +import dd from "gdt-jsapi"; import router from "../router"; // axios.defaults.baseURL = '/api' axios.defaults.timeout = 120000; diff --git a/src/view/guide.vue b/src/view/guide.vue index 3554cb0..a83f9f4 100644 --- a/src/view/guide.vue +++ b/src/view/guide.vue @@ -61,6 +61,9 @@