Commit 5172dd5f by 张立顺

合并vuecli 升级代码

2 parents 764e92b7 e0cf7a96
# 所有环境默认 # 所有环境默认
# 页面 title 前缀 # 页面 title 前缀
VUE_APP_TITLE=D+ VUE_APP_TITLE=D+
# 仓库地址 # 静态资源基础路径
VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config VUE_APP_PUBLIC_PATH = /dj-carlife-web/
# 国际化配置 # 仓库地址
VUE_APP_I18N_LOCALE=zh-chs VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config
VUE_APP_I18N_FALLBACK_LOCALE=en
# 国际化配置
VUE_APP_ELEMENT_COLOR=#409EFF VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_STORAGE_PREFIX=d+ VUE_APP_STORAGE_PREFIX=d+
\ No newline at end of file \ No newline at end of file
module.exports = { module.exports = {
root: true, root: true,
parserOptions: { parserOptions: {
parser: 'babel-eslint' parser: '@babel/eslint-parser'
}, },
env: { env: {
browser: true browser: true
}, },
extends: [ extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevent // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevent
// ion consider switching to `plugin:vue/strongly-recommended` or // ion consider switching to `plugin:vue/strongly-recommended` or
// `plugin:vue/recommended` for stricter rules. // `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential', 'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md // https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard' 'standard'
], ],
// required to lint *.vue files // required to lint *.vue files
plugins: ['vue'], plugins: ['vue'],
globals: { globals: {
NODE_ENV: false, NODE_ENV: false,
_: false, _: false,
echarts: false echarts: false
}, },
rules: { rules: {
'arrow-spacing': [ 'arrow-spacing': [
2, 2,
{ {
before: true, before: true,
after: true after: true
} }
], ],
eqeqeq: 'off', eqeqeq: 'off',
// 'no-eval': ['error', { allowIndirect: false }], // default is false // 'no-eval': ['error', { allowIndirect: false }], // default is false
'no-eval': 'off', // default is false 'no-eval': 'off', // default is false
// allow async-await // allow async-await
'generator-star-spacing': 'off', 'generator-star-spacing': 'off',
// 'block-spacing': [2, 'always'], // 'block-spacing': [2, 'always'],
'brace-style': [ 'brace-style': [
2, 2,
'1tbs', '1tbs',
{ {
allowSingleLine: true allowSingleLine: true
} }
], ],
'comma-dangle': [2, 'never'], 'comma-dangle': [2, 'never'],
'comma-spacing': [ 'comma-spacing': [
2, 2,
{ {
before: false, before: false,
after: true after: true
} }
], ],
'comma-style': [2, 'last'], 'comma-style': [2, 'last'],
curly: [2, 'multi-line'], curly: [2, 'multi-line'],
'dot-location': [2, 'property'], 'dot-location': [2, 'property'],
indent: [ indent: [
2, 2,
2, 2,
{ {
SwitchCase: 1 SwitchCase: 1
} }
], ],
'key-spacing': [ 'key-spacing': [
2, 2,
{ {
beforeColon: false, beforeColon: false,
afterColon: true afterColon: true
} }
], ],
'keyword-spacing': [ 'keyword-spacing': [
2, 2,
{ {
before: true, before: true,
after: true after: true
} }
], ],
'new-cap': [ 'new-cap': [
2, 2,
{ {
newIsCap: true, newIsCap: true,
capIsNew: false capIsNew: false
} }
], ],
'no-extra-parens': [2, 'functions'], 'no-extra-parens': [2, 'functions'],
'no-floating-decimal': 2, 'no-floating-decimal': 2,
'no-multi-spaces': 2, 'no-multi-spaces': 2,
'no-multiple-empty-lines': [ 'no-multiple-empty-lines': [
2, 2,
{ {
max: 1 max: 1
} }
], ],
'no-trailing-spaces': 2, 'no-trailing-spaces': 2,
quotes: [ quotes: [
2, 2,
'single', 'single',
{ {
avoidEscape: true, avoidEscape: true,
allowTemplateLiterals: true allowTemplateLiterals: true
} }
], ],
semi: [2, 'never'], semi: [2, 'never'],
'space-before-blocks': [2, 'always'], 'space-before-blocks': [2, 'always'],
// 'space-before-function-paren': [2, 'never'], // 'space-before-function-paren': [2, 'never'],
'space-before-function-paren': 0, 'space-before-function-paren': 0,
'space-in-parens': [2, 'never'], 'space-in-parens': [2, 'never'],
'space-infix-ops': 2, 'space-infix-ops': 2,
'space-unary-ops': [ 'space-unary-ops': [
2, 2,
{ {
words: true, words: true,
nonwords: false nonwords: false
} }
], ],
'spaced-comment': [2, 'always'], 'spaced-comment': [2, 'always'],
'prefer-const': 2 'prefer-const': 2
} }
} }
module.exports = { module.exports = {
plugins: [ plugins: [
'@babel/plugin-proposal-nullish-coalescing-operator', // 双问号 '@babel/plugin-proposal-nullish-coalescing-operator', // 双问号
'@babel/plugin-proposal-optional-chaining' // 可选链 '@babel/plugin-proposal-optional-chaining' // 可选链
// '@babel/plugin-proposal-optional-chaining', // 可选链 ?. // '@babel/plugin-proposal-optional-chaining', // 可选链 ?.
// '@babel/plugin-proposal-nullish-coalescing-operator' // 空值合并 ?? // '@babel/plugin-proposal-nullish-coalescing-operator' // 空值合并 ??
], ],
presets: ['@vue/app'], presets: ['@vue/cli-plugin-babel/preset'],
// 允许两种编码引入方式共存,也就是 common 规范与 es6 规范的共存处理 // 允许两种编码引入方式共存,也就是 common 规范与 es6 规范的共存处理
sourceType: 'unambiguous' sourceType: 'unambiguous'
} }
No preview for this file type
This diff could not be displayed because it is too large.
{ {
"name": "dj-car-life-system", "name": "dj-car-life-system",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", "备注": "set NODE_OPTIONS=--openssl-legacy-provider 解决vuecli 不兼容node17以上版本",
"start": "npm run --openssl-legacy-provider serve", "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --open",
"dev": "npm run --openssl-legacy-provider serve", "start": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"build": "vue-cli-service --openssl-legacy-provider build --mode nomock", "dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"build:nomock": "vue-cli-service --openssl-legacy-provider build --mode nomock", "build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode nomock",
"build:travis": "vue-cli-service --openssl-legacy-provider build --mode travis", "build:nomock": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode nomock",
"lint": "vue-cli-service --openssl-legacy-provider lint --fix", "build:travis": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode travis",
"test:unit": "vue-cli-service --openssl-legacy-provider test:unit", "lint": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint --fix",
"report": "vue-cli-service --openssl-legacy-provider build --report" "test:unit": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service test:unit",
}, "report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report"
"dependencies": { },
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", "dependencies": {
"@babel/plugin-proposal-optional-chaining": "7.13.12", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12",
"@sentry/browser": "^7.3.0", "@babel/plugin-proposal-optional-chaining": "7.13.12",
"@sentry/tracing": "^7.3.0", "@sentry/browser": "^7.3.0",
"@sentry/vue": "^7.3.0", "@sentry/tracing": "^7.3.0",
"@sentry/webpack-plugin": "^1.18.9", "@sentry/vue": "^7.3.0",
"axios": "^0.18.0", "@sentry/webpack-plugin": "^1.18.9",
"better-scroll": "^1.15.2", "axios": "^0.18.0",
"dayjs": "^1.8.12", "better-scroll": "^1.15.2",
"default-passive-events": "^2.0.0", "core-js": "^3.8.3",
"echarts": "^5.3.2", "dayjs": "^1.8.12",
"element-ui": "^2.13.1", "default-passive-events": "^2.0.0",
"eslint-plugin-standard": "^5.0.0", "echarts": "^5.3.2",
"file-saver": "^2.0.5", "element-ui": "^2.13.1",
"flex.css": "^1.1.7", "eslint-plugin-standard": "^5.0.0",
"fuse.js": "^3.4.4", "file-saver": "^2.0.5",
"hotkeys-js": "^3.6.2", "flex.css": "^1.1.7",
"html2canvas": "^1.4.1", "fuse.js": "^3.4.4",
"js-cookie": "^2.2.0", "hotkeys-js": "^3.6.2",
"js-md5": "^0.7.3", "html2canvas": "^1.4.1",
"jspdf": "^2.5.1", "js-cookie": "^2.2.0",
"lodash": "^4.17.11", "js-md5": "^0.7.3",
"lowdb": "^1.0.0", "jspdf": "^2.5.1",
"nprogress": "^0.2.0", "lodash": "^4.17.11",
"qs": "^6.8.0", "lowdb": "^1.0.0",
"screenfull": "^4.2.0", "nprogress": "^0.2.0",
"sha1": "^1.1.1", "qs": "^6.8.0",
"speed-measure-webpack-plugin": "^1.5.0", "screenfull": "^4.2.0",
"ua-parser-js": "^0.7.19", "sha1": "^1.1.1",
"vue": "^2.6.10", "speed-measure-webpack-plugin": "^1.5.0",
"vue-i18n": "^8.14.0", "svg-sprite-loader": "^6.0.11",
"vue-qr": "^2.5.0", "ua-parser-js": "^0.7.19",
"vue-router": "3.0.5", "vue": "^2.6.10",
"vue2-org-tree": "^1.3.6", "vue-i18n": "^8.14.0",
"vuex": "^3.0.1", "vue-qr": "^2.5.0",
"xlsx": "^0.16.9" "vue-router": "3.0.5",
}, "vue2-org-tree": "^1.3.6",
"devDependencies": { "vuex": "^3.0.1",
"@kazupon/vue-i18n-loader": "^0.4.1", "webpack-theme-color-replacer": "^1.4.1",
"@vue/cli-plugin-babel": "^3.6.0", "webpack5-svg-sprite-loader": "^5.1.1",
"@vue/cli-plugin-eslint": "^3.6.0", "xlsx": "^0.16.9"
"@vue/cli-plugin-unit-jest": "^3.6.0", },
"@vue/cli-service": "^3.6.0", "devDependencies": {
"@vue/eslint-config-standard": "^4.0.0", "@babel/core": "^7.12.16",
"@vue/test-utils": "1.0.0-beta.29", "@babel/eslint-parser": "^7.12.16",
"babel-core": "7.0.0-bridge.0", "@kazupon/vue-i18n-loader": "^0.4.1",
"babel-eslint": "^10.0.1", "@vue/cli-plugin-babel": "~5.0.8",
"babel-jest": "^23.6.0", "@vue/cli-plugin-eslint": "~5.0.8",
"eslint": "^5.16.0", "@vue/cli-plugin-unit-jest": "~5.0.8",
"eslint-plugin-vue": "^5.0.0", "@vue/cli-service": "~5.0.8",
"hard-source-webpack-plugin": "^0.13.1", "@vue/eslint-config-standard": "^6.1.0",
"sass": "^1.18.0", "@vue/test-utils": "1.0.0-beta.29",
"sass-loader": "^7.1.0", "@vue/vue2-jest": "^27.0.0-alpha.3",
"script-loader": "^0.7.2", "babel-core": "7.0.0-bridge.0",
"svg-sprite-loader": "^4.1.3", "babel-jest": "^23.6.0",
"vue-template-compiler": "^2.5.21", "eslint": "^7.32.0",
"webpack-theme-color-replacer": "^1.2.15" "eslint-plugin-import": "^2.25.3",
} "eslint-plugin-node": "^11.1.0",
} "eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.1.0",
"postcss": "^8.4.16",
"postcss-loader": "^7.0.1",
"postcss-preset-env": "^7.7.2",
"sass": "^1.18.0",
"sass-loader": "^7.1.0",
"script-loader": "^0.7.2",
"vue-template-compiler": "^2.5.21",
"webpack": "^5.74.0"
}
}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>icon.ico"> <link rel="icon" href="<%= BASE_URL %>icon.ico">
<!-- 使用CDN的CSS文件 --> <!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" /> <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" /> <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %> <% } %>
<!-- 使用CDN的JS文件 预加载 --> <!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" /> <link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %> <% } %>
<title><%= VUE_APP_TITLE %></title> <title>
<style> <%= VUE_APP_TITLE %>
html, </title>
body, <style>
#app { html,
height: 100%; body,
margin: 0px; #app {
padding: 0px; height: 100%;
width: 100%; margin: 0px;
} padding: 0px;
.d2-home { width: 100%;
background-color: #2A343D; }
height: 100%;
display: flex; .d2-home {
flex-direction: column; background-color: #2A343D;
} height: 100%;
display: flex;
.d2-home__main { flex-direction: column;
user-select: none; }
width: 100%;
flex-grow: 1; .d2-home__main {
display: flex; user-select: none;
justify-content: center; width: 100%;
align-items: center; flex-grow: 1;
flex-direction: column; display: flex;
} justify-content: center;
align-items: center;
.d2-home__footer { flex-direction: column;
width: 100%; }
flex-grow: 0;
text-align: center; .d2-home__footer {
padding: 1em 0; width: 100%;
} flex-grow: 0;
text-align: center;
.d2-home__footer>a { padding: 1em 0;
font-size: 12px; }
color: #fff;
text-decoration: none; .d2-home__footer>a {
} font-size: 12px;
color: #fff;
.d2-home__loading { text-decoration: none;
height: 32px; }
width: 32px;
margin-bottom: 20px; .d2-home__loading {
} height: 32px;
width: 32px;
.d2-home__title { margin-bottom: 20px;
color: #FFF; }
font-size: 20px;
margin-bottom: 10px; .d2-home__title {
} color: #FFF;
font-size: 20px;
.d2-home__sub-title { margin-bottom: 10px;
color: #fff; }
font-size: 14px;
} .d2-home__sub-title {
</style> color: #fff;
<!-- <script> font-size: 14px;
var _hmt = _hmt || []; }
var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1"; </style>
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})(); <!-- <script>
</script> --> var _hmt = _hmt || [];
</head> var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1";
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
<body> </script> -->
<noscript> </head>
<strong>
很抱歉,如果没有 JavaScript 支持,系统 将不能正常工作。请启用浏览器的 JavaScript 然后继续。 <body>
</strong> <noscript>
</noscript> <strong>
<div id="app"> 很抱歉,如果没有 JavaScript 支持,系统 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
<div class="d2-home"> </strong>
<div class="d2-home__main"> </noscript>
<img class="d2-home__loading" src="./image/loading/loading-spin.svg" alt="loading"> <div id="app">
<div class="d2-home__title"> <div class="d2-home">
正在加载资源 <div class="d2-home__main">
</div> <!-- <img class="d2-home__loading" src="`/image/loading/loading-spin.svg`" alt="loading"> -->
<div class="d2-home__sub-title"> <img class="d2-home__loading" src="<%= VUE_APP_PUBLIC_PATH %>/image/loading/loading-spin.svg" alt="loading">
初次加载资源可能需要较多时间 请耐心等待 <div class="d2-home__title">
</div> 正在加载资源
</div> </div>
<div class="d2-home__footer"> <div class="d2-home__sub-title">
<a href="http://www.glsx.com.cn" target="_blank"> 初次加载资源可能需要较多时间 请耐心等待
<!-- 版权所有&copy-2019 GLSX粤ICP备12020087号 --> </div>
</a> </div>
</div> <div class="d2-home__footer">
</div> <a href="http://www.glsx.com.cn" target="_blank">
</div> <!-- 版权所有&copy-2019 GLSX粤ICP备12020087号 -->
<!-- built files will be auto injected --> </a>
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> </div>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script> </div>
<% } %> </div>
</body> <!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html> </html>
\ No newline at end of file \ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
// .map(requireContext)
const requireAll = requireContext => requireContext.keys().map(requireContext) const requireAll = requireContext => requireContext.keys()
const req = require.context('./icons', false, /\.svg$/) // console.log(requireAll)
const iconMap = requireAll(req) const req = require.context('./icons', false, /\.svg$/)
// console.log(req)
Vue.prototype.$IconSvg = iconMap.map(e => e.default.id.slice(3)) const iconMap = requireAll(req)
// console.log("iconMap",iconMap);
// e.slice(3) 老写法
Vue.prototype.$IconSvg = iconMap.map(e =>e.split('/')[1].split('.')[0] )
// Vue.prototype.$IconSvg = iconMap.map(e =>console.log(e.default))
// 创建 el-menu-item // 创建 el-menu-item
export function elMenuItem(createElement, menu) { export function elMenuItem(createElement, menu) {
return createElement('el-menu-item', { props: { index: menu.path } }, [ return createElement('el-menu-item', { props: { index: menu.path } }, [
...menu.icon ? [ ...menu.icon ? [
createElement('i', { attrs: { class: `el-icon-${menu.icon}` } }) createElement('i', { attrs: { class: `el-icon-${menu.icon}` } })
] : [], ] : [],
...menu.icon === undefined & !menu.iconSvg ? [ ...menu.icon === undefined & !menu.iconSvg ? [
createElement('img', { attrs: { src: './menuIcon/' + menu.path.slice(1) + '.png' } }) // createElement('img', { attrs: { src: './menuIcon/' + menu.path.slice(1) + '.png' } })
] : [], // public 文件需要使用绝对路径引入
...menu.iconSvg ? [ createElement('img', { attrs: { src: `${process.env.VUE_APP_PUBLIC_PATH}/menuIcon/` + menu.path.slice(1) + '.png' } })
createElement('d2-icon-svg', { props: { name: menu.iconSvg } }) ] : [],
] : [], ...menu.iconSvg ? [
createElement('span', { slot: 'title' }, menu.title || '未命名菜单') createElement('d2-icon-svg', { props: { name: menu.iconSvg } })
]) ] : [],
} createElement('span', { slot: 'title' }, menu.title || '未命名菜单')
])
// 创建 el-submenu }
export function elSubmenu(createElement, menu) {
return createElement('el-submenu', { props: { index: menu.path } }, [ // 创建 el-submenu
...menu.icon ? [ export function elSubmenu(createElement, menu) {
createElement('i', { slot: 'title', attrs: { class: `el-icon-${menu.icon}` } }) return createElement('el-submenu', { props: { index: menu.path } }, [
] : [], ...menu.icon ? [
...menu.icon === undefined & !menu.iconSvg ? [ createElement('i', { slot: 'title', attrs: { class: `el-icon-${menu.icon}` } })
createElement('img', { slot: 'title', attrs: { src: './menuIcon/' + menu.path.slice(1) + '.png' } }) ] : [],
] : [], ...menu.icon === undefined & !menu.iconSvg ? [
...menu.iconSvg ? [ // createElement('img', { slot: 'title', attrs: { src: './menuIcon/' + menu.path.slice(1) + '.png' } })
createElement('d2-icon-svg', { slot: 'title', props: { name: menu.iconSvg } }) // public 文件需要使用绝对路径引入
] : [], createElement('img', { slot: 'title', attrs: { src: `${process.env.VUE_APP_PUBLIC_PATH}/menuIcon/` + menu.path.slice(1) + '.png' } })
createElement('span', { slot: 'title' }, menu.title || '未命名菜单'), ] : [],
...menu.children.map((child, childIndex) => child.sideHidden ? '' : (child.children === undefined ? elMenuItem : elSubmenu).call(this, createElement, child)) ...menu.iconSvg ? [
]) createElement('d2-icon-svg', { slot: 'title', props: { name: menu.iconSvg } })
} ] : [],
createElement('span', { slot: 'title' }, menu.title || '未命名菜单'),
...menu.children.map((child, childIndex) => child.sideHidden ? '' : (child.children === undefined ? elMenuItem : elSubmenu).call(this, createElement, child))
])
}
...@@ -216,6 +216,14 @@ ...@@ -216,6 +216,14 @@
<span>{{ scope.row.employeeName || '-' }}</span> <span>{{ scope.row.employeeName || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<<<<<<< HEAD
=======
<!-- <el-table-column prop="outTradeNo"
label="交易参考号"
align="center"
width="120px">
</el-table-column> -->
>>>>>>> test
<el-table-column prop="tradeNo" <el-table-column prop="tradeNo"
label="交易参考号" label="交易参考号"
align="center" align="center"
......
<!-- 图片上传 --> <!-- 图片上传 -->
<template> <template>
<div class="gl-upload-img"> <div class="gl-upload-img">
<el-upload <el-upload action=""
action="" list-type="picture-card"
list-type="picture-card" :auto-upload="false"
:auto-upload="false" :show-file-list="false"
:show-file-list="false" :disabled="!!picObj[formObj[attrName]].url"
:disabled="!!picObj[formObj[attrName]].url" :on-change="e => handleChange(e, formObj[attrName], formObj)"
:on-change="e => handleChange(e, formObj[attrName], formObj)" :on-preview="e => handlePreview(e, formObj[attrName])"
:on-preview="e => handlePreview(e, formObj[attrName])" :on-remove="e => handleRemove(e, formObj[attrName])">
:on-remove="e => handleRemove(e, formObj[attrName])"
>
<span class="img-btn"> <span class="img-btn">
<img <img v-if="picObj[formObj[attrName]].url"
v-if="picObj[formObj[attrName]].url" :src='picObj[formObj[attrName]].url'
:src='picObj[formObj[attrName]].url' class="rectImg">
class="rectImg"
>
<span class="img-btns"> <span class="img-btns">
<span class="btn-item"> <span class="btn-item">
<i <i @click.stop='handleRemove(formObj[attrName], formObj)'
@click.stop='handleRemove(formObj[attrName], formObj)' class="el-icon-delete"></i>
class="el-icon-delete" <i @click.stop="handleImgLook"
></i> class="el-icon-zoom-in"></i>
<i
@click.stop="handleImgLook"
class="el-icon-zoom-in"
></i>
</span> </span>
</span> </span>
</span> </span>
<i <i v-if="!picObj[formObj[attrName]].url && formObj.useDefaultImg"
v-if="!picObj[formObj[attrName]].url && formObj.useDefaultImg" class="el-icon-plus avatar-uploader-icon"
class="el-icon-plus avatar-uploader-icon" style="color: #8c939d;"></i>
style="color: #8c939d;" <img v-if="!picObj[formObj[attrName]].url && !formObj.useDefaultImg"
></i> :src='examplePicUrl'
<img class="rectImg">
v-if="!picObj[formObj[attrName]].url && !formObj.useDefaultImg"
:src='examplePicUrl'
class="rectImg"
>
</el-upload> </el-upload>
<span v-if="txtDescript">{{txtDescript}}</span> <span v-if="txtDescript">{{txtDescript}}</span>
<p <p v-show="!picObj[formObj[attrName]].url"
v-show="!picObj[formObj[attrName]].url" slot="errorTips"
slot="errorTips" class="car-error-txt">请上传{{txtDescript}}</p>
class="car-error-txt"
>请上传{{txtDescript}}</p>
<el-dialog :visible.sync="lookImgVisible"> <el-dialog :visible.sync="lookImgVisible">
<img <img width="100%"
width="100%" :src="picObj[formObj[attrName]].url"
:src="picObj[formObj[attrName]].url" alt="图片">
alt="图片"
>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -91,7 +75,8 @@ export default { ...@@ -91,7 +75,8 @@ export default {
}, },
mounted() { mounted() {
this.examplePicUrl = './account/' + this.formObj[this.attrName] + '.png' // public 文件需要使用绝对路径引入
this.examplePicUrl = `${process.env.VUE_APP_PUBLIC_PATH}/account/` + this.formObj[this.attrName] + '.png'
}, },
methods: { methods: {
......
...@@ -1432,7 +1432,8 @@ export default { ...@@ -1432,7 +1432,8 @@ export default {
}, },
lookDemo() { lookDemo() {
this.lookUrl = './account/hetong.png' // public 文件需要使用绝对路径引入
this.lookUrl = `${process.env.VUE_APP_PUBLIC_PATH}/account/hetong.png`
this.lookImgVisible = !this.lookImgVisible this.lookImgVisible = !this.lookImgVisible
}, },
......
File mode changed
const VueFilenameInjector = require('./tools/vue-filename-injector') const VueFilenameInjector = require('./tools/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer') const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI') const forElementUI = require('webpack-theme-color-replacer/forElementUI')
const HardPlugin = require('hard-source-webpack-plugin') // 使用缓存,优化启动速度 // const HardPlugin = require('hard-source-webpack-plugin') // 使用缓存,优化启动速度
const SentryWebpackPlugin = require('@sentry/webpack-plugin') const SentryWebpackPlugin = require('@sentry/webpack-plugin')
// const SpeedMeasurePlugin = require('speed-measure-webpack-plugin') // const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
const CopyDir = require('./plugins/copyDir') const CopyDir = require('./plugins/copyDir')
...@@ -37,7 +37,8 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss') ...@@ -37,7 +37,8 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
const isDev = process.env.NODE_ENV !== 'development' const isDev = process.env.NODE_ENV !== 'development'
// 基础路径 注意发布之前要先修改这里 // 基础路径 注意发布之前要先修改这里
const publicPath = '/dj-carlife-web/' // const publicPath = '/dj-carlife-web/'
const publicPath = process.env.VUE_APP_PUBLIC_PATH
// const publicPath = '/' // const publicPath = '/'
// const CDN_DOMAIN = 'https://cdn.bootcss.com' // const CDN_DOMAIN = 'https://cdn.bootcss.com'
const CDN_DOMAIN = 'https://img02.glsx.com.cn/dj-carlife-web' const CDN_DOMAIN = 'https://img02.glsx.com.cn/dj-carlife-web'
...@@ -116,14 +117,14 @@ module.exports = { ...@@ -116,14 +117,14 @@ module.exports = {
// dayjs: 'dayjs', // dayjs: 'dayjs',
// 'flex.css': 'flex.css' // 'flex.css': 'flex.css'
// 非开发环境 // 非开发环境
if (isDev) { // if (isDev) {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false // config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true // config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true // config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = [ // config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = [
'console.log' // 'console.log'
] // ]
} // }
// console.log(config) // console.log(config)
// const Plugins = [ // const Plugins = [
...@@ -136,13 +137,14 @@ module.exports = { ...@@ -136,13 +137,14 @@ module.exports = {
// config.plugins = [...config.plugins, ...Plugins] // config.plugins = [...config.plugins, ...Plugins]
const plugins = [] const plugins = []
plugins.push( // webpack5 不需要 已经内部提供改支持
new HardPlugin({ // plugins.push(
cacheDirectory: assets(__dirname, 'cache'), // new HardPlugin({
// 解决报错问题 // cacheDirectory: assets(__dirname, 'cache'),
test: /mini-css-extract-plugin[\\/]dist[\\/]loader/ // // 解决报错问题
}) // test: /mini-css-extract-plugin[\\/]dist[\\/]loader/
) // })
// )
if (isDev) { if (isDev) {
plugins.push(new CopyDir()) // 把dist 文件修改成有两份来兼容部署时请求目录不一样的情况 plugins.push(new CopyDir()) // 把dist 文件修改成有两份来兼容部署时请求目录不一样的情况
...@@ -231,6 +233,7 @@ module.exports = { ...@@ -231,6 +233,7 @@ module.exports = {
symbolId: 'd2-[name]' symbolId: 'd2-[name]'
}) })
.end() .end()
// image exclude // image exclude
const imagesRule = config.module.rule('images') const imagesRule = config.module.rule('images')
imagesRule imagesRule
......
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!