diff --git a/.env.development b/.env.development index d9a2132..3c71310 100644 --- a/.env.development +++ b/.env.development @@ -1,8 +1,12 @@ ENV = 'development' -# 接口地址 -VUE_APP_BASE_API = 'http://localhost:8000' -VUE_APP_WS_API = 'ws://localhost:8000' +# 本地接口地址 +VUE_APP_BASE_API = 'http://localhost:7070' +VUE_APP_WS_API = 'ws://localhost:7070' + +# 外网接口地址 TODO:暂时还没有域名 内网开发不需要域名 +#VUE_APP_BASE_API = 'https://yxkadmin.aiyxlib.com' +#VUE_APP_WS_API = 'wss://yxkadmin.aiyxlib.com' # 是否启用 babel-plugin-dynamic-import-node插件 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/mock/index.js b/mock/index.js deleted file mode 100644 index 74d47d8..0000000 --- a/mock/index.js +++ /dev/null @@ -1,56 +0,0 @@ -const Mock = require('mockjs') -const { param2Obj } = require('./utils') - -const user = require('./user') -const role = require('./role') -const article = require('./article') -const search = require('./remote-search') - -const mocks = [ - ...user, - ...role, - ...article, - ...search -] - -function mockXHR() { - - Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send - Mock.XHR.prototype.send = function() { - if (this.custom.xhr) { - this.custom.xhr.withCredentials = this.withCredentials || false - - if (this.responseType) { - this.custom.xhr.responseType = this.responseType - } - } - this.proxy_send(...arguments) - } - - function XHR2ExpressReqWrap(respond) { - return function(options) { - let result = null - if (respond instanceof Function) { - const { body, type, url } = options - - result = respond({ - method: type, - body: JSON.parse(body), - query: param2Obj(url) - }) - } else { - result = respond - } - return Mock.mock(result) - } - } - - for (const i of mocks) { - Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response)) - } -} - -module.exports = { - mocks, - mockXHR -} diff --git a/mock/role/index.js b/mock/role/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/mock/role/routes.js b/mock/role/routes.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/assets/401_images/401.gif b/src/assets/401_images/401.gif new file mode 100644 index 0000000..cd6e0d9 Binary files /dev/null and b/src/assets/401_images/401.gif differ diff --git a/src/assets/404_images/404.png b/src/assets/404_images/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/src/assets/404_images/404.png differ diff --git a/src/assets/404_images/404_cloud.png b/src/assets/404_images/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/src/assets/404_images/404_cloud.png differ diff --git a/src/assets/icons/index.js b/src/assets/icons/index.js new file mode 100644 index 0000000..2c6b309 --- /dev/null +++ b/src/assets/icons/index.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import SvgIcon from '@/components/SvgIcon'// svg component + +// register globally +Vue.component('svg-icon', SvgIcon) + +const req = require.context('./svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys().map(requireContext) +requireAll(req) diff --git a/src/assets/icons/svg/Steve-Jobs.svg b/src/assets/icons/svg/Steve-Jobs.svg new file mode 100644 index 0000000..53843e2 --- /dev/null +++ b/src/assets/icons/svg/Steve-Jobs.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/alipay.svg b/src/assets/icons/svg/alipay.svg new file mode 100644 index 0000000..9138981 --- /dev/null +++ b/src/assets/icons/svg/alipay.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/anq.svg b/src/assets/icons/svg/anq.svg new file mode 100644 index 0000000..a466608 --- /dev/null +++ b/src/assets/icons/svg/anq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/app.svg b/src/assets/icons/svg/app.svg new file mode 100644 index 0000000..0796da3 --- /dev/null +++ b/src/assets/icons/svg/app.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/backup.svg b/src/assets/icons/svg/backup.svg new file mode 100644 index 0000000..a3272a4 --- /dev/null +++ b/src/assets/icons/svg/backup.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/chain.svg b/src/assets/icons/svg/chain.svg new file mode 100644 index 0000000..ed3317f --- /dev/null +++ b/src/assets/icons/svg/chain.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/chart.svg b/src/assets/icons/svg/chart.svg new file mode 100644 index 0000000..27728fb --- /dev/null +++ b/src/assets/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/codeConsole.svg b/src/assets/icons/svg/codeConsole.svg new file mode 100644 index 0000000..672ec6e --- /dev/null +++ b/src/assets/icons/svg/codeConsole.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dashboard.svg b/src/assets/icons/svg/dashboard.svg new file mode 100644 index 0000000..5317d37 --- /dev/null +++ b/src/assets/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/database.svg b/src/assets/icons/svg/database.svg new file mode 100644 index 0000000..7fbad9b --- /dev/null +++ b/src/assets/icons/svg/database.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/date.svg b/src/assets/icons/svg/date.svg new file mode 100644 index 0000000..0540e99 --- /dev/null +++ b/src/assets/icons/svg/date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/deploy.svg b/src/assets/icons/svg/deploy.svg new file mode 100644 index 0000000..f4a1c56 --- /dev/null +++ b/src/assets/icons/svg/deploy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dept.svg b/src/assets/icons/svg/dept.svg new file mode 100644 index 0000000..894e4bf --- /dev/null +++ b/src/assets/icons/svg/dept.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dev.svg b/src/assets/icons/svg/dev.svg new file mode 100644 index 0000000..ed4d23c --- /dev/null +++ b/src/assets/icons/svg/dev.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/develop.svg b/src/assets/icons/svg/develop.svg new file mode 100644 index 0000000..e189223 --- /dev/null +++ b/src/assets/icons/svg/develop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dictionary.svg b/src/assets/icons/svg/dictionary.svg new file mode 100644 index 0000000..6e83c43 --- /dev/null +++ b/src/assets/icons/svg/dictionary.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/doc.svg b/src/assets/icons/svg/doc.svg new file mode 100644 index 0000000..9160de8 --- /dev/null +++ b/src/assets/icons/svg/doc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/download.svg b/src/assets/icons/svg/download.svg new file mode 100644 index 0000000..0243c6a --- /dev/null +++ b/src/assets/icons/svg/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/edit.svg b/src/assets/icons/svg/edit.svg new file mode 100644 index 0000000..d26101f --- /dev/null +++ b/src/assets/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/education.svg b/src/assets/icons/svg/education.svg new file mode 100644 index 0000000..7bfb01d --- /dev/null +++ b/src/assets/icons/svg/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/email.svg b/src/assets/icons/svg/email.svg new file mode 100644 index 0000000..f1cf3ae --- /dev/null +++ b/src/assets/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/error.svg b/src/assets/icons/svg/error.svg new file mode 100644 index 0000000..fd935da --- /dev/null +++ b/src/assets/icons/svg/error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/exit-fullscreen.svg b/src/assets/icons/svg/exit-fullscreen.svg new file mode 100644 index 0000000..485c128 --- /dev/null +++ b/src/assets/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fullscreen.svg b/src/assets/icons/svg/fullscreen.svg new file mode 100644 index 0000000..0e86b6f --- /dev/null +++ b/src/assets/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fwb.svg b/src/assets/icons/svg/fwb.svg new file mode 100644 index 0000000..59933fc --- /dev/null +++ b/src/assets/icons/svg/fwb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/github.svg b/src/assets/icons/svg/github.svg new file mode 100644 index 0000000..8145e95 --- /dev/null +++ b/src/assets/icons/svg/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/gonggao.svg b/src/assets/icons/svg/gonggao.svg new file mode 100644 index 0000000..22aed08 --- /dev/null +++ b/src/assets/icons/svg/gonggao.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/icon.svg b/src/assets/icons/svg/icon.svg new file mode 100644 index 0000000..82fbdd9 --- /dev/null +++ b/src/assets/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/image.svg b/src/assets/icons/svg/image.svg new file mode 100644 index 0000000..16d572f --- /dev/null +++ b/src/assets/icons/svg/image.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/index.svg b/src/assets/icons/svg/index.svg new file mode 100644 index 0000000..fdb3826 --- /dev/null +++ b/src/assets/icons/svg/index.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/international.svg b/src/assets/icons/svg/international.svg new file mode 100644 index 0000000..e9b56ee --- /dev/null +++ b/src/assets/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/ipvisits.svg b/src/assets/icons/svg/ipvisits.svg new file mode 100644 index 0000000..4ca473d --- /dev/null +++ b/src/assets/icons/svg/ipvisits.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/java.svg b/src/assets/icons/svg/java.svg new file mode 100644 index 0000000..e2effbb --- /dev/null +++ b/src/assets/icons/svg/java.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/link.svg b/src/assets/icons/svg/link.svg new file mode 100644 index 0000000..48197ba --- /dev/null +++ b/src/assets/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/list.svg b/src/assets/icons/svg/list.svg new file mode 100644 index 0000000..20259ed --- /dev/null +++ b/src/assets/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/lock.svg b/src/assets/icons/svg/lock.svg new file mode 100644 index 0000000..0f842ea --- /dev/null +++ b/src/assets/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/log.svg b/src/assets/icons/svg/log.svg new file mode 100644 index 0000000..4fefe74 --- /dev/null +++ b/src/assets/icons/svg/log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/login.svg b/src/assets/icons/svg/login.svg new file mode 100644 index 0000000..cc5a854 --- /dev/null +++ b/src/assets/icons/svg/login.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/markdown.svg b/src/assets/icons/svg/markdown.svg new file mode 100644 index 0000000..7cd6747 --- /dev/null +++ b/src/assets/icons/svg/markdown.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/menu.svg b/src/assets/icons/svg/menu.svg new file mode 100644 index 0000000..e4360a0 --- /dev/null +++ b/src/assets/icons/svg/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/message.svg b/src/assets/icons/svg/message.svg new file mode 100644 index 0000000..14ca817 --- /dev/null +++ b/src/assets/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/mnt.svg b/src/assets/icons/svg/mnt.svg new file mode 100644 index 0000000..502a7c0 --- /dev/null +++ b/src/assets/icons/svg/mnt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/money.svg b/src/assets/icons/svg/money.svg new file mode 100644 index 0000000..c1580de --- /dev/null +++ b/src/assets/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/monitor.svg b/src/assets/icons/svg/monitor.svg new file mode 100644 index 0000000..fbf0a2f --- /dev/null +++ b/src/assets/icons/svg/monitor.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/svg/nested.svg b/src/assets/icons/svg/nested.svg new file mode 100644 index 0000000..06713a8 --- /dev/null +++ b/src/assets/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/password.svg b/src/assets/icons/svg/password.svg new file mode 100644 index 0000000..4ab451f --- /dev/null +++ b/src/assets/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/people.svg b/src/assets/icons/svg/people.svg new file mode 100644 index 0000000..2bd54ae --- /dev/null +++ b/src/assets/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/peoples.svg b/src/assets/icons/svg/peoples.svg new file mode 100644 index 0000000..2c91161 --- /dev/null +++ b/src/assets/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/permission.svg b/src/assets/icons/svg/permission.svg new file mode 100644 index 0000000..c4c7409 --- /dev/null +++ b/src/assets/icons/svg/permission.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/phone.svg b/src/assets/icons/svg/phone.svg new file mode 100644 index 0000000..da339f9 --- /dev/null +++ b/src/assets/icons/svg/phone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/qiniu.svg b/src/assets/icons/svg/qiniu.svg new file mode 100644 index 0000000..c2f9f8b --- /dev/null +++ b/src/assets/icons/svg/qiniu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/redis.svg b/src/assets/icons/svg/redis.svg new file mode 100644 index 0000000..bef111b --- /dev/null +++ b/src/assets/icons/svg/redis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/role.svg b/src/assets/icons/svg/role.svg new file mode 100644 index 0000000..76cb18f --- /dev/null +++ b/src/assets/icons/svg/role.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/search.svg b/src/assets/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/src/assets/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/server.svg b/src/assets/icons/svg/server.svg new file mode 100644 index 0000000..db6dcdf --- /dev/null +++ b/src/assets/icons/svg/server.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/shopping.svg b/src/assets/icons/svg/shopping.svg new file mode 100644 index 0000000..87513e7 --- /dev/null +++ b/src/assets/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/size.svg b/src/assets/icons/svg/size.svg new file mode 100644 index 0000000..ddb25b8 --- /dev/null +++ b/src/assets/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/skill.svg b/src/assets/icons/svg/skill.svg new file mode 100644 index 0000000..a3b7312 --- /dev/null +++ b/src/assets/icons/svg/skill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/source.svg b/src/assets/icons/svg/source.svg new file mode 100644 index 0000000..1c3a038 --- /dev/null +++ b/src/assets/icons/svg/source.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/sqlMonitor.svg b/src/assets/icons/svg/sqlMonitor.svg new file mode 100644 index 0000000..950a430 --- /dev/null +++ b/src/assets/icons/svg/sqlMonitor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/swagger.svg b/src/assets/icons/svg/swagger.svg new file mode 100644 index 0000000..ded7de8 --- /dev/null +++ b/src/assets/icons/svg/swagger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/sys-tools.svg b/src/assets/icons/svg/sys-tools.svg new file mode 100644 index 0000000..324aa04 --- /dev/null +++ b/src/assets/icons/svg/sys-tools.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/system.svg b/src/assets/icons/svg/system.svg new file mode 100644 index 0000000..9333c60 --- /dev/null +++ b/src/assets/icons/svg/system.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/svg/system1.svg b/src/assets/icons/svg/system1.svg new file mode 100644 index 0000000..37b0a0a --- /dev/null +++ b/src/assets/icons/svg/system1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tab.svg b/src/assets/icons/svg/tab.svg new file mode 100644 index 0000000..b4b48e4 --- /dev/null +++ b/src/assets/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/theme.svg b/src/assets/icons/svg/theme.svg new file mode 100644 index 0000000..5982a2f --- /dev/null +++ b/src/assets/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/timing.svg b/src/assets/icons/svg/timing.svg new file mode 100644 index 0000000..f8fdc6d --- /dev/null +++ b/src/assets/icons/svg/timing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tools.svg b/src/assets/icons/svg/tools.svg new file mode 100644 index 0000000..aba1a40 --- /dev/null +++ b/src/assets/icons/svg/tools.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tree-table.svg b/src/assets/icons/svg/tree-table.svg new file mode 100644 index 0000000..8aafdb8 --- /dev/null +++ b/src/assets/icons/svg/tree-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tree.svg b/src/assets/icons/svg/tree.svg new file mode 100644 index 0000000..dd4b7dd --- /dev/null +++ b/src/assets/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/unlock.svg b/src/assets/icons/svg/unlock.svg new file mode 100644 index 0000000..1219e41 --- /dev/null +++ b/src/assets/icons/svg/unlock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/user.svg b/src/assets/icons/svg/user.svg new file mode 100644 index 0000000..09d7a81 --- /dev/null +++ b/src/assets/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/user1.svg b/src/assets/icons/svg/user1.svg new file mode 100644 index 0000000..14ca51e --- /dev/null +++ b/src/assets/icons/svg/user1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/validCode.svg b/src/assets/icons/svg/validCode.svg new file mode 100644 index 0000000..a1feb74 --- /dev/null +++ b/src/assets/icons/svg/validCode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/visits.svg b/src/assets/icons/svg/visits.svg new file mode 100644 index 0000000..8425662 --- /dev/null +++ b/src/assets/icons/svg/visits.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/web.svg b/src/assets/icons/svg/web.svg new file mode 100644 index 0000000..9c57415 --- /dev/null +++ b/src/assets/icons/svg/web.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/wechat.svg b/src/assets/icons/svg/wechat.svg new file mode 100644 index 0000000..c586e55 --- /dev/null +++ b/src/assets/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/weixin.svg b/src/assets/icons/svg/weixin.svg new file mode 100644 index 0000000..8dbcfa5 --- /dev/null +++ b/src/assets/icons/svg/weixin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/zujian.svg b/src/assets/icons/svg/zujian.svg new file mode 100644 index 0000000..2aba32f --- /dev/null +++ b/src/assets/icons/svg/zujian.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svgo.yml b/src/assets/icons/svgo.yml new file mode 100644 index 0000000..d11906a --- /dev/null +++ b/src/assets/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/src/assets/images/avatar.png b/src/assets/images/avatar.png new file mode 100644 index 0000000..997732a Binary files /dev/null and b/src/assets/images/avatar.png differ diff --git a/src/assets/images/background.jpg b/src/assets/images/background.jpg new file mode 100644 index 0000000..f47c070 Binary files /dev/null and b/src/assets/images/background.jpg differ diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png new file mode 100644 index 0000000..79805ce Binary files /dev/null and b/src/assets/images/logo.png differ diff --git a/src/assets/logo.png b/src/assets/logo.png deleted file mode 100644 index f3d2503..0000000 Binary files a/src/assets/logo.png and /dev/null differ diff --git a/src/assets/styles/btn.scss b/src/assets/styles/btn.scss new file mode 100644 index 0000000..8aea589 --- /dev/null +++ b/src/assets/styles/btn.scss @@ -0,0 +1,92 @@ +@import 'variables'; +@mixin colorBtn($color) { + background: $color; + &:hover { + color: $color; + &:before, + &:after { + background: $color; + } + } +} + +.blue-btn { + @include colorBtn($blue) +} + +.light-blue-btn { + @include colorBtn($light-blue) +} + +.red-btn { + @include colorBtn($red) +} + +.pink-btn { + @include colorBtn($pink) +} + +.green-btn { + @include colorBtn($green) +} + +.tiffany-btn { + @include colorBtn($tiffany) +} + +.yellow-btn { + @include colorBtn($yellow) +} + +.pan-btn { + font-size: 14px; + color: #fff; + padding: 14px 36px; + border-radius: 8px; + border: none; + outline: none; + transition: 600ms ease all; + position: relative; + display: inline-block; + &:hover { + background: #fff; + &:before, + &:after { + width: 100%; + transition: 600ms ease all; + } + } + &:before, + &:after { + content: ''; + position: absolute; + top: 0; + right: 0; + height: 2px; + width: 0; + transition: 400ms ease all; + } + &::after { + right: inherit; + top: inherit; + left: 0; + bottom: 0; + } +} + +.custom-button { + display: inline-block; + line-height: 1; + white-space: nowrap; + cursor: pointer; + background: #fff; + color: #fff; + -webkit-appearance: none; + text-align: center; + box-sizing: border-box; + outline: 0; + margin: 0; + padding: 10px 15px; + font-size: 14px; + border-radius: 4px; +} \ No newline at end of file diff --git a/src/assets/styles/eladmin.scss b/src/assets/styles/eladmin.scss new file mode 100644 index 0000000..e1e0195 --- /dev/null +++ b/src/assets/styles/eladmin.scss @@ -0,0 +1,117 @@ +.head-container { + padding-bottom: 10px; + .filter-item { + display: inline-block; + vertical-align: middle; + margin: 0 3px 10px 0; + input { + height: 30.5px; + line-height: 30.5px; + } + } + .el-form-item-label { + margin: 0 3px 9px 0; + display: inline-block; + text-align: right; + vertical-align: middle; + font-size: 14px; + color: #606266; + line-height: 30.5px; + padding: 0 7px 0 7px; + } + .el-button+.el-button { + margin-left: 0 !important; + } + .el-select__caret.el-input__icon.el-icon-arrow-up{ + line-height: 30.5px; + } + .date-item { + display: inline-block; + vertical-align: middle; + margin-bottom: 10px; + height: 30.5px !important; + width: 230px !important; + } +} +.el-avatar { + display: inline-block; + text-align: center; + background: #ccc; + color: #fff; + white-space: nowrap; + position: relative; + overflow: hidden; + vertical-align: middle; + width: 32px; + height: 32px; + line-height: 32px; + border-radius: 16px; +} + +.logo-con{ + height: 60px; + padding: 13px 0 0; + img{ + height: 32px; + width: 135px; + display: block; + //margin: 0 auto; + } +} + +#el-login-footer { + height: 40px; + line-height: 40px; + position: fixed; + bottom: 0; + width: 100%; + text-align: center; + color: #fff; + font-family: Arial, serif; + font-size: 12px; + letter-spacing: 1px; +} + +#el-main-footer { + background: none repeat scroll 0 0 white; + border-top: 1px solid #e7eaec; + overflow: hidden; + padding: 10px 6px 0 6px; + height: 33px; + font-size: 0.7rem !important; + color: #7a8b9a; + letter-spacing: 0.8px; + font-family: Arial, sans-serif !important; + position: fixed; + bottom: 0; + z-index: 99; + width: 100%; +} +.eladmin-upload { + border: 1px dashed #c0ccda; + border-radius: 5px; + height: 45px; + line-height: 45px; + width: 368px; +} +.my-blockquote{ + margin: 0 0 10px; + padding: 15px; + line-height: 22px; + border-left: 5px solid #00437B; + border-radius: 0 2px 2px 0; + background-color: #f2f2f2; +} +.my-code{ + position: relative; + padding: 15px; + line-height: 20px; + border-left: 5px solid #ddd; + color: #333; + font-family: Courier New, serif; + font-size: 12px +} + +.el-tabs{ + margin-bottom: 25px; +} diff --git a/src/assets/styles/element-ui.scss b/src/assets/styles/element-ui.scss new file mode 100644 index 0000000..c882815 --- /dev/null +++ b/src/assets/styles/element-ui.scss @@ -0,0 +1,78 @@ + + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type="file"] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + +.cell { + .el-tag { + margin-right: 0; + } +} + +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} + +.fixed-width { + .el-button--mini { + padding: 7px 10px; + width: 60px; + } +} + +.status-col { + .cell { + padding: 0 10px; + text-align: center; + + .el-tag { + margin-right: 0; + } + } +} + +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block + } +} + +// fix date-picker ui bug in filter-item +.el-range-editor.el-input__inner { + display: inline-flex !important; +} diff --git a/src/assets/styles/element-variables.scss b/src/assets/styles/element-variables.scss new file mode 100644 index 0000000..7bf3006 --- /dev/null +++ b/src/assets/styles/element-variables.scss @@ -0,0 +1,27 @@ + + + +$--color-primary: #1890ff; +$--color-success: #13ce66; +$--color-warning: #FFBA00; +$--color-danger: #ff4949; +// $--color-info: #1E1E1E; + +$--button-font-weight: 400; + +// $--color-text-regular: #1f2d3d; + +$--border-color-light: #dfe4ed; +$--border-color-lighter: #e6ebf5; + +$--table-border:1px solid#dfe6ec; + + +$--font-path: '~element-ui/lib/theme-chalk/fonts'; + +@import "../../../node_modules/element-ui/packages/theme-chalk/src/index"; + + +:export { + theme: $--color-primary; +} diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss new file mode 100644 index 0000000..21fbda1 --- /dev/null +++ b/src/assets/styles/index.scss @@ -0,0 +1,182 @@ +@import 'variables'; +@import 'mixin'; +@import 'transition'; +@import 'element-ui'; +@import 'sidebar'; +@import 'btn'; +@import 'eladmin'; + +body { + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; +} + +label { + font-weight: 700; +} + +html { + height: 100%; + box-sizing: border-box; +} + +#app { + height: 100%; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +.no-padding { + padding: 0 !important; +} + +.padding-content { + padding: 4px 0; +} + +a:focus, +a:active { + outline: none; +} + +a, +a:focus, +a:hover { + cursor: pointer; + color: inherit; + text-decoration: none; +} + +div:focus { + outline: none; +} + +.fr { + float: right; +} + +.fl { + float: left; +} + +.pr-5 { + padding-right: 5px; +} + +.pl-5 { + padding-left: 5px; +} + +.block { + display: block; +} + +.pointer { + cursor: pointer; +} + +.inlineBlock { + display: block; +} + +.clearfix { + &:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; + } +} + +aside { + background: #eef1f6; + padding: 8px 24px; + margin-bottom: 20px; + border-radius: 2px; + display: block; + line-height: 32px; + font-size: 16px; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + color: #2c3e50; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + a { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } + } +} + +//main-container全局样式 +.app-container { + padding: 20px 20px 45px 20px; +} + +.components-container { + margin: 30px 50px; + position: relative; +} + +.pagination-container { + margin-top: 30px; +} + +.text-center { + text-align: center +} + +.sub-navbar { + height: 50px; + line-height: 50px; + position: relative; + width: 100%; + text-align: right; + padding-right: 20px; + transition: 600ms ease position; + background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%); + + .subtitle { + font-size: 20px; + color: #fff; + } + + &.draft { + background: #d0d0d0; + } + + &.deleted { + background: #d0d0d0; + } +} + +.link-type, +.link-type:focus { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } +} + +//refine vue-multiselect plugin +.multiselect { + line-height: 16px; +} + +.multiselect--active { + z-index: 1000 !important; +} diff --git a/src/assets/styles/mixin.scss b/src/assets/styles/mixin.scss new file mode 100644 index 0000000..06fa061 --- /dev/null +++ b/src/assets/styles/mixin.scss @@ -0,0 +1,66 @@ +@mixin clearfix { + &:after { + content: ""; + display: table; + clear: both; + } +} + +@mixin scrollBar { + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } +} + +@mixin relative { + position: relative; + width: 100%; + height: 100%; +} + +@mixin pct($pct) { + width: #{$pct}; + position: relative; + margin: 0 auto; +} + +@mixin triangle($width, $height, $color, $direction) { + $width: $width/2; + $color-border-style: $height solid $color; + $transparent-border-style: $width solid transparent; + height: 0; + width: 0; + + @if $direction==up { + border-bottom: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==right { + border-left: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } + + @else if $direction==down { + border-top: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==left { + border-right: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } +} diff --git a/src/assets/styles/sidebar.scss b/src/assets/styles/sidebar.scss new file mode 100644 index 0000000..17381fc --- /dev/null +++ b/src/assets/styles/sidebar.scss @@ -0,0 +1,209 @@ +#app { + + .main-container { + min-height: 100%; + transition: margin-left .28s; + margin-left: $sideBarWidth; + position: relative; + } + + .sidebar-container { + transition: width 0.28s; + width: $sideBarWidth !important; + background-color: $menuBg; + height: 100%; + position: fixed; + font-size: 0; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; + + // reset element-ui css + .horizontal-collapse-transition { + transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; + } + + .scrollbar-wrapper { + overflow-x: hidden !important; + } + + .el-scrollbar__bar.is-vertical { + right: 0; + } + + .el-scrollbar { + height: 100%; + } + + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } + + .is-horizontal { + display: none; + } + + a { + display: inline-block; + width: 100%; + overflow: hidden; + } + + .svg-icon { + margin-right: 16px; + } + + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } + + // menu hover + .submenu-title-noDropdown, + .el-submenu__title { + &:hover { + background-color: $menuHover !important; + } + } + + .is-active>.el-submenu__title { + color: $subMenuActiveText !important; + } + + & .nest-menu .el-submenu>.el-submenu__title, + & .el-submenu .el-menu-item { + min-width: $sideBarWidth !important; + background-color: $subMenuBg !important; + + &:hover { + background-color: $subMenuHover !important; + } + } + } + + .hideSidebar { + .sidebar-container { + width: 54px !important; + } + + .main-container { + margin-left: 54px; + } + + .submenu-title-noDropdown { + padding: 0 !important; + position: relative; + + .el-tooltip { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-submenu { + overflow: hidden; + + &>.el-submenu__title { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + + .el-submenu__icon-arrow { + display: none; + } + } + } + + .el-menu--collapse { + .el-submenu { + &>.el-submenu__title { + &>span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } + + .el-menu--collapse .el-menu .el-submenu { + min-width: $sideBarWidth !important; + } + + // mobile responsive + .mobile { + .main-container { + margin-left: 0; + } + + .sidebar-container { + transition: transform .28s; + width: $sideBarWidth !important; + } + + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$sideBarWidth, 0, 0); + } + } + } + + .withoutAnimation { + + .main-container, + .sidebar-container { + transition: none; + } + } +} + +// when menu collapsed +.el-menu--vertical { + &>.el-menu { + .svg-icon { + margin-right: 16px; + } + } + + .nest-menu .el-submenu>.el-submenu__title, + .el-menu-item { + &:hover { + // you can use $subMenuHover + background-color: $menuHover !important; + } + } + + // the scroll bar appears when the subMenu is too long + >.el-menu--popup { + max-height: 100vh; + overflow-y: auto; + + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } + } +} diff --git a/src/assets/styles/transition.scss b/src/assets/styles/transition.scss new file mode 100644 index 0000000..88ce0bf --- /dev/null +++ b/src/assets/styles/transition.scss @@ -0,0 +1,48 @@ + + +/* fade */ +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.28s; +} + +.fade-enter, +.fade-leave-active { + opacity: 0; +} + +/* fade-transform */ +.fade-transform-leave-active, +.fade-transform-enter-active { + transition: all .5s; +} + +.fade-transform-enter { + opacity: 0; + transform: translateX(-30px); +} + +.fade-transform-leave-to { + opacity: 0; + transform: translateX(30px); +} + +/* breadcrumb transition */ +.breadcrumb-enter-active, +.breadcrumb-leave-active { + transition: all .5s; +} + +.breadcrumb-enter, +.breadcrumb-leave-active { + opacity: 0; + transform: translateX(20px); +} + +.breadcrumb-move { + transition: all .5s; +} + +.breadcrumb-leave-active { + position: absolute; +} diff --git a/src/assets/styles/variables.scss b/src/assets/styles/variables.scss new file mode 100644 index 0000000..179bd0f --- /dev/null +++ b/src/assets/styles/variables.scss @@ -0,0 +1,34 @@ +// base color +$blue:#324157; +$light-blue:#3A71A8; +$red:#C03639; +$pink: #E65D6E; +$green: #30B08F; +$tiffany: #4AB7BD; +$yellow:#FEC171; +$panGreen: #30B08F; + +// sidebar +$menuText:#bfcbd9; +$menuActiveText:#409EFF; +$subMenuActiveText:#f4f4f5; + +$menuBg:#304156; +$menuHover:#263445; + +$subMenuBg:#1f2d3d; +$subMenuHover:#001528; + +$sideBarWidth: 205px; + + +:export { + menuText: $menuText; + menuActiveText: $menuActiveText; + subMenuActiveText: $subMenuActiveText; + menuBg: $menuBg; + menuHover: $menuHover; + subMenuBg: $subMenuBg; + subMenuHover: $subMenuHover; + sideBarWidth: $sideBarWidth; +} diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue new file mode 100644 index 0000000..3d805df --- /dev/null +++ b/src/layout/components/AppMain.vue @@ -0,0 +1,61 @@ + + + + + + + diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue new file mode 100644 index 0000000..6360164 --- /dev/null +++ b/src/layout/components/Navbar.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue new file mode 100644 index 0000000..749de87 --- /dev/null +++ b/src/layout/components/Settings/index.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/layout/components/Sidebar/FixiOSBug.js b/src/layout/components/Sidebar/FixiOSBug.js new file mode 100644 index 0000000..c41f7ea --- /dev/null +++ b/src/layout/components/Sidebar/FixiOSBug.js @@ -0,0 +1,24 @@ +export default { + computed: { + device() { + return this.$store.state.app.device + } + }, + mounted() { + this.fixBugIniOS() + }, + methods: { + fixBugIniOS() { + const $subMenu = this.$refs.subMenu + if ($subMenu) { + const handleMouseleave = $subMenu.handleMouseleave + $subMenu.handleMouseleave = (e) => { + if (this.device === 'mobile') { + return + } + handleMouseleave(e) + } + } + } + } +} diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue new file mode 100644 index 0000000..b515f61 --- /dev/null +++ b/src/layout/components/Sidebar/Item.vue @@ -0,0 +1,29 @@ + diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue new file mode 100644 index 0000000..eb4dd10 --- /dev/null +++ b/src/layout/components/Sidebar/Link.vue @@ -0,0 +1,36 @@ + + + + diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue new file mode 100644 index 0000000..6a943e2 --- /dev/null +++ b/src/layout/components/Sidebar/Logo.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue new file mode 100644 index 0000000..b0ba5f8 --- /dev/null +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -0,0 +1,83 @@ + + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..d0e1429 --- /dev/null +++ b/src/layout/components/Sidebar/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue new file mode 100644 index 0000000..b15b959 --- /dev/null +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue new file mode 100644 index 0000000..c31f0c3 --- /dev/null +++ b/src/layout/components/TagsView/index.vue @@ -0,0 +1,285 @@ + + + + + + + diff --git a/src/layout/components/index.js b/src/layout/components/index.js new file mode 100644 index 0000000..cae537c --- /dev/null +++ b/src/layout/components/index.js @@ -0,0 +1,6 @@ +export { default as AppMain } from './AppMain' +export { default as Navbar } from './Navbar' +export { default as Settings } from './Settings' +export { default as Sidebar } from './Sidebar/index' +export { default as TagsView } from './TagsView/index' +// export { default as TopMenus } from './TopMenus' diff --git a/src/layout/index.vue b/src/layout/index.vue new file mode 100644 index 0000000..3934423 --- /dev/null +++ b/src/layout/index.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/layout/mixin/ResizeHandler.js b/src/layout/mixin/ResizeHandler.js new file mode 100644 index 0000000..3a24056 --- /dev/null +++ b/src/layout/mixin/ResizeHandler.js @@ -0,0 +1,44 @@ +import store from '@/store' + +const { body } = document +const WIDTH = 992 + +export default { + watch: { + $route(route) { + if (this.device === 'mobile' && this.sidebar.opened) { + store.dispatch('app/closeSideBar', { withoutAnimation: false }) + } + } + }, + beforeMount() { + window.addEventListener('resize', this.$_resizeHandler) + }, + beforeDestroy() { + window.removeEventListener('resize', this.$_resizeHandler) + }, + mounted() { + const isMobile = this.$_isMobile() + if (isMobile) { + store.dispatch('app/toggleDevice', 'mobile') + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + }, + methods: { + + $_isMobile() { + const rect = body.getBoundingClientRect() + return rect.width - 1 < WIDTH + }, + $_resizeHandler() { + if (!document.hidden) { + const isMobile = this.$_isMobile() + store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') + + if (isMobile) { + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + } + } + } +} diff --git a/src/mixins/crud.js b/src/mixins/crud.js new file mode 100644 index 0000000..bb90342 --- /dev/null +++ b/src/mixins/crud.js @@ -0,0 +1,335 @@ +import { + initData, + download +} from '@/api/data' +import { + parseTime, + downloadFile +} from '@/utils/index' + +export default { + data() { + return { + // 表格数据 + data: [], + // 排序规则,默认 id 降序, 支持多字段排序 ['id,desc', 'createTime,asc'] + sort: ['id,desc'], + // 页码 + page: 0, + // 每页数据条数 + size: 10, + // 总数据条数 + total: 0, + // 请求数据的url + url: '', + // 查询数据的参数 + params: {}, + // 待查询的对象 + query: {}, + // 等待时间 + time: 50, + // 是否为新增类型的表单 + isAdd: false, + // 导出的 Loading + downloadLoading: false, + // 表格 Loading 属性 + loading: true, + // 删除 Loading 属性 + delLoading: false, + delAllLoading: false, + // 弹窗属性 + dialog: false, + // Form 表单 + form: {}, + // 重置表单 + resetForm: {}, + // 标题 + title: '' + } + }, + methods: { + parseTime, + downloadFile, + async init() { + if (!await this.beforeInit()) { + return + } + return new Promise((resolve, reject) => { + this.loading = true + // 请求数据 + initData(this.url, this.getQueryParame()).then(data => { + this.total = data.totalElements + this.data = data.content + // time 毫秒后显示表格 + setTimeout(() => { + this.loading = false + }, this.time) + resolve(data) + }).catch(err => { + this.loading = false + reject(err) + }) + }) + }, + beforeInit() { + return true + }, + getQueryParame: function() { + return { + page: this.page, + size: this.size, + sort: this.sort, + ...this.query, + ...this.params + } + }, + // 改变页码 + pageChange(e) { + this.page = e - 1 + this.init() + }, + // 改变每页显示数 + sizeChange(e) { + this.page = 0 + this.size = e + this.init() + }, + // 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据 + dleChangePage(size) { + if (size === undefined) { + size = 1 + } + if (this.data.length === size && this.page !== 0) { + this.page = this.page - 1 + } + }, + // 查询方法 + toQuery() { + this.page = 0 + this.init() + }, + /** + * 通用的提示封装 + */ + submitSuccessNotify() { + this.$notify({ + title: '提交成功', + type: 'success', + duration: 2500 + }) + }, + addSuccessNotify() { + this.$notify({ + title: '新增成功', + type: 'success', + duration: 2500 + }) + }, + editSuccessNotify() { + this.$notify({ + title: '编辑成功', + type: 'success', + duration: 2500 + }) + }, + delSuccessNotify() { + this.$notify({ + title: '删除成功', + type: 'success', + duration: 2500 + }) + }, + notify(title, type) { + this.$notify({ + title: title, + type: type, + duration: 2500 + }) + }, + /** + * 删除前可以调用 beforeDelMethod 做一些操作 + */ + beforeDelMethod() { + return true + }, + /** + * 通用的删除 + */ + delMethod(id) { + if (!this.beforeDelMethod()) { + return + } + this.delLoading = true + this.crudMethod.del(id).then(() => { + this.delLoading = false + this.$refs[id].doClose() + this.dleChangePage() + this.delSuccessNotify() + this.afterDelMethod() + this.init() + }).catch(() => { + this.delLoading = false + this.$refs[id].doClose() + }) + }, + afterDelMethod() {}, + /** + * 多选删除提示 + */ + beforeDelAllMethod() { + this.$confirm('你确定删除选中的数据吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.delAllMethod() + }) + }, + /** + * 多选删除 + */ + delAllMethod() { + this.delAllLoading = true + const data = this.$refs.table.selection + const ids = [] + for (let i = 0; i < data.length; i++) { + ids.push(data[i].id) + } + this.crudMethod.delAll(ids).then(() => { + this.delAllLoading = false + this.dleChangePage(ids.length) + this.init() + this.$notify({ + title: '删除成功', + type: 'success', + duration: 2500 + }) + }).catch(() => { + this.delAllLoading = false + }) + }, + /** + * 显示新增弹窗前可以调用该方法 + */ + beforeShowAddForm() {}, + /** + * 显示新增弹窗 + */ + showAddFormDialog() { + this.isAdd = true + this.resetForm = JSON.parse(JSON.stringify(this.form)) + this.beforeShowAddForm() + this.dialog = true + }, + /** + * 显示编辑弹窗前可以调用该方法 + */ + beforeShowEditForm(data) {}, + /** + * 显示编辑弹窗 + */ + showEditFormDialog(data = '') { + this.isAdd = false + if (data) { + this.resetForm = JSON.parse(JSON.stringify(this.form)) + this.form = JSON.parse(JSON.stringify(data)) + } + this.beforeShowEditForm(data) + this.dialog = true + }, + /** + * 新增方法 + */ + addMethod() { + this.crudMethod.add(this.form).then(() => { + this.addSuccessNotify() + this.loading = false + this.afterAddMethod() + this.cancel() + this.init() + }).catch(() => { + this.loading = false + this.afterAddErrorMethod() + }) + }, + /** + * 新增后可以调用该方法 + */ + afterAddMethod() {}, + /** + * 新增失败后调用该方法 + */ + afterAddErrorMethod() {}, + /** + * 通用的编辑方法 + */ + editMethod() { + this.crudMethod.edit(this.form).then(() => { + this.editSuccessNotify() + this.loading = false + this.afterEditMethod() + this.cancel() + this.init() + }).catch(() => { + this.loading = false + }) + }, + /** + * 编辑后可以调用该方法 + */ + afterEditMethod() {}, + /** + * 提交前可以调用该方法 + */ + beforeSubmitMethod() { + return true + }, + /** + * 提交 + */ + submitMethod() { + if (!this.beforeSubmitMethod()) { + return + } + if (this.$refs['form']) { + this.$refs['form'].validate((valid) => { + if (valid) { + this.loading = true + if (this.isAdd) { + this.addMethod() + } else this.editMethod() + } + }) + } + }, + /** + * 隐藏弹窗 + */ + cancel() { + this.dialog = false + if (this.$refs['form']) { + this.$refs['form'].clearValidate() + this.form = this.resetForm + } + }, + /** + * 获取弹窗的标题 + */ + getFormTitle() { + return this.isAdd ? `新增${this.title}` : `编辑${this.title}` + }, + /** + * 通用导出 + */ + downloadMethod() { + this.beforeInit() + this.downloadLoading = true + download(this.url + '/download', this.params).then(result => { + this.downloadFile(result, this.title + '数据', 'xlsx') + this.downloadLoading = false + }).catch(() => { + this.downloadLoading = false + }) + } + } +} diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..2f5c8d1 --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,72 @@ +import router from './routers' +import store from '@/store' +import Config from '@/settings' +import NProgress from 'nprogress' // progress bar +import 'nprogress/nprogress.css' // progress bar style +import { getToken } from '@/utils/auth' // getToken from cookie +import { buildMenus } from '@/api/system/menu' +import { filterAsyncRouter } from '@/store/modules/permission' + +NProgress.configure({ showSpinner: false }) // NProgress Configuration + +const whiteList = ['/login'] // no redirect whitelist + +router.beforeEach((to, from, next) => { + if (to.meta.title) { + document.title = to.meta.title + ' - ' + Config.title + } + NProgress.start() + if (getToken()) { + // 已登录且要跳转的页面是登录页 + if (to.path === '/login') { + next({ path: '/' }) + NProgress.done() + } else { + if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(() => { // 拉取user_info + // 动态路由,拉取菜单 + loadMenus(next, to) + }).catch(() => { + store.dispatch('LogOut').then(() => { + location.reload() // 为了重新实例化vue-router对象 避免bug + }) + }) + // 登录时未拉取 菜单,在此处拉取 + } else if (store.getters.loadMenus) { + // 修改成false,防止死循环 + store.dispatch('updateLoadMenus') + loadMenus(next, to) + } else { + next() + } + } + } else { + /* has no token*/ + if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 + next() + } else { + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 + NProgress.done() + } + } +}) + +export const loadMenus = (next, to) => { + buildMenus().then(res => { + const sdata = JSON.parse(JSON.stringify(res)) + const rdata = JSON.parse(JSON.stringify(res)) + const sidebarRoutes = filterAsyncRouter(sdata) + const rewriteRoutes = filterAsyncRouter(rdata, true) + rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) + + store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由 + router.addRoutes(rewriteRoutes) // 动态添加可访问路由表 + next({ ...to, replace: true }) + }) + store.dispatch('SetSidebarRouters', sidebarRoutes) + }) +} + +router.afterEach(() => { + NProgress.done() // finish progress bar +}) diff --git a/src/router/routers.js b/src/router/routers.js new file mode 100644 index 0000000..a233423 --- /dev/null +++ b/src/router/routers.js @@ -0,0 +1,69 @@ +import Vue from 'vue' +import Router from 'vue-router' +import Layout from '../layout/index' + +Vue.use(Router) + +export const constantRouterMap = [ + { path: '/login', + meta: { title: '登录', noCache: true }, + component: (resolve) => require(['@/views/login'], resolve), + hidden: true + }, + { + path: '/404', + component: (resolve) => require(['@/views/features/404'], resolve), + hidden: true + }, + { + path: '/401', + component: (resolve) => require(['@/views/features/401'], resolve), + hidden: true + }, + { + path: '/redirect', + component: Layout, + hidden: true, + children: [ + { + path: '/redirect/:path*', + component: (resolve) => require(['@/views/features/redirect'], resolve) + } + ] + }, + { + path: '/', + component: Layout, + redirect: '/dashboard', + children: [ + { + path: 'dashboard', + component: (resolve) => require(['@/views/home'], resolve), + name: 'Dashboard', + meta: { title: '首页', icon: 'index', affix: true, noCache: true } + } + ] + }, + { + path: '/user', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'center', + component: (resolve) => require(['@/views/system/user/center'], resolve), + name: '个人中心', + meta: { title: '个人中心' } + } + ] + } +] + +export default new Router({ + // 修改路由,取消hash的注释改变部署模式 + // mode: 'hash', + mode: 'history', + scrollBehavior: () => ({ y: 0 }), + routes: constantRouterMap +}) diff --git a/src/settings.js b/src/settings.js index 3252616..46a025e 100644 --- a/src/settings.js +++ b/src/settings.js @@ -2,7 +2,7 @@ module.exports = { /** * @description 网站标题 */ - title: 'yxk-storeroom', + title: '智能库房综合管理系统', /** * @description 是否显示 tagsView */ diff --git a/src/utils/datetime.js b/src/utils/datetime.js deleted file mode 100644 index 6f8edae..0000000 --- a/src/utils/datetime.js +++ /dev/null @@ -1,213 +0,0 @@ -/* eslint-disable */ - - - -Date.prototype.toMidnight = function() { - this.setHours(0) - this.setMinutes(0) - this.setSeconds(0) - this.setMilliseconds(0) - return this -} - -Date.prototype.daysAgo = function(days, midnight) { - days = days ? days - 0 : 0 - const date = new Date(this.getTime() - days * 8.64E7) - return midnight ? date.toMidnight() : date -} - -Date.prototype.monthBegin = function(offset) { - offset = offset ? offset - 0 : 0 - const days = this.getDate() - 1 - offset - return this.daysAgo(days, true) -} - -Date.prototype.quarterBegin = function() { - const month = this.getMonth() - this.getMonth() % 3 - return new Date(this.getFullYear(), month, 1).toMidnight() -} - -Date.prototype.yearBegin = function() { - return new Date(this.getFullYear(), 0, 1).toMidnight() -} - -Date.prototype.strftime = function(format, local) { - if (!format) { - const str = new Date(this.getTime() + 2.88E7).toISOString() - return str.substr(0, 16).replace('T', ' ') - } - local = local && local.startsWith('zh') ? 'zh' : 'en' - const padZero = function(str, len) { - const pads = len - str.toString().length - return (pads && pads > 0 ? '0'.repeat(pads) : '') + str - } - format = format.replace('%F', '%Y-%m-%d') - format = format.replace(/%D|%x/, '%m/%d/%y') - format = format.replace(/%T|%X/, '%H:%M:%S') - format = format.replace('%R', '%H:%M') - format = format.replace('%r', '%H:%M:%S %p') - format = format.replace('%c', '%a %b %e %H:%M:%S %Y') - const _this = this - return format.replace(/%[A-Za-z%]/g, function(f) { - let ans = f - switch (f) { - case '%%': - ans = '%' - break - - case '%Y': - case '%G': - ans = _this.getFullYear() - break - - case '%y': - ans = _this.getFullYear() % 100 - break - - case '%C': - ans = _this.getFullYear() / 100 - break - - case '%m': - case '%n': - ans = _this.getMonth() + 1 - break - - case '%B': - local = local.startsWith('en') ? 'english' : local - - case '%b': - const m = _this.getMonth() - ans = local_labels.monthes[local][m] - break - - case '%d': - case '%e': - ans = _this.getDate() - break - - case '%j': - ans = _this.getDaysOfYear() - break - - case '%U': - case '%W': - const ws = _this.getWeeksOfYear(f === '%W') - ans = padZero(ws, 2) - break - - case '%w': - ans = _this.getDay() - - case '%u': - ans = ans === 0 ? 7 : ans - break - - case '%A': - local = local.startsWith('en') ? 'english' : local - - case '%a': - const d = _this.getDay() - ans = local_labels.weekdays[local][d] - break - - case '%H': - case '%k': - ans = _this.getHours() - break - - case '%I': - case '%l': - ans = _this.getHours() - ans = ans % 12 - break - - case '%M': - ans = _this.getMinutes() - break - - case '%S': - ans = _this.getSeconds() - break - - case '%s': - ans = parseInt(_this.getTime() / 1E3) - break - - case '%f': - const ms = _this.getMilliseconds() - ans = padZero(ms * 1E3, 6) - break - - case '%P': - local = local.startsWith('en') ? 'english' : local - - case '%p': - const h = _this.getHours() - ans = local_labels.meridians[local][h < 12 ? 0 : 1] - break - - case '%z': - let tzo = _this.getTimezoneOffset() - const sign = tzo < 0 ? '-' : '+' - tzo = Math.abs(tzo) - const ho = padZero(tzo / 60, 2) - const mo = padZero(tzo % 60, 2) - ans = sign + ho + mo - break - - default: - break - } - if (f === '%C' || f === '%y' || f === '%m' || f === '%d' || f === '%H' || f === '%M' || f === '%S') { - ans = padZero(ans, 2) - } - return ans.toString() - }) -} - -Date.prototype.humanize = function(local) { - local = local && local.startsWith('zh') ? 'zh' : 'en' - const result = this.strftime('', local) - const days = (Date.today() - this.toMidnight().getTime()) / 8.64E7 - if (days <= -10 || days >= 10) { - return result - } - const labels = local_labels.dayagos[local] - let lbl = '' - if (days === 0 || days === 1) { - lbl = labels[days] - } else if (days === -1) { - lbl = labels[2] - } else if (days >= 2) { - lbl = days + labels[3] - } else { - lbl = days + labels[4] - } - return lbl + result.substr(10, 6) -} - -const local_labels = { - monthes: { - english: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - en: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - zh: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'] - }, - weekdays: { - english: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - en: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - zh: ['日', '一', '二', '三', '四', '五', '六'] - }, - meridians: { - english: ['a.m.', 'p.m.'], - en: ['AM', 'PM'], - zh: ['上午', '下午'] - }, - dayagos: { - english: ['Today', 'Yesterday', 'Tomorrow', ' days ago', ' days late'], - en: ['Today', 'Yesterday', 'Tomorrow', ' days ago', ' days late'], - zh: ['今天', '昨天', '明天', '天前', '天后'] - } -} - -export default Date diff --git a/src/utils/index.js b/src/utils/index.js index 448abf7..47f5b9b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,6 +1,5 @@ - /** - * Parse the time to string + * * @param {(Object|string|number)} time * @param {string} cFormat * @returns {string} @@ -36,7 +35,7 @@ export function parseTime(time, cFormat) { const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { let value = formatObj[key] // Note: getDay() returns 0 on Sunday - if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } if (result.length > 0 && value < 10) { value = '0' + value } @@ -76,14 +75,14 @@ export function formatTime(time, option) { } else { return ( d.getMonth() + - 1 + - '月' + - d.getDate() + - '日' + - d.getHours() + - '时' + - d.getMinutes() + - '分' + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' ) } } @@ -162,12 +161,12 @@ export function param2Obj(url) { } return JSON.parse( '{"' + - decodeURIComponent(search) - .replace(/"/g, '\\"') - .replace(/&/g, '","') - .replace(/=/g, '":"') - .replace(/\+/g, ' ') + - '"}' + decodeURIComponent(search) + .replace(/"/g, '\\"') + .replace(/&/g, '","') + .replace(/=/g, '":"') + .replace(/\+/g, ' ') + + '"}' ) } @@ -219,8 +218,8 @@ export function toggleClass(element, className) { classString += '' + className } else { classString = - classString.substr(0, nameIndex) + - classString.substr(nameIndex + className.length) + classString.substr(0, nameIndex) + + classString.substr(nameIndex + className.length) } element.className = classString } diff --git a/src/utils/permission.js b/src/utils/permission.js index b0c7523..58c22e5 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -3,7 +3,7 @@ import store from '@/store' /** * @param {Array} value * @returns {Boolean} - * @example see @/views/permission/directive.vue + * @example */ export default { install(Vue) { @@ -11,9 +11,15 @@ export default { if (value && value instanceof Array && value.length > 0) { const roles = store.getters && store.getters.roles const permissionRoles = value - return roles.some(role => { + + const hasPermission = roles.some(role => { return permissionRoles.includes(role) }) + + if (!hasPermission) { + return false + } + return true } else { console.error(`need roles! Like v-permission="['admin','editor']"`) return false diff --git a/src/utils/request.js b/src/utils/request.js index ce7fd1b..ae3096d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,8 +1,12 @@ import axios from 'axios' import router from '@/router/routers' -import { Notification } from 'element-ui' +import { + Notification +} from 'element-ui' import store from '../store' -import { getToken } from '@/utils/auth' +import { + getToken +} from '@/utils/auth' import Config from '@/settings' import Cookies from 'js-cookie' @@ -65,7 +69,9 @@ service.interceptors.response.use( location.reload() }) } else if (code === 403) { - router.push({ path: '/401' }) + router.push({ + path: '/401' + }) } else { const errorMsg = error.response.data.message if (errorMsg !== undefined) { diff --git a/src/utils/rsaEncrypt.js b/src/utils/rsaEncrypt.js index 1948ddd..ab350a2 100644 --- a/src/utils/rsaEncrypt.js +++ b/src/utils/rsaEncrypt.js @@ -2,8 +2,19 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' // 密钥对生成 http://web.chacuo.net/netrsakeypair -const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + - '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' +// const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + +// '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' + +const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANP2lMp6IM32vCRevWqZAZHGLLL8rafpcLA9XQFxF0lW88RsvCKQOnjRi7uH13KBL2O5dxUrz5ZgC9TwLGiT0ZcCAwEAAQ==' + +const privateKey = 'MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEA0/aUynogzfa8JF69\n' + +'apkBkcYssvytp+lwsD1dAXEXSVbzxGy8IpA6eNGLu4fXcoEvY7l3FSvPlmAL1PAs\n' + +'aJPRlwIDAQABAkBAiHVag/5S1skHRbTjrHvW1wAq6lUwpxkA/12+n6DYWcuv7bbJ\n' + +'kNOHuXMXFLg6Lhr5+z5BIQYA0K56+XWSAJNJAiEA+IIa90mRTzfWwweDr7Ezc8DT\n' + +'5rMIlMDucMCaXGmg2PUCIQDaWm9YmJfnifHobONoprpm/qRvZGr2JKlCWbv41A5Y\n' + +'2wIgVge0jidJxsLt9laDoC8YQNpggV05e0XPRflndtaaeIECIQDKzqqS6JBW31pP\n' + +'3itOfWWu2h9S0ztBygVn+j7MO/HjdwIhAN0+OATaKEHXh1RrxdWxxrxEQVmKoIAt\n' + +'SSMqJ/1ElFO7' // 加密 export function encrypt(txt) { @@ -12,3 +23,10 @@ export function encrypt(txt) { return encryptor.encrypt(txt) // 对需要加密的数据进行加密 } +// 解密 +export function decrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPrivateKey(privateKey) + return encryptor.decrypt(txt) +} + diff --git a/src/utils/shortcuts.js b/src/utils/shortcuts.js index d92edc3..a191590 100644 --- a/src/utils/shortcuts.js +++ b/src/utils/shortcuts.js @@ -3,102 +3,90 @@ import Date from './datetime.js' export const calendarBaseShortcuts = [{ text: '今天', onClick(picker) { - const startTime = new Date(new Date().setHours(0, 0, 0)) - const endTime = new Date(new Date().setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date() + picker.$emit('pick', [start, start]) } }, { text: '昨天', onClick(picker) { - const startTime = new Date(new Date().daysAgo(1).setHours(0, 0, 0)) - const endTime = new Date(new Date().daysAgo(1).setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date().daysAgo(1) + picker.$emit('pick', [start, start]) } }, { text: '最近一周', onClick(picker) { - const startTime = new Date(new Date().daysAgo(7).setHours(0, 0, 0)) - const endTime = new Date(new Date().setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date().daysAgo(7) + picker.$emit('pick', [start, new Date()]) } }, { text: '最近30天', onClick(picker) { - const startTime = new Date(new Date().daysAgo(30).setHours(0, 0, 0)) - const endTime = new Date(new Date().setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date().daysAgo(30) + picker.$emit('pick', [start, new Date()]) } }, { text: '这个月', onClick(picker) { - const startTime = new Date(new Date().monthBegin().setHours(0, 0, 0)) - const endTime = new Date(new Date().setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date().monthBegin() + picker.$emit('pick', [start, new Date()]) } }, { text: '本季度', onClick(picker) { - const startTime = new Date(new Date().quarterBegin().setHours(0, 0, 0)) - const endTime = new Date(new Date().setHours(23, 59, 59)) - picker.$emit('pick', [startTime, endTime]) + const start = new Date().quarterBegin() + picker.$emit('pick', [start, new Date()]) } }] export const calendarMoveShortcuts = [{ text: '‹ 往前一天 ', onClick(picker) { - let startTime = new Date(new Date().daysAgo(1).setHours(0, 0, 0)) - let endTime = new Date(new Date().daysAgo(1).setHours(23, 59, 59)) - if (!picker.value) { - picker.value = [startTime, endTime] + if (picker.value.length === 0) { + picker.value = [new Date(), new Date()] } - startTime = picker.value[0].daysAgo(1) - endTime = picker.value[1].daysAgo(1) - picker.$emit('pick', [startTime, endTime]) + const start = picker.value[0].daysAgo(1) + const end = picker.value[1].daysAgo(1) + picker.$emit('pick', [start, end]) } }, { text: ' 往后一天 ›', onClick(picker) { - let startTime = new Date(new Date().setHours(0, 0, 0)) - let endTime = new Date(new Date().setHours(23, 59, 59)) - if (!picker.value) { - picker.value = [startTime, endTime] + let start = new Date() + let end = new Date() + if (picker.value.length > 0) { + if (end - picker.value[1] > 8.64E7) { + start = picker.value[0].daysAgo(-1) + end = picker.value[1].daysAgo(-1) + } else { + start = picker.value[0] + } } - startTime = picker.value[0].daysAgo(-1) - endTime = picker.value[1].daysAgo(-1) - picker.$emit('pick', [startTime, endTime]) + picker.$emit('pick', [start, end]) } }, { text: '« 往前一周 ', onClick(picker) { - let startTime = new Date(new Date().setHours(0, 0, 0)) - let endTime = new Date(new Date().setHours(23, 59, 59)) - if (!picker.value) { - picker.value = [startTime.daysAgo(new Date().getDay()), - endTime.daysAgo(new Date().getDay() + 1)] - } else { - picker.value = [picker.value[0].daysAgo(picker.value[0].getDay()), - picker.value[1].daysAgo(picker.value[1].getDay() + 1)] + if (picker.value.length === 0) { + picker.value = [new Date().daysAgo(7), new Date()] } - startTime = picker.value[0].daysAgo(7) - endTime = picker.value[1] - picker.$emit('pick', [startTime, endTime]) + const start = picker.value[0].daysAgo(7) + const end = picker.value[1].daysAgo(7) + picker.$emit('pick', [start, end]) } }, { text: ' 往后一周 »', onClick(picker) { - let startTime = new Date(new Date().setHours(0, 0, 0)) - let endTime = new Date(new Date().setHours(23, 59, 59)) - if (!picker.value) { - picker.value = [startTime.daysAgo(new Date().getDay() - 7), - endTime.daysAgo(new Date().getDay() - 6)] - } else { - picker.value = [picker.value[0].daysAgo(picker.value[0].getDay() - 7), - picker.value[1].daysAgo(picker.value[1].getDay() - 6)] + let start = new Date().daysAgo(7) + let end = new Date() + if (picker.value.length > 0) { + if (end - picker.value[1] > 8.64E7) { + start = picker.value[0].daysAgo(-7) + end = picker.value[1].daysAgo(-7) + } else { + start = picker.value[0] + } } - startTime = picker.value[0] - endTime = picker.value[1].daysAgo(-7) - picker.$emit('pick', [startTime, endTime]) + picker.$emit('pick', [start, end]) } }] diff --git a/src/utils/validate.js b/src/utils/validate.js index 777e5b4..dcf7d9d 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -62,7 +62,7 @@ export function validEmail(email) { } export function isvalidPhone(phone) { - const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/ + const reg = /^1[3|4|5|7|8][0-9]\d{8}$/ return reg.test(phone) } @@ -109,7 +109,7 @@ export function validateIP(rule, value, callback) { /* 是否手机号码或者固话*/ export function validatePhoneTwo(rule, value, callback) { - const reg = /^((0\d{2,3}-\d{7,8})|(1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}))$/ + const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/ if (value === '' || value === undefined || value == null) { callback() } else { @@ -137,7 +137,7 @@ export function validateTelephone(rule, value, callback) { /* 是否手机号码*/ export function validatePhone(rule, value, callback) { - const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/ + const reg = /^[1][3,4,5,7,8][0-9]{9}$/ if (value === '' || value === undefined || value == null) { callback() } else { @@ -162,3 +162,4 @@ export function validateIdNo(rule, value, callback) { } } } + diff --git a/src/views/componts/Echarts.vue b/src/views/componts/Echarts.vue new file mode 100644 index 0000000..d70a8a3 --- /dev/null +++ b/src/views/componts/Echarts.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/views/componts/Editor.vue b/src/views/componts/Editor.vue new file mode 100644 index 0000000..b602d70 --- /dev/null +++ b/src/views/componts/Editor.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/views/componts/MarkDown.vue b/src/views/componts/MarkDown.vue new file mode 100644 index 0000000..4eff05c --- /dev/null +++ b/src/views/componts/MarkDown.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/views/componts/YamlEdit.vue b/src/views/componts/YamlEdit.vue new file mode 100644 index 0000000..9455fde --- /dev/null +++ b/src/views/componts/YamlEdit.vue @@ -0,0 +1,207 @@ + + + + + diff --git a/src/views/componts/excel/upload-excel.vue b/src/views/componts/excel/upload-excel.vue new file mode 100644 index 0000000..75f7634 --- /dev/null +++ b/src/views/componts/excel/upload-excel.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/views/componts/icons/element-icons.js b/src/views/componts/icons/element-icons.js new file mode 100644 index 0000000..df72201 --- /dev/null +++ b/src/views/componts/icons/element-icons.js @@ -0,0 +1,74 @@ +const elementIcons = [ + 'info', + 'error', + 'success', + 'warning', + 'question', + 'back', + 'arrow-left', + 'arrow-down', + 'arrow-right', + 'arrow-up', + 'caret-left', + 'caret-bottom', + 'caret-top', + 'caret-right', + 'd-arrow-left', + 'd-arrow-right', + 'minus', + 'plus', + 'remove', + 'circle-plus', + 'remove-outline', + 'circle-plus-outline', + 'close', + 'check', + 'circle-close', + 'circle-check', + 'circle-close-outline', + 'circle-check-outline', + 'zoom-out', + 'zoom-in', + 'd-caret', + 'sort', + 'sort-down', + 'sort-up', + 'tickets', + 'document', + 'goods', + 'sold-out', + 'news', + 'message', + 'date', + 'printer', + 'time', + 'bell', + 'mobile-phone', + 'service', + 'view', + 'menu', + 'more', + 'more-outline', + 'star-on', + 'star-off', + 'location', + 'location-outline', + 'phone', + 'phone-outline', + 'picture', + 'picture-outline', + 'delete', + 'search', + 'edit', + 'edit-outline', + 'rank', + 'refresh', + 'share', + 'setting', + 'upload', + 'upload2', + 'download', + 'loading' +] + +export default elementIcons diff --git a/src/views/componts/icons/index.vue b/src/views/componts/icons/index.vue new file mode 100644 index 0000000..fa24e9e --- /dev/null +++ b/src/views/componts/icons/index.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/views/componts/icons/svg-icons.js b/src/views/componts/icons/svg-icons.js new file mode 100644 index 0000000..724cd8e --- /dev/null +++ b/src/views/componts/icons/svg-icons.js @@ -0,0 +1,10 @@ +const req = require.context('../../../assets/icons/svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys() + +const re = /\.\/(.*)\.svg/ + +const svgIcons = requireAll(req).map(i => { + return i.match(re)[1] +}) + +export default svgIcons diff --git a/src/views/home.vue b/src/views/home.vue new file mode 100644 index 0000000..c2f031b --- /dev/null +++ b/src/views/home.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/views/login.vue b/src/views/login.vue new file mode 100644 index 0000000..25b2302 --- /dev/null +++ b/src/views/login.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue new file mode 100644 index 0000000..d02b846 --- /dev/null +++ b/src/views/system/dept/index.vue @@ -0,0 +1,254 @@ + + + + + + diff --git a/src/views/system/dict/dictDetail.vue b/src/views/system/dict/dictDetail.vue new file mode 100644 index 0000000..32756da --- /dev/null +++ b/src/views/system/dict/dictDetail.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue new file mode 100644 index 0000000..20c818b --- /dev/null +++ b/src/views/system/dict/index.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/src/views/system/job/index.vue b/src/views/system/job/index.vue new file mode 100644 index 0000000..e17ea75 --- /dev/null +++ b/src/views/system/job/index.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/src/views/system/job/module/form.vue b/src/views/system/job/module/form.vue new file mode 100644 index 0000000..aa538fb --- /dev/null +++ b/src/views/system/job/module/form.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/src/views/system/job/module/header.vue b/src/views/system/job/module/header.vue new file mode 100644 index 0000000..6503317 --- /dev/null +++ b/src/views/system/job/module/header.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue new file mode 100644 index 0000000..110077e --- /dev/null +++ b/src/views/system/menu/index.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue new file mode 100644 index 0000000..c6af85b --- /dev/null +++ b/src/views/system/role/index.vue @@ -0,0 +1,357 @@ + + + + + + + diff --git a/src/views/system/timing/index.vue b/src/views/system/timing/index.vue new file mode 100644 index 0000000..bb3bf77 --- /dev/null +++ b/src/views/system/timing/index.vue @@ -0,0 +1,210 @@ + + + diff --git a/src/views/system/timing/log.vue b/src/views/system/timing/log.vue new file mode 100644 index 0000000..09c32ef --- /dev/null +++ b/src/views/system/timing/log.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/views/system/user/center.vue b/src/views/system/user/center.vue new file mode 100644 index 0000000..1cc5681 --- /dev/null +++ b/src/views/system/user/center.vue @@ -0,0 +1,221 @@ + + + + + diff --git a/src/views/system/user/center/updateEmail.vue b/src/views/system/user/center/updateEmail.vue new file mode 100644 index 0000000..b246684 --- /dev/null +++ b/src/views/system/user/center/updateEmail.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/src/views/system/user/center/updatePass.vue b/src/views/system/user/center/updatePass.vue new file mode 100644 index 0000000..078ed17 --- /dev/null +++ b/src/views/system/user/center/updatePass.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue new file mode 100644 index 0000000..92efc12 --- /dev/null +++ b/src/views/system/user/index.vue @@ -0,0 +1,478 @@ + + + + +