refactor(seller): 商家端系统性优化与 Vue3 迁移遗留问题修复

- 清理:删除 4 个未使用依赖、约 2700 行死代码(shop/ossManage 等)、tree-table 死组件、37 处未使用 import
- ESLint 9 flat config 升级(.eslintrc.js -> eslint.config.js),修复迁移遗留的 34 处真实 bug
- axios 重构:拦截器不再吞错、refreshToken 单例共享 Promise、超时收敛、form 序列化抽公共函数、vue-router 4 失效 API 修正
- 安全:4 处 v-html 增加 xss 过滤;logout 改为精确删除 localStorage 键
- API 重复定义收敛(delSpec/insertOrUpdateSpec、getDictData、ws)
- 首屏瘦身:tinymce 懒加载(约省 7.4MB)、core-js 按需 polyfill、vendor chunk 合并、dplayer/@antv/g2 动态 import、3 张大图压缩
- 页面修复:发布商品表单布局(iview 遗留 margin 移除)、beforeVideoUpload 补定义、el-tag type 空值、lili-dialog emits 声明、消息中心布局塌陷修复与样式重构、department-choose 空值、affix-time 不再发多余店铺请求、goods/distributionGoods 去掉品牌筛选
This commit is contained in:
pikachu1995@126.com
2026-10-08 15:22:56 +08:00
parent 8484936e3d
commit 5fcc26a866
93 changed files with 651 additions and 5241 deletions

View File

@@ -1,3 +1,20 @@
import xss from "xss";
// 富文本 XSS 过滤:默认白名单基础上放行 style 属性(内容由 cssfilter 过滤)
const richTextWhiteList = { ...xss.whiteList };
Object.keys(richTextWhiteList).forEach((tag) => {
richTextWhiteList[tag] = [...(richTextWhiteList[tag] || []), "style"];
});
const richTextFilter = new xss.FilterXSS({
whiteList: richTextWhiteList,
css: true
});
// 渲染服务端 HTML 前过滤,配合 v-html 使用:v-html="$filters.xssFilter(html)"
export function xssFilter(html) {
return html ? richTextFilter.process(html) : "";
}
/**
* 金钱单位置换 2999 --> 2,999.00
* @param val
@@ -154,6 +171,10 @@ export function secrecyMobile(mobile) {
return mobile.replace(/(\d{3})(\d{4})(\d{4})/, "$1****$3");
}
function padLeftZero(str) {
return ("00" + str).substr(str.length);
}
export function formatDate(date, fmt) {
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(
@@ -181,8 +202,8 @@ export function formatDate(date, fmt) {
}
// 楼层装修,选择链接处理跳转方式
// 所有跳转的分类 依次为 商品、分类、店铺、活动、页面、其他
export function formatLinkType (item) {
const types = ['goods', 'category', 'shops', 'marketing', 'pages', 'other'] // 所有跳转的分类 依次为 商品、分类、店铺、活动、页面、其他
let url = '';
switch (item.___type) {
case 'goods':

View File

@@ -11,12 +11,11 @@ export {
* @returns {*}
*/
export default function cloneObj(obj) {
let str = null
let newobj = obj.constructor === Array ? [] : {}
if (typeof obj !== 'object') {
return
} else if (window && window.JSON) {
str = JSON.stringify(obj) // 系列化对象
const str = JSON.stringify(obj) // 系列化对象
newobj = JSON.parse(str) // 还原
} else {
for (var i in obj) {

View File

@@ -151,19 +151,6 @@ function binl2hex(binarray) {
return str
}
/*
* Convert an array of little-endian words to a base64 encoded string.
*/
function binl2b64(binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
var str = ""
for (var i = 0; i < binarray.length * 32; i += 6) {
str += tab.charAt(((binarray[i >> 5] << (i % 32)) & 0x3F) |
((binarray[i >> 5 + 1] >> (32 - i % 32)) & 0x3F))
}
return str
}
/*
* Convert an 8-bit character string to a sequence of 16-word blocks, stored
* as an array, and append appropriate padding for MD4/5 calculation.
@@ -173,28 +160,13 @@ function str2binl(str) {
var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks
var blks = new Array(nblk * 16)
for (var i = 0; i < nblk * 16; i++) blks[i] = 0
for (var i = 0; i < str.length; i++)
for (i = 0; i < str.length; i++)
blks[i >> 2] |= (str.charCodeAt(i) & 0xFF) << ((i % 4) * 8)
blks[i >> 2] |= 0x80 << ((i % 4) * 8)
blks[nblk * 16 - 2] = str.length * 8
return blks
}
/*
* Convert a wide-character string to a sequence of 16-word blocks, stored as
* an array, and append appropriate padding for MD4/5 calculation.
*/
function strw2binl(str) {
var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks
var blks = new Array(nblk * 16)
for (var i = 0; i < nblk * 16; i++) blks[i] = 0
for (var i = 0; i < str.length; i++)
blks[i >> 1] |= str.charCodeAt(i) << ((i % 2) * 16)
blks[i >> 1] |= 0x80 << ((i % 2) * 16)
blks[nblk * 16 - 2] = str.length * 16
return blks
}
/*
* External interface
*/
@@ -202,22 +174,6 @@ function hexMD5(str) {
return binl2hex(coreMD5(str2binl(str)))
}
function hexMD5w(str) {
return binl2hex(coreMD5(strw2binl(str)))
}
function b64MD5(str) {
return binl2b64(coreMD5(str2binl(str)))
}
function b64MD5w(str) {
return binl2b64(coreMD5(strw2binl(str)))
}
/* Backward compatibility */
function calcMD5(str) {
return binl2hex(coreMD5(str2binl(str)))
}
module.exports = {
md5: hexMD5
}

View File

@@ -85,7 +85,7 @@ export const VARCHAR255 = {
}
export const URL200 = {
pattern: /[a-zA-z]+\:\/\/[^\s]{1,190}/,
pattern: /[a-zA-z]+:\/\/[^\s]{1,190}/,
message: '请输入长度不超过200的URL地址'
}
export const REQUIRED = {