202aa77a by 任超

Merge branch 'master' into dev

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