This commit is contained in:
faiz 2024-05-23 18:31:45 +08:00
parent 39e06e08a7
commit 11caa29bb8
17 changed files with 9300 additions and 9064 deletions

View File

@ -3,11 +3,11 @@ ENV = 'development'
# http://192.168.1.43:8324/admin
# http://mer.crmeb.net/admin
# base api
VUE_APP_BASE_API = 'http://192.168.1.50:8080'
VUE_APP_BASE_API = 'https://api.tropjoin.com/'
# VUE_APP_BASE_API = 'https://plus.hwms.shop'
# socket 连接地址
VUE_APP_WS_URL = 'ws://192.168.1.50:8080'
VUE_APP_WS_URL = 'ws://https://api.tropjoin.com/'
# VUE_APP_WS_URL = 'ws://plus.hwms.shop'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,

View File

@ -90,6 +90,7 @@
"vuedraggable": "2.20.0",
"vuex": "3.1.0",
"wangeditor": "^4.7.12",
"worker-loader": "^3.0.8",
"xlsx": "0.14.1"
},
"devDependencies": {

View File

@ -183,7 +183,7 @@ export default {
info: [
{
title: '标题',
value: '促销单品',
value: '特惠专区',
tips: '选填不超过4个字',
max: 4
},

View File

@ -230,7 +230,7 @@ export default {
info: [
{
title: '标题',
value: '促销单品',
value: '特惠专区',
tips: '选填不超过4个字',
max: 4
},
@ -247,7 +247,7 @@ export default {
info: [
{
title: '标题',
value: '促销单品',
value: '特惠专区',
tips: '选填不超过4个字',
max: 4
},

View File

@ -1,10 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta charset="utf-8" />
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"
type="image/x-icon" />
<link rel="icon" type="image/svg+xml"
href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" />
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
@ -34,10 +37,12 @@
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
<img width="200"
src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
@ -47,7 +52,8 @@
<li class="dib"><span>Symbol</span></li>
</ul>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=993865" target="_blank" class="nav-more">查看项目</a>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=993865" target="_blank"
class="nav-more">查看项目</a>
</div>
<div class="tab-container">
@ -698,7 +704,7 @@
<li class="dib">
<span class="icon iconfont">&#xe7b7;</span>
<div class="name">促销单品</div>
<div class="name">特惠专区</div>
<div class="code-name">&amp;#xe7b7;</div>
</li>
@ -3657,7 +3663,7 @@
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1665560959543') format('woff2'),
@ -3666,7 +3672,7 @@
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
@ -3676,7 +3682,7 @@
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
@ -4654,7 +4660,7 @@
<li class="dib">
<span class="icon iconfont icon-cuxiaodanpin"></span>
<div class="name">
促销单品
特惠专区
</div>
<div class="code-name">.icon-cuxiaodanpin
</div>
@ -9083,10 +9089,10 @@
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
@ -9957,7 +9963,7 @@
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-cuxiaodanpin"></use>
</svg>
<div class="name">促销单品</div>
<div class="name">特惠专区</div>
<div class="code-name">#icon-cuxiaodanpin</div>
</li>
@ -13896,10 +13902,10 @@
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
@ -13910,7 +13916,7 @@
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
@ -13939,4 +13945,5 @@
})
</script>
</body>
</html>

View File

@ -4,8 +4,7 @@
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "外包项目图标添加",
"glyphs": [
{
"glyphs": [{
"icon_id": "5387812",
"name": "购物_o",
"font_class": "gouwu_o",
@ -756,7 +755,7 @@
},
{
"icon_id": "25889479",
"name": "促销单品",
"name": "特惠专区",
"font_class": "cuxiaodanpin",
"unicode": "e7b7",
"unicode_decimal": 59319

View File

@ -207,7 +207,7 @@ const objTitle = {
title: '体积(m³)'
}
}
const proOptions = [{ name: '是否热卖', value: 'is_hot' }, { name: '优品推荐', value: 'is_good' }, { name: '促销单品', value: 'is_benefit' }, { name: '是否精品', value: 'is_best' }, { name: '是否新品', value: 'is_new' }]
const proOptions = [{ name: '是否热卖', value: 'is_hot' }, { name: '优品推荐', value: 'is_good' }, { name: '特惠专区', value: 'is_benefit' }, { name: '是否精品', value: 'is_best' }, { name: '是否新品', value: 'is_new' }]
export default {
name: 'Info',
props: {

View File

@ -251,7 +251,7 @@ const objTitle2 = {
title: '体积(m³)'
}
}
const proOptions = [{ name: '是否热卖', value: 'is_hot' }, { name: '优品推荐', value: 'is_good' }, { name: '促销单品', value: 'is_benefit' }, { name: '是否精品', value: 'is_best' }, { name: '是否新品', value: 'is_new' }]
const proOptions = [{ name: '是否热卖', value: 'is_hot' }, { name: '优品推荐', value: 'is_good' }, { name: '特惠专区', value: 'is_benefit' }, { name: '是否精品', value: 'is_best' }, { name: '是否新品', value: 'is_new' }]
export default {
name: 'Info',
props: {

View File

@ -207,7 +207,7 @@ const objTitle = {
title: '体积(m³)'
}
}
const proOptions = [{ name: '热门榜单', value: 'is_hot' }, { name: '促销单品', value: 'is_benefit' }, { name: '精品推荐', value: 'is_best' }, { name: '首发新品', value: 'is_new' }]
const proOptions = [{ name: '热门榜单', value: 'is_hot' }, { name: '特惠专区', value: 'is_benefit' }, { name: '精品推荐', value: 'is_best' }, { name: '首发新品', value: 'is_new' }]
export default {
name: 'Info',
props: {

View File

@ -378,6 +378,8 @@ import createWorkBook from '@/utils/newToExcel.js';
import cardsData from "@/components/cards/index";
import { fromList } from "@/libs/constants.js";
import timeOptions from '@/utils/timeOptions';
import * as FileSaver from 'file-saver'
import Worker from "worker-loader!@/worker/calcWorker.js";
export default {
components: { orderDetail, cardsData, userDetails },
data() {
@ -540,31 +542,34 @@ export default {
this.userDawer = v;
},
// csv
exportCsv(columns, dataList, fileName) {
let title = columns.map(item => item);
let keyArray = columns.map(item => item.key);
let str = [];
console.log(dataList);
console.log(title);
str.push(title.join(',') + '\n');
for (let i = 0; i < dataList.length; i++) {
const temp = [];
for (let j = 0; j < keyArray.length; j++) {
console.log(dataList[i][j]);
temp.push(dataList[i][j]);
}
str.push(temp.join(',') + '\n');
}
console.log(str)
let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str.join(''));
let downloadLink = document.createElement('a');
downloadLink.href = uri;
downloadLink.download = fileName;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
},
// exportCsv(columns, dataList, fileName) {
// let title = columns.map(item => item);
// let keyArray = columns.map(item => item.key);
// let str = [];
// str.push(title.join(',') + '\n');
// for (let i = 0; i < dataList.length; i++) {
// const temp = [];
// for (let j = 0; j < keyArray.length; j++) {
// console.log(dataList[i][j]);
// temp.push(dataList[i][j]);
// }
// str.push(temp.join(',') + '\n');
// }
// let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str.join(''));
// let downloadLink = document.createElement('a');
// downloadLink.href = uri;
// downloadLink.download = fileName;
// document.body.appendChild(downloadLink);
// downloadLink.click();
// document.body.removeChild(downloadLink);
// },
async exports() {
const loading = this.$loading({
lock: true,
text: '导出中...',
spinner: 'el-icon-loading',
background: 'hsla(0, 0%, 100%, .9)'
});
let excelData = JSON.parse(JSON.stringify(this.tableFrom)), data = []
excelData.page = 1
excelData.limit = 200
@ -584,7 +589,35 @@ export default {
excelData.page++
}
}
this.exportCsv(lebData.header,data,lebData.filename)
console.log('开始处理');
//
let start = performance.now();
// 线
let worker = new Worker();
// 线postMessage
worker.postMessage({
header:lebData.header,
title: lebData.title,
data,
foot: lebData.foot,
filename:lebData.filename
});
// message
worker.addEventListener("message", (e) => {
// 线
worker.terminate();
//
let end = performance.now();
//
let durationTime = end - start;
console.log('计算结果:', e.data);
let { blob, filename } = e.data
FileSaver.saveAs(blob, filename + '.xlsx')
loading.close();
console.log(`代码执行了 ${durationTime} 毫秒`);
});
// this.exportCsv(lebData.header,data,lebData.filename)
// createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename)
// work.saveAndDowloade(lebData.filename)
return

View File

@ -814,7 +814,7 @@ const proOptions = [
value: "is_hot",
},
{
name: "促销单品",
name: "特惠专区",
value: "is_benefit",
},
{
@ -880,7 +880,7 @@ export default {
value: "hot",
},
{
name: "促销单品",
name: "特惠专区",
value: "good",
},
{

View File

@ -769,7 +769,7 @@ const objTitle = {
const proOptions = [
{ name: "是否热卖", value: "is_hot" },
{ name: "优品推荐", value: "is_good" },
{ name: "促销单品", value: "is_benefit" },
{ name: "特惠专区", value: "is_benefit" },
{ name: "是否精品", value: "is_best" },
{ name: "是否新品", value: "is_new" },
];

View File

@ -438,7 +438,7 @@
class="value"
>
<span class="value-item" v-if="productData.is_benefit"
>促销单品</span
>特惠专区</span
>
<span class="value-item" v-if="productData.is_new"
>首发新品</span

View File

@ -363,9 +363,9 @@
<el-divider></el-divider>
</div>
<div>
<span class="spBlock spTitle mb10">热门榜单/ 精品推荐/ 首发新品/促销单品</span>
<span class="spBlock spTitle mb10">热门榜单/ 精品推荐/ 首发新品/特惠专区</span>
<span class="spBlock mb5">地址<i>/pages/columnGoods/HotNewGoods/index</i></span>
<span class="spBlock mb5">参数<i>type: 区分列表best为精品推荐hot为热门榜单new为首发新品good为促销单品</i></span>
<span class="spBlock mb5">参数<i>type: 区分列表best为精品推荐hot为热门榜单new为首发新品good为特惠专区</i></span>
<span class="spBlock spEx">例如<i>/pages/columnGoods/HotNewGoods/index?type=best</i></span>
<el-divider></el-divider>
</div>

View File

@ -24,9 +24,9 @@
<el-divider />
</div>
<div>
<span class="spBlock spTitle mb10">热门榜单/ 精品推荐/ 首发新品/促销单品</span>
<span class="spBlock spTitle mb10">热门榜单/ 精品推荐/ 首发新品/特惠专区</span>
<span class="spBlock mb5">地址<i>/goods_list</i></span>
<span class="spBlock mb5">参数<i>type: 区分列表best为精品推荐hot为热门榜单new为首发新品good为促销单品</i></span>
<span class="spBlock mb5">参数<i>type: 区分列表best为精品推荐hot为热门榜单new为首发新品good为特惠专区</i></span>
<span class="spBlock spEx">例如<i>/goods_list?type=best</i></span>
<el-divider></el-divider>
</div>

191
src/worker/calcWorker.js Normal file
View File

@ -0,0 +1,191 @@
// importScripts("https://cdn.bootcdn.net/ajax/libs/exceljs/4.3.0/exceljs.js");
import ExcelJS from 'exceljs'
onmessage = (res) => {
const letter = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
let lcomun = 1;
let worksheet;
let { header, title, data, foot, filename, sheets } = res.data;
const workBook = new ExcelJS.Workbook();
let long = header.length;
/**
* 创建工作薄
* @param {*} sheets
*/
function createSheets(sheets) {
let sheet = Array.isArray(sheets) ? sheets[0] : sheets;
let style = Array.isArray(sheets) ? sheets[1] : {};
worksheet = workBook.addWorksheet(sheet, style);
}
/**
* 设置表名介绍等
* @param {*} title
* @param {*} long
*/
function setTitle(title, long) {
title = Array.isArray(title) ? title : title.split(',');
for (let i = 0; i < title.length; i++) {
let ti = worksheet.getRow(i + 1);
ti.getCell(1).value = title[i];
ti.height = 30;
ti.font = { bold: true, size: 20, vertAlign: 'subscript', };
ti.alignment = { vertical: 'bottom', horizontal: 'center' };
ti.outlineLevel = 1;
worksheet.mergeCells(i + 1, 1, i + 1, long)
ti.commit();
lcomun++;
}
}
/**
* 设置表头行
* @param {*} header
*/
function setHeader(header) {
const headerRow = worksheet.getRow(lcomun);
for (let index = 1; index <= header.length; index++) {
headerRow.getCell(index).value = header[index - 1];
}
headerRow.height = 25;
headerRow.width = 50;
headerRow.font = { bold: true, size: 18, vertAlign: 'subscript', };
headerRow.alignment = { vertical: 'bottom', horizontal: 'center' };
headerRow.outlineLevel = 1;
headerRow.commit();
lcomun++;
}
/**
* 导出内容
* @param {*} data
*/
function setContent(data) {
for (let h = 0; h < data.length; h++) {
let satarLcomun = lcomun;
let lcomunNow = worksheet.getRow(lcomun);
let hasMerge = false;
let starKey = 0;
let endKey = 0;
/** 循环列 */
//需要操作第几列
let sk = 0;
for (let l = 0; l < data[h].length; l++) {
if (Array.isArray(data[h][l])) {
//数组长度
starKey = sk;
hasMerge = true;
setArrayContent(data[h][l], sk);
if (data[h][l][0]) {
sk = sk + data[h][l][0].length
}
endKey = sk;
} else {
//不是数组
lcomunNow.getCell(getLetter(sk)).value = data[h][l];
lcomunNow.getCell(getLetter(sk)).border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
lcomunNow.alignment = { vertical: 'middle', horizontal: 'center' };
sk++
}
}
if (hasMerge) setMergeLcomun(satarLcomun, lcomun, starKey, endKey);
lcomunNow.height = 25;
lcomunNow.commit();
lcomun++
}
}
/**
* 占多行的数组
* @param {*} arr
* @param {*} sk
*/
function setArrayContent(arr, sk) {
/**
* 循环二维数组,在循环行
*/
let al = arr.length;
let sl = al - 1;
for (let i = 0; i < arr.length; i++) {
let lcomunNow = worksheet.getRow(lcomun);
for (let v = 0; v < arr[i].length; v++) {
lcomunNow.getCell(getLetter(sk + v)).value = arr[i][v];
lcomunNow.getCell(getLetter(sk + v)).border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
lcomunNow.alignment = { vertical: 'middle', horizontal: 'center' };
}
lcomunNow.height = 25;
lcomunNow.commit()
if (i < sl) lcomun++
}
}
/**
* 合并操作
* @param {*} satarLcomun
* @param {*} endLcomun
* @param {*} starKey
* @param {*} endKey
*/
function setMergeLcomun(satarLcomun, endLcomun, starKey, endKey) {
for (let ml = 0; ml < long; ml++) {
if (ml < starKey || ml >= endKey) {
worksheet.mergeCells(getLetter(ml) + satarLcomun + ':' + getLetter(ml) + endLcomun)
}
}
}
/**
* 设置表末尾统计备注等
* @param {*} footData
*/
function setFoot(footData) {
if (Array.isArray(footData)) {
for (let f = 0; f < footData.length; f++) {
let lcomunNow = worksheet.getRow(lcomun);
lcomunNow.getCell(1).value = footData[f];
lcomunNow.getCell(1).border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
lcomunNow.alignment = { vertical: 'middle', horizontal: 'left' };
worksheet.mergeCells('A' + lcomun + ':' + getLetter(long - 1) + lcomun)
lcomun++
}
} else {
let lcomunNow = worksheet.getRow(lcomun);
lcomunNow.getCell(1).value = footData;
lcomunNow.getCell(1).border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
lcomunNow.alignment = { vertical: 'middle', horizontal: 'left' };
worksheet.mergeCells('A' + lcomun + ':' + getLetter(long - 1) + lcomun)
}
}
/**
* 处理超过26个字母的列
* @param {*} number
* @returns
*/
function getLetter(number) {
if (number < 26) {
return letter[number];
} else {
let n = number % 26
let l = Math.floor(number % 26)
return letter[l] + letter[n]
}
}
/**
* 导出下载
* @param {*} filename
*/
function saveAndDowloade(filename) {
if (!filename) filename = new Date().getTime();
workBook.xlsx.writeBuffer().then(data => {
const blob = new Blob([data], { type: 'application/octet-stream' })
postMessage({ blob, filename })
})
}
createSheets(sheets);
setTitle(title, long);
setHeader(header);
setContent(data);
setFoot(foot);
saveAndDowloade(filename)
}

View File

@ -68,6 +68,11 @@ module.exports = {
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('worker')
.test(/\.worker\.js$/)
.use('worker')
.loader('worker-loader')
// set svg-sprite-loader
config.module
.rule('svg')