zetan-cli-dev-template-vue-element-admin 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -0
- package/template/.editorconfig +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +6 -0
- package/template/.env.staging +8 -0
- package/template/.eslintignore +4 -0
- package/template/.eslintrc.js +198 -0
- package/template/.travis.yml +5 -0
- package/template/LICENSE +21 -0
- package/template/README.es.md +228 -0
- package/template/README.ja.md +224 -0
- package/template/README.md +250 -0
- package/template/README.zh-CN.md +273 -0
- package/template/babel.config.js +14 -0
- package/template/build/index.js +35 -0
- package/template/jest.config.js +24 -0
- package/template/jsconfig.json +9 -0
- package/template/mock/article.js +116 -0
- package/template/mock/index.js +60 -0
- package/template/mock/mock-server.js +81 -0
- package/template/mock/remote-search.js +51 -0
- package/template/mock/role/index.js +98 -0
- package/template/mock/role/routes.js +530 -0
- package/template/mock/user.js +84 -0
- package/template/mock/utils.js +48 -0
- package/template/package.json +111 -0
- package/template/plop-templates/component/index.hbs +26 -0
- package/template/plop-templates/component/prompt.js +55 -0
- package/template/plop-templates/store/index.hbs +16 -0
- package/template/plop-templates/store/prompt.js +62 -0
- package/template/plop-templates/utils.js +2 -0
- package/template/plop-templates/view/index.hbs +26 -0
- package/template/plop-templates/view/prompt.js +55 -0
- package/template/plopfile.js +9 -0
- package/template/postcss.config.js +5 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/index.html +15 -0
- package/template/src/App.vue +11 -0
- package/template/src/api/article.js +41 -0
- package/template/src/api/qiniu.js +8 -0
- package/template/src/api/remote-search.js +17 -0
- package/template/src/api/role.js +38 -0
- package/template/src/api/user.js +24 -0
- package/template/src/assets/401_images/401.gif +0 -0
- package/template/src/assets/404_images/404.png +0 -0
- package/template/src/assets/404_images/404_cloud.png +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
- package/template/src/assets/custom-theme/index.css +1 -0
- package/template/src/components/BackToTop/index.vue +111 -0
- package/template/src/components/Breadcrumb/index.vue +82 -0
- package/template/src/components/Charts/Keyboard.vue +155 -0
- package/template/src/components/Charts/LineMarker.vue +227 -0
- package/template/src/components/Charts/MixChart.vue +271 -0
- package/template/src/components/Charts/mixins/resize.js +56 -0
- package/template/src/components/DndList/index.vue +166 -0
- package/template/src/components/DragSelect/index.vue +65 -0
- package/template/src/components/Dropzone/index.vue +297 -0
- package/template/src/components/ErrorLog/index.vue +78 -0
- package/template/src/components/GithubCorner/index.vue +54 -0
- package/template/src/components/Hamburger/index.vue +44 -0
- package/template/src/components/HeaderSearch/index.vue +180 -0
- package/template/src/components/ImageCropper/index.vue +1779 -0
- package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
- package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
- package/template/src/components/ImageCropper/utils/language.js +232 -0
- package/template/src/components/ImageCropper/utils/mimes.js +7 -0
- package/template/src/components/JsonEditor/index.vue +77 -0
- package/template/src/components/Kanban/index.vue +99 -0
- package/template/src/components/MDinput/index.vue +360 -0
- package/template/src/components/MarkdownEditor/default-options.js +31 -0
- package/template/src/components/MarkdownEditor/index.vue +118 -0
- package/template/src/components/Pagination/index.vue +101 -0
- package/template/src/components/PanThumb/index.vue +142 -0
- package/template/src/components/RightPanel/index.vue +145 -0
- package/template/src/components/Screenfull/index.vue +60 -0
- package/template/src/components/Share/DropdownMenu.vue +103 -0
- package/template/src/components/SizeSelect/index.vue +57 -0
- package/template/src/components/Sticky/index.vue +91 -0
- package/template/src/components/SvgIcon/index.vue +62 -0
- package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
- package/template/src/components/ThemePicker/index.vue +175 -0
- package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
- package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
- package/template/src/components/Tinymce/index.vue +247 -0
- package/template/src/components/Tinymce/plugins.js +7 -0
- package/template/src/components/Tinymce/toolbar.js +6 -0
- package/template/src/components/Upload/SingleImage.vue +134 -0
- package/template/src/components/Upload/SingleImage2.vue +130 -0
- package/template/src/components/Upload/SingleImage3.vue +157 -0
- package/template/src/components/UploadExcel/index.vue +138 -0
- package/template/src/directive/clipboard/clipboard.js +49 -0
- package/template/src/directive/clipboard/index.js +13 -0
- package/template/src/directive/el-drag-dialog/drag.js +77 -0
- package/template/src/directive/el-drag-dialog/index.js +13 -0
- package/template/src/directive/el-table/adaptive.js +41 -0
- package/template/src/directive/el-table/index.js +13 -0
- package/template/src/directive/permission/index.js +13 -0
- package/template/src/directive/permission/permission.js +31 -0
- package/template/src/directive/sticky.js +91 -0
- package/template/src/directive/waves/index.js +13 -0
- package/template/src/directive/waves/waves.css +26 -0
- package/template/src/directive/waves/waves.js +72 -0
- package/template/src/filters/index.js +68 -0
- package/template/src/icons/index.js +9 -0
- package/template/src/icons/svg/404.svg +1 -0
- package/template/src/icons/svg/bug.svg +1 -0
- package/template/src/icons/svg/chart.svg +1 -0
- package/template/src/icons/svg/clipboard.svg +1 -0
- package/template/src/icons/svg/component.svg +1 -0
- package/template/src/icons/svg/dashboard.svg +1 -0
- package/template/src/icons/svg/documentation.svg +1 -0
- package/template/src/icons/svg/drag.svg +1 -0
- package/template/src/icons/svg/edit.svg +1 -0
- package/template/src/icons/svg/education.svg +1 -0
- package/template/src/icons/svg/email.svg +1 -0
- package/template/src/icons/svg/example.svg +1 -0
- package/template/src/icons/svg/excel.svg +1 -0
- package/template/src/icons/svg/exit-fullscreen.svg +1 -0
- package/template/src/icons/svg/eye-open.svg +1 -0
- package/template/src/icons/svg/eye.svg +1 -0
- package/template/src/icons/svg/form.svg +1 -0
- package/template/src/icons/svg/fullscreen.svg +1 -0
- package/template/src/icons/svg/guide.svg +1 -0
- package/template/src/icons/svg/icon.svg +1 -0
- package/template/src/icons/svg/international.svg +1 -0
- package/template/src/icons/svg/language.svg +1 -0
- package/template/src/icons/svg/link.svg +1 -0
- package/template/src/icons/svg/list.svg +1 -0
- package/template/src/icons/svg/lock.svg +1 -0
- package/template/src/icons/svg/message.svg +1 -0
- package/template/src/icons/svg/money.svg +1 -0
- package/template/src/icons/svg/nested.svg +1 -0
- package/template/src/icons/svg/password.svg +1 -0
- package/template/src/icons/svg/pdf.svg +1 -0
- package/template/src/icons/svg/people.svg +1 -0
- package/template/src/icons/svg/peoples.svg +1 -0
- package/template/src/icons/svg/qq.svg +1 -0
- package/template/src/icons/svg/search.svg +1 -0
- package/template/src/icons/svg/shopping.svg +1 -0
- package/template/src/icons/svg/size.svg +1 -0
- package/template/src/icons/svg/skill.svg +1 -0
- package/template/src/icons/svg/star.svg +1 -0
- package/template/src/icons/svg/tab.svg +1 -0
- package/template/src/icons/svg/table.svg +1 -0
- package/template/src/icons/svg/theme.svg +1 -0
- package/template/src/icons/svg/tree-table.svg +1 -0
- package/template/src/icons/svg/tree.svg +1 -0
- package/template/src/icons/svg/user.svg +1 -0
- package/template/src/icons/svg/wechat.svg +1 -0
- package/template/src/icons/svg/zip.svg +1 -0
- package/template/src/icons/svgo.yml +22 -0
- package/template/src/layout/components/AppMain.vue +57 -0
- package/template/src/layout/components/Navbar.vue +167 -0
- package/template/src/layout/components/Settings/index.vue +108 -0
- package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
- package/template/src/layout/components/Sidebar/Item.vue +41 -0
- package/template/src/layout/components/Sidebar/Link.vue +43 -0
- package/template/src/layout/components/Sidebar/Logo.vue +82 -0
- package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
- package/template/src/layout/components/Sidebar/index.vue +54 -0
- package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
- package/template/src/layout/components/TagsView/index.vue +292 -0
- package/template/src/layout/components/index.js +5 -0
- package/template/src/layout/index.vue +102 -0
- package/template/src/layout/mixin/ResizeHandler.js +45 -0
- package/template/src/main.js +53 -0
- package/template/src/permission.js +74 -0
- package/template/src/router/index.js +404 -0
- package/template/src/router/modules/charts.js +36 -0
- package/template/src/router/modules/components.js +102 -0
- package/template/src/router/modules/nested.js +66 -0
- package/template/src/router/modules/table.js +41 -0
- package/template/src/settings.js +35 -0
- package/template/src/store/getters.js +15 -0
- package/template/src/store/index.js +25 -0
- package/template/src/store/modules/app.js +56 -0
- package/template/src/store/modules/errorLog.js +28 -0
- package/template/src/store/modules/permission.js +69 -0
- package/template/src/store/modules/settings.js +35 -0
- package/template/src/store/modules/tagsView.js +160 -0
- package/template/src/store/modules/user.js +131 -0
- package/template/src/styles/btn.scss +99 -0
- package/template/src/styles/element-ui.scss +84 -0
- package/template/src/styles/element-variables.scss +31 -0
- package/template/src/styles/index.scss +191 -0
- package/template/src/styles/mixin.scss +66 -0
- package/template/src/styles/sidebar.scss +226 -0
- package/template/src/styles/transition.scss +48 -0
- package/template/src/styles/variables.scss +35 -0
- package/template/src/utils/auth.js +15 -0
- package/template/src/utils/clipboard.js +32 -0
- package/template/src/utils/error-log.js +35 -0
- package/template/src/utils/get-page-title.js +10 -0
- package/template/src/utils/index.js +357 -0
- package/template/src/utils/open-window.js +25 -0
- package/template/src/utils/permission.js +21 -0
- package/template/src/utils/request.js +85 -0
- package/template/src/utils/scroll-to.js +58 -0
- package/template/src/utils/validate.js +87 -0
- package/template/src/vendor/Export2Excel.js +220 -0
- package/template/src/vendor/Export2Zip.js +24 -0
- package/template/src/views/charts/keyboard.vue +23 -0
- package/template/src/views/charts/line.vue +23 -0
- package/template/src/views/charts/mix-chart.vue +23 -0
- package/template/src/views/clipboard/index.vue +49 -0
- package/template/src/views/components-demo/avatar-upload.vue +61 -0
- package/template/src/views/components-demo/back-to-top.vue +154 -0
- package/template/src/views/components-demo/count-to.vue +218 -0
- package/template/src/views/components-demo/dnd-list.vue +39 -0
- package/template/src/views/components-demo/drag-dialog.vue +61 -0
- package/template/src/views/components-demo/drag-kanban.vue +66 -0
- package/template/src/views/components-demo/drag-select.vue +43 -0
- package/template/src/views/components-demo/dropzone.vue +31 -0
- package/template/src/views/components-demo/json-editor.vue +36 -0
- package/template/src/views/components-demo/markdown.vue +101 -0
- package/template/src/views/components-demo/mixin.vue +169 -0
- package/template/src/views/components-demo/split-pane.vue +67 -0
- package/template/src/views/components-demo/sticky.vue +135 -0
- package/template/src/views/components-demo/tinymce.vue +36 -0
- package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
- package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
- package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
- package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
- package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
- package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
- package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
- package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
- package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
- package/template/src/views/dashboard/admin/index.vue +124 -0
- package/template/src/views/dashboard/editor/index.vue +74 -0
- package/template/src/views/dashboard/index.vue +31 -0
- package/template/src/views/documentation/index.vue +57 -0
- package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
- package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
- package/template/src/views/error-log/index.vue +32 -0
- package/template/src/views/error-page/401.vue +99 -0
- package/template/src/views/error-page/404.vue +228 -0
- package/template/src/views/example/components/ArticleDetail.vue +289 -0
- package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
- package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
- package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
- package/template/src/views/example/components/Dropdown/index.js +3 -0
- package/template/src/views/example/components/Warning.vue +13 -0
- package/template/src/views/example/create.vue +13 -0
- package/template/src/views/example/edit.vue +13 -0
- package/template/src/views/example/list.vue +112 -0
- package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
- package/template/src/views/excel/components/BookTypeOption.vue +39 -0
- package/template/src/views/excel/components/FilenameOption.vue +27 -0
- package/template/src/views/excel/export-excel.vue +116 -0
- package/template/src/views/excel/merge-header.vue +101 -0
- package/template/src/views/excel/select-excel.vue +107 -0
- package/template/src/views/excel/upload-excel.vue +42 -0
- package/template/src/views/guide/index.vue +36 -0
- package/template/src/views/guide/steps.js +53 -0
- package/template/src/views/icons/element-icons.js +3 -0
- package/template/src/views/icons/index.vue +101 -0
- package/template/src/views/icons/svg-icons.js +10 -0
- package/template/src/views/login/auth-redirect.vue +15 -0
- package/template/src/views/login/components/SocialSignin.vue +72 -0
- package/template/src/views/login/index.vue +324 -0
- package/template/src/views/nested/menu1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
- package/template/src/views/nested/menu2/index.vue +5 -0
- package/template/src/views/pdf/content.js +58 -0
- package/template/src/views/pdf/download.vue +201 -0
- package/template/src/views/pdf/index.vue +13 -0
- package/template/src/views/permission/components/SwitchRoles.vue +32 -0
- package/template/src/views/permission/directive.vue +111 -0
- package/template/src/views/permission/page.vue +19 -0
- package/template/src/views/permission/role.vue +270 -0
- package/template/src/views/profile/components/Account.vue +38 -0
- package/template/src/views/profile/components/Activity.vue +185 -0
- package/template/src/views/profile/components/Timeline.vue +43 -0
- package/template/src/views/profile/components/UserCard.vue +134 -0
- package/template/src/views/profile/index.vue +68 -0
- package/template/src/views/qiniu/upload.vue +41 -0
- package/template/src/views/redirect/index.vue +12 -0
- package/template/src/views/tab/components/TabPane.vue +103 -0
- package/template/src/views/tab/index.vue +57 -0
- package/template/src/views/table/complex-table.vue +379 -0
- package/template/src/views/table/drag-table.vue +153 -0
- package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
- package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
- package/template/src/views/table/dynamic-table/index.vue +24 -0
- package/template/src/views/table/inline-edit-table.vue +149 -0
- package/template/src/views/theme/index.vue +120 -0
- package/template/src/views/zip/index.vue +77 -0
- package/template/tests/unit/.eslintrc.js +5 -0
- package/template/tests/unit/components/Hamburger.spec.js +18 -0
- package/template/tests/unit/components/SvgIcon.spec.js +22 -0
- package/template/tests/unit/utils/formatTime.spec.js +29 -0
- package/template/tests/unit/utils/param2Obj.spec.js +14 -0
- package/template/tests/unit/utils/parseTime.spec.js +37 -0
- package/template/tests/unit/utils/validate.spec.js +28 -0
- package/template/vue.config.js +124 -0
@@ -0,0 +1,297 @@
|
|
1
|
+
<template>
|
2
|
+
<div :id="id" :ref="id" :action="url" class="dropzone">
|
3
|
+
<input type="file" name="file">
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import Dropzone from 'dropzone'
|
9
|
+
import 'dropzone/dist/dropzone.css'
|
10
|
+
// import { getToken } from 'api/qiniu';
|
11
|
+
|
12
|
+
Dropzone.autoDiscover = false
|
13
|
+
|
14
|
+
export default {
|
15
|
+
props: {
|
16
|
+
id: {
|
17
|
+
type: String,
|
18
|
+
required: true
|
19
|
+
},
|
20
|
+
url: {
|
21
|
+
type: String,
|
22
|
+
required: true
|
23
|
+
},
|
24
|
+
clickable: {
|
25
|
+
type: Boolean,
|
26
|
+
default: true
|
27
|
+
},
|
28
|
+
defaultMsg: {
|
29
|
+
type: String,
|
30
|
+
default: '上传图片'
|
31
|
+
},
|
32
|
+
acceptedFiles: {
|
33
|
+
type: String,
|
34
|
+
default: ''
|
35
|
+
},
|
36
|
+
thumbnailHeight: {
|
37
|
+
type: Number,
|
38
|
+
default: 200
|
39
|
+
},
|
40
|
+
thumbnailWidth: {
|
41
|
+
type: Number,
|
42
|
+
default: 200
|
43
|
+
},
|
44
|
+
showRemoveLink: {
|
45
|
+
type: Boolean,
|
46
|
+
default: true
|
47
|
+
},
|
48
|
+
maxFilesize: {
|
49
|
+
type: Number,
|
50
|
+
default: 2
|
51
|
+
},
|
52
|
+
maxFiles: {
|
53
|
+
type: Number,
|
54
|
+
default: 3
|
55
|
+
},
|
56
|
+
autoProcessQueue: {
|
57
|
+
type: Boolean,
|
58
|
+
default: true
|
59
|
+
},
|
60
|
+
useCustomDropzoneOptions: {
|
61
|
+
type: Boolean,
|
62
|
+
default: false
|
63
|
+
},
|
64
|
+
defaultImg: {
|
65
|
+
default: '',
|
66
|
+
type: [String, Array]
|
67
|
+
},
|
68
|
+
couldPaste: {
|
69
|
+
type: Boolean,
|
70
|
+
default: false
|
71
|
+
}
|
72
|
+
},
|
73
|
+
data() {
|
74
|
+
return {
|
75
|
+
dropzone: '',
|
76
|
+
initOnce: true
|
77
|
+
}
|
78
|
+
},
|
79
|
+
watch: {
|
80
|
+
defaultImg(val) {
|
81
|
+
if (val.length === 0) {
|
82
|
+
this.initOnce = false
|
83
|
+
return
|
84
|
+
}
|
85
|
+
if (!this.initOnce) return
|
86
|
+
this.initImages(val)
|
87
|
+
this.initOnce = false
|
88
|
+
}
|
89
|
+
},
|
90
|
+
mounted() {
|
91
|
+
const element = document.getElementById(this.id)
|
92
|
+
const vm = this
|
93
|
+
this.dropzone = new Dropzone(element, {
|
94
|
+
clickable: this.clickable,
|
95
|
+
thumbnailWidth: this.thumbnailWidth,
|
96
|
+
thumbnailHeight: this.thumbnailHeight,
|
97
|
+
maxFiles: this.maxFiles,
|
98
|
+
maxFilesize: this.maxFilesize,
|
99
|
+
dictRemoveFile: 'Remove',
|
100
|
+
addRemoveLinks: this.showRemoveLink,
|
101
|
+
acceptedFiles: this.acceptedFiles,
|
102
|
+
autoProcessQueue: this.autoProcessQueue,
|
103
|
+
dictDefaultMessage: '<i style="margin-top: 3em;display: inline-block" class="material-icons">' + this.defaultMsg + '</i><br>Drop files here to upload',
|
104
|
+
dictMaxFilesExceeded: '只能一个图',
|
105
|
+
previewTemplate: '<div class="dz-preview dz-file-preview"> <div class="dz-image" style="width:' + this.thumbnailWidth + 'px;height:' + this.thumbnailHeight + 'px" ><img style="width:' + this.thumbnailWidth + 'px;height:' + this.thumbnailHeight + 'px" data-dz-thumbnail /></div> <div class="dz-details"><div class="dz-size"><span data-dz-size></span></div> <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark"> <i class="material-icons">done</i> </div> <div class="dz-error-mark"><i class="material-icons">error</i></div></div>',
|
106
|
+
init() {
|
107
|
+
const val = vm.defaultImg
|
108
|
+
if (!val) return
|
109
|
+
if (Array.isArray(val)) {
|
110
|
+
if (val.length === 0) return
|
111
|
+
val.map((v, i) => {
|
112
|
+
const mockFile = { name: 'name' + i, size: 12345, url: v }
|
113
|
+
this.options.addedfile.call(this, mockFile)
|
114
|
+
this.options.thumbnail.call(this, mockFile, v)
|
115
|
+
mockFile.previewElement.classList.add('dz-success')
|
116
|
+
mockFile.previewElement.classList.add('dz-complete')
|
117
|
+
vm.initOnce = false
|
118
|
+
return true
|
119
|
+
})
|
120
|
+
} else {
|
121
|
+
const mockFile = { name: 'name', size: 12345, url: val }
|
122
|
+
this.options.addedfile.call(this, mockFile)
|
123
|
+
this.options.thumbnail.call(this, mockFile, val)
|
124
|
+
mockFile.previewElement.classList.add('dz-success')
|
125
|
+
mockFile.previewElement.classList.add('dz-complete')
|
126
|
+
vm.initOnce = false
|
127
|
+
}
|
128
|
+
},
|
129
|
+
accept: (file, done) => {
|
130
|
+
/* 七牛*/
|
131
|
+
// const token = this.$store.getters.token;
|
132
|
+
// getToken(token).then(response => {
|
133
|
+
// file.token = response.data.qiniu_token;
|
134
|
+
// file.key = response.data.qiniu_key;
|
135
|
+
// file.url = response.data.qiniu_url;
|
136
|
+
// done();
|
137
|
+
// })
|
138
|
+
done()
|
139
|
+
},
|
140
|
+
sending: (file, xhr, formData) => {
|
141
|
+
// formData.append('token', file.token);
|
142
|
+
// formData.append('key', file.key);
|
143
|
+
vm.initOnce = false
|
144
|
+
}
|
145
|
+
})
|
146
|
+
|
147
|
+
if (this.couldPaste) {
|
148
|
+
document.addEventListener('paste', this.pasteImg)
|
149
|
+
}
|
150
|
+
|
151
|
+
this.dropzone.on('success', file => {
|
152
|
+
vm.$emit('dropzone-success', file, vm.dropzone.element)
|
153
|
+
})
|
154
|
+
this.dropzone.on('addedfile', file => {
|
155
|
+
vm.$emit('dropzone-fileAdded', file)
|
156
|
+
})
|
157
|
+
this.dropzone.on('removedfile', file => {
|
158
|
+
vm.$emit('dropzone-removedFile', file)
|
159
|
+
})
|
160
|
+
this.dropzone.on('error', (file, error, xhr) => {
|
161
|
+
vm.$emit('dropzone-error', file, error, xhr)
|
162
|
+
})
|
163
|
+
this.dropzone.on('successmultiple', (file, error, xhr) => {
|
164
|
+
vm.$emit('dropzone-successmultiple', file, error, xhr)
|
165
|
+
})
|
166
|
+
},
|
167
|
+
destroyed() {
|
168
|
+
document.removeEventListener('paste', this.pasteImg)
|
169
|
+
this.dropzone.destroy()
|
170
|
+
},
|
171
|
+
methods: {
|
172
|
+
removeAllFiles() {
|
173
|
+
this.dropzone.removeAllFiles(true)
|
174
|
+
},
|
175
|
+
processQueue() {
|
176
|
+
this.dropzone.processQueue()
|
177
|
+
},
|
178
|
+
pasteImg(event) {
|
179
|
+
const items = (event.clipboardData || event.originalEvent.clipboardData).items
|
180
|
+
if (items[0].kind === 'file') {
|
181
|
+
this.dropzone.addFile(items[0].getAsFile())
|
182
|
+
}
|
183
|
+
},
|
184
|
+
initImages(val) {
|
185
|
+
if (!val) return
|
186
|
+
if (Array.isArray(val)) {
|
187
|
+
val.map((v, i) => {
|
188
|
+
const mockFile = { name: 'name' + i, size: 12345, url: v }
|
189
|
+
this.dropzone.options.addedfile.call(this.dropzone, mockFile)
|
190
|
+
this.dropzone.options.thumbnail.call(this.dropzone, mockFile, v)
|
191
|
+
mockFile.previewElement.classList.add('dz-success')
|
192
|
+
mockFile.previewElement.classList.add('dz-complete')
|
193
|
+
return true
|
194
|
+
})
|
195
|
+
} else {
|
196
|
+
const mockFile = { name: 'name', size: 12345, url: val }
|
197
|
+
this.dropzone.options.addedfile.call(this.dropzone, mockFile)
|
198
|
+
this.dropzone.options.thumbnail.call(this.dropzone, mockFile, val)
|
199
|
+
mockFile.previewElement.classList.add('dz-success')
|
200
|
+
mockFile.previewElement.classList.add('dz-complete')
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
}
|
205
|
+
}
|
206
|
+
</script>
|
207
|
+
|
208
|
+
<style scoped>
|
209
|
+
.dropzone {
|
210
|
+
border: 2px solid #E5E5E5;
|
211
|
+
font-family: 'Roboto', sans-serif;
|
212
|
+
color: #777;
|
213
|
+
transition: background-color .2s linear;
|
214
|
+
padding: 5px;
|
215
|
+
}
|
216
|
+
|
217
|
+
.dropzone:hover {
|
218
|
+
background-color: #F6F6F6;
|
219
|
+
}
|
220
|
+
|
221
|
+
i {
|
222
|
+
color: #CCC;
|
223
|
+
}
|
224
|
+
|
225
|
+
.dropzone .dz-image img {
|
226
|
+
width: 100%;
|
227
|
+
height: 100%;
|
228
|
+
}
|
229
|
+
|
230
|
+
.dropzone input[name='file'] {
|
231
|
+
display: none;
|
232
|
+
}
|
233
|
+
|
234
|
+
.dropzone .dz-preview .dz-image {
|
235
|
+
border-radius: 0px;
|
236
|
+
}
|
237
|
+
|
238
|
+
.dropzone .dz-preview:hover .dz-image img {
|
239
|
+
transform: none;
|
240
|
+
filter: none;
|
241
|
+
width: 100%;
|
242
|
+
height: 100%;
|
243
|
+
}
|
244
|
+
|
245
|
+
.dropzone .dz-preview .dz-details {
|
246
|
+
bottom: 0px;
|
247
|
+
top: 0px;
|
248
|
+
color: white;
|
249
|
+
background-color: rgba(33, 150, 243, 0.8);
|
250
|
+
transition: opacity .2s linear;
|
251
|
+
text-align: left;
|
252
|
+
}
|
253
|
+
|
254
|
+
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
|
255
|
+
background-color: transparent;
|
256
|
+
}
|
257
|
+
|
258
|
+
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
|
259
|
+
border: none;
|
260
|
+
}
|
261
|
+
|
262
|
+
.dropzone .dz-preview .dz-details .dz-filename:hover span {
|
263
|
+
background-color: transparent;
|
264
|
+
border: none;
|
265
|
+
}
|
266
|
+
|
267
|
+
.dropzone .dz-preview .dz-remove {
|
268
|
+
position: absolute;
|
269
|
+
z-index: 30;
|
270
|
+
color: white;
|
271
|
+
margin-left: 15px;
|
272
|
+
padding: 10px;
|
273
|
+
top: inherit;
|
274
|
+
bottom: 15px;
|
275
|
+
border: 2px white solid;
|
276
|
+
text-decoration: none;
|
277
|
+
text-transform: uppercase;
|
278
|
+
font-size: 0.8rem;
|
279
|
+
font-weight: 800;
|
280
|
+
letter-spacing: 1.1px;
|
281
|
+
opacity: 0;
|
282
|
+
}
|
283
|
+
|
284
|
+
.dropzone .dz-preview:hover .dz-remove {
|
285
|
+
opacity: 1;
|
286
|
+
}
|
287
|
+
|
288
|
+
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
|
289
|
+
margin-left: -40px;
|
290
|
+
margin-top: -50px;
|
291
|
+
}
|
292
|
+
|
293
|
+
.dropzone .dz-preview .dz-success-mark i, .dropzone .dz-preview .dz-error-mark i {
|
294
|
+
color: white;
|
295
|
+
font-size: 5rem;
|
296
|
+
}
|
297
|
+
</style>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<template>
|
2
|
+
<div v-if="errorLogs.length>0">
|
3
|
+
<el-badge :is-dot="true" style="line-height: 25px;margin-top: -5px;" @click.native="dialogTableVisible=true">
|
4
|
+
<el-button style="padding: 8px 10px;" size="small" type="danger">
|
5
|
+
<svg-icon icon-class="bug" />
|
6
|
+
</el-button>
|
7
|
+
</el-badge>
|
8
|
+
|
9
|
+
<el-dialog :visible.sync="dialogTableVisible" width="80%" append-to-body>
|
10
|
+
<div slot="title">
|
11
|
+
<span style="padding-right: 10px;">Error Log</span>
|
12
|
+
<el-button size="mini" type="primary" icon="el-icon-delete" @click="clearAll">Clear All</el-button>
|
13
|
+
</div>
|
14
|
+
<el-table :data="errorLogs" border>
|
15
|
+
<el-table-column label="Message">
|
16
|
+
<template slot-scope="{row}">
|
17
|
+
<div>
|
18
|
+
<span class="message-title">Msg:</span>
|
19
|
+
<el-tag type="danger">
|
20
|
+
{{ row.err.message }}
|
21
|
+
</el-tag>
|
22
|
+
</div>
|
23
|
+
<br>
|
24
|
+
<div>
|
25
|
+
<span class="message-title" style="padding-right: 10px;">Info: </span>
|
26
|
+
<el-tag type="warning">
|
27
|
+
{{ row.vm.$vnode.tag }} error in {{ row.info }}
|
28
|
+
</el-tag>
|
29
|
+
</div>
|
30
|
+
<br>
|
31
|
+
<div>
|
32
|
+
<span class="message-title" style="padding-right: 16px;">Url: </span>
|
33
|
+
<el-tag type="success">
|
34
|
+
{{ row.url }}
|
35
|
+
</el-tag>
|
36
|
+
</div>
|
37
|
+
</template>
|
38
|
+
</el-table-column>
|
39
|
+
<el-table-column label="Stack">
|
40
|
+
<template slot-scope="scope">
|
41
|
+
{{ scope.row.err.stack }}
|
42
|
+
</template>
|
43
|
+
</el-table-column>
|
44
|
+
</el-table>
|
45
|
+
</el-dialog>
|
46
|
+
</div>
|
47
|
+
</template>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
export default {
|
51
|
+
name: 'ErrorLog',
|
52
|
+
data() {
|
53
|
+
return {
|
54
|
+
dialogTableVisible: false
|
55
|
+
}
|
56
|
+
},
|
57
|
+
computed: {
|
58
|
+
errorLogs() {
|
59
|
+
return this.$store.getters.errorLogs
|
60
|
+
}
|
61
|
+
},
|
62
|
+
methods: {
|
63
|
+
clearAll() {
|
64
|
+
this.dialogTableVisible = false
|
65
|
+
this.$store.dispatch('errorLog/clearErrorLog')
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
</script>
|
70
|
+
|
71
|
+
<style scoped>
|
72
|
+
.message-title {
|
73
|
+
font-size: 16px;
|
74
|
+
color: #333;
|
75
|
+
font-weight: bold;
|
76
|
+
padding-right: 8px;
|
77
|
+
}
|
78
|
+
</style>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<template>
|
2
|
+
<a href="https://github.com/PanJiaChen/vue-element-admin" target="_blank" class="github-corner" aria-label="View source on Github">
|
3
|
+
<svg
|
4
|
+
width="80"
|
5
|
+
height="80"
|
6
|
+
viewBox="0 0 250 250"
|
7
|
+
style="fill:#40c9c6; color:#fff;"
|
8
|
+
aria-hidden="true"
|
9
|
+
>
|
10
|
+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
|
11
|
+
<path
|
12
|
+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
|
13
|
+
fill="currentColor"
|
14
|
+
style="transform-origin: 130px 106px;"
|
15
|
+
class="octo-arm"
|
16
|
+
/>
|
17
|
+
<path
|
18
|
+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
|
19
|
+
fill="currentColor"
|
20
|
+
class="octo-body"
|
21
|
+
/>
|
22
|
+
</svg>
|
23
|
+
</a>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
<style scoped>
|
27
|
+
.github-corner:hover .octo-arm {
|
28
|
+
animation: octocat-wave 560ms ease-in-out
|
29
|
+
}
|
30
|
+
|
31
|
+
@keyframes octocat-wave {
|
32
|
+
0%,
|
33
|
+
100% {
|
34
|
+
transform: rotate(0)
|
35
|
+
}
|
36
|
+
20%,
|
37
|
+
60% {
|
38
|
+
transform: rotate(-25deg)
|
39
|
+
}
|
40
|
+
40%,
|
41
|
+
80% {
|
42
|
+
transform: rotate(10deg)
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
@media (max-width:500px) {
|
47
|
+
.github-corner:hover .octo-arm {
|
48
|
+
animation: none
|
49
|
+
}
|
50
|
+
.github-corner .octo-arm {
|
51
|
+
animation: octocat-wave 560ms ease-in-out
|
52
|
+
}
|
53
|
+
}
|
54
|
+
</style>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<template>
|
2
|
+
<div style="padding: 0 15px;" @click="toggleClick">
|
3
|
+
<svg
|
4
|
+
:class="{'is-active':isActive}"
|
5
|
+
class="hamburger"
|
6
|
+
viewBox="0 0 1024 1024"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
width="64"
|
9
|
+
height="64"
|
10
|
+
>
|
11
|
+
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z" />
|
12
|
+
</svg>
|
13
|
+
</div>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
export default {
|
18
|
+
name: 'Hamburger',
|
19
|
+
props: {
|
20
|
+
isActive: {
|
21
|
+
type: Boolean,
|
22
|
+
default: false
|
23
|
+
}
|
24
|
+
},
|
25
|
+
methods: {
|
26
|
+
toggleClick() {
|
27
|
+
this.$emit('toggleClick')
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<style scoped>
|
34
|
+
.hamburger {
|
35
|
+
display: inline-block;
|
36
|
+
vertical-align: middle;
|
37
|
+
width: 20px;
|
38
|
+
height: 20px;
|
39
|
+
}
|
40
|
+
|
41
|
+
.hamburger.is-active {
|
42
|
+
transform: rotate(180deg);
|
43
|
+
}
|
44
|
+
</style>
|
@@ -0,0 +1,180 @@
|
|
1
|
+
<template>
|
2
|
+
<div :class="{'show':show}" class="header-search">
|
3
|
+
<svg-icon class-name="search-icon" icon-class="search" @click.stop="click" />
|
4
|
+
<el-select
|
5
|
+
ref="headerSearchSelect"
|
6
|
+
v-model="search"
|
7
|
+
:remote-method="querySearch"
|
8
|
+
filterable
|
9
|
+
default-first-option
|
10
|
+
remote
|
11
|
+
placeholder="Search"
|
12
|
+
class="header-search-select"
|
13
|
+
@change="change"
|
14
|
+
>
|
15
|
+
<el-option v-for="item in options" :key="item.path" :value="item" :label="item.title.join(' > ')" />
|
16
|
+
</el-select>
|
17
|
+
</div>
|
18
|
+
</template>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
// fuse is a lightweight fuzzy-search module
|
22
|
+
// make search results more in line with expectations
|
23
|
+
import Fuse from 'fuse.js'
|
24
|
+
import path from 'path'
|
25
|
+
|
26
|
+
export default {
|
27
|
+
name: 'HeaderSearch',
|
28
|
+
data() {
|
29
|
+
return {
|
30
|
+
search: '',
|
31
|
+
options: [],
|
32
|
+
searchPool: [],
|
33
|
+
show: false,
|
34
|
+
fuse: undefined
|
35
|
+
}
|
36
|
+
},
|
37
|
+
computed: {
|
38
|
+
routes() {
|
39
|
+
return this.$store.getters.permission_routes
|
40
|
+
}
|
41
|
+
},
|
42
|
+
watch: {
|
43
|
+
routes() {
|
44
|
+
this.searchPool = this.generateRoutes(this.routes)
|
45
|
+
},
|
46
|
+
searchPool(list) {
|
47
|
+
this.initFuse(list)
|
48
|
+
},
|
49
|
+
show(value) {
|
50
|
+
if (value) {
|
51
|
+
document.body.addEventListener('click', this.close)
|
52
|
+
} else {
|
53
|
+
document.body.removeEventListener('click', this.close)
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
mounted() {
|
58
|
+
this.searchPool = this.generateRoutes(this.routes)
|
59
|
+
},
|
60
|
+
methods: {
|
61
|
+
click() {
|
62
|
+
this.show = !this.show
|
63
|
+
if (this.show) {
|
64
|
+
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
|
65
|
+
}
|
66
|
+
},
|
67
|
+
close() {
|
68
|
+
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
|
69
|
+
this.options = []
|
70
|
+
this.show = false
|
71
|
+
},
|
72
|
+
change(val) {
|
73
|
+
this.$router.push(val.path)
|
74
|
+
this.search = ''
|
75
|
+
this.options = []
|
76
|
+
this.$nextTick(() => {
|
77
|
+
this.show = false
|
78
|
+
})
|
79
|
+
},
|
80
|
+
initFuse(list) {
|
81
|
+
this.fuse = new Fuse(list, {
|
82
|
+
shouldSort: true,
|
83
|
+
threshold: 0.4,
|
84
|
+
location: 0,
|
85
|
+
distance: 100,
|
86
|
+
maxPatternLength: 32,
|
87
|
+
minMatchCharLength: 1,
|
88
|
+
keys: [{
|
89
|
+
name: 'title',
|
90
|
+
weight: 0.7
|
91
|
+
}, {
|
92
|
+
name: 'path',
|
93
|
+
weight: 0.3
|
94
|
+
}]
|
95
|
+
})
|
96
|
+
},
|
97
|
+
// Filter out the routes that can be displayed in the sidebar
|
98
|
+
// And generate the internationalized title
|
99
|
+
generateRoutes(routes, basePath = '/', prefixTitle = []) {
|
100
|
+
let res = []
|
101
|
+
|
102
|
+
for (const router of routes) {
|
103
|
+
// skip hidden router
|
104
|
+
if (router.hidden) { continue }
|
105
|
+
|
106
|
+
const data = {
|
107
|
+
path: path.resolve(basePath, router.path),
|
108
|
+
title: [...prefixTitle]
|
109
|
+
}
|
110
|
+
|
111
|
+
if (router.meta && router.meta.title) {
|
112
|
+
data.title = [...data.title, router.meta.title]
|
113
|
+
|
114
|
+
if (router.redirect !== 'noRedirect') {
|
115
|
+
// only push the routes with title
|
116
|
+
// special case: need to exclude parent router without redirect
|
117
|
+
res.push(data)
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
// recursive child routes
|
122
|
+
if (router.children) {
|
123
|
+
const tempRoutes = this.generateRoutes(router.children, data.path, data.title)
|
124
|
+
if (tempRoutes.length >= 1) {
|
125
|
+
res = [...res, ...tempRoutes]
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
return res
|
130
|
+
},
|
131
|
+
querySearch(query) {
|
132
|
+
if (query !== '') {
|
133
|
+
this.options = this.fuse.search(query)
|
134
|
+
} else {
|
135
|
+
this.options = []
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
</script>
|
141
|
+
|
142
|
+
<style lang="scss" scoped>
|
143
|
+
.header-search {
|
144
|
+
font-size: 0 !important;
|
145
|
+
|
146
|
+
.search-icon {
|
147
|
+
cursor: pointer;
|
148
|
+
font-size: 18px;
|
149
|
+
vertical-align: middle;
|
150
|
+
}
|
151
|
+
|
152
|
+
.header-search-select {
|
153
|
+
font-size: 18px;
|
154
|
+
transition: width 0.2s;
|
155
|
+
width: 0;
|
156
|
+
overflow: hidden;
|
157
|
+
background: transparent;
|
158
|
+
border-radius: 0;
|
159
|
+
display: inline-block;
|
160
|
+
vertical-align: middle;
|
161
|
+
|
162
|
+
::v-deep .el-input__inner {
|
163
|
+
border-radius: 0;
|
164
|
+
border: 0;
|
165
|
+
padding-left: 0;
|
166
|
+
padding-right: 0;
|
167
|
+
box-shadow: none !important;
|
168
|
+
border-bottom: 1px solid #d9d9d9;
|
169
|
+
vertical-align: middle;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
&.show {
|
174
|
+
.header-search-select {
|
175
|
+
width: 210px;
|
176
|
+
margin-left: 10px;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
</style>
|