mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-19 01:15:53 +08:00
merge master
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -2,7 +2,8 @@ export default {
|
||||
/**
|
||||
* @description 配置显示在浏览器标签的title
|
||||
*/
|
||||
title: "Lili电商",
|
||||
title: "lilishop",
|
||||
|
||||
/**
|
||||
* @description token在Cookie中存储的天数,默认1天
|
||||
*/
|
||||
@@ -14,6 +15,8 @@ export default {
|
||||
*/
|
||||
useI18n: true,
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description api请求基础路径
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -2,12 +2,13 @@ import lazyLoading from './lazyLoading.js';
|
||||
import Cookies from "js-cookie";
|
||||
import { result } from './routerJson.js';
|
||||
|
||||
import config from '@/config/index'
|
||||
let util = {
|
||||
|
||||
};
|
||||
|
||||
util.title = function (title) {
|
||||
title = title || 'lili 商家后台';
|
||||
title = title || `${config.title} 商家后台`;
|
||||
window.document.title = title;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// The Vue build version to load with the `import` command
|
||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||
import Vue from "vue";
|
||||
import ViewUI from "view-design";
|
||||
import "./styles/theme.less";
|
||||
|
||||
import "core-js/stable";
|
||||
// import "regenerator-runtime/runtime";
|
||||
import vueQr from "vue-qr";
|
||||
|
||||
import App from "./App";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Main from "@/views/Main.vue";
|
||||
|
||||
import config from '@/config/index'
|
||||
// 不作为Main组件的子页面展示的页面单独写,如下
|
||||
export const loginRouter = {
|
||||
path: "/login",
|
||||
name: "login",
|
||||
meta: {
|
||||
title: "登录 - lili商家后台"
|
||||
title: `登录 - ${config.title}商家后台`
|
||||
},
|
||||
component: () => import("@/views/login.vue")
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<Avatar :src="userInfo.storeLogo" style="background: #fff;margin-left: 10px;"></Avatar>
|
||||
</div>
|
||||
<DropdownMenu slot="list">
|
||||
<DropdownItem name="changePass">切换</DropdownItem>
|
||||
<DropdownItem name="changePass">修改密码</DropdownItem>
|
||||
<DropdownItem name="loginOut" divided>退出</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
|
||||
@@ -509,6 +509,7 @@ export default {
|
||||
isIndex: "",
|
||||
required: "",
|
||||
paramId: "",
|
||||
sort: ""
|
||||
};
|
||||
}
|
||||
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
|
||||
@@ -519,6 +520,7 @@ export default {
|
||||
isIndex: params.isIndex,
|
||||
required: params.required,
|
||||
paramId: params.id,
|
||||
sort: params.sort
|
||||
};
|
||||
},
|
||||
// 编辑sku图片
|
||||
|
||||
@@ -112,8 +112,16 @@ export default {
|
||||
item.storeId = this.storeId;
|
||||
this.month = "";
|
||||
|
||||
if (item.searchType == "") {
|
||||
item.searchType = "LAST_SEVEN";
|
||||
if (item.searchType == "") {
|
||||
if (
|
||||
dateList.some((date) => {
|
||||
return date.title == item.title;
|
||||
})
|
||||
) {
|
||||
item.searchType = date.searchType;
|
||||
} else {
|
||||
item.searchType = "LAST_SEVEN";
|
||||
}
|
||||
}
|
||||
|
||||
this.selectedWay = item;
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<div class="block">
|
||||
<div class="box">
|
||||
<span>付款笔数</span>
|
||||
<span>{{overViewList.paymentsNum || 0 }}</span>
|
||||
<span>{{overViewList.paymentOrderNum || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
@@ -10,7 +10,7 @@ const resolve = dir => {
|
||||
* 将开发环境中替换为本地的内容,方便处理bug以及开启vueDev
|
||||
* 我们可以根据环境变量进行相应的处理,只有在产品的时候,才让插件去自动注入相应的资源文件到html页面
|
||||
*/
|
||||
const enableCDN = process.env.NODE_ENV === "production"; // 是否生产环境
|
||||
const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境
|
||||
|
||||
let externals = {
|
||||
vue: "Vue",
|
||||
@@ -23,8 +23,7 @@ let externals = {
|
||||
wangeditor: "wangEditor",
|
||||
"sockjs-client": "SockJS",
|
||||
vuedraggable: "vuedraggable",
|
||||
"@antv/g2": "G2",
|
||||
|
||||
"@antv/g2": "G2"
|
||||
};
|
||||
|
||||
// 使用CDN的内容
|
||||
@@ -42,13 +41,30 @@ 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"
|
||||
]
|
||||
};
|
||||
|
||||
// 删除注释
|
||||
let jsPlugin = [
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
// 删除注释
|
||||
output: {
|
||||
comments: false
|
||||
},
|
||||
compress: {
|
||||
drop_console: true, // 删除所有调式带有console的
|
||||
drop_debugger: true,
|
||||
pure_funcs: ["console.log"] // 删除console.log
|
||||
}
|
||||
}
|
||||
})
|
||||
];
|
||||
// 判断是否需要加载CDN
|
||||
cdn = enableCDN ? cdn : { css: [], js: [] };
|
||||
externals = enableCDN ? externals : {};
|
||||
cdn = enableProduction ? cdn : { css: [], js: [] };
|
||||
externals = enableProduction ? externals : {};
|
||||
jsPlugin = enableProduction ? jsPlugin : [];
|
||||
|
||||
module.exports = {
|
||||
css: {
|
||||
@@ -80,6 +96,7 @@ module.exports = {
|
||||
})
|
||||
],
|
||||
optimization: {
|
||||
minimizer: jsPlugin,
|
||||
runtimeChunk: "single",
|
||||
splitChunks: {
|
||||
chunks: "all",
|
||||
|
||||
Reference in New Issue
Block a user