10 |
11 |
12 |
44 |
45 |
48 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 elprup
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/frontend/src/mock/util.js:
--------------------------------------------------------------------------------
1 | const responseBody = {
2 | message: '',
3 | timestamp: 0,
4 | result: null,
5 | code: 0
6 | }
7 |
8 | export const builder = (data, message, code = 0, headers = {}) => {
9 | responseBody.result = data
10 | if (message !== undefined && message !== null) {
11 | responseBody.message = message
12 | }
13 | if (code !== undefined && code !== 0) {
14 | responseBody.code = code
15 | responseBody._status = code
16 | }
17 | if (headers !== null && typeof headers === 'object' && Object.keys(headers).length > 0) {
18 | responseBody._headers = headers
19 | }
20 | responseBody.timestamp = new Date().getTime()
21 | return responseBody
22 | }
23 |
24 | export const getQueryParameters = (options) => {
25 | const url = options.url
26 | const search = url.split('?')[1]
27 | if (!search) {
28 | return {}
29 | }
30 | return JSON.parse('{"' + decodeURIComponent(search)
31 | .replace(/"/g, '\\"')
32 | .replace(/&/g, '","')
33 | .replace(/=/g, '":"') + '"}')
34 | }
35 |
36 | export const getBody = (options) => {
37 | return options.body && JSON.parse(options.body)
38 | }
39 |
--------------------------------------------------------------------------------
/frontend/src/views/helloworld/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ loading }}
4 |
{{ data }}
5 |
6 |
7 |
8 |
55 |
--------------------------------------------------------------------------------
/frontend/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Anan Yang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/frontend/src/components/_util/util.js:
--------------------------------------------------------------------------------
1 | /**
2 | * components util
3 | */
4 |
5 | /**
6 | * 清理空值,对象
7 | * @param children
8 | * @returns {*[]}
9 | */
10 | export function filterEmpty (children = []) {
11 | return children.filter(c => c.tag || (c.text && c.text.trim() !== ''))
12 | }
13 |
14 | /**
15 | * 获取字符串长度,英文字符 长度1,中文字符长度2
16 | * @param {*} str
17 | */
18 | export const getStrFullLength = (str = '') =>
19 | str.split('').reduce((pre, cur) => {
20 | const charCode = cur.charCodeAt(0)
21 | if (charCode >= 0 && charCode <= 128) {
22 | return pre + 1
23 | }
24 | return pre + 2
25 | }, 0)
26 |
27 | /**
28 | * 截取字符串,根据 maxLength 截取后返回
29 | * @param {*} str
30 | * @param {*} maxLength
31 | */
32 | export const cutStrByFullLength = (str = '', maxLength) => {
33 | let showLength = 0
34 | return str.split('').reduce((pre, cur) => {
35 | const charCode = cur.charCodeAt(0)
36 | if (charCode >= 0 && charCode <= 128) {
37 | showLength += 1
38 | } else {
39 | showLength += 2
40 | }
41 | if (showLength <= maxLength) {
42 | return pre + cur
43 | }
44 | return pre
45 | }, '')
46 | }
47 |
--------------------------------------------------------------------------------
/frontend/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve(Bug 反馈)
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug (描述 Bug)**
11 |
12 | A clear and concise description of what the bug is.
13 |
14 |
15 |
16 | **To Reproduce (重现步骤)**
17 | Steps to reproduce the behavior:
18 |
19 | 1. Go to '...'
20 | 2. Click on '....'
21 | 3. Scroll down to '....'
22 | 4. See error
23 |
24 |
25 |
26 | **Expected behavior(你期待的是什么?)**
27 | A clear and concise description of what you expected to happen.
28 |
29 |
30 |
31 | **Screenshots(截图)**
32 | If applicable, add screenshots to help explain your problem.
33 |
34 |
35 |
36 | **Desktop (please complete the following information):**
37 |
38 | - OS: [e.g. iOS]
39 | - Browser [e.g. chrome, safari]
40 | - Version [e.g. 22]
41 |
42 |
43 |
44 | **Smartphone (please complete the following information):**
45 |
46 | - Device: [e.g. iPhone6]
47 | - OS: [e.g. iOS8.1]
48 | - Browser [e.g. stock browser, safari]
49 | - Version [e.g. 22]
50 |
51 |
52 |
53 | **Additional context(附加信息)**
54 | Add any other context about the problem here.
--------------------------------------------------------------------------------
/frontend/src/core/directives/action.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import store from '@/store'
3 |
4 | /**
5 | * Action 权限指令
6 | * 指令用法:
7 | * - 在需要控制 action 级别权限的组件上使用 v-action:[method] , 如下:
8 | * 添加用户
9 | * 删除用户
10 | * 修改
11 | *
12 | * - 当前用户没有权限时,组件上使用了该指令则会被隐藏
13 | * - 当后台权限跟 pro 提供的模式不同时,只需要针对这里的权限过滤进行修改即可
14 | *
15 | * @see https://github.com/vueComponent/ant-design-vue-pro/pull/53
16 | */
17 | const action = Vue.directive('action', {
18 | inserted: function (el, binding, vnode) {
19 | const actionName = binding.arg
20 | const roles = store.getters.roles
21 | const elVal = vnode.context.$route.meta.permission
22 | const permissionId = elVal instanceof String && [elVal] || elVal
23 | roles.permissions.forEach(p => {
24 | if (!permissionId.includes(p.permissionId)) {
25 | return
26 | }
27 | if (p.actionList && !p.actionList.includes(actionName)) {
28 | el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
29 | }
30 | })
31 | }
32 | })
33 |
34 | export default action
35 |
--------------------------------------------------------------------------------
/frontend/src/views/list/search/components/CardInfo.vue:
--------------------------------------------------------------------------------
1 |
2 |