@lavida/vue-element-admin-template 1.0.0
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/package.json +15 -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 +222 -0
- package/template/README.ja.md +218 -0
- package/template/README.md +222 -0
- package/template/README.zh-CN.md +245 -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 +250 -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 +25 -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 +56 -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 +125 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Math.easeInOutQuad = function(t, b, c, d) {
|
|
2
|
+
t /= d / 2
|
|
3
|
+
if (t < 1) {
|
|
4
|
+
return c / 2 * t * t + b
|
|
5
|
+
}
|
|
6
|
+
t--
|
|
7
|
+
return -c / 2 * (t * (t - 2) - 1) + b
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
|
11
|
+
var requestAnimFrame = (function() {
|
|
12
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
|
|
13
|
+
})()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
|
17
|
+
* @param {number} amount
|
|
18
|
+
*/
|
|
19
|
+
function move(amount) {
|
|
20
|
+
document.documentElement.scrollTop = amount
|
|
21
|
+
document.body.parentNode.scrollTop = amount
|
|
22
|
+
document.body.scrollTop = amount
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function position() {
|
|
26
|
+
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {number} to
|
|
31
|
+
* @param {number} duration
|
|
32
|
+
* @param {Function} callback
|
|
33
|
+
*/
|
|
34
|
+
export function scrollTo(to, duration, callback) {
|
|
35
|
+
const start = position()
|
|
36
|
+
const change = to - start
|
|
37
|
+
const increment = 20
|
|
38
|
+
let currentTime = 0
|
|
39
|
+
duration = (typeof (duration) === 'undefined') ? 500 : duration
|
|
40
|
+
var animateScroll = function() {
|
|
41
|
+
// increment the time
|
|
42
|
+
currentTime += increment
|
|
43
|
+
// find the value with the quadratic in-out easing function
|
|
44
|
+
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
|
45
|
+
// move the document.body
|
|
46
|
+
move(val)
|
|
47
|
+
// do the animation unless its over
|
|
48
|
+
if (currentTime < duration) {
|
|
49
|
+
requestAnimFrame(animateScroll)
|
|
50
|
+
} else {
|
|
51
|
+
if (callback && typeof (callback) === 'function') {
|
|
52
|
+
// the animation is done so lets callback
|
|
53
|
+
callback()
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
animateScroll()
|
|
58
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by PanJiaChen on 16/11/18.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} path
|
|
7
|
+
* @returns {Boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function isExternal(path) {
|
|
10
|
+
return /^(https?:|mailto:|tel:)/.test(path)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} str
|
|
15
|
+
* @returns {Boolean}
|
|
16
|
+
*/
|
|
17
|
+
export function validUsername(str) {
|
|
18
|
+
const valid_map = ['admin', 'editor']
|
|
19
|
+
return valid_map.indexOf(str.trim()) >= 0
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} url
|
|
24
|
+
* @returns {Boolean}
|
|
25
|
+
*/
|
|
26
|
+
export function validURL(url) {
|
|
27
|
+
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
|
|
28
|
+
return reg.test(url)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} str
|
|
33
|
+
* @returns {Boolean}
|
|
34
|
+
*/
|
|
35
|
+
export function validLowerCase(str) {
|
|
36
|
+
const reg = /^[a-z]+$/
|
|
37
|
+
return reg.test(str)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} str
|
|
42
|
+
* @returns {Boolean}
|
|
43
|
+
*/
|
|
44
|
+
export function validUpperCase(str) {
|
|
45
|
+
const reg = /^[A-Z]+$/
|
|
46
|
+
return reg.test(str)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} str
|
|
51
|
+
* @returns {Boolean}
|
|
52
|
+
*/
|
|
53
|
+
export function validAlphabets(str) {
|
|
54
|
+
const reg = /^[A-Za-z]+$/
|
|
55
|
+
return reg.test(str)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {string} email
|
|
60
|
+
* @returns {Boolean}
|
|
61
|
+
*/
|
|
62
|
+
export function validEmail(email) {
|
|
63
|
+
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
64
|
+
return reg.test(email)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param {string} str
|
|
69
|
+
* @returns {Boolean}
|
|
70
|
+
*/
|
|
71
|
+
export function isString(str) {
|
|
72
|
+
if (typeof str === 'string' || str instanceof String) {
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @param {Array} arg
|
|
80
|
+
* @returns {Boolean}
|
|
81
|
+
*/
|
|
82
|
+
export function isArray(arg) {
|
|
83
|
+
if (typeof Array.isArray === 'undefined') {
|
|
84
|
+
return Object.prototype.toString.call(arg) === '[object Array]'
|
|
85
|
+
}
|
|
86
|
+
return Array.isArray(arg)
|
|
87
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { saveAs } from 'file-saver'
|
|
3
|
+
import XLSX from 'xlsx'
|
|
4
|
+
|
|
5
|
+
function generateArray(table) {
|
|
6
|
+
var out = [];
|
|
7
|
+
var rows = table.querySelectorAll('tr');
|
|
8
|
+
var ranges = [];
|
|
9
|
+
for (var R = 0; R < rows.length; ++R) {
|
|
10
|
+
var outRow = [];
|
|
11
|
+
var row = rows[R];
|
|
12
|
+
var columns = row.querySelectorAll('td');
|
|
13
|
+
for (var C = 0; C < columns.length; ++C) {
|
|
14
|
+
var cell = columns[C];
|
|
15
|
+
var colspan = cell.getAttribute('colspan');
|
|
16
|
+
var rowspan = cell.getAttribute('rowspan');
|
|
17
|
+
var cellValue = cell.innerText;
|
|
18
|
+
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
|
|
19
|
+
|
|
20
|
+
//Skip ranges
|
|
21
|
+
ranges.forEach(function (range) {
|
|
22
|
+
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
|
|
23
|
+
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
//Handle Row Span
|
|
28
|
+
if (rowspan || colspan) {
|
|
29
|
+
rowspan = rowspan || 1;
|
|
30
|
+
colspan = colspan || 1;
|
|
31
|
+
ranges.push({
|
|
32
|
+
s: {
|
|
33
|
+
r: R,
|
|
34
|
+
c: outRow.length
|
|
35
|
+
},
|
|
36
|
+
e: {
|
|
37
|
+
r: R + rowspan - 1,
|
|
38
|
+
c: outRow.length + colspan - 1
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//Handle Value
|
|
44
|
+
outRow.push(cellValue !== "" ? cellValue : null);
|
|
45
|
+
|
|
46
|
+
//Handle Colspan
|
|
47
|
+
if (colspan)
|
|
48
|
+
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
|
|
49
|
+
}
|
|
50
|
+
out.push(outRow);
|
|
51
|
+
}
|
|
52
|
+
return [out, ranges];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function datenum(v, date1904) {
|
|
56
|
+
if (date1904) v += 1462;
|
|
57
|
+
var epoch = Date.parse(v);
|
|
58
|
+
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function sheet_from_array_of_arrays(data, opts) {
|
|
62
|
+
var ws = {};
|
|
63
|
+
var range = {
|
|
64
|
+
s: {
|
|
65
|
+
c: 10000000,
|
|
66
|
+
r: 10000000
|
|
67
|
+
},
|
|
68
|
+
e: {
|
|
69
|
+
c: 0,
|
|
70
|
+
r: 0
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
for (var R = 0; R != data.length; ++R) {
|
|
74
|
+
for (var C = 0; C != data[R].length; ++C) {
|
|
75
|
+
if (range.s.r > R) range.s.r = R;
|
|
76
|
+
if (range.s.c > C) range.s.c = C;
|
|
77
|
+
if (range.e.r < R) range.e.r = R;
|
|
78
|
+
if (range.e.c < C) range.e.c = C;
|
|
79
|
+
var cell = {
|
|
80
|
+
v: data[R][C]
|
|
81
|
+
};
|
|
82
|
+
if (cell.v == null) continue;
|
|
83
|
+
var cell_ref = XLSX.utils.encode_cell({
|
|
84
|
+
c: C,
|
|
85
|
+
r: R
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (typeof cell.v === 'number') cell.t = 'n';
|
|
89
|
+
else if (typeof cell.v === 'boolean') cell.t = 'b';
|
|
90
|
+
else if (cell.v instanceof Date) {
|
|
91
|
+
cell.t = 'n';
|
|
92
|
+
cell.z = XLSX.SSF._table[14];
|
|
93
|
+
cell.v = datenum(cell.v);
|
|
94
|
+
} else cell.t = 's';
|
|
95
|
+
|
|
96
|
+
ws[cell_ref] = cell;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
|
|
100
|
+
return ws;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function Workbook() {
|
|
104
|
+
if (!(this instanceof Workbook)) return new Workbook();
|
|
105
|
+
this.SheetNames = [];
|
|
106
|
+
this.Sheets = {};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function s2ab(s) {
|
|
110
|
+
var buf = new ArrayBuffer(s.length);
|
|
111
|
+
var view = new Uint8Array(buf);
|
|
112
|
+
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
|
113
|
+
return buf;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function export_table_to_excel(id) {
|
|
117
|
+
var theTable = document.getElementById(id);
|
|
118
|
+
var oo = generateArray(theTable);
|
|
119
|
+
var ranges = oo[1];
|
|
120
|
+
|
|
121
|
+
/* original data */
|
|
122
|
+
var data = oo[0];
|
|
123
|
+
var ws_name = "SheetJS";
|
|
124
|
+
|
|
125
|
+
var wb = new Workbook(),
|
|
126
|
+
ws = sheet_from_array_of_arrays(data);
|
|
127
|
+
|
|
128
|
+
/* add ranges to worksheet */
|
|
129
|
+
// ws['!cols'] = ['apple', 'banan'];
|
|
130
|
+
ws['!merges'] = ranges;
|
|
131
|
+
|
|
132
|
+
/* add worksheet to workbook */
|
|
133
|
+
wb.SheetNames.push(ws_name);
|
|
134
|
+
wb.Sheets[ws_name] = ws;
|
|
135
|
+
|
|
136
|
+
var wbout = XLSX.write(wb, {
|
|
137
|
+
bookType: 'xlsx',
|
|
138
|
+
bookSST: false,
|
|
139
|
+
type: 'binary'
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
saveAs(new Blob([s2ab(wbout)], {
|
|
143
|
+
type: "application/octet-stream"
|
|
144
|
+
}), "test.xlsx")
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function export_json_to_excel({
|
|
148
|
+
multiHeader = [],
|
|
149
|
+
header,
|
|
150
|
+
data,
|
|
151
|
+
filename,
|
|
152
|
+
merges = [],
|
|
153
|
+
autoWidth = true,
|
|
154
|
+
bookType = 'xlsx'
|
|
155
|
+
} = {}) {
|
|
156
|
+
/* original data */
|
|
157
|
+
filename = filename || 'excel-list'
|
|
158
|
+
data = [...data]
|
|
159
|
+
data.unshift(header);
|
|
160
|
+
|
|
161
|
+
for (let i = multiHeader.length - 1; i > -1; i--) {
|
|
162
|
+
data.unshift(multiHeader[i])
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
var ws_name = "SheetJS";
|
|
166
|
+
var wb = new Workbook(),
|
|
167
|
+
ws = sheet_from_array_of_arrays(data);
|
|
168
|
+
|
|
169
|
+
if (merges.length > 0) {
|
|
170
|
+
if (!ws['!merges']) ws['!merges'] = [];
|
|
171
|
+
merges.forEach(item => {
|
|
172
|
+
ws['!merges'].push(XLSX.utils.decode_range(item))
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (autoWidth) {
|
|
177
|
+
/*设置worksheet每列的最大宽度*/
|
|
178
|
+
const colWidth = data.map(row => row.map(val => {
|
|
179
|
+
/*先判断是否为null/undefined*/
|
|
180
|
+
if (val == null) {
|
|
181
|
+
return {
|
|
182
|
+
'wch': 10
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/*再判断是否为中文*/
|
|
186
|
+
else if (val.toString().charCodeAt(0) > 255) {
|
|
187
|
+
return {
|
|
188
|
+
'wch': val.toString().length * 2
|
|
189
|
+
};
|
|
190
|
+
} else {
|
|
191
|
+
return {
|
|
192
|
+
'wch': val.toString().length
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}))
|
|
196
|
+
/*以第一行为初始值*/
|
|
197
|
+
let result = colWidth[0];
|
|
198
|
+
for (let i = 1; i < colWidth.length; i++) {
|
|
199
|
+
for (let j = 0; j < colWidth[i].length; j++) {
|
|
200
|
+
if (result[j]['wch'] < colWidth[i][j]['wch']) {
|
|
201
|
+
result[j]['wch'] = colWidth[i][j]['wch'];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
ws['!cols'] = result;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* add worksheet to workbook */
|
|
209
|
+
wb.SheetNames.push(ws_name);
|
|
210
|
+
wb.Sheets[ws_name] = ws;
|
|
211
|
+
|
|
212
|
+
var wbout = XLSX.write(wb, {
|
|
213
|
+
bookType: bookType,
|
|
214
|
+
bookSST: false,
|
|
215
|
+
type: 'binary'
|
|
216
|
+
});
|
|
217
|
+
saveAs(new Blob([s2ab(wbout)], {
|
|
218
|
+
type: "application/octet-stream"
|
|
219
|
+
}), `${filename}.${bookType}`);
|
|
220
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { saveAs } from 'file-saver'
|
|
3
|
+
import JSZip from 'jszip'
|
|
4
|
+
|
|
5
|
+
export function export_txt_to_zip(th, jsonData, txtName, zipName) {
|
|
6
|
+
const zip = new JSZip()
|
|
7
|
+
const txt_name = txtName || 'file'
|
|
8
|
+
const zip_name = zipName || 'file'
|
|
9
|
+
const data = jsonData
|
|
10
|
+
let txtData = `${th}\r\n`
|
|
11
|
+
data.forEach((row) => {
|
|
12
|
+
let tempStr = ''
|
|
13
|
+
tempStr = row.toString()
|
|
14
|
+
txtData += `${tempStr}\r\n`
|
|
15
|
+
})
|
|
16
|
+
zip.file(`${txt_name}.txt`, txtData)
|
|
17
|
+
zip.generateAsync({
|
|
18
|
+
type: "blob"
|
|
19
|
+
}).then((blob) => {
|
|
20
|
+
saveAs(blob, `${zip_name}.zip`)
|
|
21
|
+
}, (err) => {
|
|
22
|
+
alert('导出失败')
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="chart-container">
|
|
3
|
+
<chart height="100%" width="100%" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import Chart from '@/components/Charts/Keyboard'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'KeyboardChart',
|
|
12
|
+
components: { Chart }
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.chart-container{
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: calc(100vh - 84px);
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="chart-container">
|
|
3
|
+
<chart height="100%" width="100%" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import Chart from '@/components/Charts/LineMarker'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'LineChart',
|
|
12
|
+
components: { Chart }
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.chart-container{
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: calc(100vh - 84px);
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="chart-container">
|
|
3
|
+
<chart height="100%" width="100%" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import Chart from '@/components/Charts/MixChart'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'MixChart',
|
|
12
|
+
components: { Chart }
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.chart-container{
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: calc(100vh - 84px);
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="app-container">
|
|
3
|
+
<el-tabs v-model="activeName">
|
|
4
|
+
<el-tab-pane label="use clipboard directly" name="directly">
|
|
5
|
+
<el-input v-model="inputData" placeholder="Please input" style="width:400px;max-width:100%;" />
|
|
6
|
+
<el-button type="primary" icon="el-icon-document" @click="handleCopy(inputData,$event)">
|
|
7
|
+
copy
|
|
8
|
+
</el-button>
|
|
9
|
+
</el-tab-pane>
|
|
10
|
+
<el-tab-pane label="use clipboard by v-directive" name="v-directive">
|
|
11
|
+
<el-input v-model="inputData" placeholder="Please input" style="width:400px;max-width:100%;" />
|
|
12
|
+
<el-button v-clipboard:copy="inputData" v-clipboard:success="clipboardSuccess" type="primary" icon="el-icon-document">
|
|
13
|
+
copy
|
|
14
|
+
</el-button>
|
|
15
|
+
</el-tab-pane>
|
|
16
|
+
</el-tabs>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import clip from '@/utils/clipboard' // use clipboard directly
|
|
22
|
+
import clipboard from '@/directive/clipboard/index.js' // use clipboard by v-directive
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'ClipboardDemo',
|
|
26
|
+
directives: {
|
|
27
|
+
clipboard
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
activeName: 'directly',
|
|
32
|
+
inputData: 'https://github.com/PanJiaChen/vue-element-admin'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
handleCopy(text, event) {
|
|
37
|
+
clip(text, event)
|
|
38
|
+
},
|
|
39
|
+
clipboardSuccess() {
|
|
40
|
+
this.$message({
|
|
41
|
+
message: 'Copy successfully',
|
|
42
|
+
type: 'success',
|
|
43
|
+
duration: 1500
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="components-container">
|
|
3
|
+
<aside>This is based on
|
|
4
|
+
<a class="link-type" href="//github.com/dai-siki/vue-image-crop-upload"> vue-image-crop-upload</a>.
|
|
5
|
+
Since I was using only the vue@1 version, and it is not compatible with mockjs at the moment, I modified it myself, and if you are going to use it, it is better to use official version.
|
|
6
|
+
</aside>
|
|
7
|
+
|
|
8
|
+
<pan-thumb :image="image" />
|
|
9
|
+
|
|
10
|
+
<el-button type="primary" icon="el-icon-upload" style="position: absolute;bottom: 15px;margin-left: 40px;" @click="imagecropperShow=true">
|
|
11
|
+
Change Avatar
|
|
12
|
+
</el-button>
|
|
13
|
+
|
|
14
|
+
<image-cropper
|
|
15
|
+
v-show="imagecropperShow"
|
|
16
|
+
:key="imagecropperKey"
|
|
17
|
+
:width="300"
|
|
18
|
+
:height="300"
|
|
19
|
+
url="https://httpbin.org/post"
|
|
20
|
+
lang-type="en"
|
|
21
|
+
@close="close"
|
|
22
|
+
@crop-upload-success="cropSuccess"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import ImageCropper from '@/components/ImageCropper'
|
|
29
|
+
import PanThumb from '@/components/PanThumb'
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: 'AvatarUploadDemo',
|
|
33
|
+
components: { ImageCropper, PanThumb },
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
imagecropperShow: false,
|
|
37
|
+
imagecropperKey: 0,
|
|
38
|
+
image: 'https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
cropSuccess(resData) {
|
|
43
|
+
this.imagecropperShow = false
|
|
44
|
+
this.imagecropperKey = this.imagecropperKey + 1
|
|
45
|
+
this.image = resData.files.avatar
|
|
46
|
+
},
|
|
47
|
+
close() {
|
|
48
|
+
this.imagecropperShow = false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style scoped>
|
|
55
|
+
.avatar{
|
|
56
|
+
width: 200px;
|
|
57
|
+
height: 200px;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
61
|
+
|