|
@@ -1,38 +1,38 @@
|
|
|
-import { createRouter, createWebHistory } from 'vue-router'
|
|
|
-import {hzybRoutes} from './hzyb/index'// 弘则研报小程序路由
|
|
|
-import {cygxRoutes} from './cygx/index'// 查研观向小程序路由
|
|
|
-import {hzslRoutes} from './hzsl/index'// 弘则思路小程序路由
|
|
|
-import {htgjRoutes} from './htgj/index'// 海通国际 APP 路由
|
|
|
+import { createRouter, createWebHistory } from "vue-router";
|
|
|
+import { hzybRoutes } from "./hzyb/index"; // 弘则研报小程序路由
|
|
|
+import { cygxRoutes } from "./cygx/index"; // 查研观向小程序路由
|
|
|
+import { hzslRoutes } from "./hzsl/index"; // 弘则思路小程序路由
|
|
|
+import { htgjRoutes } from "./htgj/index"; // 海通国际 APP 路由
|
|
|
import store from "@/store";
|
|
|
-const routes=[
|
|
|
- ...hzybRoutes,
|
|
|
- ...cygxRoutes,
|
|
|
- ...hzslRoutes,
|
|
|
- ...htgjRoutes,
|
|
|
- //404
|
|
|
- {
|
|
|
- path: "/:pathMatch(.*)",
|
|
|
- name:"404",
|
|
|
- component: () => import("@/views/Error.vue"),
|
|
|
- },
|
|
|
-]
|
|
|
+const routes = [
|
|
|
+ ...hzybRoutes,
|
|
|
+ ...cygxRoutes,
|
|
|
+ ...hzslRoutes,
|
|
|
+ ...htgjRoutes,
|
|
|
+ //404
|
|
|
+ {
|
|
|
+ path: "/:pathMatch(.*)",
|
|
|
+ name: "404",
|
|
|
+ component: () => import("@/views/Error.vue"),
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
const router = createRouter({
|
|
|
- history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
|
|
|
- routes
|
|
|
-})
|
|
|
+ history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
|
|
|
+ routes,
|
|
|
+});
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- if(to.fullPath.includes('htgj')) {
|
|
|
- to.query.userName = '哔哩哔哩老电视-0001'
|
|
|
- to.query.sign = 77777
|
|
|
- let data = {
|
|
|
- name: to.query.userName,
|
|
|
- sign: to.query.sign
|
|
|
- }
|
|
|
- store.commit('getUserData', data)
|
|
|
- }
|
|
|
- next();
|
|
|
-})
|
|
|
+ if (to.fullPath.includes("htgj")) {
|
|
|
+ let data = {
|
|
|
+ name: to.query.userName,
|
|
|
+ sign: to.query.sign,
|
|
|
+ }
|
|
|
+ if(!store.state.userData.name || !store.state.userData.sign){
|
|
|
+ store.commit("getUserData", data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ next();
|
|
|
+});
|
|
|
|
|
|
-export default router
|
|
|
+export default router;
|