diff --git a/manager/package.json b/manager/package.json index 41910b3f..282a442f 100644 --- a/manager/package.json +++ b/manager/package.json @@ -12,42 +12,25 @@ "dependencies": { "@amap/amap-jsapi-loader": "0.0.7", "@antv/g2": "^4.1.12", - "apexcharts": "^3.26.0", "axios": "^0.21.1", "core-js": "^3.6.5", - "countup.js": "^2.0.4", - "date-fns": "^1.30.1", "dplayer": "^1.26.0", - "gitalk": "^1.6.2", - "html2canvas": "^1.0.0-rc.5", - "iview-area": "^1.6.0", "js-cookie": "^2.2.1", "node-sass": "^4.14.1", - "pinyin": "^2.9.0", - "print-js": "^1.0.63", - "qrcodejs2": "0.0.2", "sass-loader": "^8.0.2", "sockjs-client": "^1.4.0", - "stompjs": "^2.3.3", "swiper": "^6.3.5", "uuid": "^8.3.2", "view-design": "^4.2.0", "vue": "^2.6.10", - "vue-apexcharts": "^1.5.1", - "vue-awesome": "^4.0.2", "vue-awesome-swiper": "^4.1.1", - "vue-clipboard2": "^0.3.0", - "vue-cropper": "^0.4.9", "vue-i18n": "^8.15.1", "vue-json-excel": "^0.3.0", - "vue-json-pretty": "^1.4.1", - "vue-lazyload": "^1.3.3", "vue-qr": "^2.3.0", "vue-router": "^3.1.3", "vuedraggable": "^2.23.2", "vuex": "^3.4.0", "wangeditor": "^4.7.5", - "xlsx": "^0.16.2", "xss": "^1.0.7" }, "devDependencies": { @@ -61,6 +44,7 @@ "less-loader": "^6.2.0", "style-loader": "^2.0.0", "style-resources-loader": "^1.3.2", + "uglifyjs-webpack-plugin": "^2.2.0", "vue-cli-plugin-style-resources-loader": "^0.1.4", "vue-template-compiler": "^2.6.10" } diff --git a/manager/public/index.html b/manager/public/index.html index 076d2228..0644d4d7 100644 --- a/manager/public/index.html +++ b/manager/public/index.html @@ -1,107 +1,86 @@ - - - - - - - lili admin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
+ .half-circle-spinner { + width: 35px; + height: 35px; + border-radius: 100%; + position: relative; + } + + .half-circle-spinner .circle { + content: ""; + position: absolute; + width: 100%; + height: 100%; + border-radius: 100%; + border: calc(35px / 10) solid transparent; + } + + .half-circle-spinner .circle.circle-1 { + border-top-color: #5cadff; + animation: half-circle-spinner-animation 1s infinite; + } + + .half-circle-spinner .circle.circle-2 { + border-bottom-color: #5cadff; + animation: half-circle-spinner-animation 1s infinite alternate; + } + + @keyframes half-circle-spinner-animation { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + + + + + <% for(var js of htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> + +
+
+
+
+
+
+

正在加载资源...

-

正在加载资源...

-
- - - + diff --git a/manager/src/libs/excel.js b/manager/src/libs/excel.js deleted file mode 100644 index 4acb2791..00000000 --- a/manager/src/libs/excel.js +++ /dev/null @@ -1,102 +0,0 @@ -import XLSX from 'xlsx'; - -function auto_width(ws, data){ - /*set worksheet max width per col*/ - const colWidth = data.map(row => row.map(val => { - /*if null/undefined*/ - if (val == null) { - return {'wch': 10}; - } - /*if chinese*/ - else if (val.toString().charCodeAt(0) > 255) { - return {'wch': val.toString().length * 2}; - } else { - return {'wch': val.toString().length}; - } - })) - /*start in the first row*/ - let result = colWidth[0]; - for (let i = 1; i < colWidth.length; i++) { - for (let j = 0; j < colWidth[i].length; j++) { - if (result[j]['wch'] < colWidth[i][j]['wch']) { - result[j]['wch'] = colWidth[i][j]['wch']; - } - } - } - ws['!cols'] = result; -} - -function json_to_array(key, jsonData){ - return jsonData.map(v => key.map(j => { return v[j] })); -} - -// fix data,return string -function fixdata(data) { - let o = '' - let l = 0 - const w = 10240 - for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w))) - o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w))) - return o -} - -// get head from excel file,return array -function get_header_row(sheet) { - const headers = [] - const range = XLSX.utils.decode_range(sheet['!ref']) - let C - const R = range.s.r /* start in the first row */ - for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */ - var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] /* find the cell in the first row */ - var hdr = 'UNKNOWN ' + C // <-- replace with your desired default - if (cell && cell.t) hdr = XLSX.utils.format_cell(cell) - headers.push(hdr) - } - return headers -} - -export const export_table_to_excel= (id, filename) => { - const table = document.getElementById(id); - const wb = XLSX.utils.table_to_book(table); - XLSX.writeFile(wb, filename); -} - -export const export_json_to_excel = ({data, key, title, filename, autoWidth}) => { - const wb = XLSX.utils.book_new(); - data.unshift(title); - const ws = XLSX.utils.json_to_sheet(data, {header: key, skipHeader: true}); - if(autoWidth){ - const arr = json_to_array(key, data); - auto_width(ws, arr); - } - XLSX.utils.book_append_sheet(wb, ws, filename); - XLSX.writeFile(wb, filename + '.xlsx'); -} - -export const export_array_to_excel = ({key, data, title, filename, autoWidth}) => { - const wb = XLSX.utils.book_new(); - const arr = json_to_array(key, data); - arr.unshift(title); - const ws = XLSX.utils.aoa_to_sheet(arr); - if(autoWidth){ - auto_width(ws, arr); - } - XLSX.utils.book_append_sheet(wb, ws, filename); - XLSX.writeFile(wb, filename + '.xlsx'); -} - -export const read = (data, type) => { - const workbook = XLSX.read(data, { type: type }); - const firstSheetName = workbook.SheetNames[0]; - const worksheet = workbook.Sheets[firstSheetName]; - const header = get_header_row(worksheet); - const results = XLSX.utils.sheet_to_json(worksheet); - return {header, results}; -} - -export default { - export_table_to_excel, - export_array_to_excel, - export_json_to_excel, - read -} diff --git a/manager/src/main.js b/manager/src/main.js index 1843f474..1a89101b 100644 --- a/manager/src/main.js +++ b/manager/src/main.js @@ -15,7 +15,6 @@ import vueQr from 'vue-qr' import { getRequest, postRequest, putRequest, deleteRequest, importRequest, uploadFileRequest } from '@/libs/axios' import { setStore, getStore, removeStore } from '@/libs/storage' import util from '@/libs/util' -import VueLazyload from 'vue-lazyload' import * as filters from '@/utils/filters' // global filter import liliDialog from '@/views/lili-dialog' @@ -30,10 +29,7 @@ Vue.prototype.linkTo = function (goodsId, skuId) { // 跳转买家端商品 Vue.prototype.wapLinkTo = function (goodsId, skuId) { // app端二维码 return `${buyerUrlWap}/pages/product/goods?id=${skuId}&goodsId=${goodsId}` }; -Vue.use(VueLazyload, { - error: require('./assets/img-error.png'), - loading: require('./assets/loading2.gif') -}) + Vue.use(ViewUI, { i18n: (key, value) => i18n.t(key, value) }); diff --git a/manager/src/router/router.js b/manager/src/router/router.js index 548235a5..3a7d5d48 100644 --- a/manager/src/router/router.js +++ b/manager/src/router/router.js @@ -19,7 +19,7 @@ export const otherRouter = { children: [ { path: "home", - title: { i18n: "home" }, + title: '首页', name: "home_index", component: () => import("@/views/home/home.vue") }, diff --git a/manager/src/views/customWords/index.vue b/manager/src/views/customWords/index.vue index 25d11f1d..5856769a 100644 --- a/manager/src/views/customWords/index.vue +++ b/manager/src/views/customWords/index.vue @@ -11,7 +11,6 @@ :data="data" ref="table" sortable="custom" - @on-sort-change="changeSort" @on-selection-change="changeSelect" > diff --git a/manager/src/views/distribution/distributionCash.vue b/manager/src/views/distribution/distributionCash.vue index aa1afb95..f8c213e6 100644 --- a/manager/src/views/distribution/distributionCash.vue +++ b/manager/src/views/distribution/distributionCash.vue @@ -25,7 +25,7 @@ -
+ diff --git a/manager/src/views/distribution/distributionGoods.vue b/manager/src/views/distribution/distributionGoods.vue index 2f214fab..acd87626 100644 --- a/manager/src/views/distribution/distributionGoods.vue +++ b/manager/src/views/distribution/distributionGoods.vue @@ -1,22 +1,18 @@ diff --git a/manager/src/views/distribution/distributionOrder.vue b/manager/src/views/distribution/distributionOrder.vue index 06efbe74..5db18f42 100644 --- a/manager/src/views/distribution/distributionOrder.vue +++ b/manager/src/views/distribution/distributionOrder.vue @@ -69,10 +69,13 @@ } from "@/api/distribution"; import {orderStatusList} from './dataJson' import {getShopListData} from '@/api/shops' + import vueQr from 'vue-qr' export default { name: "distributionOrder", - components: {}, + components: { + "vue-qr":vueQr + }, data() { return { timeRange: [], // 范围时间 diff --git a/manager/src/views/distribution/distributionSetting.vue b/manager/src/views/distribution/distributionSetting.vue index ac577650..04dec74d 100644 --- a/manager/src/views/distribution/distributionSetting.vue +++ b/manager/src/views/distribution/distributionSetting.vue @@ -25,7 +25,6 @@ diff --git a/manager/src/views/lili-floor-renovation/wap/template/tpl_banner.vue b/manager/src/views/lili-floor-renovation/wap/template/tpl_banner.vue index 479b4f3e..e45bd27a 100644 --- a/manager/src/views/lili-floor-renovation/wap/template/tpl_banner.vue +++ b/manager/src/views/lili-floor-renovation/wap/template/tpl_banner.vue @@ -1,6 +1,6 @@ diff --git a/manager/src/views/my-components/lili/department-choose.vue b/manager/src/views/my-components/lili/department-choose.vue index ffc07bb1..412e4d73 100644 --- a/manager/src/views/my-components/lili/department-choose.vue +++ b/manager/src/views/my-components/lili/department-choose.vue @@ -3,7 +3,6 @@ import * as API_Order from "@/api/order"; - + import vueQr from 'vue-qr' export default { name: "orderList", + components: { + "vue-qr":vueQr + }, data() { return { loading: true, // 表单加载状态 diff --git a/manager/src/views/order/after-order/orderComplaint.vue b/manager/src/views/order/after-order/orderComplaint.vue index 93752bd1..ee67eb60 100644 --- a/manager/src/views/order/after-order/orderComplaint.vue +++ b/manager/src/views/order/after-order/orderComplaint.vue @@ -72,12 +72,11 @@ diff --git a/manager/src/views/promotion/kanjia/kanjiaActivityEditGoods.vue b/manager/src/views/promotion/kanjia/kanjiaActivityEditGoods.vue index 2444c560..69f01eb4 100644 --- a/manager/src/views/promotion/kanjia/kanjiaActivityEditGoods.vue +++ b/manager/src/views/promotion/kanjia/kanjiaActivityEditGoods.vue @@ -86,10 +86,7 @@
- +
@@ -99,13 +96,11 @@ editKanJiaActivityGoods, } from "@/api/promotion"; import {regular} from "@/utils"; - import skuSelect from "@/views/lili-dialog"; + export default { name: "editKanjiaActivityGoods", - components: { - skuSelect, - }, + watch: {}, data() { const checkSettlementPrice = (rule, value, callback) => { diff --git a/manager/src/views/promotion/kanjia/kanjiaActivityGoods.vue b/manager/src/views/promotion/kanjia/kanjiaActivityGoods.vue index a2c2db2e..ea06dbf7 100644 --- a/manager/src/views/promotion/kanjia/kanjiaActivityGoods.vue +++ b/manager/src/views/promotion/kanjia/kanjiaActivityGoods.vue @@ -4,7 +4,7 @@
- + - + +
@@ -25,7 +25,7 @@
+ @on-sort-change="changeSort"> @@ -48,279 +48,272 @@
{{ row.goodsSku.quantity }}
+ @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator + show-sizer> diff --git a/manager/src/views/promotion/live/live.vue b/manager/src/views/promotion/live/live.vue index 7fcdf4cc..35fa9596 100644 --- a/manager/src/views/promotion/live/live.vue +++ b/manager/src/views/promotion/live/live.vue @@ -23,7 +23,7 @@ export default { data() { return { // 查询数据的总数 - total: "", + total: 0, // 查询的form searchForm: { pageSize: 10, diff --git a/manager/src/views/promotion/pintuan/pintuan.vue b/manager/src/views/promotion/pintuan/pintuan.vue index c0867d7f..e1ac0e90 100644 --- a/manager/src/views/promotion/pintuan/pintuan.vue +++ b/manager/src/views/promotion/pintuan/pintuan.vue @@ -95,6 +95,7 @@ export default { name: "pintuan", data() { return { + selectDate:[], //选中的数据 loading: true, // 表单加载状态 searchForm: { // 搜索框初始化对象 diff --git a/manager/src/views/promotion/pintuan/pintuanGoods.vue b/manager/src/views/promotion/pintuan/pintuanGoods.vue index ba2c249b..9516e10f 100644 --- a/manager/src/views/promotion/pintuan/pintuanGoods.vue +++ b/manager/src/views/promotion/pintuan/pintuanGoods.vue @@ -16,8 +16,6 @@ :data="goodsData" ref="table" sortable="custom" - @on-sort-change="changeSort" - @on-selection-change="changeSelect" > diff --git a/manager/vue.config.js b/manager/vue.config.js index 3a8f6944..3f9dcc1a 100644 --- a/manager/vue.config.js +++ b/manager/vue.config.js @@ -1,10 +1,55 @@ const path = require("path"); const CompressionPlugin = require("compression-webpack-plugin"); - +const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const resolve = dir => { return path.join(__dirname, dir); }; +/** + * 在项目开发的时候将生产环境以及开发环境进行判断 + * 将生产环境中的路径用cdn来进行优化处理 + * 将开发环境中替换为本地的内容,方便处理bug以及开启vueDev + * 我们可以根据环境变量进行相应的处理,只有在产品的时候,才让插件去自动注入相应的资源文件到html页面 + */ +const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境 +let externals = { + vue: "Vue", + axios: "axios", + "vue-router": "VueRouter", + vuex: "Vuex", + "view-design": "iview", + "vue-lazyload": "VueLazyload", + "js-cookie": "Cookies", + wangeditor: "wangEditor", + "sockjs-client": "SockJS", + vuedraggable: "vuedraggable", + "@antv/g2": "G2", + dplayer: "DPlayer" +}; + +// 使用CDN的内容 +let cdn = { + css: ["https://cdn.jsdelivr.net/npm/view-design@4.1.1/dist/styles/iview.css"], + js: [ + // vue must at first! + "https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js", + "https://cdn.jsdelivr.net/npm/vuex@3.1.2/dist/vuex.min.js", + "https://cdn.jsdelivr.net/npm/vue-router@3.1.3/dist/vue-router.min.js", + "https://cdn.jsdelivr.net/npm/axios@0.19.0/dist/axios.min.js", + "https://cdn.jsdelivr.net/npm/view-design@4.1.1/dist/iview.min.js", + "https://cdn.jsdelivr.net/npm/vue-lazyload@1.3.3/vue-lazyload.min.js", + "https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js", + "https://cdn.jsdelivr.net/npm/dplayer@1.25.0/dist/DPlayer.min.js", + "https://cdn.jsdelivr.net/npm/wangeditor@latest/dist/wangEditor.min.js", + "https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js", + "https://cdn.jsdelivr.net/npm/vuedraggable@2.23.2/dist/vuedraggable.umd.min.js", + "https://gw.alipayobjects.com/os/lib/antv/g2/4.1.24/dist/g2.min.js" + ] +}; + +// 判断是否需要加载CDN +cdn = enableProduction ? cdn : { css: [], js: [] }; +externals = enableProduction ? externals : {}; module.exports = { css: { loaderOptions: { @@ -20,37 +65,13 @@ module.exports = { port: 10003 }, - chainWebpack: config => { - // @ 对应 src目录 - config.resolve.alias.set("@", resolve("src")); - }, - // 打包时不生成.map文件 避免看到源码 productionSourceMap: false, // 部署优化 configureWebpack: { // 使用CDN - externals: { - vue: "Vue", - "vue-i18n": "VueI18n", - axios: "axios", - "vue-router": "VueRouter", - vuex: "Vuex", - "view-design": "iview", - xlsx: "XLSX", - dplayer: "DPlayer", - "print-js": "printJS", - html2canvas: "html2canvas", - "vue-json-pretty": "VueJsonPretty", - "vue-lazyload": "VueLazyload", - gitalk: "Gitalk", - "js-cookie": "Cookies", - wangEditor: "wangEditor", - stompjs: "Stomp", - "sockjs-client": "SockJS", - vuedraggable: "vuedraggable" - }, + externals: externals, // GZIP压缩 plugins: [ new CompressionPlugin({ @@ -58,8 +79,24 @@ module.exports = { threshold: 10240 // 对超过10k文件压缩 }) ], + mode: "production", optimization: { runtimeChunk: "single", + minimizer: [ + new UglifyJsPlugin({ + uglifyOptions: { + // 删除注释 + output: { + comments: false + }, + compress: { + drop_console: true, // 删除所有调式带有console的 + drop_debugger: true, + pure_funcs: ["console.log"] // 删除console.log + } + } + }) + ], splitChunks: { chunks: "all", maxInitialRequests: Infinity, @@ -81,6 +118,15 @@ module.exports = { } } }, + // 将cdn的资源挂载到插件上 + chainWebpack(config) { + // @ 对应 src目录 + config.resolve.alias.set("@", resolve("src")); + config.plugin("html").tap(args => { + args[0].cdn = cdn; + return args; + }); + }, pluginOptions: { "style-resources-loader": { diff --git a/seller/package.json b/seller/package.json index 362c9ad7..563d30f4 100644 --- a/seller/package.json +++ b/seller/package.json @@ -40,6 +40,7 @@ "less-loader": "^6.2.0", "style-loader": "^2.0.0", "style-resources-loader": "^1.3.2", + "uglifyjs-webpack-plugin": "^2.2.0", "view-design": "^4.6.1", "vue-cli-plugin-style-resources-loader": "^0.1.4", "vue-template-compiler": "^2.6.10" diff --git a/seller/src/libs/excel.js b/seller/src/libs/excel.js deleted file mode 100644 index 4acb2791..00000000 --- a/seller/src/libs/excel.js +++ /dev/null @@ -1,102 +0,0 @@ -import XLSX from 'xlsx'; - -function auto_width(ws, data){ - /*set worksheet max width per col*/ - const colWidth = data.map(row => row.map(val => { - /*if null/undefined*/ - if (val == null) { - return {'wch': 10}; - } - /*if chinese*/ - else if (val.toString().charCodeAt(0) > 255) { - return {'wch': val.toString().length * 2}; - } else { - return {'wch': val.toString().length}; - } - })) - /*start in the first row*/ - let result = colWidth[0]; - for (let i = 1; i < colWidth.length; i++) { - for (let j = 0; j < colWidth[i].length; j++) { - if (result[j]['wch'] < colWidth[i][j]['wch']) { - result[j]['wch'] = colWidth[i][j]['wch']; - } - } - } - ws['!cols'] = result; -} - -function json_to_array(key, jsonData){ - return jsonData.map(v => key.map(j => { return v[j] })); -} - -// fix data,return string -function fixdata(data) { - let o = '' - let l = 0 - const w = 10240 - for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w))) - o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w))) - return o -} - -// get head from excel file,return array -function get_header_row(sheet) { - const headers = [] - const range = XLSX.utils.decode_range(sheet['!ref']) - let C - const R = range.s.r /* start in the first row */ - for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */ - var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] /* find the cell in the first row */ - var hdr = 'UNKNOWN ' + C // <-- replace with your desired default - if (cell && cell.t) hdr = XLSX.utils.format_cell(cell) - headers.push(hdr) - } - return headers -} - -export const export_table_to_excel= (id, filename) => { - const table = document.getElementById(id); - const wb = XLSX.utils.table_to_book(table); - XLSX.writeFile(wb, filename); -} - -export const export_json_to_excel = ({data, key, title, filename, autoWidth}) => { - const wb = XLSX.utils.book_new(); - data.unshift(title); - const ws = XLSX.utils.json_to_sheet(data, {header: key, skipHeader: true}); - if(autoWidth){ - const arr = json_to_array(key, data); - auto_width(ws, arr); - } - XLSX.utils.book_append_sheet(wb, ws, filename); - XLSX.writeFile(wb, filename + '.xlsx'); -} - -export const export_array_to_excel = ({key, data, title, filename, autoWidth}) => { - const wb = XLSX.utils.book_new(); - const arr = json_to_array(key, data); - arr.unshift(title); - const ws = XLSX.utils.aoa_to_sheet(arr); - if(autoWidth){ - auto_width(ws, arr); - } - XLSX.utils.book_append_sheet(wb, ws, filename); - XLSX.writeFile(wb, filename + '.xlsx'); -} - -export const read = (data, type) => { - const workbook = XLSX.read(data, { type: type }); - const firstSheetName = workbook.SheetNames[0]; - const worksheet = workbook.Sheets[firstSheetName]; - const header = get_header_row(worksheet); - const results = XLSX.utils.sheet_to_json(worksheet); - return {header, results}; -} - -export default { - export_table_to_excel, - export_array_to_excel, - export_json_to_excel, - read -} diff --git a/seller/vue.config.js b/seller/vue.config.js index 8b832a94..978a04c0 100644 --- a/seller/vue.config.js +++ b/seller/vue.config.js @@ -1,6 +1,6 @@ const path = require("path"); const CompressionPlugin = require("compression-webpack-plugin"); - +const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const resolve = dir => { return path.join(__dirname, dir); }; @@ -23,8 +23,7 @@ let externals = { wangeditor: "wangEditor", "sockjs-client": "SockJS", vuedraggable: "vuedraggable", - "@antv/g2": "G2", - + "@antv/g2": "G2" }; // 使用CDN的内容 @@ -42,7 +41,7 @@ let cdn = { "https://cdn.jsdelivr.net/npm/wangeditor@latest/dist/wangEditor.min.js", "https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js", "https://cdn.jsdelivr.net/npm/vuedraggable@2.23.2/dist/vuedraggable.umd.min.js", - "https://gw.alipayobjects.com/os/lib/antv/g2/4.1.24/dist/g2.min.js", + "https://gw.alipayobjects.com/os/lib/antv/g2/4.1.24/dist/g2.min.js" ] }; @@ -79,7 +78,23 @@ module.exports = { threshold: 10240 // 对超过10k文件压缩 }) ], + mode: "production", optimization: { + minimizer: [ + new UglifyJsPlugin({ + uglifyOptions: { + // 删除注释 + output: { + comments: false + }, + compress: { + drop_console: true, // 删除所有调式带有console的 + drop_debugger: true, + pure_funcs: ["console.log"] // 删除console.log + } + } + }) + ], runtimeChunk: "single", splitChunks: { chunks: "all",