ry-vue-map 0.0.1 → 0.0.2
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/README.MD +2 -186
- package/lib/ryui.common.js +7 -7
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.umd.js +7 -7
- package/lib/ryui.umd.js.gz +0 -0
- package/package.json +3 -5
- package/src/main.js +5 -9
- package/src/router/index.js +1 -37
- package/src/store/index.js +1 -6
- package/src/styles/index.scss +1 -2
- package/vue.config.js +1 -1
- package/src/config/setting.js +0 -40
- package/src/layout/components/footer.vue +0 -35
- package/src/layout/components/header-right.vue +0 -135
- package/src/layout/components/notice.vue +0 -418
- package/src/layout/components/password.vue +0 -133
- package/src/layout/index.vue +0 -252
- package/src/store/getters.js +0 -7
- package/src/store/modules/theme.js +0 -544
- package/src/store/modules/user.js +0 -74
- package/src/utils/index.js +0 -4
- package/src/utils/page-tab-util.js +0 -106
- package/src/utils/permission.js +0 -118
- package/src/utils/request.js +0 -68
- package/src/utils/token-util.js +0 -40
- package/src/views/exception/403.vue +0 -31
- package/src/views/exception/404.vue +0 -31
- package/src/views/exception/500.vue +0 -31
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 页签操作封装
|
|
3
|
-
*/
|
|
4
|
-
import store from '@/store';
|
|
5
|
-
import router from '@/router';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 刷新当前tab
|
|
9
|
-
*/
|
|
10
|
-
export function reloadPageTab() {
|
|
11
|
-
const { path, query, matched } = router.currentRoute;
|
|
12
|
-
const components = new Set();
|
|
13
|
-
matched.forEach((m) => {
|
|
14
|
-
if (m.components?.default?.name) {
|
|
15
|
-
if (
|
|
16
|
-
!['EleEmptyLayout', 'EleLayout'].includes(m.components.default.name)
|
|
17
|
-
) {
|
|
18
|
-
components.add(m.components.default.name);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
store
|
|
23
|
-
.dispatch('theme/setKeepAliveExclude', Array.from(components))
|
|
24
|
-
.then(() => {
|
|
25
|
-
router.replace({
|
|
26
|
-
query: query,
|
|
27
|
-
path: '/redirect' + path
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 关闭当前tab
|
|
34
|
-
*/
|
|
35
|
-
export function finishPageTab() {
|
|
36
|
-
store
|
|
37
|
-
.dispatch('theme/tabRemove', router.currentRoute.fullPath)
|
|
38
|
-
.then(({ lastPath }) => {
|
|
39
|
-
router.push(lastPath || '/');
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 移除指定tab
|
|
45
|
-
* @param key {string} tab的key
|
|
46
|
-
* @param active {string} 当前选中tab
|
|
47
|
-
*/
|
|
48
|
-
export function removePageTab(key, active) {
|
|
49
|
-
store.dispatch('theme/tabRemove', key).then(({ lastPath }) => {
|
|
50
|
-
if (active && key === active) {
|
|
51
|
-
router.push(lastPath || '/');
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 移除所有tab
|
|
58
|
-
* @param active {string} 当前选中tab
|
|
59
|
-
*/
|
|
60
|
-
export function removeAllPageTab(active) {
|
|
61
|
-
store.dispatch('theme/tabRemoveAll').then(() => {
|
|
62
|
-
if (active && active !== '/') {
|
|
63
|
-
router.push('/');
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 移除左侧tab
|
|
70
|
-
* @param key {string} tab的key
|
|
71
|
-
*/
|
|
72
|
-
export function removeLeftPageTab(key) {
|
|
73
|
-
return store.dispatch('theme/tabRemoveLeft', key);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* 移除右侧tab
|
|
78
|
-
* @param key {string} tab的key
|
|
79
|
-
*/
|
|
80
|
-
export function removeRightPageTab(key) {
|
|
81
|
-
return store.dispatch('theme/tabRemoveRight', key);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 移除其他tab
|
|
86
|
-
* @param key {string} tab的key
|
|
87
|
-
*/
|
|
88
|
-
export function removeOtherPageTab(key) {
|
|
89
|
-
return store.dispatch('theme/tabRemoveOther', key);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 添加tab
|
|
94
|
-
* @param obj
|
|
95
|
-
*/
|
|
96
|
-
export function addPageTab(obj) {
|
|
97
|
-
return store.dispatch('theme/tabAdd', obj);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 修改指定tab
|
|
102
|
-
* @param obj
|
|
103
|
-
*/
|
|
104
|
-
export function setPageTab(obj) {
|
|
105
|
-
return store.dispatch('theme/tabSetTitle', obj);
|
|
106
|
-
}
|
package/src/utils/permission.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 按钮级权限控制
|
|
3
|
-
*/
|
|
4
|
-
import store from '@/store';
|
|
5
|
-
|
|
6
|
-
/* 数组是否有某些值 */
|
|
7
|
-
const arrayHas = function(array, value) {
|
|
8
|
-
if (!value) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (!array) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
for (let i = 0; i < value.length; i++) {
|
|
16
|
-
if (array.indexOf(value[i]) === -1) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return array.indexOf(value) !== -1;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/* 数组是否有任意值 */
|
|
26
|
-
const arrayHasAny = function(array, value) {
|
|
27
|
-
if (!value) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
if (!array) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (Array.isArray(value)) {
|
|
34
|
-
for (let i = 0; i < value.length; i++) {
|
|
35
|
-
if (array.indexOf(value[i]) !== -1) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return array.indexOf(value) !== -1;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 是否有某些角色
|
|
46
|
-
* @param value {string, Array<string>} 角色字符或字符数组
|
|
47
|
-
* @returns {boolean}
|
|
48
|
-
*/
|
|
49
|
-
export function hasRole(value) {
|
|
50
|
-
return arrayHas(store.state.user?.roles, value);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 是否有任意角色
|
|
55
|
-
* @param value {string, Array<string>} 角色字符或字符数组
|
|
56
|
-
* @returns {boolean}
|
|
57
|
-
*/
|
|
58
|
-
export function hasAnyRole(value) {
|
|
59
|
-
return arrayHasAny(store.state.user?.roles, value);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 是否有某些权限
|
|
64
|
-
* @param value {string, Array<string>} 权限字符或字符数组
|
|
65
|
-
* @returns {boolean}
|
|
66
|
-
*/
|
|
67
|
-
export function hasPermission(value) {
|
|
68
|
-
return arrayHas(store.state.user?.authorities, value);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 是否有任意权限
|
|
73
|
-
* @param value {string, Array<string>} 权限字符或字符数组
|
|
74
|
-
* @returns {boolean}
|
|
75
|
-
*/
|
|
76
|
-
export function hasAnyPermission(value) {
|
|
77
|
-
return arrayHasAny(store.state.user?.authorities, value);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default {
|
|
81
|
-
install(Vue) {
|
|
82
|
-
// 添加全局方法
|
|
83
|
-
Vue.prototype.$hasRole = hasRole;
|
|
84
|
-
Vue.prototype.$hasAnyRole = hasAnyRole;
|
|
85
|
-
Vue.prototype.$hasPermission = hasPermission;
|
|
86
|
-
Vue.prototype.$hasAnyPermission = hasAnyPermission;
|
|
87
|
-
|
|
88
|
-
// 添加自定义指令
|
|
89
|
-
Vue.directive('role', {
|
|
90
|
-
inserted: (el, binding) => {
|
|
91
|
-
if (!hasRole(binding.value)) {
|
|
92
|
-
el.parentNode && el.parentNode.removeChild(el);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Vue.directive('any-role', {
|
|
97
|
-
inserted: (el, binding) => {
|
|
98
|
-
if (!hasAnyRole(binding.value)) {
|
|
99
|
-
el.parentNode && el.parentNode.removeChild(el);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
Vue.directive('permission', {
|
|
104
|
-
inserted: (el, binding) => {
|
|
105
|
-
if (!hasPermission(binding.value)) {
|
|
106
|
-
el.parentNode && el.parentNode.removeChild(el);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
Vue.directive('any-permission', {
|
|
111
|
-
inserted: (el, binding) => {
|
|
112
|
-
if (!hasAnyPermission(binding.value)) {
|
|
113
|
-
el.parentNode && el.parentNode.removeChild(el);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
package/src/utils/request.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* axios实例
|
|
3
|
-
*/
|
|
4
|
-
import axios from 'axios';
|
|
5
|
-
import router from '@/router';
|
|
6
|
-
import { MessageBox } from 'element-ui';
|
|
7
|
-
import { TOKEN_HEADER_NAME } from '@/config/setting';
|
|
8
|
-
import { getToken, setToken, removeToken } from './token-util';
|
|
9
|
-
|
|
10
|
-
const service = axios.create({
|
|
11
|
-
baseURL: process.env.VUE_APP_API_BASE_URL
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
/* 跳转到登录页面 */
|
|
15
|
-
const goLogin = function(from) {
|
|
16
|
-
removeToken();
|
|
17
|
-
router.push({
|
|
18
|
-
path: '/login',
|
|
19
|
-
query: from ? { from } : undefined
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/* 添加请求拦截器 */
|
|
24
|
-
service.interceptors.request.use(
|
|
25
|
-
(config) => {
|
|
26
|
-
// 添加token到header
|
|
27
|
-
const token = getToken();
|
|
28
|
-
if (token && config.headers) {
|
|
29
|
-
config.headers.common[TOKEN_HEADER_NAME] = token;
|
|
30
|
-
}
|
|
31
|
-
return config;
|
|
32
|
-
},
|
|
33
|
-
(error) => {
|
|
34
|
-
return Promise.reject(error);
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
/* 添加响应拦截器 */
|
|
39
|
-
service.interceptors.response.use((res) => {
|
|
40
|
-
// 登录过期处理
|
|
41
|
-
if (res.data?.code === 401) {
|
|
42
|
-
const currentPath = router.currentRoute.path;
|
|
43
|
-
if (currentPath === '/') {
|
|
44
|
-
goLogin();
|
|
45
|
-
} else {
|
|
46
|
-
MessageBox.alert('登录状态已过期, 请退出重新登录!', '系统提示', {
|
|
47
|
-
confirmButtonText: '重新登录',
|
|
48
|
-
callback: (action) => {
|
|
49
|
-
if (action === 'confirm') {
|
|
50
|
-
goLogin(currentPath);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
beforeClose: () => {
|
|
54
|
-
MessageBox.close();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return Promise.reject(new Error(res.data.message));
|
|
59
|
-
}
|
|
60
|
-
// token自动续期
|
|
61
|
-
const token = res.headers[TOKEN_HEADER_NAME.toLowerCase()];
|
|
62
|
-
if (token) {
|
|
63
|
-
setToken(token);
|
|
64
|
-
}
|
|
65
|
-
return res;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export default service;
|
package/src/utils/token-util.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* token操作封装
|
|
3
|
-
*/
|
|
4
|
-
import { TOKEN_STORE_NAME } from '@/config/setting';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 获取缓存的token
|
|
8
|
-
* @returns {string}
|
|
9
|
-
*/
|
|
10
|
-
export function getToken() {
|
|
11
|
-
const token = localStorage.getItem(TOKEN_STORE_NAME);
|
|
12
|
-
if (!token) {
|
|
13
|
-
return sessionStorage.getItem(TOKEN_STORE_NAME);
|
|
14
|
-
}
|
|
15
|
-
return token;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 缓存token
|
|
20
|
-
* @param token token
|
|
21
|
-
* @param remember 是否永久存储
|
|
22
|
-
*/
|
|
23
|
-
export function setToken(token, remember) {
|
|
24
|
-
removeToken();
|
|
25
|
-
if (token) {
|
|
26
|
-
if (remember) {
|
|
27
|
-
localStorage.setItem(TOKEN_STORE_NAME, token);
|
|
28
|
-
} else {
|
|
29
|
-
sessionStorage.setItem(TOKEN_STORE_NAME, token);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 移除缓存的token
|
|
36
|
-
*/
|
|
37
|
-
export function removeToken() {
|
|
38
|
-
localStorage.removeItem(TOKEN_STORE_NAME);
|
|
39
|
-
sessionStorage.removeItem(TOKEN_STORE_NAME);
|
|
40
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ele-exception
|
|
3
|
-
title="403"
|
|
4
|
-
description="抱歉,你无权访问该页面"
|
|
5
|
-
style="margin: 145px 0"
|
|
6
|
-
>
|
|
7
|
-
<template slot="icon">
|
|
8
|
-
<img
|
|
9
|
-
alt=""
|
|
10
|
-
src="@/assets/ic-403.svg"
|
|
11
|
-
style="width: 216px; height: 250px"
|
|
12
|
-
/>
|
|
13
|
-
</template>
|
|
14
|
-
<template slot="extra">
|
|
15
|
-
<router-link to="/">
|
|
16
|
-
<el-button type="primary">返回首页</el-button>
|
|
17
|
-
</router-link>
|
|
18
|
-
</template>
|
|
19
|
-
</ele-exception>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import EleException from 'ele-admin/packages/ele-exception';
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: 'Exception403',
|
|
27
|
-
components: { EleException }
|
|
28
|
-
};
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<style scoped></style>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ele-exception
|
|
3
|
-
title="404"
|
|
4
|
-
description="抱歉,你访问的页面不存在"
|
|
5
|
-
style="margin: 145px 0"
|
|
6
|
-
>
|
|
7
|
-
<template slot="icon">
|
|
8
|
-
<img
|
|
9
|
-
alt=""
|
|
10
|
-
src="@/assets/ic-404.svg"
|
|
11
|
-
style="width: 305px; height: 245px"
|
|
12
|
-
/>
|
|
13
|
-
</template>
|
|
14
|
-
<template slot="extra">
|
|
15
|
-
<router-link to="/">
|
|
16
|
-
<el-button type="primary">返回首页</el-button>
|
|
17
|
-
</router-link>
|
|
18
|
-
</template>
|
|
19
|
-
</ele-exception>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import EleException from 'ele-admin/packages/ele-exception';
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: 'Exception404',
|
|
27
|
-
components: { EleException }
|
|
28
|
-
};
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<style scoped></style>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ele-exception
|
|
3
|
-
title="500"
|
|
4
|
-
description="抱歉,服务器出错了"
|
|
5
|
-
style="margin: 145px 0"
|
|
6
|
-
>
|
|
7
|
-
<template slot="icon">
|
|
8
|
-
<img
|
|
9
|
-
alt=""
|
|
10
|
-
src="@/assets/ic-500.svg"
|
|
11
|
-
style="width: 400px; height: 185px"
|
|
12
|
-
/>
|
|
13
|
-
</template>
|
|
14
|
-
<template slot="extra">
|
|
15
|
-
<router-link to="/">
|
|
16
|
-
<el-button type="primary">返回首页</el-button>
|
|
17
|
-
</router-link>
|
|
18
|
-
</template>
|
|
19
|
-
</ele-exception>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import EleException from 'ele-admin/packages/ele-exception';
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: 'Exception500',
|
|
27
|
-
components: { EleException }
|
|
28
|
-
};
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<style scoped></style>
|