From 2f96ef3f59c0084d2943a7fdac9f47f51fe30da5 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 18 十一月 2021 17:35:08 +0800 Subject: [PATCH] 完善权限管理.清理无用的代码 --- src/utils/pageTitle.js | 12 src/views/401.vue | 23 - vue.config.js | 139 ++++---- src/colorfulIcon/index.js | 8 src/utils/clipboard.js | 34 - src/utils/handleRoutes.js | 20 - src/utils/validate.js | 114 ------- src/views/404.vue | 23 - src/utils/permission.js | 18 /dev/null | 52 --- src/main.js | 27 - src/api/project.js | 3 src/config/theme.config.js | 8 src/views/project/components/ProjectEdit.vue | 25 + src/utils/accessToken.js | 54 +-- src/utils/errorLog.js | 2 package.json | 21 - src/views/project/index.vue | 24 webstorm.config.js | 8 src/utils/index.js | 261 ++++++---------- src/views/user/components/UserEdit.vue | 2 21 files changed, 265 insertions(+), 613 deletions(-) diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index e9b54e6..0000000 --- a/nginx.conf +++ /dev/null @@ -1,45 +0,0 @@ -user nginx; -worker_processes auto; -pid /var/run/nginx.pid; - -events { - use epoll; - worker_connections 51200; - multi_accept on; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - server_names_hash_bucket_size 512; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 50m; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; - sendfile on; - tcp_nopush on; - tcp_nodelay on; - - keepalive_timeout 65; - - # gzip 鍘嬬缉 - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.1; - gzip_comp_level 2; - gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; - gzip_vary on; - gzip_proxied expired no-cache no-store private auth; - gzip_disable "MSIE [1-6]\."; - - limit_conn_zone $binary_remote_addr zone=perip:10m; - limit_conn_zone $server_name zone=perserver:10m; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/nginx.default.conf b/nginx.default.conf deleted file mode 100644 index e602ce3..0000000 --- a/nginx.default.conf +++ /dev/null @@ -1,46 +0,0 @@ -server { - listen 80; - server_name localhost; - - access_log /data/log/nginx/access.log main; - error_log /data/log/nginx/error.log; - - # 闈欐�佽祫婧� - location / { - root /data/web; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } - - # 鍓嶇浠g悊 - location ^~ /鍚庣鏈嶅姟鍚� { - proxy_pass http://鍚庣鏈嶅姟IP鍦板潃:8080; - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Credentials: true; - add_header Access-Control-Allow-Methods GET,POST,OPTIONS,PUT,DELETE; - - proxy_http_version 1.1; - # 杩炴帴寤舵椂 - proxy_connect_timeout 3600s; - proxy_read_timeout 3600s; - proxy_send_timeout 3600s; - # IP 绌块�� - proxy_set_header Host $proxy_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - # WebSocket 绌块�� - proxy_set_header Origin ""; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} -} - diff --git a/package.json b/package.json index 6da370f..e6198d6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "lint": "vue-cli-service lint", "lint:style": "stylelint-config-prettier-check", "inspect": "vue-cli-service inspect", - "template": "plop", "clear": "rimraf node_modules&&npm install --registry=https://registry.npm.taobao.org", "image-webpack-loader": "cnpm i image-webpack-loader -D", "use:npm": "nrm use npm", @@ -35,28 +34,22 @@ "clipboard": "^2.0.8", "core-js": "^3.16.2", "dayjs": "^1.10.6", - "echarts": "^5.1.2", "element-ui": "^2.15.5", "jsencrypt": "^3.2.1", "lodash": "^4.17.21", "maptalks": "^0.49.5", "mapv": "^2.0.62", - "mockjs": "^1.1.0", "nprogress": "^0.2.0", "qs": "^6.10.1", "screenfull": "^5.1.0", "sortablejs": "^1.14.0", "vab-icon": "^0.0.1", "vue": "^2.6.14", - "vue-echarts": "6.0.0", "vue-router": "^3.5.2", "vuex": "^3.6.2", "zx-count": "^0.3.7", "zx-layouts": "^0.6.27", "zx-magnifie": "^0.4.0", - "zx-markdown-editor": "^0.0.2", - "zx-player": "^1.0.2", - "zx-quill": "^0.0.3", "zx-templates": "^0.0.26", "zx-verify": "^0.0.2" }, @@ -76,7 +69,6 @@ "filemanager-webpack-plugin": "^6.1.6", "image-webpack-loader": "^7.0.1", "lint-staged": "^11.1.2", - "plop": "^2.7.4", "prettier": "^2.3.2", "sass": "~1.32.13", "sass-loader": "^10.1.1", @@ -87,19 +79,8 @@ "vue-template-compiler": "^2.6.14", "webpackbar": "^4.0.0" }, - "keywords": [ - "vue", - "admin", - "dashboard", - "element-ui", - "vue-admin", - "element-admin", - "boilerplate", - "admin-template", - "management-system" - ], "engines": { "node": ">=8.9", "npm": ">= 3.0.0" } -} \ No newline at end of file +} diff --git a/plopfile.js b/plopfile.js deleted file mode 100644 index 8121409..0000000 --- a/plopfile.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 浠g爜鐢熸垚鏈� - */ -const viewGenerator = require('zx-templates/view/prompt') -const curdGenerator = require('zx-templates/curd/prompt') -const componentGenerator = require('zx-templates/component/prompt') -const mockGenerator = require('zx-templates/mock/prompt') -const vuexGenerator = require('zx-templates/vuex/prompt') -module.exports = (plop) => { - plop.setGenerator('view', viewGenerator) - plop.setGenerator('curd', curdGenerator) - plop.setGenerator('component', componentGenerator) - plop.setGenerator('mock&api', mockGenerator) - plop.setGenerator('vuex', vuexGenerator) -} diff --git a/src/api/project.js b/src/api/project.js index ee06075..f64329d 100644 --- a/src/api/project.js +++ b/src/api/project.js @@ -1,9 +1,10 @@ import request from "@/utils/request"; -export function getList() { +export function getList(query) { return request({ url: "/projects", method: "get", + params: query, }); } diff --git a/src/colorfulIcon/index.js b/src/colorfulIcon/index.js index 2dd876e..09e98c7 100644 --- a/src/colorfulIcon/index.js +++ b/src/colorfulIcon/index.js @@ -1,4 +1,4 @@ -const req = require.context('./svg', false, /\.svg$/), +const req = require.context("./svg", false, /\.svg$/), requireAll = (requireContext) => { /*let a = requireContext.keys().map(requireContext); let arr = []; @@ -8,6 +8,6 @@ arr.push(icon); } console.log(JSON.stringify(arr));*/ - return requireContext.keys().map(requireContext) - } -requireAll(req) + return requireContext.keys().map(requireContext); + }; +requireAll(req); diff --git a/src/components/SelectTree/index.vue b/src/components/SelectTree/index.vue deleted file mode 100644 index d683143..0000000 --- a/src/components/SelectTree/index.vue +++ /dev/null @@ -1,201 +0,0 @@ -<template> - <div class="select-tree-template"> - <el-select - v-model="selectValue" - :clearable="clearable" - :collapse-tags="selectType == 'multiple'" - :multiple="selectType == 'multiple'" - class="vab-tree-select" - value-key="id" - @clear="clearHandle" - @remove-tag="removeTag" - > - <el-option :value="selectKey"> - <el-tree - id="treeOption" - ref="treeOption" - :current-node-key="currentNodeKey" - :data="treeOptions" - :default-checked-keys="defaultSelectedKeys" - :default-expanded-keys="defaultSelectedKeys" - :highlight-current="true" - :props="defaultProps" - :show-checkbox="selectType == 'multiple'" - node-key="id" - @check="checkNode" - @node-click="nodeClick" - ></el-tree> - </el-option> - </el-select> - </div> -</template> - -<script> -export default { - name: "SelectTreeTemplate", - props: { - /* 鏍戝舰缁撴瀯鏁版嵁 */ - treeOptions: { - type: Array, - default: () => { - return []; - }, - }, - /* 鍗曢��/澶氶�� */ - selectType: { - type: String, - default: () => { - return "single"; - }, - }, - /* 鍒濆閫変腑鍊糼ey */ - selectedKey: { - type: String, - default: () => { - return ""; - }, - }, - /* 鍒濆閫変腑鍊糿ame */ - selectedValue: { - type: String, - default: () => { - return ""; - }, - }, - /* 鍙仛閫夋嫨鐨勫眰绾� */ - selectLevel: { - type: [String, Number], - default: () => { - return ""; - }, - }, - /* 鍙竻绌洪�夐」 */ - clearable: { - type: Boolean, - default: () => { - return true; - }, - }, - }, - data() { - return { - defaultProps: { - children: "children", - label: "name", - }, - defaultSelectedKeys: [], //鍒濆閫変腑鍊兼暟缁� - currentNodeKey: this.selectedKey, - selectValue: - this.selectType == "multiple" - ? this.selectedValue.split(",") - : this.selectedValue, //涓嬫媺妗嗛�変腑鍊糽abel - selectKey: - this.selectType == "multiple" - ? this.selectedKey.split(",") - : this.selectedKey, //涓嬫媺妗嗛�変腑鍊紇alue - }; - }, - mounted() { - const that = this; - this.initTree(); - }, - methods: { - // 鍒濆鍖栨爲鐨勫�� - initTree() { - const that = this; - if (that.selectedKey) { - that.defaultSelectedKeys = that.selectedKey.split(","); // 璁剧疆榛樿灞曞紑 - if (that.selectType == "single") { - that.$refs.treeOption.setCurrentKey(that.selectedKey); // 璁剧疆榛樿閫変腑 - } else { - that.$refs.treeOption.setCheckedKeys(that.defaultSelectedKeys); - } - } - }, - // 娓呴櫎閫変腑 - clearHandle() { - const that = this; - this.selectValue = ""; - this.selectKey = ""; - this.defaultSelectedKeys = []; - this.currentNodeKey = ""; - this.clearSelected(); - if (that.selectType == "single") { - that.$refs.treeOption.setCurrentKey(""); // 璁剧疆榛樿閫変腑 - } else { - that.$refs.treeOption.setCheckedKeys([]); - } - }, - /* 娓呯┖閫変腑鏍峰紡 */ - clearSelected() { - const allNode = document.querySelectorAll("#treeOption .el-tree-node"); - allNode.forEach((element) => element.classList.remove("is-current")); - }, - // select澶氶�夋椂绉婚櫎鏌愰」鎿嶄綔 - removeTag(val) { - this.$refs.treeOption.setCheckedKeys([]); - }, - // 鐐瑰嚮鍙跺瓙鑺傜偣 - nodeClick(data, node, el) { - if (data.rank >= this.selectLevel) { - this.selectValue = data.name; - this.selectKey = data.id; - } - }, - // 鑺傜偣閫変腑鎿嶄綔 - checkNode(data, node, el) { - const checkedNodes = this.$refs.treeOption.getCheckedNodes(); - const keyArr = []; - const valueArr = []; - checkedNodes.forEach((item) => { - if (item.rank >= this.selectLevel) { - keyArr.push(item.id); - valueArr.push(item.name); - } - }); - this.selectValue = valueArr; - this.selectKey = keyArr; - }, - }, -}; -</script> - -<style lang="scss" scoped> -.el-scrollbar .el-scrollbar__view .el-select-dropdown__item { - height: auto; - max-height: 274px; - padding: 0; - overflow-y: auto; -} - -.el-select-dropdown__item.selected { - font-weight: normal; -} - -ul li > .el-tree .el-tree-node__content { - height: auto; - padding: 0 20px; -} - -.el-tree-node__label { - font-weight: normal; -} - -.el-tree > .is-current .el-tree-node__label { - font-weight: 700; - color: #409eff; -} - -.el-tree > .is-current .el-tree-node__children .el-tree-node__label { - font-weight: normal; - color: #606266; -} -</style> -<style lang="scss"> -/* .vab-tree-select{ - .el-tag__close.el-icon-close{ - width:0; - overflow:hidden; - } - } */ -</style> diff --git a/src/components/VabCharge/index.vue b/src/components/VabCharge/index.vue deleted file mode 100644 index 14950e9..0000000 --- a/src/components/VabCharge/index.vue +++ /dev/null @@ -1,191 +0,0 @@ -<template> - <div class="content"> - <div class="g-container" :style="styleObj"> - <div class="g-number"> - <vab-count - :start-val="startVal" - :end-val="endVal" - :duration="duration" - :separator="separator" - :prefix="prefix" - :suffix="suffix" - :decimals="decimals" - /> - </div> - <div class="g-contrast"> - <div class="g-circle"></div> - <ul class="g-bubbles"> - <li v-for="(item, index) in 15" :key="index"></li> - </ul> - </div> - </div> - </div> -</template> - -<script> -export default { - name: "VabCharge", - props: { - styleObj: { - type: Object, - default: () => { - return {}; - }, - }, - startVal: { - type: Number, - default: 0, - }, - endVal: { - type: Number, - default: 100, - }, - }, - data() { - return { - decimals: 2, - prefix: "", - suffix: "%", - separator: ",", - duration: 3000, - }; - }, - created() {}, - mounted() {}, - methods: {}, -}; -</script> - -<style lang="scss" scoped> -.content { - position: relative; - display: flex; - align-items: center; /* 鍨傜洿灞呬腑 */ - justify-content: center; /* 姘村钩灞呬腑 */ - width: 100%; - background: #000; - - .g-number { - position: absolute; - top: 27%; - z-index: 99; - width: 300px; - font-size: 32px; - color: #fff; - text-align: center; - } - - .g-container { - position: relative; - width: 300px; - height: 400px; - margin: auto; - } - - .g-contrast { - width: 300px; - height: 400px; - overflow: hidden; - background-color: #000; - filter: contrast(15) hue-rotate(0); - animation: hueRotate 10s infinite linear; - } - - .g-circle { - position: relative; - box-sizing: border-box; - width: 300px; - height: 300px; - filter: blur(8px); - - &::after { - position: absolute; - top: 40%; - left: 50%; - width: 200px; - height: 200px; - content: ""; - background-color: #00ff6f; - border-radius: 42% 38% 62% 49% / 45%; - transform: translate(-50%, -50%) rotate(0); - animation: rotate 10s infinite linear; - } - - &::before { - position: absolute; - top: 40%; - left: 50%; - z-index: 99; - width: 176px; - height: 176px; - content: ""; - background-color: #000; - border-radius: 50%; - transform: translate(-50%, -50%); - } - } - - .g-bubbles { - position: absolute; - bottom: 0; - left: 50%; - width: 100px; - height: 40px; - background-color: #00ff6f; - filter: blur(5px); - border-radius: 100px 100px 0 0; - transform: translate(-50%, 0); - } - - li { - position: absolute; - background: #00ff6f; - border-radius: 50%; - } - - @for $i from 0 through 15 { - li:nth-child(#{$i}) { - $width: 15 + random(15) + px; - - top: 50%; - left: 15 + random(70) + px; - width: $width; - height: $width; - transform: translate(-50%, -50%); - animation: moveToTop - #{random(6) + - 3}s - ease-in-out -#{random(5000) / - 1000}s - infinite; - } - } - - @keyframes rotate { - 50% { - border-radius: 45% / 42% 38% 58% 49%; - } - - 100% { - transform: translate(-50%, -50%) rotate(720deg); - } - } - - @keyframes moveToTop { - 90% { - opacity: 1; - } - - 100% { - opacity: 0.1; - transform: translate(-50%, -180px); - } - } - - @keyframes hueRotate { - 100% { - filter: contrast(15) hue-rotate(360deg); - } - } -} -</style> diff --git a/src/components/VabProfile/index.vue b/src/components/VabProfile/index.vue deleted file mode 100644 index f91e881..0000000 --- a/src/components/VabProfile/index.vue +++ /dev/null @@ -1,313 +0,0 @@ -<template> - <div class="card" :style="styleObj"> - <div class="card-borders"> - <div class="border-top"></div> - <div class="border-right"></div> - <div class="border-bottom"></div> - <div class="border-left"></div> - </div> - <div class="card-content"> - <el-image :src="avatar" class="avatar"></el-image> - <div class="username">{{ username }}</div> - <div class="social-icons"> - <a - v-for="(item, index) in iconArray" - :key="index" - class="social-icon" - :href="item.url" - target="_blank" - > - <vab-icon :icon="['fas', item.icon]" /> - </a> - </div> - </div> - </div> -</template> - -<script> -export default { - name: "VabProfile", - props: { - styleObj: { - type: Object, - default: () => { - return {}; - }, - }, - username: { - type: String, - default: "", - }, - avatar: { - type: String, - default: "", - }, - iconArray: { - type: Array, - default: () => { - return [ - { icon: "bell", url: "" }, - { icon: "bookmark", url: "" }, - { icon: "cloud-sun", url: "" }, - ]; - }, - }, - }, - data() { - return {}; - }, - created() {}, - mounted() {}, - methods: {}, -}; -</script> - -<style lang="scss" scoped> -.card { - --card-bg-color: hsl(240, 31%, 25%); - --card-bg-color-transparent: hsla(240, 31%, 25%, 0.7); - - position: relative; - width: 100%; - height: 100%; - - .card-borders { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - overflow: hidden; - - .border-top { - position: absolute; - top: 0; - width: 100%; - height: 2px; - background: var(--card-bg-color); - transform: translateX(-100%); - animation: slide-in-horizontal 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) - forwards; - } - - .border-right { - position: absolute; - right: 0; - width: 2px; - height: 100%; - background: var(--card-bg-color); - transform: translateY(100%); - animation: slide-in-vertical 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) - forwards; - } - - .border-bottom { - position: absolute; - bottom: 0; - width: 100%; - height: 2px; - background: var(--card-bg-color); - transform: translateX(100%); - animation: slide-in-horizontal-reverse 0.8s - cubic-bezier(0.645, 0.045, 0.355, 1) forwards; - } - - .border-left { - position: absolute; - top: 0; - width: 2px; - height: 100%; - background: var(--card-bg-color); - transform: translateY(-100%); - animation: slide-in-vertical-reverse 0.8s - cubic-bezier(0.645, 0.045, 0.355, 1) forwards; - } - } - - .card-content { - display: flex; - flex-direction: column; - align-items: center; - height: 100%; - padding: 40px 0 40px 0; - background: var(--card-bg-color-transparent); - opacity: 0; - transform: scale(0.6); - animation: bump-in 0.5s 0.8s forwards; - - .avatar { - width: 80px; - height: 80px; - border: 1px solid $base-color-white; - border-radius: 50%; - opacity: 0; - transform: scale(0.6); - animation: bump-in 0.5s 1s forwards; - } - - .username { - position: relative; - margin-top: 20px; - margin-bottom: 20px; - font-size: 26px; - color: transparent; - letter-spacing: 2px; - animation: fill-text-white 1.2s 2s forwards; - - &::before { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - color: black; - content: ""; - background: #35b9f1; - transform: scaleX(0); - transform-origin: left; - animation: slide-in-out 1.2s 1.2s cubic-bezier(0.75, 0, 0, 1) forwards; - } - } - - .social-icons { - display: flex; - - .social-icon { - position: relative; - display: flex; - align-items: center; - justify-content: center; - width: 2.5em; - height: 2.5em; - margin: 0 15px; - color: white; - text-decoration: none; - border-radius: 50%; - - @for $i from 1 through 3 { - &:nth-child(#{$i}) { - &::before { - animation-delay: 2s + 0.1s * $i; - } - - &::after { - animation-delay: 2.1s + 0.1s * $i; - } - - svg { - animation-delay: 2.2s + 0.1s * $i; - } - } - } - - &::before, - &::after { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - content: ""; - border-radius: inherit; - transform: scale(0); - } - - &::before { - background: #f7f1e3; - animation: scale-in 0.5s cubic-bezier(0.75, 0, 0, 1) forwards; - } - - &::after { - background: #2c3e50; - animation: scale-in 0.5s cubic-bezier(0.75, 0, 0, 1) forwards; - } - - svg { - z-index: 99; - transform: scale(0); - animation: scale-in 0.5s cubic-bezier(0.75, 0, 0, 1) forwards; - } - } - } - } -} - -@keyframes bump-in { - 50% { - transform: scale(1.05); - } - - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes slide-in-horizontal { - 50% { - transform: translateX(0); - } - - to { - transform: translateX(100%); - } -} - -@keyframes slide-in-horizontal-reverse { - 50% { - transform: translateX(0); - } - - to { - transform: translateX(-100%); - } -} - -@keyframes slide-in-vertical { - 50% { - transform: translateY(0); - } - - to { - transform: translateY(-100%); - } -} - -@keyframes slide-in-vertical-reverse { - 50% { - transform: translateY(0); - } - - to { - transform: translateY(100%); - } -} - -@keyframes slide-in-out { - 50% { - transform: scaleX(1); - transform-origin: left; - } - - 50.1% { - transform-origin: right; - } - - 100% { - transform: scaleX(0); - transform-origin: right; - } -} - -@keyframes fill-text-white { - to { - color: white; - } -} - -@keyframes scale-in { - to { - transform: scale(1); - } -} -</style> diff --git a/src/components/VabSnow/index.vue b/src/components/VabSnow/index.vue deleted file mode 100644 index badcbb2..0000000 --- a/src/components/VabSnow/index.vue +++ /dev/null @@ -1,81 +0,0 @@ -<template> - <div class="content" :style="styleObj"> - <div v-for="(item, index) in 200" :key="index" class="snow"></div> - </div> -</template> - -<script> -export default { - name: "VabSnow", - props: { - styleObj: { - type: Object, - default: () => { - return {}; - }, - }, - }, - data() { - return {}; - }, - created() {}, - mounted() {}, - methods: {}, -}; -</script> - -<style lang="scss" scoped> -.content { - position: relative; - width: 100%; - height: 100%; - overflow: hidden; - background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%); - filter: drop-shadow(0 0 10px white); -} - -@function random_range($min, $max) { - $rand: random(); - $random_range: $min + floor($rand * (($max - $min) + 1)); - - @return $random_range; -} - -.snow { - $total: 200; - - position: absolute; - width: 10px; - height: 10px; - background: white; - border-radius: 50%; - - @for $i from 1 through $total { - $random-x: random(1000000) * 0.0001vw; - $random-offset: random_range(-100000, 100000) * 0.0001vw; - $random-x-end: $random-x + $random-offset; - $random-x-end-yoyo: $random-x + ($random-offset / 2); - $random-yoyo-time: random_range(30000, 80000) / 100000; - $random-yoyo-y: $random-yoyo-time * 100vh; - $random-scale: random(10000) * 0.0001; - $fall-duration: random_range(10, 30) * 1s; - $fall-delay: random(30) * -1s; - - &:nth-child(#{$i}) { - opacity: random(10000) * 0.0001; - transform: translate($random-x, -10px) scale($random-scale); - animation: fall-#{$i} $fall-duration $fall-delay linear infinite; - } - - @keyframes fall-#{$i} { - #{percentage($random-yoyo-time)} { - transform: translate($random-x-end, $random-yoyo-y) scale($random-scale); - } - - to { - transform: translate($random-x-end-yoyo, 100vh) scale($random-scale); - } - } - } -} -</style> diff --git a/src/components/VabUpload/index.vue b/src/components/VabUpload/index.vue deleted file mode 100644 index a8c6412..0000000 --- a/src/components/VabUpload/index.vue +++ /dev/null @@ -1,255 +0,0 @@ -<template> - <el-dialog - :before-close="handleClose" - :close-on-click-modal="false" - :title="title" - :visible.sync="dialogFormVisible" - width="909px" - > - <div class="upload"> - <el-alert - :closable="false" - :title="`鏀寔jpg銆乯peg銆乸ng鏍煎紡锛屽崟娆″彲鏈�澶氶�夋嫨${limit}寮犲浘鐗囷紝姣忓紶涓嶅彲澶т簬${size}M锛屽鏋滃ぇ浜�${size}M浼氳嚜鍔ㄤ负鎮ㄨ繃婊" - type="info" - ></el-alert> - <br /> - <el-upload - ref="upload" - :action="action" - :auto-upload="false" - :close-on-click-modal="false" - :data="data" - :file-list="fileList" - :headers="headers" - :limit="limit" - :multiple="true" - :name="name" - :on-change="handleChange" - :on-error="handleError" - :on-exceed="handleExceed" - :on-preview="handlePreview" - :on-progress="handleProgress" - :on-remove="handleRemove" - :on-success="handleSuccess" - accept="image/png, image/jpeg" - class="upload-content" - list-type="picture-card" - > - <i slot="trigger" class="el-icon-plus"></i> - <el-dialog - :visible.sync="dialogVisible" - append-to-body - title="鏌ョ湅澶у浘" - > - <div> - <img :src="dialogImageUrl" alt="" width="100%" /> - </div> - </el-dialog> - </el-upload> - </div> - <div - slot="footer" - class="dialog-footer" - style="position: relative; padding-right: 15px; text-align: right" - > - <div - v-if="show" - style="position: absolute; top: 10px; left: 15px; color: #999" - > - 姝e湪涓婁紶涓�... 褰撳墠涓婁紶鎴愬姛鏁�:{{ imgSuccessNum }}寮� 褰撳墠涓婁紶澶辫触鏁�:{{ - imgErrorNum - }}寮� - </div> - <el-button type="primary" @click="handleClose">鍏抽棴</el-button> - <el-button - :loading="loading" - size="small" - style="margin-left: 10px" - type="success" - @click="submitUpload" - > - 寮�濮嬩笂浼� - </el-button> - </div> - </el-dialog> -</template> - -<script> -import { baseURL, tokenName } from "@/config"; - -export default { - name: "VabUpload", - props: { - url: { - type: String, - default: "/upload", - required: true, - }, - name: { - type: String, - default: "file", - required: true, - }, - limit: { - type: Number, - default: 50, - required: true, - }, - size: { - type: Number, - default: 1, - required: true, - }, - }, - data() { - return { - show: false, - loading: false, - dialogVisible: false, - dialogImageUrl: "", - action: "https://vab-unicloud-3a9da9.service.tcloudbase.com/upload", - headers: {}, - fileList: [], - picture: "picture", - imgNum: 0, - imgSuccessNum: 0, - imgErrorNum: 0, - typeList: null, - title: "涓婁紶", - dialogFormVisible: false, - data: {}, - }; - }, - computed: { - percentage() { - if (this.allImgNum == 0) return 0; - return this.$baseLodash.round(this.imgNum / this.allImgNum, 2) * 100; - }, - }, - methods: { - submitUpload() { - this.$refs.upload.submit(); - }, - handleProgress(event, file, fileList) { - this.loading = true; - this.show = true; - }, - handleChange(file, fileList) { - if (file.size > 1048576 * this.size) { - fileList.map((item, index) => { - if (item === file) { - fileList.splice(index, 1); - } - }); - this.fileList = fileList; - } else { - this.allImgNum = fileList.length; - } - }, - handleSuccess(response, file, fileList) { - this.imgNum = this.imgNum + 1; - this.imgSuccessNum = this.imgSuccessNum + 1; - if (fileList.length === this.imgNum) { - setTimeout(() => { - this.$baseMessage( - `涓婁紶瀹屾垚! 鍏变笂浼�${fileList.length}寮犲浘鐗嘸, - "success" - ); - }, 1000); - } - - setTimeout(() => { - this.loading = false; - this.show = false; - }, 1000); - }, - handleError(err, file, fileList) { - this.imgNum = this.imgNum + 1; - this.imgErrorNum = this.imgErrorNum + 1; - this.$baseMessage( - `鏂囦欢[${file.raw.name}]涓婁紶澶辫触,鏂囦欢澶у皬涓�${this.$baseLodash.round( - file.raw.size / 1024, - 0 - )}KB`, - "error" - ); - setTimeout(() => { - this.loading = false; - this.show = false; - }, 1000); - }, - handleRemove(file, fileList) { - this.imgNum = this.imgNum - 1; - this.allNum = this.allNum - 1; - }, - handlePreview(file) { - this.dialogImageUrl = file.url; - this.dialogVisible = true; - }, - handleExceed(files, fileList) { - this.$baseMessage( - `褰撳墠闄愬埗閫夋嫨 ${this.limit} 涓枃浠讹紝鏈閫夋嫨浜� - ${files.length} - 涓枃浠禶, - "error" - ); - }, - handleShow(data) { - this.title = "涓婁紶"; - this.data = data; - this.dialogFormVisible = true; - }, - handleClose() { - this.fileList = []; - this.picture = "picture"; - this.allImgNum = 0; - this.imgNum = 0; - this.imgSuccessNum = 0; - this.imgErrorNum = 0; - /* if ("development" === process.env.NODE_ENV) { - this.api = process.env.VUE_APP_BASE_API; - } else { - this.api = `${window.location.protocol}//${window.location.host}`; - } - - this.action = this.api + this.url; */ - this.dialogFormVisible = false; - }, - }, -}; -</script> - -<style lang="scss" scoped> -.upload { - height: 500px; - - .upload-content { - .el-upload__tip { - display: block; - height: 30px; - line-height: 30px; - } - - ::v-deep { - .el-upload--picture-card { - width: 128px; - height: 128px; - margin: 3px 8px 8px 8px; - border: 2px dashed #c0ccda; - } - - .el-upload-list--picture { - margin-bottom: 20px; - } - - .el-upload-list--picture-card { - .el-upload-list__item { - width: 128px; - height: 128px; - margin: 3px 8px 8px 8px; - } - } - } - } -} -</style> diff --git a/src/config/theme.config.js b/src/config/theme.config.js index b6a69d2..7994852 100644 --- a/src/config/theme.config.js +++ b/src/config/theme.config.js @@ -3,12 +3,12 @@ */ const theme = { //鏄惁鍥藉畾澶撮儴 鍥哄畾fixed 涓嶅浐瀹歯oFixed - header: 'fixed', + header: "fixed", //妯旱甯冨眬 horizontal vertical - layout: 'vertical', + layout: "vertical", //鏄惁寮�鍚富棰橀厤缃寜閽� themeBar: true, //鏄惁鏄剧ず澶氭爣绛鹃〉 tabsBar: true, -} -module.exports = theme +}; +module.exports = theme; diff --git a/src/main.js b/src/main.js index 6b496d7..406f6ae 100644 --- a/src/main.js +++ b/src/main.js @@ -1,24 +1,15 @@ -import Vue from 'vue' -import App from './App' -import store from './store' -import router from './router' -import './plugins' -import '@/layouts/export' -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鐢熶骇鐜榛樿閮戒娇鐢╩ock锛屽鏋滄寮忕敤浜庣敓浜х幆澧冩椂锛岃寰楀幓鎺� - */ +import Vue from "vue"; +import App from "./App"; +import store from "./store"; +import router from "./router"; +import "./plugins"; +import "@/layouts/export"; -if (process.env.NODE_ENV === 'production') { - const { mockXHR } = require('@/utils/static') - mockXHR() -} - -Vue.config.productionTip = false +Vue.config.productionTip = false; new Vue({ - el: '#vue-admin-beautiful', + el: "#vue-admin-beautiful", router, store, render: (h) => h(App), -}) +}); diff --git a/src/plugins/echarts.js b/src/plugins/echarts.js deleted file mode 100644 index f07a15d..0000000 --- a/src/plugins/echarts.js +++ /dev/null @@ -1,4 +0,0 @@ -import "echarts"; -import VabChart from "vue-echarts"; - -export default VabChart; diff --git a/src/plugins/vabMarkdownEditor.js b/src/plugins/vabMarkdownEditor.js deleted file mode 100644 index 03686b6..0000000 --- a/src/plugins/vabMarkdownEditor.js +++ /dev/null @@ -1,5 +0,0 @@ -import ZxMarkdownEditor from 'zx-markdown-editor' -import 'zx-markdown-editor/dist/zx-markdown-editor.css' - -const VabMarkdownEditor = ZxMarkdownEditor -export default VabMarkdownEditor diff --git a/src/plugins/vabPlayer.js b/src/plugins/vabPlayer.js deleted file mode 100644 index 69bf8a7..0000000 --- a/src/plugins/vabPlayer.js +++ /dev/null @@ -1,3 +0,0 @@ -import { VabPlayerMp4, VabPlayerHls, VabPlayerFlv } from 'zx-player' - -export { VabPlayerMp4, VabPlayerHls, VabPlayerFlv } diff --git a/src/plugins/vabQuill.js b/src/plugins/vabQuill.js deleted file mode 100644 index eae4bbf..0000000 --- a/src/plugins/vabQuill.js +++ /dev/null @@ -1,4 +0,0 @@ -import 'zx-quill/dist/zx-quill.css' -import VabQuill from 'zx-quill' - -export default VabQuill diff --git a/src/utils/accessToken.js b/src/utils/accessToken.js index 1c79c78..d4b4fb1 100644 --- a/src/utils/accessToken.js +++ b/src/utils/accessToken.js @@ -1,59 +1,43 @@ -import { storage, tokenTableName } from '@/config' +import { storage, tokenTableName } from "@/config"; -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鑾峰彇accessToken - * @returns {string|ActiveX.IXMLDOMNode|Promise<any>|any|IDBRequest<any>|MediaKeyStatus|FormDataEntryValue|Function|Promise<Credential | null>} - */ export function getAccessToken() { if (storage) { - if ('localStorage' === storage) { - return localStorage.getItem(tokenTableName) - } else if ('sessionStorage' === storage) { - return sessionStorage.getItem(tokenTableName) + if ("localStorage" === storage) { + return localStorage.getItem(tokenTableName); + } else if ("sessionStorage" === storage) { + return sessionStorage.getItem(tokenTableName); } else { - return localStorage.getItem(tokenTableName) + return localStorage.getItem(tokenTableName); } } else { - return localStorage.getItem(tokenTableName) + return localStorage.getItem(tokenTableName); } } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 瀛樺偍accessToken - * @param accessToken - * @returns {void|*} - */ export function setAccessToken(accessToken) { if (storage) { - if ('localStorage' === storage) { - return localStorage.setItem(tokenTableName, accessToken) - } else if ('sessionStorage' === storage) { - return sessionStorage.setItem(tokenTableName, accessToken) + if ("localStorage" === storage) { + return localStorage.setItem(tokenTableName, accessToken); + } else if ("sessionStorage" === storage) { + return sessionStorage.setItem(tokenTableName, accessToken); } else { - return localStorage.setItem(tokenTableName, accessToken) + return localStorage.setItem(tokenTableName, accessToken); } } else { - return localStorage.setItem(tokenTableName, accessToken) + return localStorage.setItem(tokenTableName, accessToken); } } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 绉婚櫎accessToken - * @returns {void|Promise<void>} - */ export function removeAccessToken() { if (storage) { - if ('localStorage' === storage) { - return localStorage.removeItem(tokenTableName) - } else if ('sessionStorage' === storage) { - return sessionStorage.clear() + if ("localStorage" === storage) { + return localStorage.removeItem(tokenTableName); + } else if ("sessionStorage" === storage) { + return sessionStorage.clear(); } else { - return localStorage.removeItem(tokenTableName) + return localStorage.removeItem(tokenTableName); } } else { - return localStorage.removeItem(tokenTableName) + return localStorage.removeItem(tokenTableName); } } diff --git a/src/utils/clipboard.js b/src/utils/clipboard.js index 20a19b7..79f231c 100644 --- a/src/utils/clipboard.js +++ b/src/utils/clipboard.js @@ -1,31 +1,25 @@ -import Vue from 'vue' -import Clipboard from 'clipboard' +import Vue from "vue"; +import Clipboard from "clipboard"; function clipboardSuccess() { - Vue.prototype.$baseMessage('澶嶅埗鎴愬姛', 'success') + Vue.prototype.$baseMessage("澶嶅埗鎴愬姛", "success"); } function clipboardError() { - Vue.prototype.$baseMessage('澶嶅埗澶辫触', 'error') + Vue.prototype.$baseMessage("澶嶅埗澶辫触", "error"); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 澶嶅埗鏁版嵁 - * @param text - * @param event - */ export default function handleClipboard(text, event) { const clipboard = new Clipboard(event.target, { text: () => text, - }) - clipboard.on('success', () => { - clipboardSuccess() - clipboard.destroy() - }) - clipboard.on('error', () => { - clipboardError() - clipboard.destroy() - }) - clipboard.onClick(event) + }); + clipboard.on("success", () => { + clipboardSuccess(); + clipboard.destroy(); + }); + clipboard.on("error", () => { + clipboardError(); + clipboard.destroy(); + }); + clipboard.onClick(event); } diff --git a/src/utils/errorLog.js b/src/utils/errorLog.js index 6ab7ea0..564a9b8 100644 --- a/src/utils/errorLog.js +++ b/src/utils/errorLog.js @@ -16,7 +16,7 @@ }; if (checkNeed()) { Vue.config.errorHandler = (err, vm, info) => { - console.error("vue-admin-beautiful閿欒鎷︽埅:", err, vm, info); + console.error("閿欒鎷︽埅:", err, vm, info); const url = window.location.href; Vue.nextTick(() => { store.dispatch("errorLog/addErrorLog", { err, vm, info, url }); diff --git a/src/utils/handleRoutes.js b/src/utils/handleRoutes.js index 62248c4..4e14df6 100644 --- a/src/utils/handleRoutes.js +++ b/src/utils/handleRoutes.js @@ -1,9 +1,3 @@ -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description all妯″紡娓叉煋鍚庣杩斿洖璺敱 - * @param constantRoutes - * @returns {*} - */ export function convertRouter(asyncRoutes) { return asyncRoutes.map((route) => { if (route.component) { @@ -26,13 +20,6 @@ }); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇褰撳墠璺敱鏄惁鍖呭惈鏉冮檺 - * @param permissions - * @param route - * @returns {boolean|*} - */ function hasPermission(permissions, route) { if (route.meta && route.meta.permissions) { return permissions.some((role) => route.meta.permissions.includes(role)); @@ -41,13 +28,6 @@ } } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description intelligence妯″紡鏍规嵁permissions鏁扮粍鎷︽埅璺敱 - * @param routes - * @param permissions - * @returns {[]} - */ export function filterAsyncRoutes(routes, permissions) { const finallyRoutes = []; routes.forEach((route) => { diff --git a/src/utils/index.js b/src/utils/index.js index 80e89c1..2f6a0e1 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,26 +1,19 @@ -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鏍煎紡鍖栨椂闂� - * @param time - * @param cFormat - * @returns {string|null} - */ export function parseTime(time, cFormat) { if (arguments.length === 0) { - return null + return null; } - const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' - let date - if (typeof time === 'object') { - date = time + const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}"; + let date; + if (typeof time === "object") { + date = time; } else { - if (typeof time === 'string' && /^[0-9]+$/.test(time)) { - time = parseInt(time) + if (typeof time === "string" && /^[0-9]+$/.test(time)) { + time = parseInt(time); } - if (typeof time === 'number' && time.toString().length === 10) { - time = time * 1000 + if (typeof time === "number" && time.toString().length === 10) { + time = time * 1000; } - date = new Date(time) + date = new Date(time); } const formatObj = { y: date.getFullYear(), @@ -30,75 +23,62 @@ i: date.getMinutes(), s: date.getSeconds(), a: date.getDay(), - } + }; const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { - let value = formatObj[key] - if (key === 'a') { - return ['鏃�', '涓�', '浜�', '涓�', '鍥�', '浜�', '鍏�'][value] + let value = formatObj[key]; + if (key === "a") { + return ["鏃�", "涓�", "浜�", "涓�", "鍥�", "浜�", "鍏�"][value]; } if (result.length > 0 && value < 10) { - value = '0' + value + value = "0" + value; } - return value || 0 - }) - return time_str + return value || 0; + }); + return time_str; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鏍煎紡鍖栨椂闂� - * @param time - * @param option - * @returns {string} - */ export function formatTime(time, option) { - if (('' + time).length === 10) { - time = parseInt(time) * 1000 + if (("" + time).length === 10) { + time = parseInt(time) * 1000; } else { - time = +time + time = +time; } - const d = new Date(time) - const now = Date.now() + const d = new Date(time); + const now = Date.now(); - const diff = (now - d) / 1000 + const diff = (now - d) / 1000; if (diff < 30) { - return '鍒氬垰' + return "鍒氬垰"; } else if (diff < 3600) { // less 1 hour - return Math.ceil(diff / 60) + '鍒嗛挓鍓�' + return Math.ceil(diff / 60) + "鍒嗛挓鍓�"; } else if (diff < 3600 * 24) { - return Math.ceil(diff / 3600) + '灏忔椂鍓�' + return Math.ceil(diff / 3600) + "灏忔椂鍓�"; } else if (diff < 3600 * 24 * 2) { - return '1澶╁墠' + return "1澶╁墠"; } if (option) { - return parseTime(time, option) + return parseTime(time, option); } else { return ( d.getMonth() + 1 + - '鏈�' + + "鏈�" + d.getDate() + - '鏃�' + + "鏃�" + d.getHours() + - '鏃�' + + "鏃�" + d.getMinutes() + - '鍒�' - ) + "鍒�" + ); } } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 灏唘rl璇锋眰鍙傛暟杞负json鏍煎紡 - * @param url - * @returns {{}|any} - */ export function paramObj(url) { - const search = url.split('?')[1] + const search = url.split("?")[1]; if (!search) { - return {} + return {}; } return JSON.parse( '{"' + @@ -106,161 +86,114 @@ .replace(/"/g, '\\"') .replace(/&/g, '","') .replace(/=/g, '":"') - .replace(/\+/g, ' ') + + .replace(/\+/g, " ") + '"}' - ) + ); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鐖跺瓙鍏崇郴鐨勬暟缁勮浆鎹㈡垚鏍戝舰缁撴瀯鏁版嵁 - * @param data - * @returns {*} - */ export function translateDataToTree(data) { const parent = data.filter( - (value) => value.parentId === 'undefined' || value.parentId == null - ) + (value) => value.parentId === "undefined" || value.parentId == null + ); const children = data.filter( - (value) => value.parentId !== 'undefined' && value.parentId != null - ) + (value) => value.parentId !== "undefined" && value.parentId != null + ); const translator = (parent, children) => { parent.forEach((parent) => { children.forEach((current, index) => { if (current.parentId === parent.id) { - const temp = JSON.parse(JSON.stringify(children)) - temp.splice(index, 1) - translator([current], temp) - typeof parent.children !== 'undefined' + const temp = JSON.parse(JSON.stringify(children)); + temp.splice(index, 1); + translator([current], temp); + typeof parent.children !== "undefined" ? parent.children.push(current) - : (parent.children = [current]) + : (parent.children = [current]); } - }) - }) - } - translator(parent, children) - return parent + }); + }); + }; + translator(parent, children); + return parent; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鏍戝舰缁撴瀯鏁版嵁杞崲鎴愮埗瀛愬叧绯荤殑鏁扮粍 - * @param data - * @returns {[]} - */ export function translateTreeToData(data) { - const result = [] + const result = []; data.forEach((item) => { const loop = (data) => { result.push({ id: data.id, name: data.name, parentId: data.parentId, - }) - const child = data.children + }); + const child = data.children; if (child) { for (let i = 0; i < child.length; i++) { - loop(child[i]) + loop(child[i]); } } - } - loop(item) - }) - return result + }; + loop(item); + }); + return result; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 10浣嶆椂闂存埑杞崲 - * @param time - * @returns {string} - */ export function tenBitTimestamp(time) { - const date = new Date(time * 1000) - const y = date.getFullYear() - let m = date.getMonth() + 1 - m = m < 10 ? '' + m : m - let d = date.getDate() - d = d < 10 ? '' + d : d - let h = date.getHours() - h = h < 10 ? '0' + h : h - let minute = date.getMinutes() - let second = date.getSeconds() - minute = minute < 10 ? '0' + minute : minute - second = second < 10 ? '0' + second : second - return y + '骞�' + m + '鏈�' + d + '鏃� ' + h + ':' + minute + ':' + second //缁勫悎 + const date = new Date(time * 1000); + const y = date.getFullYear(); + let m = date.getMonth() + 1; + m = m < 10 ? "" + m : m; + let d = date.getDate(); + d = d < 10 ? "" + d : d; + let h = date.getHours(); + h = h < 10 ? "0" + h : h; + let minute = date.getMinutes(); + let second = date.getSeconds(); + minute = minute < 10 ? "0" + minute : minute; + second = second < 10 ? "0" + second : second; + return y + "骞�" + m + "鏈�" + d + "鏃� " + h + ":" + minute + ":" + second; //缁勫悎 } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 13浣嶆椂闂存埑杞崲 - * @param time - * @returns {string} - */ export function thirteenBitTimestamp(time) { - const date = new Date(time / 1) - const y = date.getFullYear() - let m = date.getMonth() + 1 - m = m < 10 ? '' + m : m - let d = date.getDate() - d = d < 10 ? '' + d : d - let h = date.getHours() - h = h < 10 ? '0' + h : h - let minute = date.getMinutes() - let second = date.getSeconds() - minute = minute < 10 ? '0' + minute : minute - second = second < 10 ? '0' + second : second - return y + '骞�' + m + '鏈�' + d + '鏃� ' + h + ':' + minute + ':' + second //缁勫悎 + const date = new Date(time / 1); + const y = date.getFullYear(); + let m = date.getMonth() + 1; + m = m < 10 ? "" + m : m; + let d = date.getDate(); + d = d < 10 ? "" + d : d; + let h = date.getHours(); + h = h < 10 ? "0" + h : h; + let minute = date.getMinutes(); + let second = date.getSeconds(); + minute = minute < 10 ? "0" + minute : minute; + second = second < 10 ? "0" + second : second; + return y + "骞�" + m + "鏈�" + d + "鏃� " + h + ":" + minute + ":" + second; //缁勫悎 } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鑾峰彇闅忔満id - * @param length - * @returns {string} - */ export function uuid(length = 32) { - const num = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' - let str = '' + const num = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + let str = ""; for (let i = 0; i < length; i++) { - str += num.charAt(Math.floor(Math.random() * num.length)) + str += num.charAt(Math.floor(Math.random() * num.length)); } - return str + return str; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description m鍒皀鐨勯殢鏈烘暟 - * @param m - * @param n - * @returns {number} - */ export function random(m, n) { - return Math.floor(Math.random() * (m - n) + n) + return Math.floor(Math.random() * (m - n) + n); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description addEventListener - * @type {function(...[*]=)} - */ export const on = (function () { return function (element, event, handler, useCapture = false) { if (element && event && handler) { - element.addEventListener(event, handler, useCapture) + element.addEventListener(event, handler, useCapture); } - } -})() + }; +})(); -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description removeEventListener - * @type {function(...[*]=)} - */ export const off = (function () { return function (element, event, handler, useCapture = false) { if (element && event) { - element.removeEventListener(event, handler, useCapture) + element.removeEventListener(event, handler, useCapture); } - } -})() + }; +})(); diff --git a/src/utils/pageTitle.js b/src/utils/pageTitle.js index 38334c3..790e3ea 100644 --- a/src/utils/pageTitle.js +++ b/src/utils/pageTitle.js @@ -1,14 +1,8 @@ -import { title } from '@/config' +import { title } from "@/config"; -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 璁剧疆鏍囬 - * @param pageTitle - * @returns {string} - */ export default function getPageTitle(pageTitle) { if (pageTitle) { - return `${pageTitle}-${title}` + return `${pageTitle}-${title}`; } - return `${title}` + return `${title}`; } diff --git a/src/utils/permission.js b/src/utils/permission.js index 88b3506..76ae39a 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -1,20 +1,14 @@ -import store from '@/store' +import store from "@/store"; -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 妫�鏌ユ潈闄� - * @param value - * @returns {boolean} - */ export default function checkPermission(value) { if (value && value instanceof Array && value.length > 0) { - const permissions = store.getters['user/permissions'] - const permissionPermissions = value + const permissions = store.getters["user/permissions"]; + const permissionPermissions = value; return permissions.some((role) => { - return permissionPermissions.includes(role) - }) + return permissionPermissions.includes(role); + }); } else { - return false + return false; } } diff --git a/src/utils/static.js b/src/utils/static.js deleted file mode 100644 index bd0abd9..0000000 --- a/src/utils/static.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author chuzhixin 1204505056@qq.com - * @description 瀵煎叆鎵�鏈� controller 妯″潡锛屾祻瑙堝櫒鐜涓嚜鍔ㄨ緭鍑篶ontroller鏂囦欢澶逛笅Mock鎺ュ彛锛岃鍕夸慨鏀广�� - */ -import Mock from 'mockjs' -import { paramObj } from '@/utils' - -const mocks = [] -const files = require.context('../../mock/controller', false, /\.js$/) - -files.keys().forEach((key) => { - mocks.push(...files(key)) -}) - -export 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 XHRHttpRequst(respond) { - return function (options) { - let result - if (respond instanceof Function) { - const { body, type, url } = options - result = respond({ - method: type, - body: JSON.parse(body), - query: paramObj(url), - }) - } else { - result = respond - } - return Mock.mock(result) - } - } - - mocks.forEach((item) => { - Mock.mock( - new RegExp(item.url), - item.type || 'get', - XHRHttpRequst(item.response) - ) - }) -} diff --git a/src/utils/validate.js b/src/utils/validate.js index bd15ad4..56af15a 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -1,118 +1,52 @@ -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒よ鏄惁涓哄閾� - * @param path - * @returns {boolean} - */ export function isExternal(path) { return /^(https?:|mailto:|tel:)/.test(path); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鏍¢獙瀵嗙爜鏄惁灏忎簬6浣� - * @param str - * @returns {boolean} - */ export function isPassword(str) { return str.length >= 5; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓烘暟瀛� - * @param value - * @returns {boolean} - */ export function isNumber(value) { const reg = /^[0-9]*$/; return reg.test(value); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄悕绉� - * @param value - * @returns {boolean} - */ export function isName(value) { const reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/; return reg.test(value); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓篒P - * @param ip - * @returns {boolean} - */ export function isIP(ip) { const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; return reg.test(ip); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄紶缁熺綉绔� - * @param url - * @returns {boolean} - */ export function isUrl(url) { 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.,?'\\+&%$#=~_-]+))*$/; return reg.test(url); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄皬鍐欏瓧姣� - * @param str - * @returns {boolean} - */ export function isLowerCase(str) { const reg = /^[a-z]+$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄ぇ鍐欏瓧姣� - * @param str - * @returns {boolean} - */ export function isUpperCase(str) { const reg = /^[A-Z]+$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄ぇ鍐欏瓧姣嶅紑澶� - * @param str - * @returns {boolean} - */ export function isAlphabets(str) { const reg = /^[A-Za-z]+$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄瓧绗︿覆 - * @param str - * @returns {boolean} - */ export function isString(str) { return typeof str === "string" || str instanceof String; } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄暟缁� - * @param arg - * @returns {arg is any[]|boolean} - */ export function isArray(arg) { if (typeof Array.isArray === "undefined") { return Object.prototype.toString.call(arg) === "[object Array]"; @@ -120,69 +54,33 @@ return Array.isArray(arg); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄鍙e彿 - * @param str - * @returns {boolean} - */ export function isPort(str) { const reg = /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄墜鏈哄彿 - * @param str - * @returns {boolean} - */ export function isPhone(str) { const reg = /^1\d{10}$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄韩浠借瘉鍙�(绗簩浠�) - * @param str - * @returns {boolean} - */ export function isIdCard(str) { const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁鏄偖绠� - * @param str - * @returns {boolean} - */ export function isEmail(str) { const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓枃 - * @param str - * @returns {boolean} - */ export function isChina(str) { const reg = /^[\u4E00-\u9FA5]{2,4}$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓虹┖ - * @param str - * @returns {boolean} - */ export function isBlank(str) { return ( str == null || @@ -193,24 +91,12 @@ ); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓哄浐璇� - * @param str - * @returns {boolean} - */ export function isTel(str) { const reg = /^(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |杞�)*([0-9]{1,4}))?$/; return reg.test(str); } -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description 鍒ゆ柇鏄惁涓烘暟瀛椾笖鏈�澶氫袱浣嶅皬鏁� - * @param str - * @returns {boolean} - */ export function isNum(str) { const reg = /^\d+(\.\d{1,2})?$/; return reg.test(str); diff --git a/src/views/401.vue b/src/views/401.vue index e2defb1..98c9833 100644 --- a/src/views/401.vue +++ b/src/views/401.vue @@ -3,28 +3,7 @@ <div class="error-content"> <el-row :gutter="20"> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12"> - <div class="pic-error"> - <img - alt="401" - class="pic-error-parent" - src="@/assets/error_images/401.png" - /> - <img - alt="401" - class="pic-error-child left" - src="@/assets/error_images/cloud.png" - /> - <img - alt="401" - class="pic-error-child" - src="@/assets/error_images/cloud.png" - /> - <img - alt="401" - class="pic-error-child" - src="@/assets/error_images/cloud.png" - /> - </div> + <div class="pic-error">401</div> </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12"> diff --git a/src/views/404.vue b/src/views/404.vue index 500a7b4..8b2cfc7 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -3,28 +3,7 @@ <div class="error-content"> <el-row :gutter="20"> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12"> - <div class="pic-error"> - <img - alt="401" - class="pic-error-parent" - src="@/assets/error_images/404.png" - /> - <img - alt="401" - class="pic-error-child left" - src="@/assets/error_images/cloud.png" - /> - <img - alt="401" - class="pic-error-child" - src="@/assets/error_images/cloud.png" - /> - <img - alt="401" - class="pic-error-child" - src="@/assets/error_images/cloud.png" - /> - </div> + 404 page not found! </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12"> diff --git a/src/views/project/components/ProjectEdit.vue b/src/views/project/components/ProjectEdit.vue index e613d8e..0d38401 100644 --- a/src/views/project/components/ProjectEdit.vue +++ b/src/views/project/components/ProjectEdit.vue @@ -2,7 +2,7 @@ <el-dialog :title="title" :visible.sync="dialogFormVisible" - width="500px" + width="550px" :close-on-click-modal="false" @close="close" > @@ -10,13 +10,13 @@ <el-tab-pane label="鍩虹淇℃伅" name="base"> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="椤圭洰鍚嶇О" prop="name"> - <el-input v-model.trim="form.name" autocomplete="off"></el-input> + <el-input v-model.trim="form.name" :disabled="edit"></el-input> </el-form-item> <el-form-item label="椤圭洰鍦板潃" prop="srcUrl"> - <el-input v-model.trim="form.srcUrl" autocomplete="off"></el-input> + <el-input v-model.trim="form.srcUrl"></el-input> </el-form-item> <el-form-item label="椤圭洰鐢ㄦ埛" prop="srcUser"> - <el-input v-model.trim="form.srcUser" autocomplete="off"></el-input> + <el-input v-model.trim="form.srcUser"></el-input> </el-form-item> <el-form-item label="椤圭洰瀵嗙爜" prop="srcPassword"> <el-input @@ -28,19 +28,20 @@ > </el-form-item> <el-form-item label="椤圭洰鎻忚堪" prop="desc"> - <el-input v-model="form.desc" autocomplete="off"></el-input> + <el-input v-model="form.desc"></el-input> </el-form-item> <el-form-item label="缂栬瘧鍒嗘敮" prop="branch"> - <el-input v-model.trim="form.branch" autocomplete="off"></el-input> + <el-input v-model.trim="form.branch" :disabled="edit"></el-input> </el-form-item> <el-form-item label="缂栬瘧鏋舵瀯" prop="arch"> - <el-radio-group v-model="form.arch"> + <el-radio-group v-model="form.arch" :disabled="edit"> <el-radio label="x86">X86</el-radio> <el-radio label="arm">ARM</el-radio> </el-radio-group> </el-form-item> <el-form-item label="椤圭洰绫诲瀷" prop="type"> <el-radio-group v-model="form.type"> + <el-radio label="os">鍩虹鍖�</el-radio> <el-radio label="sys">绯荤粺鍖�</el-radio> <el-radio label="app">搴旂敤鍖�</el-radio> <el-radio label="algo">绠楁硶鍖�</el-radio> @@ -84,6 +85,7 @@ }, title: "", dialogFormVisible: false, + edit: false, }; }, created() {}, @@ -91,7 +93,9 @@ showEdit(row) { if (!row) { this.title = "娣诲姞"; + this.edit = false; } else { + this.edit = true; this.title = "缂栬緫"; this.form = Object.assign({}, row); } @@ -101,7 +105,7 @@ this.$refs["form"].resetFields(); this.form = this.$options.data().form; this.dialogFormVisible = false; - this.$emit("fetch-data"); + // this.$emit("fetch-data"); }, save() { this.$refs["form"].validate(async (valid) => { @@ -125,3 +129,8 @@ }, }; </script> +<style scoped> +.el-radio { + margin-right: 20 px; +} +</style> diff --git a/src/views/project/index.vue b/src/views/project/index.vue index 3d4a639..6ebaf36 100644 --- a/src/views/project/index.vue +++ b/src/views/project/index.vue @@ -9,18 +9,24 @@ @submit.native.prevent > <el-form-item> - <el-input v-model="queryForm.title" placeholder="鍚嶇О" /> + <el-input + v-model="queryForm.name" + placeholder="鍚嶇О" + clearable="" + /> </el-form-item> <el-form-item> <el-select - v-model="queryForm.address" + v-model="queryForm.type" placeholder="绫诲瀷" class="handle-select mr10" size="mini" + clearable="" > - <el-option key="1" label="绯荤粺" value="绯荤粺"></el-option> - <el-option key="2" label="搴旂敤" value="搴旂敤"></el-option> - <el-option key="3" label="绠楁硶" value="绠楁硶"></el-option> + <el-option key="os" label="鍩虹" value="os"></el-option> + <el-option key="sys" label="绯荤粺" value="sys"></el-option> + <el-option key="app" label="搴旂敤" value="app"></el-option> + <el-option key="algo" label="绠楁硶" value="algo"></el-option> </el-select> </el-form-item> <el-form-item> @@ -111,6 +117,8 @@ <el-tag>{{ row.type | typeFilter }}</el-tag> </template> </el-table-column> + <el-table-column show-overflow-tooltip prop="arch" label="鏋舵瀯"> + </el-table-column> <!-- <el-table-column show-overflow-tooltip label="褰撳墠鐗堟湰" prop="latestVersion"></el-table-column> --> <el-table-column label="鐘舵��"> <template #default="{ row }"> @@ -173,6 +181,7 @@ }, typeFilter(type) { const typeMap = { + os: "OS鍩虹鍖�", sys: "绯荤粺鍖�", app: "搴旂敤鍖�", algo: "绠楁硶鍖�", @@ -200,7 +209,6 @@ queryForm: { pageNo: 1, pageSize: 20, - title: "", }, }; }, @@ -277,9 +285,7 @@ }, async expandChange(row, expandRows) { - console.log(row); if (expandRows.length == 0) { - console.log("fold"); return; } @@ -299,7 +305,6 @@ }) .then(({ value }) => { buildPkg(row, value).then((rsp) => { - console.log(rsp); this.expandChange(row, 1); }); }) @@ -320,7 +325,6 @@ handleDownload(row) { download({ path: row.filePath }).then((rsp) => { if (rsp && rsp.success) { - console.log(rsp); window.location = rsp.data; } }); diff --git a/src/views/user/components/UserEdit.vue b/src/views/user/components/UserEdit.vue index 6367505..801b5bc 100644 --- a/src/views/user/components/UserEdit.vue +++ b/src/views/user/components/UserEdit.vue @@ -80,7 +80,7 @@ this.$refs["form"].resetFields(); this.form = this.$options.data().form; this.dialogFormVisible = false; - this.$emit("fetch-data"); + // this.$emit("fetch-data"); }, async save() { if (this.createAction) { diff --git a/vue.config.js b/vue.config.js index 2973a1c..602fd6a 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,4 +1,4 @@ -const path = require('path') +const path = require("path"); const { publicPath, assetsDir, @@ -11,27 +11,27 @@ providePlugin, build7z, donation, -} = require('./src/config') -const { webpackBarName, webpackBanner, donationConsole } = require('zx-layouts') +} = require("./src/config"); +const { + webpackBarName, + webpackBanner, + donationConsole, +} = require("zx-layouts"); -const { version, author } = require('./package.json') +const { version, author } = require("./package.json"); -const Webpack = require('webpack') -const WebpackBar = require('webpackbar') -const FileManagerPlugin = require('filemanager-webpack-plugin') -const dayjs = require('dayjs') -const date = dayjs().format('YYYY_M_D') -const time = dayjs().format('YYYY-M-D HH:mm:ss') -process.env.VUE_APP_TITLE = title || 'vue-admin-beautiful' -process.env.VUE_APP_AUTHOR = author || 'chuzhixin 1204505056@qq.com' -process.env.VUE_APP_UPDATE_TIME = time -process.env.VUE_APP_VERSION = version +const Webpack = require("webpack"); +const WebpackBar = require("webpackbar"); +const FileManagerPlugin = require("filemanager-webpack-plugin"); +const dayjs = require("dayjs"); +const date = dayjs().format("YYYY_M_D"); +const time = dayjs().format("YYYY-M-D HH:mm:ss"); +process.env.VUE_APP_TITLE = "vue-intergrate"; +process.env.VUE_APP_AUTHOR = "basic"; +process.env.VUE_APP_UPDATE_TIME = time; +process.env.VUE_APP_VERSION = version; -const resolve = (dir) => path.join(__dirname, dir) -const mockServer = () => { - if (process.env.NODE_ENV === 'development') return require('./mock') - else return '' -} +const resolve = (dir) => path.join(__dirname, dir); module.exports = { publicPath, @@ -49,13 +49,12 @@ warnings: true, errors: true, }, - after: mockServer(), }, configureWebpack() { return { resolve: { alias: { - '@': resolve('src'), + "@": resolve("src"), }, }, plugins: [ @@ -64,92 +63,92 @@ name: webpackBarName, }), ], - } + }; }, chainWebpack(config) { - config.plugins.delete('preload') - config.plugins.delete('prefetch') + config.plugins.delete("preload"); + config.plugins.delete("prefetch"); config.module - .rule('svg') - .exclude.add(resolve('src/remixIcon')) - .add(resolve('src/colorfulIcon')) - .end() + .rule("svg") + .exclude.add(resolve("src/remixIcon")) + .add(resolve("src/colorfulIcon")) + .end(); config.module - .rule('remixIcon') + .rule("remixIcon") .test(/\.svg$/) - .include.add(resolve('src/remixIcon')) + .include.add(resolve("src/remixIcon")) .end() - .use('svg-sprite-loader') - .loader('svg-sprite-loader') - .options({ symbolId: 'remix-icon-[name]' }) - .end() + .use("svg-sprite-loader") + .loader("svg-sprite-loader") + .options({ symbolId: "remix-icon-[name]" }) + .end(); config.module - .rule('colorfulIcon') + .rule("colorfulIcon") .test(/\.svg$/) - .include.add(resolve('src/colorfulIcon')) + .include.add(resolve("src/colorfulIcon")) .end() - .use('svg-sprite-loader') - .loader('svg-sprite-loader') - .options({ symbolId: 'colorful-icon-[name]' }) - .end() + .use("svg-sprite-loader") + .loader("svg-sprite-loader") + .options({ symbolId: "colorful-icon-[name]" }) + .end(); /* config.when(process.env.NODE_ENV === "development", (config) => { config.devtool("source-map"); }); */ - config.when(process.env.NODE_ENV !== 'development', (config) => { - config.performance.set('hints', false) - config.devtool('none') + config.when(process.env.NODE_ENV !== "development", (config) => { + config.performance.set("hints", false); + config.devtool("none"); config.optimization.splitChunks({ - automaticNameDelimiter: '-', - chunks: 'all', + automaticNameDelimiter: "-", + chunks: "all", cacheGroups: { chunk: { - name: 'vab-chunk', + name: "vab-chunk", test: /[\\/]node_modules[\\/]/, minSize: 131072, maxSize: 524288, - chunks: 'async', + chunks: "async", minChunks: 2, priority: 10, }, vue: { - name: 'vue', + name: "vue", test: /[\\/]node_modules[\\/](vue(.*)|core-js)[\\/]/, - chunks: 'initial', + chunks: "initial", priority: 20, }, elementUI: { - name: 'element-ui', + name: "element-ui", test: /[\\/]node_modules[\\/]element-ui(.*)[\\/]/, priority: 30, }, extra: { - name: 'vab-layouts', - test: resolve('src/layouts'), + name: "vab-layouts", + test: resolve("src/layouts"), priority: 40, }, }, - }) + }); config - .plugin('banner') + .plugin("banner") .use(Webpack.BannerPlugin, [`${webpackBanner}${time}`]) - .end() + .end(); config.module - .rule('images') - .use('image-webpack-loader') - .loader('image-webpack-loader') + .rule("images") + .use("image-webpack-loader") + .loader("image-webpack-loader") .options({ bypassOnDebug: true, }) - .end() - }) + .end(); + }); if (build7z) { - config.when(process.env.NODE_ENV === 'production', (config) => { + config.when(process.env.NODE_ENV === "production", (config) => { config - .plugin('fileManager') + .plugin("fileManager") .use(FileManagerPlugin, [ { onEnd: { @@ -163,8 +162,8 @@ }, }, ]) - .end() - }) + .end(); + }); } }, runtimeCompiler: true, @@ -179,16 +178,16 @@ /*sass-loader 9.0鍐欐硶锛屾劅璋ithub鐢ㄦ埛 shaonialife*/ additionalData(content, loaderContext) { - const { resourcePath, rootContext } = loaderContext - const relativePath = path.relative(rootContext, resourcePath) + const { resourcePath, rootContext } = loaderContext; + const relativePath = path.relative(rootContext, resourcePath); if ( - relativePath.replace(/\\/g, '/') !== 'src/styles/variables.scss' + relativePath.replace(/\\/g, "/") !== "src/styles/variables.scss" ) { - return '@import "~@/styles/variables.scss";' + content + return '@import "~@/styles/variables.scss";' + content; } - return content + return content; }, }, }, }, -} +}; diff --git a/webstorm.config.js b/webstorm.config.js index 499195b..fba240b 100644 --- a/webstorm.config.js +++ b/webstorm.config.js @@ -1,6 +1,2 @@ -/** - * @author chuzhixin 1204505056@qq.com 锛堜笉鎯充繚鐣檃uthor鍙垹闄わ級 - * @description webstorm.config - */ -const webpackConfig = require('@vue/cli-service/webpack.config.js') -module.exports = webpackConfig +const webpackConfig = require("@vue/cli-service/webpack.config.js"); +module.exports = webpackConfig; -- Gitblit v1.8.0