vue2-client 1.4.56 → 1.4.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.4.57 -2022-11-27 @江超**
5
+ - 优化登录态和未登录态的页面跳转方式
6
+
4
7
  **1.4.54 - 1.4.56 -2022-11-25 @江超**
5
8
  - 现在登录时会清除indexedDB缓存了
6
9
  - 增加查询系统访问记录的接口
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.4.56",
3
+ "version": "1.4.57",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,70 +1,70 @@
1
- <template>
2
- <div class="exception-page">
3
- <div class="img">
4
- <img :src="config[type].img" alt=""/>
5
- </div>
6
- <div class="content">
7
- <h1>{{ config[type].title }}</h1>
8
- <div class="desc">{{ config[type].desc }}</div>
9
- <div class="action">
10
- <a-button type="primary" @click="backHome">返回登录页</a-button>
11
- </div>
12
- </div>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- import Config from './typeConfig'
18
-
19
- export default {
20
- name: 'ExceptionPage',
21
- // eslint-disable-next-line vue/require-prop-types
22
- props: ['type', 'homeRoute'],
23
- data () {
24
- return {
25
- config: Config
26
- }
27
- },
28
- methods: {
29
- backHome () {
30
- if (this.homeRoute) {
31
- this.$router.push('/login')
32
- }
33
- this.$emit('backHome', this.type)
34
- }
35
- }
36
- }
37
- </script>
38
-
39
- <style lang="less" scoped>
40
- .exception-page{
41
- border-radius: 4px;
42
- display: flex;
43
- justify-content: center;
44
- align-items: center;
45
- background-color: @base-bg-color;
46
- .img{
47
- padding-right: 52px;
48
- zoom: 1;
49
- img{
50
- max-width: 430px;
51
- }
52
- }
53
- .content{
54
- h1{
55
- color: #434e59;
56
- font-size: 72px;
57
- font-weight: 600;
58
- line-height: 72px;
59
- margin-bottom: 24px;
60
- }
61
- .desc{
62
- color: @text-color-second;
63
- font-size: 20px;
64
- line-height: 28px;
65
- margin-bottom: 16px;
66
- }
67
- }
68
- }
69
-
70
- </style>
1
+ <template>
2
+ <div class="exception-page">
3
+ <div class="img">
4
+ <img :src="config[type].img" alt=""/>
5
+ </div>
6
+ <div class="content">
7
+ <h1>{{ config[type].title }}</h1>
8
+ <div class="desc">{{ config[type].desc }}</div>
9
+ <div class="action">
10
+ <a-button type="primary" @click="backHome">返回首页</a-button>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import Config from './typeConfig'
18
+
19
+ export default {
20
+ name: 'ExceptionPage',
21
+ // eslint-disable-next-line vue/require-prop-types
22
+ props: ['type', 'homeRoute'],
23
+ data () {
24
+ return {
25
+ config: Config
26
+ }
27
+ },
28
+ methods: {
29
+ backHome () {
30
+ if (this.homeRoute) {
31
+ this.$router.push(this.homeRoute)
32
+ }
33
+ this.$emit('backHome', this.type)
34
+ }
35
+ }
36
+ }
37
+ </script>
38
+
39
+ <style lang="less" scoped>
40
+ .exception-page{
41
+ border-radius: 4px;
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ background-color: @base-bg-color;
46
+ .img{
47
+ padding-right: 52px;
48
+ zoom: 1;
49
+ img{
50
+ max-width: 430px;
51
+ }
52
+ }
53
+ .content{
54
+ h1{
55
+ color: #434e59;
56
+ font-size: 72px;
57
+ font-weight: 600;
58
+ line-height: 72px;
59
+ margin-bottom: 24px;
60
+ }
61
+ .desc{
62
+ color: @text-color-second;
63
+ font-size: 20px;
64
+ line-height: 28px;
65
+ margin-bottom: 16px;
66
+ }
67
+ }
68
+ }
69
+
70
+ </style>
@@ -1,21 +1,25 @@
1
- <template>
2
- <exception-page :home-route="homePage" :style="`min-height: ${minHeight}`" type="404" />
3
- </template>
4
-
5
- <script>
6
- import ExceptionPage from '@vue2-client/components/exception/ExceptionPage'
7
- import { mapState } from 'vuex'
8
- export default {
9
- name: 'Exp404',
10
- components: { ExceptionPage },
11
- computed: {
12
- ...mapState('setting', ['pageMinHeight', 'homePage']),
13
- minHeight () {
14
- return this.pageMinHeight ? this.pageMinHeight + 'px' : '100vh'
15
- }
16
- }
17
- }
18
- </script>
19
-
20
- <style scoped lang="less">
21
- </style>
1
+ <template>
2
+ <exception-page :home-route="homePage" :style="`min-height: ${minHeight}`" type="404" />
3
+ </template>
4
+
5
+ <script>
6
+ import ExceptionPage from '@vue2-client/components/exception/ExceptionPage'
7
+ import { mapState } from 'vuex'
8
+ const { homePage } = require('@vue2-client/config')
9
+ export default {
10
+ name: 'Exp404',
11
+ components: { ExceptionPage },
12
+ computed: {
13
+ homePage () {
14
+ return homePage
15
+ },
16
+ ...mapState('setting', ['pageMinHeight']),
17
+ minHeight () {
18
+ return this.pageMinHeight ? this.pageMinHeight + 'px' : '100vh'
19
+ }
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <style scoped lang="less">
25
+ </style>
@@ -1,67 +1,68 @@
1
- // 视图组件
2
- const view = {
3
- tabs: () => import('@vue2-client/layouts/tabs'),
4
- blank: () => import('@vue2-client/layouts/BlankView'),
5
- page: () => import('@vue2-client/layouts/PageView')
6
- }
7
- // 动态路由对象定义
8
- const routerResource = {}
9
- // --------------------------------------基本视图组件--------------------------------------
10
- // 空白视图
11
- routerResource.blank = view.blank
12
- // 单页面视图
13
- routerResource.singlePage = view.blank
14
-
15
- // --------------------------------------仪表盘--------------------------------------
16
- routerResource.dashboard = view.blank
17
- // 工作台
18
- routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
19
- // --------------------------------------系统配置--------------------------------------
20
- routerResource.system = view.blank
21
- // 报表测试用页面
22
- routerResource.testPage = () => import('@vue2-client/pages/ReportView.vue')
23
- // 字典管理
24
- routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
25
- // 查询配置管理
26
- routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
27
- // 文件管理
28
- routerResource.fileManager = () => import('@vue2-client/pages/system/file')
29
- // 登录日志
30
- routerResource.loginInfor = () => import('@vue2-client/pages/system/monitor/loginInfor')
31
- // 操作日志
32
- routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog')
33
- // 系统问题反馈工单
34
- routerResource.submitTicket = () => import(/* webpackChunkName: "submitTicket" */ '@vue2-client/pages/system/ticket')
35
-
36
- // 基础路由组件注册
37
- const routerMap = {
38
- login: {
39
- authority: '*',
40
- path: '/login',
41
- component: () => import('@vue2-client/pages/login')
42
- },
43
- root: {
44
- path: '/',
45
- name: '首页',
46
- redirect: '/login',
47
- component: view.tabs
48
- },
49
- exp403: {
50
- authority: '*',
51
- name: 'exp403',
52
- path: '403',
53
- component: () => import('@vue2-client/pages/exception/403')
54
- },
55
- exp404: {
56
- name: 'exp404',
57
- path: '404',
58
- component: () => import('@vue2-client/pages/exception/404')
59
- },
60
- exp500: {
61
- name: 'exp500',
62
- path: '500',
63
- component: () => import('@vue2-client/pages/exception/500')
64
- }
65
- }
66
- Object.assign(routerMap, routerResource)
67
- export default routerMap
1
+ const { homePage } = require('../../config')
2
+ // 视图组件
3
+ const view = {
4
+ tabs: () => import('@vue2-client/layouts/tabs'),
5
+ blank: () => import('@vue2-client/layouts/BlankView'),
6
+ page: () => import('@vue2-client/layouts/PageView')
7
+ }
8
+ // 动态路由对象定义
9
+ const routerResource = {}
10
+ // --------------------------------------基本视图组件--------------------------------------
11
+ // 空白视图
12
+ routerResource.blank = view.blank
13
+ // 单页面视图
14
+ routerResource.singlePage = view.blank
15
+
16
+ // --------------------------------------仪表盘--------------------------------------
17
+ routerResource.dashboard = view.blank
18
+ // 工作台
19
+ routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
20
+ // --------------------------------------系统配置--------------------------------------
21
+ routerResource.system = view.blank
22
+ // 报表测试用页面
23
+ routerResource.testPage = () => import('@vue2-client/pages/ReportView.vue')
24
+ // 字典管理
25
+ routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
26
+ // 查询配置管理
27
+ routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
28
+ // 文件管理
29
+ routerResource.fileManager = () => import('@vue2-client/pages/system/file')
30
+ // 登录日志
31
+ routerResource.loginInfor = () => import('@vue2-client/pages/system/monitor/loginInfor')
32
+ // 操作日志
33
+ routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog')
34
+ // 系统问题反馈工单
35
+ routerResource.submitTicket = () => import(/* webpackChunkName: "submitTicket" */ '@vue2-client/pages/system/ticket')
36
+
37
+ // 基础路由组件注册
38
+ const routerMap = {
39
+ login: {
40
+ authority: '*',
41
+ path: '/login',
42
+ component: () => import('@vue2-client/pages/login')
43
+ },
44
+ root: {
45
+ path: '/',
46
+ name: '首页',
47
+ redirect: homePage,
48
+ component: view.tabs
49
+ },
50
+ exp403: {
51
+ authority: '*',
52
+ name: 'exp403',
53
+ path: '403',
54
+ component: () => import('@vue2-client/pages/exception/403')
55
+ },
56
+ exp404: {
57
+ name: 'exp404',
58
+ path: '404',
59
+ component: () => import('@vue2-client/pages/exception/404')
60
+ },
61
+ exp500: {
62
+ name: 'exp500',
63
+ path: '500',
64
+ component: () => import('@vue2-client/pages/exception/500')
65
+ }
66
+ }
67
+ Object.assign(routerMap, routerResource)
68
+ export default routerMap
@@ -1,104 +1,104 @@
1
- import { hasAuthority } from '@vue2-client/utils/authority-utils'
2
- import { loginIgnore } from '@vue2-client/router/index'
3
- import { checkAuthorization } from '@vue2-client/utils/request'
4
- import NProgress from 'nprogress'
5
-
6
- NProgress.configure({ showSpinner: false })
7
-
8
- /**
9
- * 进度条开始
10
- * @param to
11
- * @param form
12
- * @param next
13
- */
14
- const progressStart = (to, from, next) => {
15
- // start progress bar
16
- if (!NProgress.isStarted()) {
17
- NProgress.start()
18
- }
19
- next()
20
- }
21
-
22
- /**
23
- * 登录守卫
24
- * @param to
25
- * @param form
26
- * @param next
27
- * @param options
28
- */
29
- const loginGuard = (to, from, next, options) => {
30
- const { message } = options
31
- if (!loginIgnore.includes(to) && !checkAuthorization()) {
32
- message.warning('登录已失效,请重新登录')
33
- next({ path: '/login' })
34
- } else {
35
- next()
36
- }
37
- }
38
-
39
- /**
40
- * 权限守卫
41
- * @param to
42
- * @param form
43
- * @param next
44
- * @param options
45
- */
46
- const authorityGuard = (to, from, next, options) => {
47
- const { store, message } = options
48
- const permissions = store.getters['account/permissions']
49
- const roles = store.getters['account/roles']
50
- if (!hasAuthority(to, permissions, roles)) {
51
- message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
52
- next({ path: '/403' })
53
- // NProgress.done()
54
- } else {
55
- next()
56
- }
57
- }
58
-
59
- /**
60
- * 混合导航模式下一级菜单跳转重定向
61
- * @param to
62
- * @param from
63
- * @param next
64
- * @param options
65
- * @returns {*}
66
- */
67
- const redirectGuard = (to, from, next, options) => {
68
- const { store } = options
69
- const getFirstChild = (routes) => {
70
- const route = routes[0]
71
- if (!route.children || route.children.length === 0) {
72
- return route
73
- }
74
- return getFirstChild(route.children)
75
- }
76
- if (store.state.setting.layout === 'mix') {
77
- const firstMenu = store.getters['setting/firstMenu']
78
- if (firstMenu.find(item => item.fullPath === to.fullPath)) {
79
- store.commit('setting/setActivatedFirst', to.fullPath)
80
- const subMenu = store.getters['setting/subMenu']
81
- if (subMenu.length > 0) {
82
- const redirect = getFirstChild(subMenu)
83
- return next({ path: redirect.fullPath })
84
- }
85
- }
86
- }
87
- next()
88
- }
89
-
90
- /**
91
- * 进度条结束
92
- * @param to
93
- * @param form
94
- * @param options
95
- */
96
- const progressDone = () => {
97
- // finish progress bar
98
- NProgress.done()
99
- }
100
-
101
- export default {
102
- beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
103
- afterEach: [progressDone]
104
- }
1
+ import { hasAuthority } from '@vue2-client/utils/authority-utils'
2
+ import { loginIgnore } from '@vue2-client/router/index'
3
+ import { checkAuthorization } from '@vue2-client/utils/request'
4
+ import NProgress from 'nprogress'
5
+
6
+ NProgress.configure({ showSpinner: false })
7
+
8
+ /**
9
+ * 进度条开始
10
+ * @param to
11
+ * @param form
12
+ * @param next
13
+ */
14
+ const progressStart = (to, from, next) => {
15
+ // start progress bar
16
+ if (!NProgress.isStarted()) {
17
+ NProgress.start()
18
+ }
19
+ next()
20
+ }
21
+
22
+ /**
23
+ * 登录守卫
24
+ * @param to
25
+ * @param form
26
+ * @param next
27
+ * @param options
28
+ */
29
+ const loginGuard = (to, from, next, options) => {
30
+ const { message } = options
31
+ if ((!loginIgnore.includes(to) || to.name === '404') && !checkAuthorization()) {
32
+ message.warning('登录已失效,请重新登录')
33
+ next({ path: '/login' })
34
+ } else {
35
+ next()
36
+ }
37
+ }
38
+
39
+ /**
40
+ * 权限守卫
41
+ * @param to
42
+ * @param form
43
+ * @param next
44
+ * @param options
45
+ */
46
+ const authorityGuard = (to, from, next, options) => {
47
+ const { store, message } = options
48
+ const permissions = store.getters['account/permissions']
49
+ const roles = store.getters['account/roles']
50
+ if (!hasAuthority(to, permissions, roles)) {
51
+ message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
52
+ next({ path: '/403' })
53
+ // NProgress.done()
54
+ } else {
55
+ next()
56
+ }
57
+ }
58
+
59
+ /**
60
+ * 混合导航模式下一级菜单跳转重定向
61
+ * @param to
62
+ * @param from
63
+ * @param next
64
+ * @param options
65
+ * @returns {*}
66
+ */
67
+ const redirectGuard = (to, from, next, options) => {
68
+ const { store } = options
69
+ const getFirstChild = (routes) => {
70
+ const route = routes[0]
71
+ if (!route.children || route.children.length === 0) {
72
+ return route
73
+ }
74
+ return getFirstChild(route.children)
75
+ }
76
+ if (store.state.setting.layout === 'mix') {
77
+ const firstMenu = store.getters['setting/firstMenu']
78
+ if (firstMenu.find(item => item.fullPath === to.fullPath)) {
79
+ store.commit('setting/setActivatedFirst', to.fullPath)
80
+ const subMenu = store.getters['setting/subMenu']
81
+ if (subMenu.length > 0) {
82
+ const redirect = getFirstChild(subMenu)
83
+ return next({ path: redirect.fullPath })
84
+ }
85
+ }
86
+ }
87
+ next()
88
+ }
89
+
90
+ /**
91
+ * 进度条结束
92
+ * @param to
93
+ * @param form
94
+ * @param options
95
+ */
96
+ const progressDone = () => {
97
+ // finish progress bar
98
+ NProgress.done()
99
+ }
100
+
101
+ export default {
102
+ beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
103
+ afterEach: [progressDone]
104
+ }