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.
Files changed (303) hide show
  1. package/package.json +8 -0
  2. package/template/.editorconfig +14 -0
  3. package/template/.env.development +5 -0
  4. package/template/.env.production +6 -0
  5. package/template/.env.staging +8 -0
  6. package/template/.eslintignore +4 -0
  7. package/template/.eslintrc.js +198 -0
  8. package/template/.travis.yml +5 -0
  9. package/template/LICENSE +21 -0
  10. package/template/README.es.md +228 -0
  11. package/template/README.ja.md +224 -0
  12. package/template/README.md +250 -0
  13. package/template/README.zh-CN.md +273 -0
  14. package/template/babel.config.js +14 -0
  15. package/template/build/index.js +35 -0
  16. package/template/jest.config.js +24 -0
  17. package/template/jsconfig.json +9 -0
  18. package/template/mock/article.js +116 -0
  19. package/template/mock/index.js +60 -0
  20. package/template/mock/mock-server.js +81 -0
  21. package/template/mock/remote-search.js +51 -0
  22. package/template/mock/role/index.js +98 -0
  23. package/template/mock/role/routes.js +530 -0
  24. package/template/mock/user.js +84 -0
  25. package/template/mock/utils.js +48 -0
  26. package/template/package.json +111 -0
  27. package/template/plop-templates/component/index.hbs +26 -0
  28. package/template/plop-templates/component/prompt.js +55 -0
  29. package/template/plop-templates/store/index.hbs +16 -0
  30. package/template/plop-templates/store/prompt.js +62 -0
  31. package/template/plop-templates/utils.js +2 -0
  32. package/template/plop-templates/view/index.hbs +26 -0
  33. package/template/plop-templates/view/prompt.js +55 -0
  34. package/template/plopfile.js +9 -0
  35. package/template/postcss.config.js +5 -0
  36. package/template/public/favicon.ico +0 -0
  37. package/template/public/index.html +15 -0
  38. package/template/src/App.vue +11 -0
  39. package/template/src/api/article.js +41 -0
  40. package/template/src/api/qiniu.js +8 -0
  41. package/template/src/api/remote-search.js +17 -0
  42. package/template/src/api/role.js +38 -0
  43. package/template/src/api/user.js +24 -0
  44. package/template/src/assets/401_images/401.gif +0 -0
  45. package/template/src/assets/404_images/404.png +0 -0
  46. package/template/src/assets/404_images/404_cloud.png +0 -0
  47. package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
  48. package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
  49. package/template/src/assets/custom-theme/index.css +1 -0
  50. package/template/src/components/BackToTop/index.vue +111 -0
  51. package/template/src/components/Breadcrumb/index.vue +82 -0
  52. package/template/src/components/Charts/Keyboard.vue +155 -0
  53. package/template/src/components/Charts/LineMarker.vue +227 -0
  54. package/template/src/components/Charts/MixChart.vue +271 -0
  55. package/template/src/components/Charts/mixins/resize.js +56 -0
  56. package/template/src/components/DndList/index.vue +166 -0
  57. package/template/src/components/DragSelect/index.vue +65 -0
  58. package/template/src/components/Dropzone/index.vue +297 -0
  59. package/template/src/components/ErrorLog/index.vue +78 -0
  60. package/template/src/components/GithubCorner/index.vue +54 -0
  61. package/template/src/components/Hamburger/index.vue +44 -0
  62. package/template/src/components/HeaderSearch/index.vue +180 -0
  63. package/template/src/components/ImageCropper/index.vue +1779 -0
  64. package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
  65. package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
  66. package/template/src/components/ImageCropper/utils/language.js +232 -0
  67. package/template/src/components/ImageCropper/utils/mimes.js +7 -0
  68. package/template/src/components/JsonEditor/index.vue +77 -0
  69. package/template/src/components/Kanban/index.vue +99 -0
  70. package/template/src/components/MDinput/index.vue +360 -0
  71. package/template/src/components/MarkdownEditor/default-options.js +31 -0
  72. package/template/src/components/MarkdownEditor/index.vue +118 -0
  73. package/template/src/components/Pagination/index.vue +101 -0
  74. package/template/src/components/PanThumb/index.vue +142 -0
  75. package/template/src/components/RightPanel/index.vue +145 -0
  76. package/template/src/components/Screenfull/index.vue +60 -0
  77. package/template/src/components/Share/DropdownMenu.vue +103 -0
  78. package/template/src/components/SizeSelect/index.vue +57 -0
  79. package/template/src/components/Sticky/index.vue +91 -0
  80. package/template/src/components/SvgIcon/index.vue +62 -0
  81. package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
  82. package/template/src/components/ThemePicker/index.vue +175 -0
  83. package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
  84. package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
  85. package/template/src/components/Tinymce/index.vue +247 -0
  86. package/template/src/components/Tinymce/plugins.js +7 -0
  87. package/template/src/components/Tinymce/toolbar.js +6 -0
  88. package/template/src/components/Upload/SingleImage.vue +134 -0
  89. package/template/src/components/Upload/SingleImage2.vue +130 -0
  90. package/template/src/components/Upload/SingleImage3.vue +157 -0
  91. package/template/src/components/UploadExcel/index.vue +138 -0
  92. package/template/src/directive/clipboard/clipboard.js +49 -0
  93. package/template/src/directive/clipboard/index.js +13 -0
  94. package/template/src/directive/el-drag-dialog/drag.js +77 -0
  95. package/template/src/directive/el-drag-dialog/index.js +13 -0
  96. package/template/src/directive/el-table/adaptive.js +41 -0
  97. package/template/src/directive/el-table/index.js +13 -0
  98. package/template/src/directive/permission/index.js +13 -0
  99. package/template/src/directive/permission/permission.js +31 -0
  100. package/template/src/directive/sticky.js +91 -0
  101. package/template/src/directive/waves/index.js +13 -0
  102. package/template/src/directive/waves/waves.css +26 -0
  103. package/template/src/directive/waves/waves.js +72 -0
  104. package/template/src/filters/index.js +68 -0
  105. package/template/src/icons/index.js +9 -0
  106. package/template/src/icons/svg/404.svg +1 -0
  107. package/template/src/icons/svg/bug.svg +1 -0
  108. package/template/src/icons/svg/chart.svg +1 -0
  109. package/template/src/icons/svg/clipboard.svg +1 -0
  110. package/template/src/icons/svg/component.svg +1 -0
  111. package/template/src/icons/svg/dashboard.svg +1 -0
  112. package/template/src/icons/svg/documentation.svg +1 -0
  113. package/template/src/icons/svg/drag.svg +1 -0
  114. package/template/src/icons/svg/edit.svg +1 -0
  115. package/template/src/icons/svg/education.svg +1 -0
  116. package/template/src/icons/svg/email.svg +1 -0
  117. package/template/src/icons/svg/example.svg +1 -0
  118. package/template/src/icons/svg/excel.svg +1 -0
  119. package/template/src/icons/svg/exit-fullscreen.svg +1 -0
  120. package/template/src/icons/svg/eye-open.svg +1 -0
  121. package/template/src/icons/svg/eye.svg +1 -0
  122. package/template/src/icons/svg/form.svg +1 -0
  123. package/template/src/icons/svg/fullscreen.svg +1 -0
  124. package/template/src/icons/svg/guide.svg +1 -0
  125. package/template/src/icons/svg/icon.svg +1 -0
  126. package/template/src/icons/svg/international.svg +1 -0
  127. package/template/src/icons/svg/language.svg +1 -0
  128. package/template/src/icons/svg/link.svg +1 -0
  129. package/template/src/icons/svg/list.svg +1 -0
  130. package/template/src/icons/svg/lock.svg +1 -0
  131. package/template/src/icons/svg/message.svg +1 -0
  132. package/template/src/icons/svg/money.svg +1 -0
  133. package/template/src/icons/svg/nested.svg +1 -0
  134. package/template/src/icons/svg/password.svg +1 -0
  135. package/template/src/icons/svg/pdf.svg +1 -0
  136. package/template/src/icons/svg/people.svg +1 -0
  137. package/template/src/icons/svg/peoples.svg +1 -0
  138. package/template/src/icons/svg/qq.svg +1 -0
  139. package/template/src/icons/svg/search.svg +1 -0
  140. package/template/src/icons/svg/shopping.svg +1 -0
  141. package/template/src/icons/svg/size.svg +1 -0
  142. package/template/src/icons/svg/skill.svg +1 -0
  143. package/template/src/icons/svg/star.svg +1 -0
  144. package/template/src/icons/svg/tab.svg +1 -0
  145. package/template/src/icons/svg/table.svg +1 -0
  146. package/template/src/icons/svg/theme.svg +1 -0
  147. package/template/src/icons/svg/tree-table.svg +1 -0
  148. package/template/src/icons/svg/tree.svg +1 -0
  149. package/template/src/icons/svg/user.svg +1 -0
  150. package/template/src/icons/svg/wechat.svg +1 -0
  151. package/template/src/icons/svg/zip.svg +1 -0
  152. package/template/src/icons/svgo.yml +22 -0
  153. package/template/src/layout/components/AppMain.vue +57 -0
  154. package/template/src/layout/components/Navbar.vue +167 -0
  155. package/template/src/layout/components/Settings/index.vue +108 -0
  156. package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
  157. package/template/src/layout/components/Sidebar/Item.vue +41 -0
  158. package/template/src/layout/components/Sidebar/Link.vue +43 -0
  159. package/template/src/layout/components/Sidebar/Logo.vue +82 -0
  160. package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
  161. package/template/src/layout/components/Sidebar/index.vue +54 -0
  162. package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
  163. package/template/src/layout/components/TagsView/index.vue +292 -0
  164. package/template/src/layout/components/index.js +5 -0
  165. package/template/src/layout/index.vue +102 -0
  166. package/template/src/layout/mixin/ResizeHandler.js +45 -0
  167. package/template/src/main.js +53 -0
  168. package/template/src/permission.js +74 -0
  169. package/template/src/router/index.js +404 -0
  170. package/template/src/router/modules/charts.js +36 -0
  171. package/template/src/router/modules/components.js +102 -0
  172. package/template/src/router/modules/nested.js +66 -0
  173. package/template/src/router/modules/table.js +41 -0
  174. package/template/src/settings.js +35 -0
  175. package/template/src/store/getters.js +15 -0
  176. package/template/src/store/index.js +25 -0
  177. package/template/src/store/modules/app.js +56 -0
  178. package/template/src/store/modules/errorLog.js +28 -0
  179. package/template/src/store/modules/permission.js +69 -0
  180. package/template/src/store/modules/settings.js +35 -0
  181. package/template/src/store/modules/tagsView.js +160 -0
  182. package/template/src/store/modules/user.js +131 -0
  183. package/template/src/styles/btn.scss +99 -0
  184. package/template/src/styles/element-ui.scss +84 -0
  185. package/template/src/styles/element-variables.scss +31 -0
  186. package/template/src/styles/index.scss +191 -0
  187. package/template/src/styles/mixin.scss +66 -0
  188. package/template/src/styles/sidebar.scss +226 -0
  189. package/template/src/styles/transition.scss +48 -0
  190. package/template/src/styles/variables.scss +35 -0
  191. package/template/src/utils/auth.js +15 -0
  192. package/template/src/utils/clipboard.js +32 -0
  193. package/template/src/utils/error-log.js +35 -0
  194. package/template/src/utils/get-page-title.js +10 -0
  195. package/template/src/utils/index.js +357 -0
  196. package/template/src/utils/open-window.js +25 -0
  197. package/template/src/utils/permission.js +21 -0
  198. package/template/src/utils/request.js +85 -0
  199. package/template/src/utils/scroll-to.js +58 -0
  200. package/template/src/utils/validate.js +87 -0
  201. package/template/src/vendor/Export2Excel.js +220 -0
  202. package/template/src/vendor/Export2Zip.js +24 -0
  203. package/template/src/views/charts/keyboard.vue +23 -0
  204. package/template/src/views/charts/line.vue +23 -0
  205. package/template/src/views/charts/mix-chart.vue +23 -0
  206. package/template/src/views/clipboard/index.vue +49 -0
  207. package/template/src/views/components-demo/avatar-upload.vue +61 -0
  208. package/template/src/views/components-demo/back-to-top.vue +154 -0
  209. package/template/src/views/components-demo/count-to.vue +218 -0
  210. package/template/src/views/components-demo/dnd-list.vue +39 -0
  211. package/template/src/views/components-demo/drag-dialog.vue +61 -0
  212. package/template/src/views/components-demo/drag-kanban.vue +66 -0
  213. package/template/src/views/components-demo/drag-select.vue +43 -0
  214. package/template/src/views/components-demo/dropzone.vue +31 -0
  215. package/template/src/views/components-demo/json-editor.vue +36 -0
  216. package/template/src/views/components-demo/markdown.vue +101 -0
  217. package/template/src/views/components-demo/mixin.vue +169 -0
  218. package/template/src/views/components-demo/split-pane.vue +67 -0
  219. package/template/src/views/components-demo/sticky.vue +135 -0
  220. package/template/src/views/components-demo/tinymce.vue +36 -0
  221. package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
  222. package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
  223. package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
  224. package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
  225. package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
  226. package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
  227. package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
  228. package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
  229. package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
  230. package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
  231. package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
  232. package/template/src/views/dashboard/admin/index.vue +124 -0
  233. package/template/src/views/dashboard/editor/index.vue +74 -0
  234. package/template/src/views/dashboard/index.vue +31 -0
  235. package/template/src/views/documentation/index.vue +57 -0
  236. package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
  237. package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
  238. package/template/src/views/error-log/index.vue +32 -0
  239. package/template/src/views/error-page/401.vue +99 -0
  240. package/template/src/views/error-page/404.vue +228 -0
  241. package/template/src/views/example/components/ArticleDetail.vue +289 -0
  242. package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
  243. package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
  244. package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
  245. package/template/src/views/example/components/Dropdown/index.js +3 -0
  246. package/template/src/views/example/components/Warning.vue +13 -0
  247. package/template/src/views/example/create.vue +13 -0
  248. package/template/src/views/example/edit.vue +13 -0
  249. package/template/src/views/example/list.vue +112 -0
  250. package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
  251. package/template/src/views/excel/components/BookTypeOption.vue +39 -0
  252. package/template/src/views/excel/components/FilenameOption.vue +27 -0
  253. package/template/src/views/excel/export-excel.vue +116 -0
  254. package/template/src/views/excel/merge-header.vue +101 -0
  255. package/template/src/views/excel/select-excel.vue +107 -0
  256. package/template/src/views/excel/upload-excel.vue +42 -0
  257. package/template/src/views/guide/index.vue +36 -0
  258. package/template/src/views/guide/steps.js +53 -0
  259. package/template/src/views/icons/element-icons.js +3 -0
  260. package/template/src/views/icons/index.vue +101 -0
  261. package/template/src/views/icons/svg-icons.js +10 -0
  262. package/template/src/views/login/auth-redirect.vue +15 -0
  263. package/template/src/views/login/components/SocialSignin.vue +72 -0
  264. package/template/src/views/login/index.vue +324 -0
  265. package/template/src/views/nested/menu1/index.vue +7 -0
  266. package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
  267. package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
  268. package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
  269. package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
  270. package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
  271. package/template/src/views/nested/menu2/index.vue +5 -0
  272. package/template/src/views/pdf/content.js +58 -0
  273. package/template/src/views/pdf/download.vue +201 -0
  274. package/template/src/views/pdf/index.vue +13 -0
  275. package/template/src/views/permission/components/SwitchRoles.vue +32 -0
  276. package/template/src/views/permission/directive.vue +111 -0
  277. package/template/src/views/permission/page.vue +19 -0
  278. package/template/src/views/permission/role.vue +270 -0
  279. package/template/src/views/profile/components/Account.vue +38 -0
  280. package/template/src/views/profile/components/Activity.vue +185 -0
  281. package/template/src/views/profile/components/Timeline.vue +43 -0
  282. package/template/src/views/profile/components/UserCard.vue +134 -0
  283. package/template/src/views/profile/index.vue +68 -0
  284. package/template/src/views/qiniu/upload.vue +41 -0
  285. package/template/src/views/redirect/index.vue +12 -0
  286. package/template/src/views/tab/components/TabPane.vue +103 -0
  287. package/template/src/views/tab/index.vue +57 -0
  288. package/template/src/views/table/complex-table.vue +379 -0
  289. package/template/src/views/table/drag-table.vue +153 -0
  290. package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
  291. package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
  292. package/template/src/views/table/dynamic-table/index.vue +24 -0
  293. package/template/src/views/table/inline-edit-table.vue +149 -0
  294. package/template/src/views/theme/index.vue +120 -0
  295. package/template/src/views/zip/index.vue +77 -0
  296. package/template/tests/unit/.eslintrc.js +5 -0
  297. package/template/tests/unit/components/Hamburger.spec.js +18 -0
  298. package/template/tests/unit/components/SvgIcon.spec.js +22 -0
  299. package/template/tests/unit/utils/formatTime.spec.js +29 -0
  300. package/template/tests/unit/utils/param2Obj.spec.js +14 -0
  301. package/template/tests/unit/utils/parseTime.spec.js +37 -0
  302. package/template/tests/unit/utils/validate.spec.js +28 -0
  303. package/template/vue.config.js +124 -0
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <a :class="className" class="link--mallki" href="#">
3
+ {{ text }}
4
+ <span :data-letters="text" />
5
+ <span :data-letters="text" />
6
+ </a>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ props: {
12
+ className: {
13
+ type: String,
14
+ default: ''
15
+ },
16
+ text: {
17
+ type: String,
18
+ default: 'vue-element-admin'
19
+ }
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <style>
25
+ /* Mallki */
26
+
27
+ .link--mallki {
28
+ font-weight: 800;
29
+ color: #4dd9d5;
30
+ font-family: 'Dosis', sans-serif;
31
+ -webkit-transition: color 0.5s 0.25s;
32
+ transition: color 0.5s 0.25s;
33
+ overflow: hidden;
34
+ position: relative;
35
+ display: inline-block;
36
+ line-height: 1;
37
+ outline: none;
38
+ text-decoration: none;
39
+ }
40
+
41
+ .link--mallki:hover {
42
+ -webkit-transition: none;
43
+ transition: none;
44
+ color: transparent;
45
+ }
46
+
47
+ .link--mallki::before {
48
+ content: '';
49
+ width: 100%;
50
+ height: 6px;
51
+ margin: -3px 0 0 0;
52
+ background: #3888fa;
53
+ position: absolute;
54
+ left: 0;
55
+ top: 50%;
56
+ -webkit-transform: translate3d(-100%, 0, 0);
57
+ transform: translate3d(-100%, 0, 0);
58
+ -webkit-transition: -webkit-transform 0.4s;
59
+ transition: transform 0.4s;
60
+ -webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
61
+ transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
62
+ }
63
+
64
+ .link--mallki:hover::before {
65
+ -webkit-transform: translate3d(100%, 0, 0);
66
+ transform: translate3d(100%, 0, 0);
67
+ }
68
+
69
+ .link--mallki span {
70
+ position: absolute;
71
+ height: 50%;
72
+ width: 100%;
73
+ left: 0;
74
+ top: 0;
75
+ overflow: hidden;
76
+ }
77
+
78
+ .link--mallki span::before {
79
+ content: attr(data-letters);
80
+ color: red;
81
+ position: absolute;
82
+ left: 0;
83
+ width: 100%;
84
+ color: #3888fa;
85
+ -webkit-transition: -webkit-transform 0.5s;
86
+ transition: transform 0.5s;
87
+ }
88
+
89
+ .link--mallki span:nth-child(2) {
90
+ top: 50%;
91
+ }
92
+
93
+ .link--mallki span:first-child::before {
94
+ top: 0;
95
+ -webkit-transform: translate3d(0, 100%, 0);
96
+ transform: translate3d(0, 100%, 0);
97
+ }
98
+
99
+ .link--mallki span:nth-child(2)::before {
100
+ bottom: 0;
101
+ -webkit-transform: translate3d(0, -100%, 0);
102
+ transform: translate3d(0, -100%, 0);
103
+ }
104
+
105
+ .link--mallki:hover span::before {
106
+ -webkit-transition-delay: 0.3s;
107
+ transition-delay: 0.3s;
108
+ -webkit-transform: translate3d(0, 0, 0);
109
+ transform: translate3d(0, 0, 0);
110
+ -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
111
+ transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
112
+ }
113
+ </style>
@@ -0,0 +1,175 @@
1
+ <template>
2
+ <el-color-picker
3
+ v-model="theme"
4
+ :predefine="['#409EFF', '#1890ff', '#304156','#212121','#11a983', '#13c2c2', '#6959CD', '#f5222d', ]"
5
+ class="theme-picker"
6
+ popper-class="theme-picker-dropdown"
7
+ />
8
+ </template>
9
+
10
+ <script>
11
+ const version = require('element-ui/package.json').version // element-ui version from node_modules
12
+ const ORIGINAL_THEME = '#409EFF' // default color
13
+
14
+ export default {
15
+ data() {
16
+ return {
17
+ chalk: '', // content of theme-chalk css
18
+ theme: ''
19
+ }
20
+ },
21
+ computed: {
22
+ defaultTheme() {
23
+ return this.$store.state.settings.theme
24
+ }
25
+ },
26
+ watch: {
27
+ defaultTheme: {
28
+ handler: function(val, oldVal) {
29
+ this.theme = val
30
+ },
31
+ immediate: true
32
+ },
33
+ async theme(val) {
34
+ const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
35
+ if (typeof val !== 'string') return
36
+ const themeCluster = this.getThemeCluster(val.replace('#', ''))
37
+ const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
38
+ console.log(themeCluster, originalCluster)
39
+
40
+ const $message = this.$message({
41
+ message: ' Compiling the theme',
42
+ customClass: 'theme-message',
43
+ type: 'success',
44
+ duration: 0,
45
+ iconClass: 'el-icon-loading'
46
+ })
47
+
48
+ const getHandler = (variable, id) => {
49
+ return () => {
50
+ const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
51
+ const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster)
52
+
53
+ let styleTag = document.getElementById(id)
54
+ if (!styleTag) {
55
+ styleTag = document.createElement('style')
56
+ styleTag.setAttribute('id', id)
57
+ document.head.appendChild(styleTag)
58
+ }
59
+ styleTag.innerText = newStyle
60
+ }
61
+ }
62
+
63
+ if (!this.chalk) {
64
+ const url = `https://unpkg.com/element-ui@${version}/lib/theme-chalk/index.css`
65
+ await this.getCSSString(url, 'chalk')
66
+ }
67
+
68
+ const chalkHandler = getHandler('chalk', 'chalk-style')
69
+
70
+ chalkHandler()
71
+
72
+ const styles = [].slice.call(document.querySelectorAll('style'))
73
+ .filter(style => {
74
+ const text = style.innerText
75
+ return new RegExp(oldVal, 'i').test(text) && !/Chalk Variables/.test(text)
76
+ })
77
+ styles.forEach(style => {
78
+ const { innerText } = style
79
+ if (typeof innerText !== 'string') return
80
+ style.innerText = this.updateStyle(innerText, originalCluster, themeCluster)
81
+ })
82
+
83
+ this.$emit('change', val)
84
+
85
+ $message.close()
86
+ }
87
+ },
88
+
89
+ methods: {
90
+ updateStyle(style, oldCluster, newCluster) {
91
+ let newStyle = style
92
+ oldCluster.forEach((color, index) => {
93
+ newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index])
94
+ })
95
+ return newStyle
96
+ },
97
+
98
+ getCSSString(url, variable) {
99
+ return new Promise(resolve => {
100
+ const xhr = new XMLHttpRequest()
101
+ xhr.onreadystatechange = () => {
102
+ if (xhr.readyState === 4 && xhr.status === 200) {
103
+ this[variable] = xhr.responseText.replace(/@font-face{[^}]+}/, '')
104
+ resolve()
105
+ }
106
+ }
107
+ xhr.open('GET', url)
108
+ xhr.send()
109
+ })
110
+ },
111
+
112
+ getThemeCluster(theme) {
113
+ const tintColor = (color, tint) => {
114
+ let red = parseInt(color.slice(0, 2), 16)
115
+ let green = parseInt(color.slice(2, 4), 16)
116
+ let blue = parseInt(color.slice(4, 6), 16)
117
+
118
+ if (tint === 0) { // when primary color is in its rgb space
119
+ return [red, green, blue].join(',')
120
+ } else {
121
+ red += Math.round(tint * (255 - red))
122
+ green += Math.round(tint * (255 - green))
123
+ blue += Math.round(tint * (255 - blue))
124
+
125
+ red = red.toString(16)
126
+ green = green.toString(16)
127
+ blue = blue.toString(16)
128
+
129
+ return `#${red}${green}${blue}`
130
+ }
131
+ }
132
+
133
+ const shadeColor = (color, shade) => {
134
+ let red = parseInt(color.slice(0, 2), 16)
135
+ let green = parseInt(color.slice(2, 4), 16)
136
+ let blue = parseInt(color.slice(4, 6), 16)
137
+
138
+ red = Math.round((1 - shade) * red)
139
+ green = Math.round((1 - shade) * green)
140
+ blue = Math.round((1 - shade) * blue)
141
+
142
+ red = red.toString(16)
143
+ green = green.toString(16)
144
+ blue = blue.toString(16)
145
+
146
+ return `#${red}${green}${blue}`
147
+ }
148
+
149
+ const clusters = [theme]
150
+ for (let i = 0; i <= 9; i++) {
151
+ clusters.push(tintColor(theme, Number((i / 10).toFixed(2))))
152
+ }
153
+ clusters.push(shadeColor(theme, 0.1))
154
+ return clusters
155
+ }
156
+ }
157
+ }
158
+ </script>
159
+
160
+ <style>
161
+ .theme-message,
162
+ .theme-picker-dropdown {
163
+ z-index: 99999 !important;
164
+ }
165
+
166
+ .theme-picker .el-color-picker__trigger {
167
+ height: 26px !important;
168
+ width: 26px !important;
169
+ padding: 2px;
170
+ }
171
+
172
+ .theme-picker-dropdown .el-color-dropdown__link-btn {
173
+ display: none;
174
+ }
175
+ </style>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div class="upload-container">
3
+ <el-button :style="{background:color,borderColor:color}" icon="el-icon-upload" size="mini" type="primary" @click=" dialogVisible=true">
4
+ upload
5
+ </el-button>
6
+ <el-dialog :visible.sync="dialogVisible">
7
+ <el-upload
8
+ :multiple="true"
9
+ :file-list="fileList"
10
+ :show-file-list="true"
11
+ :on-remove="handleRemove"
12
+ :on-success="handleSuccess"
13
+ :before-upload="beforeUpload"
14
+ class="editor-slide-upload"
15
+ action="https://httpbin.org/post"
16
+ list-type="picture-card"
17
+ >
18
+ <el-button size="small" type="primary">
19
+ Click upload
20
+ </el-button>
21
+ </el-upload>
22
+ <el-button @click="dialogVisible = false">
23
+ Cancel
24
+ </el-button>
25
+ <el-button type="primary" @click="handleSubmit">
26
+ Confirm
27
+ </el-button>
28
+ </el-dialog>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ // import { getToken } from 'api/qiniu'
34
+
35
+ export default {
36
+ name: 'EditorSlideUpload',
37
+ props: {
38
+ color: {
39
+ type: String,
40
+ default: '#1890ff'
41
+ }
42
+ },
43
+ data() {
44
+ return {
45
+ dialogVisible: false,
46
+ listObj: {},
47
+ fileList: []
48
+ }
49
+ },
50
+ methods: {
51
+ checkAllSuccess() {
52
+ return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
53
+ },
54
+ handleSubmit() {
55
+ const arr = Object.keys(this.listObj).map(v => this.listObj[v])
56
+ if (!this.checkAllSuccess()) {
57
+ this.$message('Please wait for all images to be uploaded successfully. If there is a network problem, please refresh the page and upload again!')
58
+ return
59
+ }
60
+ this.$emit('successCBK', arr)
61
+ this.listObj = {}
62
+ this.fileList = []
63
+ this.dialogVisible = false
64
+ },
65
+ handleSuccess(response, file) {
66
+ const uid = file.uid
67
+ const objKeyArr = Object.keys(this.listObj)
68
+ for (let i = 0, len = objKeyArr.length; i < len; i++) {
69
+ if (this.listObj[objKeyArr[i]].uid === uid) {
70
+ this.listObj[objKeyArr[i]].url = response.files.file
71
+ this.listObj[objKeyArr[i]].hasSuccess = true
72
+ return
73
+ }
74
+ }
75
+ },
76
+ handleRemove(file) {
77
+ const uid = file.uid
78
+ const objKeyArr = Object.keys(this.listObj)
79
+ for (let i = 0, len = objKeyArr.length; i < len; i++) {
80
+ if (this.listObj[objKeyArr[i]].uid === uid) {
81
+ delete this.listObj[objKeyArr[i]]
82
+ return
83
+ }
84
+ }
85
+ },
86
+ beforeUpload(file) {
87
+ const _self = this
88
+ const _URL = window.URL || window.webkitURL
89
+ const fileName = file.uid
90
+ this.listObj[fileName] = {}
91
+ return new Promise((resolve, reject) => {
92
+ const img = new Image()
93
+ img.src = _URL.createObjectURL(file)
94
+ img.onload = function() {
95
+ _self.listObj[fileName] = { hasSuccess: false, uid: file.uid, width: this.width, height: this.height }
96
+ }
97
+ resolve(true)
98
+ })
99
+ }
100
+ }
101
+ }
102
+ </script>
103
+
104
+ <style lang="scss" scoped>
105
+ .editor-slide-upload {
106
+ margin-bottom: 20px;
107
+ ::v-deep .el-upload--picture-card {
108
+ width: 100%;
109
+ }
110
+ }
111
+ </style>
@@ -0,0 +1,59 @@
1
+ let callbacks = []
2
+
3
+ function loadedTinymce() {
4
+ // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2144
5
+ // check is successfully downloaded script
6
+ return window.tinymce
7
+ }
8
+
9
+ const dynamicLoadScript = (src, callback) => {
10
+ const existingScript = document.getElementById(src)
11
+ const cb = callback || function() {}
12
+
13
+ if (!existingScript) {
14
+ const script = document.createElement('script')
15
+ script.src = src // src url for the third-party library being loaded.
16
+ script.id = src
17
+ document.body.appendChild(script)
18
+ callbacks.push(cb)
19
+ const onEnd = 'onload' in script ? stdOnEnd : ieOnEnd
20
+ onEnd(script)
21
+ }
22
+
23
+ if (existingScript && cb) {
24
+ if (loadedTinymce()) {
25
+ cb(null, existingScript)
26
+ } else {
27
+ callbacks.push(cb)
28
+ }
29
+ }
30
+
31
+ function stdOnEnd(script) {
32
+ script.onload = function() {
33
+ // this.onload = null here is necessary
34
+ // because even IE9 works not like others
35
+ this.onerror = this.onload = null
36
+ for (const cb of callbacks) {
37
+ cb(null, script)
38
+ }
39
+ callbacks = null
40
+ }
41
+ script.onerror = function() {
42
+ this.onerror = this.onload = null
43
+ cb(new Error('Failed to load ' + src), script)
44
+ }
45
+ }
46
+
47
+ function ieOnEnd(script) {
48
+ script.onreadystatechange = function() {
49
+ if (this.readyState !== 'complete' && this.readyState !== 'loaded') return
50
+ this.onreadystatechange = null
51
+ for (const cb of callbacks) {
52
+ cb(null, script) // there is no way to catch loading errors in IE8
53
+ }
54
+ callbacks = null
55
+ }
56
+ }
57
+ }
58
+
59
+ export default dynamicLoadScript
@@ -0,0 +1,247 @@
1
+ <template>
2
+ <div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
3
+ <textarea :id="tinymceId" class="tinymce-textarea" />
4
+ <div class="editor-custom-btn-container">
5
+ <editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ /**
12
+ * docs:
13
+ * https://panjiachen.github.io/vue-element-admin-site/feature/component/rich-editor.html#tinymce
14
+ */
15
+ import editorImage from './components/EditorImage'
16
+ import plugins from './plugins'
17
+ import toolbar from './toolbar'
18
+ import load from './dynamicLoadScript'
19
+
20
+ // why use this cdn, detail see https://github.com/PanJiaChen/tinymce-all-in-one
21
+ const tinymceCDN = 'https://cdn.jsdelivr.net/npm/tinymce-all-in-one@4.9.3/tinymce.min.js'
22
+
23
+ export default {
24
+ name: 'Tinymce',
25
+ components: { editorImage },
26
+ props: {
27
+ id: {
28
+ type: String,
29
+ default: function() {
30
+ return 'vue-tinymce-' + +new Date() + ((Math.random() * 1000).toFixed(0) + '')
31
+ }
32
+ },
33
+ value: {
34
+ type: String,
35
+ default: ''
36
+ },
37
+ toolbar: {
38
+ type: Array,
39
+ required: false,
40
+ default() {
41
+ return []
42
+ }
43
+ },
44
+ menubar: {
45
+ type: String,
46
+ default: 'file edit insert view format table'
47
+ },
48
+ height: {
49
+ type: [Number, String],
50
+ required: false,
51
+ default: 360
52
+ },
53
+ width: {
54
+ type: [Number, String],
55
+ required: false,
56
+ default: 'auto'
57
+ }
58
+ },
59
+ data() {
60
+ return {
61
+ hasChange: false,
62
+ hasInit: false,
63
+ tinymceId: this.id,
64
+ fullscreen: false,
65
+ languageTypeList: {
66
+ 'en': 'en',
67
+ 'zh': 'zh_CN',
68
+ 'es': 'es_MX',
69
+ 'ja': 'ja'
70
+ }
71
+ }
72
+ },
73
+ computed: {
74
+ containerWidth() {
75
+ const width = this.width
76
+ if (/^[\d]+(\.[\d]+)?$/.test(width)) { // matches `100`, `'100'`
77
+ return `${width}px`
78
+ }
79
+ return width
80
+ }
81
+ },
82
+ watch: {
83
+ value(val) {
84
+ if (!this.hasChange && this.hasInit) {
85
+ this.$nextTick(() =>
86
+ window.tinymce.get(this.tinymceId).setContent(val || ''))
87
+ }
88
+ }
89
+ },
90
+ mounted() {
91
+ this.init()
92
+ },
93
+ activated() {
94
+ if (window.tinymce) {
95
+ this.initTinymce()
96
+ }
97
+ },
98
+ deactivated() {
99
+ this.destroyTinymce()
100
+ },
101
+ destroyed() {
102
+ this.destroyTinymce()
103
+ },
104
+ methods: {
105
+ init() {
106
+ // dynamic load tinymce from cdn
107
+ load(tinymceCDN, (err) => {
108
+ if (err) {
109
+ this.$message.error(err.message)
110
+ return
111
+ }
112
+ this.initTinymce()
113
+ })
114
+ },
115
+ initTinymce() {
116
+ const _this = this
117
+ window.tinymce.init({
118
+ selector: `#${this.tinymceId}`,
119
+ language: this.languageTypeList['en'],
120
+ height: this.height,
121
+ body_class: 'panel-body ',
122
+ object_resizing: false,
123
+ toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
124
+ menubar: this.menubar,
125
+ plugins: plugins,
126
+ end_container_on_empty_block: true,
127
+ powerpaste_word_import: 'clean',
128
+ code_dialog_height: 450,
129
+ code_dialog_width: 1000,
130
+ advlist_bullet_styles: 'square',
131
+ advlist_number_styles: 'default',
132
+ imagetools_cors_hosts: ['www.tinymce.com', 'codepen.io'],
133
+ default_link_target: '_blank',
134
+ link_title: false,
135
+ nonbreaking_force_tab: true, // inserting nonbreaking space &nbsp; need Nonbreaking Space Plugin
136
+ init_instance_callback: editor => {
137
+ if (_this.value) {
138
+ editor.setContent(_this.value)
139
+ }
140
+ _this.hasInit = true
141
+ editor.on('NodeChange Change KeyUp SetContent', () => {
142
+ this.hasChange = true
143
+ this.$emit('input', editor.getContent())
144
+ })
145
+ },
146
+ setup(editor) {
147
+ editor.on('FullscreenStateChanged', (e) => {
148
+ _this.fullscreen = e.state
149
+ })
150
+ },
151
+ // it will try to keep these URLs intact
152
+ // https://www.tiny.cloud/docs-3x/reference/configuration/Configuration3x@convert_urls/
153
+ // https://stackoverflow.com/questions/5196205/disable-tinymce-absolute-to-relative-url-conversions
154
+ convert_urls: false
155
+ // 整合七牛上传
156
+ // images_dataimg_filter(img) {
157
+ // setTimeout(() => {
158
+ // const $image = $(img);
159
+ // $image.removeAttr('width');
160
+ // $image.removeAttr('height');
161
+ // if ($image[0].height && $image[0].width) {
162
+ // $image.attr('data-wscntype', 'image');
163
+ // $image.attr('data-wscnh', $image[0].height);
164
+ // $image.attr('data-wscnw', $image[0].width);
165
+ // $image.addClass('wscnph');
166
+ // }
167
+ // }, 0);
168
+ // return img
169
+ // },
170
+ // images_upload_handler(blobInfo, success, failure, progress) {
171
+ // progress(0);
172
+ // const token = _this.$store.getters.token;
173
+ // getToken(token).then(response => {
174
+ // const url = response.data.qiniu_url;
175
+ // const formData = new FormData();
176
+ // formData.append('token', response.data.qiniu_token);
177
+ // formData.append('key', response.data.qiniu_key);
178
+ // formData.append('file', blobInfo.blob(), url);
179
+ // upload(formData).then(() => {
180
+ // success(url);
181
+ // progress(100);
182
+ // })
183
+ // }).catch(err => {
184
+ // failure('出现未知问题,刷新页面,或者联系程序员')
185
+ // console.log(err);
186
+ // });
187
+ // },
188
+ })
189
+ },
190
+ destroyTinymce() {
191
+ const tinymce = window.tinymce.get(this.tinymceId)
192
+ if (this.fullscreen) {
193
+ tinymce.execCommand('mceFullScreen')
194
+ }
195
+
196
+ if (tinymce) {
197
+ tinymce.destroy()
198
+ }
199
+ },
200
+ setContent(value) {
201
+ window.tinymce.get(this.tinymceId).setContent(value)
202
+ },
203
+ getContent() {
204
+ window.tinymce.get(this.tinymceId).getContent()
205
+ },
206
+ imageSuccessCBK(arr) {
207
+ arr.forEach(v => window.tinymce.get(this.tinymceId).insertContent(`<img class="wscnph" src="${v.url}" >`))
208
+ }
209
+ }
210
+ }
211
+ </script>
212
+
213
+ <style lang="scss" scoped>
214
+ .tinymce-container {
215
+ position: relative;
216
+ line-height: normal;
217
+ }
218
+
219
+ .tinymce-container {
220
+ ::v-deep {
221
+ .mce-fullscreen {
222
+ z-index: 10000;
223
+ }
224
+ }
225
+ }
226
+
227
+ .tinymce-textarea {
228
+ visibility: hidden;
229
+ z-index: -1;
230
+ }
231
+
232
+ .editor-custom-btn-container {
233
+ position: absolute;
234
+ right: 4px;
235
+ top: 4px;
236
+ /*z-index: 2005;*/
237
+ }
238
+
239
+ .fullscreen .editor-custom-btn-container {
240
+ z-index: 10000;
241
+ position: fixed;
242
+ }
243
+
244
+ .editor-upload-btn {
245
+ display: inline-block;
246
+ }
247
+ </style>
@@ -0,0 +1,7 @@
1
+ // Any plugins you want to use has to be imported
2
+ // Detail plugins list see https://www.tinymce.com/docs/plugins/
3
+ // Custom builds see https://www.tinymce.com/download/custom-builds/
4
+
5
+ const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount']
6
+
7
+ export default plugins