202aa77a by 任超

Merge branch 'master' into dev

2 parents 7db45342 72c5f279
1 <!-- 1 <!--
2 * @Description: log 2 * @Description: log
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 14:40:06 4 * @LastEditTime: 2023-03-23 16:29:12
5 --> 5 -->
6 <template> 6 <template>
7 <el-menu router :default-active="activeMenu" mode="horizontal"> 7 <el-menu router :default-active="activeMenu" mode="horizontal">
8 <!-- 权限菜单 --> 8 <!-- 权限菜单 -->
9 <sidebar-item v-for="route in permission_routes.slice(3, 6)" :key="route.path" :item="route" 9 <sidebar-item v-for="route in permission_routes.slice(4, 7)" :key="route.path" :item="route"
10 :base-path="route.path" /> 10 :base-path="route.path" />
11 <!-- 菜单全部展示 --> 11 <!-- 菜单全部展示 -->
12 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> --> 12 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
2 * @Author: xiaomiao 1158771342@qq.com 2 * @Author: xiaomiao 1158771342@qq.com
3 * @Date: 2023-01-10 09:03:06 3 * @Date: 2023-01-10 09:03:06
4 * @LastEditors: Please set LastEditors 4 * @LastEditors: Please set LastEditors
5 * @LastEditTime: 2023-03-22 10:43:26 5 * @LastEditTime: 2023-03-23 16:29:24
6 * @FilePath: \监管系统\js-web-jianguan\src\layout\components\Sidebar\sidebarRight.vue 6 * @FilePath: \监管系统\js-web-jianguan\src\layout\components\Sidebar\sidebarRight.vue
7 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE 7 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8 --> 8 -->
9 <template> 9 <template>
10 <el-menu router :default-active="activeMenu" mode="horizontal"> 10 <el-menu router :default-active="activeMenu" mode="horizontal">
11 <!-- 权限菜单 --> 11 <!-- 权限菜单 -->
12 <sidebar-item v-for="route in permission_routes.slice(6, 9)" :key="route.path" :item="route" 12 <sidebar-item v-for="route in permission_routes.slice(7, 10)" :key="route.path" :item="route"
13 :base-path="route.path" /> 13 :base-path="route.path" />
14 <!-- 菜单全部展示 --> 14 <!-- 菜单全部展示 -->
15 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> --> 15 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 <h4>不动产登记上报系统</h4> 6 <h4>不动产登记上报系统</h4>
7 </div> 7 </div>
8 <div class="right-menu"> 8 <div class="right-menu">
9 <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover" @command="handleCommand"> 9 <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover">
10 <div class="user"> 10 <div class="user">
11 {{ userName }} 11 {{ userName }}
12 <span @click="onCancel"> 12 <span @click="onCancel">
......
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-06 16:18:21 4 * @LastEditTime: 2023-03-23 16:17:42
5 --> 5 -->
6 <template> 6 <template>
7 <div> 7 <div>
...@@ -19,41 +19,38 @@ ...@@ -19,41 +19,38 @@
19 </template> 19 </template>
20 20
21 <script> 21 <script>
22 import { mapGetters } from 'vuex' 22 import { mapGetters } from 'vuex'
23 import Logo from './Logo' 23 import Logo from './Logo'
24 import defaultSettings from '@/settings' 24 import defaultSettings from '@/settings'
25 import SidebarItem from './SidebarItem' 25 import SidebarItem from './SidebarItem'
26 import variables from '@/styles/variables.scss' 26 import variables from '@/styles/variables.scss'
27 import { asyncRoutes } from '@/router' 27 import { asyncRoutes } from '@/router'
28 export default { 28 export default {
29 components: { SidebarItem, Logo }, 29 components: { SidebarItem, Logo },
30 data () { 30 data () {
31 return { 31 return {
32 title: defaultSettings.title 32 title: defaultSettings.title
33 }
34 },
35 computed: {
36 ...mapGetters(['permission_routes', 'sidebar']),
37 activeMenu () {
38 const route = this.$route
39 const { meta, path } = route
40 if (meta.activeMenu) {
41 return meta.activeMenu
33 } 42 }
43 return path
34 }, 44 },
35 created () { 45 variables () {
36 console.log(this.permission_routes); 46 return variables
37 },
38 computed: {
39 ...mapGetters(['permission_routes', 'sidebar']),
40 activeMenu () {
41 const route = this.$route
42 const { meta, path } = route
43 if (meta.activeMenu) {
44 return meta.activeMenu
45 }
46 return path
47 },
48 variables () {
49 return variables
50 },
51 asyncRoutes () {
52 return asyncRoutes
53 }
54 }, 47 },
55 mounted () { 48 asyncRoutes () {
56 49 return asyncRoutes
57 } 50 }
51 },
52 mounted () {
53 console.log(this.permission_routes, 'permission_routespermission_routes');
58 } 54 }
55 }
59 </script> 56 </script>
......
1 <template> 1 <template>
2 <div id="tags-view-container" class="tags-view-container"> 2 <div id="tags-view-container" class="tags-view-container">
3 <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll"> 3 <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
4 <router-link v-for="tag in visitedViews" ref="tag" :key="tag.path" :class="isActive(tag)?'active':''" 4 <router-link v-for="tag in visitedViews" ref="tag" :key="tag.path" :class="isActive(tag) ? 'active' : ''"
5 :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" tag="span" class="tags-view-item" 5 :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" tag="span" class="tags-view-item"
6 @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" 6 @click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''" @contextmenu.prevent.native="openMenu(tag, $event)">
7 @contextmenu.prevent.native="openMenu(tag,$event)">
8 {{ tag.title }} 7 {{ tag.title }}
9 <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" /> 8 <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
10 </router-link> 9 </router-link>
11 </scroll-pane> 10 </scroll-pane>
12 <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> 11 <ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
13 <li @click="refreshSelectedTag(selectedTag)">Refresh</li> 12 <li @click="refreshSelectedTag(selectedTag)">Refresh</li>
14 <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li> 13 <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li>
15 <li @click="closeOthersTags">Close Others</li> 14 <li @click="closeOthersTags">Close Others</li>
...@@ -200,6 +199,7 @@ export default { ...@@ -200,6 +199,7 @@ export default {
200 padding-top: 3px; 199 padding-top: 3px;
201 box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04); 200 box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
202 margin-bottom: 5px; 201 margin-bottom: 5px;
202
203 .tags-view-wrapper { 203 .tags-view-wrapper {
204 .tags-view-item { 204 .tags-view-item {
205 display: inline-block; 205 display: inline-block;
......
1 /*
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 14:47:38
5 */
6 let mixin = {
7
8 methods: {
9
10 }
11 }
12 export default mixin
...\ No newline at end of file ...\ No newline at end of file
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 15:17:36 4 * @LastEditTime: 2023-03-23 16:37:20
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import router from "./router"; 7 import router from "./router";
...@@ -26,36 +26,46 @@ router.beforeEach(async (to, from, next) => { ...@@ -26,36 +26,46 @@ router.beforeEach(async (to, from, next) => {
26 next(); 26 next();
27 } else { 27 } else {
28 let code = Vue.prototype.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT" 28 let code = Vue.prototype.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT"
29 //请求用户信息 29 //判断token是否存在
30 if (!hasUser) { 30 const hasToken = localStorage.getItem("token");
31 store.dispatch("user/getUserInfo"); 31 if (hasToken) {
32 } 32 //请求用户信息
33 if (hasAddRoute) { 33 if (!hasUser) {
34 next(); 34 store.dispatch("user/getUserInfo");
35 } else {
36 //请求菜单
37 const { result: getMenuData } = (await getMenuInfo(code)) || [];
38 const accessRoutes = await store.dispatch(
39 "permission/generateRoutes",
40 getMenuData
41 );
42 router.addRoutes([
43 ...accessRoutes,
44 { path: "*", redirect: "/404", hidden: true }
45 ]);
46 const routeTo = Cookies.get("routerTo");
47 if (!hasAddDict) {
48 await store.dispatch("dict/generateDic");
49 } 35 }
50 if (routeTo && routeTo !== "/" && routeTo !== "/sb" && routeTo !== "/jg") { 36 if (hasAddRoute) {
51 next({ ...to, replace: true });
52 } else {
53 next(); 37 next();
38 } else {
39 //请求菜单
40 const { result: getMenuData } = (await getMenuInfo(code)) || [];
41 const accessRoutes = await store.dispatch(
42 "permission/generateRoutes",
43 getMenuData
44 );
45 router.addRoutes([
46 ...accessRoutes,
47 { path: "*", redirect: "/404", hidden: true },
48 ]);
49 const routeTo = Cookies.get("routerTo");
50 if (!hasAddDict) {
51 await store.dispatch("dict/generateDic");
52 }
53 if (routeTo && routeTo !== "/" && routeTo !== "/sb" && routeTo !== "/jg") {
54 next({ ...to, replace: true });
55 } else {
56 next();
57 }
58 }
59 } else {
60 if (code == 'BDCSBPT') {
61 next('/sb');
62 } else {
63 next('/jg');
54 } 64 }
55 } 65 }
56 } 66 }
57 NProgress.done() 67 NProgress.done();
58 }) 68 });
59 router.afterEach((to) => { 69 router.afterEach((to) => {
60 // 解决刷新页面报404问题 70 // 解决刷新页面报404问题
61 Cookies.set("routerTo", to.fullPath); 71 Cookies.set("routerTo", to.fullPath);
......
...@@ -29,15 +29,24 @@ export const constantRoutes = [ ...@@ -29,15 +29,24 @@ export const constantRoutes = [
29 name: "loginsb", 29 name: "loginsb",
30 component: () => import("@/views/loginsb/index.vue"), 30 component: () => import("@/views/loginsb/index.vue"),
31 }, 31 },
32 // 监管首页
33 { 32 {
34 path: '/', 33 path: '/',
34 redirect: to => {
35 if (Vue.prototype.BASE_API.THEME == 'jg') {
36 return { path: '/jg' }
37 } else {
38 return { path: '/sb' }
39 }
40 },
41 },
42 // 监管首页
43 {
44 path: '/home',
35 component: Layout, 45 component: Layout,
36 redirect: '/sb',
37 meta: { title: '首页' }, 46 meta: { title: '首页' },
38 children: [ 47 children: [
39 { 48 {
40 path: 'home', 49 path: '',
41 component: () => import('@/views/home/index'), 50 component: () => import('@/views/home/index'),
42 name: 'home', 51 name: 'home',
43 meta: { title: '工作台', icon: 'workbench', affix: true } 52 meta: { title: '工作台', icon: 'workbench', affix: true }
......
1 const state = { 1 const state = {
2 visitedViews: [{ 2 visitedViews: []
3 'fullPath': "/home",
4 'meta': {
5 affix: true
6 },
7 'name': "Dashboard",
8 'path': "/home",
9 'title': "工作台"
10 }]
11 } 3 }
12
13 const mutations = { 4 const mutations = {
14 ADD_VISITED_VIEW: (state, view) => { 5 ADD_VISITED_VIEW: (state, view) => {
15 if (state.visitedViews.some(v => v.path === view.path)) return 6 if (state.visitedViews.some(v => v.path === view.path)) return
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
39 <script> 39 <script>
40 import { getMenuInfo } from "@/api/user"; 40 import { getMenuInfo } from "@/api/user";
41 import { loginIn } from "@/api/login.js"; 41 import { loginIn } from "@/api/login.js";
42 import { api, getAction } from "@/api/manageApi";
43 export default { 42 export default {
44 name: "sbLogin", 43 name: "sbLogin",
45 data () { 44 data () {
...@@ -114,6 +113,14 @@ export default { ...@@ -114,6 +113,14 @@ export default {
114 const { result: getMenuData } = (await getMenuInfo(code)) || []; 113 const { result: getMenuData } = (await getMenuInfo(code)) || [];
115 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path 114 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path
116 //登录成功后需判断有无重定向,没有重定向则跳转首页 115 //登录成功后需判断有无重定向,没有重定向则跳转首页
116 const accessRoutes = await this.$store.dispatch(
117 "permission/generateRoutes",
118 getMenuData
119 );
120 this.$router.addRoutes([
121 ...accessRoutes,
122 { path: "*", redirect: "/404", hidden: true },
123 ]);
117 this.$router.replace(this.$route.query.redirect || path1); 124 this.$router.replace(this.$route.query.redirect || path1);
118 } 125 }
119 } 126 }
......