chore(seller): 清理死代码与失效机制,生产构建剥离 console

- 删除零引用组件 main-components/message-tip.vue
- 清理 113 处 no-unused-vars(重点 goodsOperationSec 20+ 项、ossManage 25 项,含死代码链级联删除;renovation 的 ModelForm 为 vue-eslint-parser 误报,保留并核实)
- stores/app.js 移除只写不读的死字段(currNavTitle/menuTheme/themeColor/isFullScreen/messageCount/currentPageName/currentPath)及失效的 cachePage/dontCache 缓存页机制(无 keep-alive 消费方),同步清理 util.js/App.vue/Main.vue/shrinkable-menu/tags-page-opened 的调用点
- 删除 30 处 console.log 调试残留;生产构建 terser 配置 drop_console 兜底
This commit is contained in:
lifenlong
2026-10-14 20:31:25 +08:00
parent 2a2c3f8174
commit 92dd179525
47 changed files with 20 additions and 1233 deletions

View File

@@ -22,7 +22,6 @@ onMounted(() => {
util.bootstrapDynamicRoutesFromCache();
util.initRouter();
appStore.setOpenedList();
appStore.initCachepage();
if (!localStorage.getItem("category")) {
getCategoryTree()
.then((res) => {

View File

@@ -313,7 +313,6 @@ util.setCurrentPath = function (name) {
];
}
}
appStore.setCurrentPath(currentPathArr);
return currentPathArr;
};
@@ -351,7 +350,6 @@ util.openNewPage = function (name, argu, query) {
appStore.increateTag(tag);
}
}
appStore.setCurrentPageName(name);
};
util.toDefaultPage = function (routers, name, route, next) {
@@ -451,16 +449,8 @@ util.initMenuData = function (data) {
}
appStore.setNavList(navList);
let currNav = window.localStorage.getItem("currNav");
if (currNav) {
for (let item of navList) {
if (item.name == currNav) {
appStore.setCurrNavTitle(item.title);
break;
}
}
} else {
if (!currNav) {
currNav = HOME_NAV_NAME;
appStore.setCurrNavTitle(HOME_NAV_ITEM.title);
}
appStore.setCurrNav(currNav);

View File

@@ -13,13 +13,8 @@ export const useAppStore = defineStore("app", {
added: false,
navList: [],
currNav: "",
currNavTitle: "",
cachePage: [],
lang: "",
isFullScreen: false,
openedSubmenuArr: [],
menuTheme: "dark",
themeColor: "",
storeOpenedList: [
{
title: "首页",
@@ -27,19 +22,9 @@ export const useAppStore = defineStore("app", {
name: "home_index",
},
],
currentPageName: "",
currentPath: [
{
title: "首页",
path: "",
name: "home_index",
},
],
menuList: [],
routers: [otherRouter],
tagsList: [...otherRouter.children],
messageCount: 0,
dontCache: ["test", "test"],
refMenu: "",
}),
actions: {
@@ -62,9 +47,6 @@ export const useAppStore = defineStore("app", {
setCurrNav(v) {
this.currNav = v;
},
setCurrNavTitle(v) {
this.currNavTitle = v;
},
setTagsList(list) {
this.tagsList.push(...list);
},
@@ -76,19 +58,6 @@ export const useAppStore = defineStore("app", {
this.openedSubmenuArr.push(name);
}
},
closePage(name) {
this.cachePage.forEach((item, index) => {
if (item == name) {
this.cachePage.splice(index, 1);
}
});
localStorage.cachePage = JSON.stringify(this.cachePage);
},
initCachepage() {
if (localStorage.cachePage) {
this.cachePage = JSON.parse(localStorage.cachePage);
}
},
removeTag(name) {
this.storeOpenedList.map((item, index) => {
if (item.name == name) {
@@ -105,8 +74,6 @@ export const useAppStore = defineStore("app", {
},
clearAllTags() {
this.storeOpenedList.splice(1);
this.cachePage.length = 0;
localStorage.cachePage = "";
localStorage.storeOpenedList = JSON.stringify(this.storeOpenedList);
},
clearOtherTags(currentName) {
@@ -122,8 +89,6 @@ export const useAppStore = defineStore("app", {
this.storeOpenedList.splice(currentIndex + 1);
this.storeOpenedList.splice(1, currentIndex - 1);
}
this.cachePage = this.cachePage.filter((item) => item == currentName);
localStorage.cachePage = JSON.stringify(this.cachePage);
localStorage.storeOpenedList = JSON.stringify(this.storeOpenedList);
},
setOpenedList() {
@@ -131,12 +96,6 @@ export const useAppStore = defineStore("app", {
? JSON.parse(localStorage.storeOpenedList)
: [otherRouter.children[0]];
},
setCurrentPath(pathArr) {
this.currentPath = pathArr;
},
setCurrentPageName(name) {
this.currentPageName = name;
},
setAvatarPath(path) {
localStorage.avatorImgPath = path;
},
@@ -147,14 +106,7 @@ export const useAppStore = defineStore("app", {
clearOpenedSubmenu() {
this.openedSubmenuArr.length = 0;
},
setMessageCount(count) {
this.messageCount = count;
},
increateTag(tagObj) {
if (this.dontCache.indexOf(tagObj.name) < 0) {
this.cachePage.push(tagObj.name);
localStorage.cachePage = JSON.stringify(this.cachePage);
}
this.storeOpenedList.push(tagObj);
localStorage.storeOpenedList = JSON.stringify(this.storeOpenedList);
},

View File

@@ -93,7 +93,6 @@ import util from "@/libs/util.js";
import { logout } from "@/api/index";
import { getIMDetail } from "@/api/common";
import { userMsg } from "@/api/index";
import config from "@/config/index.js";
import { Message } from "@/utils/message";
import { getStore, setStore } from "@/libs/storage";
import { useAppStore } from "@/stores/app";
@@ -199,13 +198,11 @@ function resize() {
watch(
() => route.name,
(name) => {
appStore.setCurrentPageName(name);
const pathArr = util.setCurrentPath(name);
if (pathArr.length > 2) {
appStore.addOpenSubmenu(pathArr[1].name);
}
checkTag(name);
localStorage.currentPageName = name;
}
);

View File

@@ -73,7 +73,6 @@ let editor = null;
let polygon = null;
let suggestion = null;
let TMap = null;
let geometryId = "";
let draftRing = [];
let clickRing = [];
let areas = [];

View File

@@ -221,7 +221,7 @@ async function exportStock() {
navigator.msSaveBlob(blob, randomNumber + ".xlsx");
}
})
.catch((err) => console.log(err));
.catch(() => {});
}
function openImportStock() {
importModal.value = true;

View File

@@ -745,8 +745,6 @@ const loadingVideo = ref(false);
const listImages = ref([]);
const newSkuValues = ref([]);
const contentImage = ref("");
const previewImage = ref(''); // 预览图片地址
const global = ref(0);
const accessToken = ref(""); //令牌token
const goodsParams = ref([]);
const categoryId = ref(""); // 商品分类第三级id
@@ -764,8 +762,6 @@ const previewGoodsPicture = ref("");
const visible = ref(false);
//展示商品图片
const goodsPictureVisible = ref(false);
//展示sku图片
const showSkuPicture = ref(false);
//选择的sku
const selectedSku = ref({});
@@ -809,47 +805,10 @@ const baseInfoForm = ref({
// 原 Options API 中直接挂在 this 上的非响应式字段
let goodsId;
let currentSkuItem = "";
let form;
let editTitle;
let selectCount;
let scrollParent = null;
let _onPublishScroll;
let _scrollTick = false;
let _scrollClickTimer;
let skuIndex;
const wholesalePreviewColumns = [
{
title: "销售规则",
width: 480,
render: (h, params) => {
let guide =
"当商品购买数量 ≥" +
params.row.num +
" 时,售价为 ¥" +
params.row.price +
" /" +
baseInfoForm.value.goodsUnit;
return h("div", guide);
},
},
];
const wholesaleColumns = [
{
title: "购买数量",
key: "num",
align: "center",
slot: "wholesaleNum",
},
{
title: "商品单价",
key: "price",
align: "center",
width: "280px",
slot: "wholesalePrice",
},
];
const wholesaleData = ref([
{
@@ -890,7 +849,6 @@ const params_panel = ref([]);
/** 存储未通过校验的单元格位置 */
const validateError = ref([]);
const currentSkuVal = ref("");
const skuInfoRules = ref({});
/** 品牌列表 */
const brandList = ref([]);
/** 店铺分类列表 */
@@ -1035,13 +993,6 @@ function changeSkuOpenImage() {
})
}
}
// ship大小不正确
function handleVideoMaxSize(file) {
Notice.warning({
title: "超过文件大小限制",
desc: "视频大小不能超过10MB",
});
}
function parseOssSelectionUrl(item) {
if (!item) return "";
if (typeof item === "string") {
@@ -1108,22 +1059,6 @@ function refresh(v) {
getGoodsBrandList('localRefresh');
}
}
function getImages(v) {
previewImage.value = v;
visible.value = true;
}
function mouseOver(v) {
showContent.value = true
listImages.value = v
if (listImages.value.images.length <= 0) {
contentImage.value = '规格专属图片暂无'
} else {
contentImage.value = '当前规格专属图片'
}
}
function mouseLeave() {
// showContent.value = false
}
function getParamOptions(options) {
if (!options) return [];
return String(options)
@@ -1179,15 +1114,6 @@ function selectParams(params, value, paramsIndex) {
// 同步更新表单项的值
params.paramValue = value;
}
// 编辑sku图片
function editSkuPicture(row) {
showContent.value = false
if (row.images && row.images.length > 0) {
previewPicture.value = row.images[0];
}
selectedSku.value = row;
showSkuPicture.value = true;
}
// 初始化视频操作
async function initVideo() {
if (baseInfoForm.value.goodsVideo) {
@@ -1349,17 +1275,6 @@ function assignSkuTableIndex() {
row._index = index;
});
}
// 更新sku图片
function updateSkuPicture() {
baseInfoForm.value.regeneratorSkuFlag = true;
let _index = selectedSku.value._index;
if (_index === undefined || _index === null) {
_index = skuTableData.value.indexOf(selectedSku.value);
}
if (_index >= 0) {
skuTableData.value[_index] = selectedSku.value;
}
}
// sku图片上传成功
function handleSuccess(res, file, images) {
if (file.response) {
@@ -1460,20 +1375,6 @@ function checkWholesalePrice(index) {
renderTableData(skuTableData.value);
syncWholesalePriceToSku();
}
// 商品图片上传成功
function handleSuccessGoodsPicture(res, file) {
if (file.response) {
file.url = file.response.result;
baseInfoForm.value.goodsGalleryFiles.push(file.url);
}
}
// 图片格式不正确
function handleFormatError(file) {
Notice.warning({
title: "文件格式不正确",
desc: "文件 " + file.name + " 的格式不正确",
});
}
function beforeVideoUpload(file) {
const allowTypes = ["avi", "wmv", "mpeg", "mp4", "mov"];
const ext = (file.name.split(".").pop() || "").toLowerCase();
@@ -1510,16 +1411,6 @@ function handleMaxSize(size = 2) {
desc: `图片大小不能超过${size}MB`,
});
}
// 图片上传前钩子
function handleBeforeUploadGoodsPicture(file) {
const check = baseInfoForm.value.goodsGalleryFiles.length < 5;
if (!check) {
Notice.warning({
title: "图片数量不能大于五张",
});
return false;
}
}
// sku图片上传前钩子
function handleBeforeUpload(file) {
const check =
@@ -2189,11 +2080,6 @@ function addSpec($index, item) {
skuInfoCopy.value = cloneObj(skuInfo.value);
}
}
function handleClearSku() {
skuInfo.value = [];
skuTableData.value = [];
renderTableData(skuTableData.value);
}
/** 移除当前规格值 */
function handleCloseSkuValue(item, index, spec) {
if (spec.spec_values.length <= 1) {
@@ -2363,55 +2249,6 @@ function renderTableData(skus) {
}
}
/**
* 迭代属性,形成表格
* result 渲染的数据
* array spec数据
*/
function specIterator(result, spec, skus) {
let table = result;
if (spec.length > 0) {
//清除当前循环的分组
let cloneTemp = cloneObj(spec);
cloneTemp.shift();
spec[0].spec_values.forEach((specItem) => {
let index = skuIndex;
if (table[index]) {
table[index][spec[0].name] = specItem.value;
} else if (skus && skus[index] && specItem.value !== "") {
let obj = {
...skus[index],
id: skus[index].id,
sn: skus[index].sn,
quantity: skus[index].quantity,
cost: skus[index].cost,
price: skus[index].price,
// [spec[0].name]: skus[index][spec[0].name] ? skus[index][spec[0].name] : specItem.value,
[spec[0].name]: specItem.value,
images:
skus[index].images || baseInfoForm.value.goodsGalleryFiles || [],
};
if (specItem.value !== "") {
obj.id = skus[index].id;
}
if (skus[index].weight !== "") {
obj.weight = skus[index].weight;
}
table.push(obj);
} else if (specItem.value !== "") {
table.push({
[spec[0].name]: specItem.value,
images: baseInfoForm.value.goodsGalleryFiles || [],
});
}
table = specIterator(table, cloneTemp, skus, index);
});
} else {
skuIndex++;
}
return table;
}
/**
* 生成所有可能的规格组合
* @param {Array} skuInfo 规格信息
@@ -2469,19 +2306,6 @@ function generateSkuCombinations(skuInfo) {
return generateCombinations(0, []);
}
// 判断相同数组的值
function scalarArrayEquals(array1, array2) {
return (
array1.length === array2.length &&
array1.every(function (v, i) {
return v === array2[i];
})
);
}
/** 自动完成表单所需方法*/
function filterMethod(value, option) {
return option.toUpperCase().indexOf(value.toUpperCase()) !== -1;
}
/** 数据改变之后 抛出数据 */
function updateSkuTable(row, item, rowIndex) {
let index = rowIndex;
@@ -2535,15 +2359,10 @@ function selectTree(v) {
v[0][attr] = "";
}
}
let str = JSON.stringify(v[0]);
let menu = JSON.parse(str);
form = menu;
editTitle = menu.title;
}
}
// 店内分类选中
function changeSelect(v) {
selectCount = v.length;
let ids = "";
v.forEach(function (e) {
ids += e.id + ",";

View File

@@ -48,8 +48,6 @@ const pendingContent = ref(null); // 编辑器未就绪时暂存待回填内容
const tinymceId =
"tinymce-" + +new Date() + ((Math.random() * 1000).toFixed(0) + ""); // 生成唯一的编辑器 ID
const fullscreen = ref(false); // 标记编辑器是否处于全屏模式
const toolbar = ref([]); // 工具栏配置
const content = ref(""); // 编辑器内容
const bindValue = computed(() => {
return props.modelValue ?? props.value ?? "";

View File

@@ -37,7 +37,6 @@ const switched = ref(false);
const spinShow = ref(false);
const data = ref([]);
const selectedWay = ref([]);
const callBackData = ref("");
const treeProps = reactive({
label: "title",
children: "children",

View File

@@ -122,10 +122,6 @@ function open(type, mutiple) {
linkVisible.value = true;
}
}
function close() {
clickClose();
}
// 外部通过 ref 访问的成员(grep seller/src 全量确认):
// - open:所有调用方打开弹窗(goods/link)
// - singleGoods:shop/modelList/forYour.vue、mixModel.vue 直接调用

View File

@@ -23,14 +23,11 @@
<script setup>
import { nextTick, onMounted, ref, watch } from "vue";
import wapList from "./wap.js";
import goodsDialog from "./goods-dialog";
import templateWay from "./template/index";
const emit = defineEmits(["selectedLink"]);
const changed = ref("");
const selected = ref(0);
const selectedLink = ref("");
// wap 为共享的模块级数组,保持原 data 引用同一数组的行为
const wap = ref(wapList);
const activeTab = ref(wapList[0]?.title || "");

View File

@@ -41,7 +41,6 @@ const thirdIndex = ref(''); // 分类三级下标
const categoryList = ref([]); // 分类列表一级数据
const secondLevel = ref([]); // 分类列表二级数据
const thirdLevel = ref([]); // 分类列表三级数据
const selectedData = ref(""); // 已选分类数据
function loadCategoryFromCache() {
try {

View File

@@ -14,18 +14,6 @@
</template>
<script setup>
// import Article from "@/views/page/article-manage/articleList.vue";
const emit = defineEmits(["selected"]);
// 无 defineExpose:grep seller/src 全量确认无外部 ref/$refs/$parent 访问本组件成员
// (link-dialog.vue 的 $refs["lili-component"][0].type 写入指向首个 tab 的 goods-dialog,与本组件无关)
function callbackArticle(val) {
val.___type = "pages";
val.___path = "/pages/passport/article";
emit("selected", [val]);
}
</script>
<style lang="scss" scoped>
:deep(.el-card__body) {

View File

@@ -1,41 +0,0 @@
<template>
<div @click="showMessage" class="message-con">
<el-tooltip
:visible="value > 0 ? undefined : false"
:content="value > 0 ? '有' + value + message : '无未读消息'"
placement="bottom"
>
<el-badge :value="value" :hidden="value <= 0" is-dot>
<el-icon :size="22"><Bell /></el-icon>
</el-badge>
</el-tooltip>
</div>
</template>
<script setup>
import { useRouter } from "vue-router";
import { Bell } from "@element-plus/icons-vue";
import util from "@/libs/util.js";
defineOptions({ name: "messageTip" });
const props = defineProps({
value: {
type: Number,
default: 0,
},
message: {
type: String,
default: "",
},
});
const router = useRouter();
function showMessage() {
util.openNewPage("message_index");
router.push({
name: "message_index",
});
}
</script>

View File

@@ -36,7 +36,7 @@
<script setup>
import { computed, ref, watch, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import util, { HOME_NAV_NAME, HOME_NAV_ITEM } from "@/libs/util.js";
import util, { HOME_NAV_NAME } from "@/libs/util.js";
import { setStore } from "@/libs/storage";
import { useAppStore } from "@/stores/app";
@@ -76,7 +76,6 @@ function syncRouteMenu(route) {
function activateHomeNav() {
appStore.setCurrNav(HOME_NAV_NAME);
appStore.setCurrNavTitle(HOME_NAV_ITEM.title);
setStore("currNav", HOME_NAV_NAME);
appStore.updateMenulist([]);
}
@@ -92,7 +91,6 @@ function selectNav(name) {
setStore("currNav", name);
if (name === HOME_NAV_NAME) {
appStore.updateMenulist([]);
appStore.setCurrNavTitle(HOME_NAV_ITEM.title);
if (route.name !== "home_index") {
router.push({ name: "home_index" });
}

View File

@@ -42,7 +42,7 @@
</template>
<script setup>
import { ref, computed, watch, onBeforeUnmount } from "vue";
import { ref, watch, onBeforeUnmount } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useAppStore } from "@/stores/app";
@@ -73,8 +73,6 @@ const actionList = {
const scrollCon = ref(null);
const scrollBody = ref(null);
const tagsList = computed(() => appStore.storeOpenedList);
const isActive = (item) => {
return item.children
? item.children[0].name === currentPageName.value
@@ -109,7 +107,6 @@ const closePage = (event, name) => {
tagBodyLeft.value = Math.min(tagBodyLeft.value + tagWidth, 0);
}
appStore.removeTag(name);
appStore.closePage(name);
storeOpenedList = appStore.storeOpenedList;
localStorage.storeOpenedList = JSON.stringify(storeOpenedList);
if (currentPageName.value === name) {

View File

@@ -72,7 +72,6 @@
<script setup>
import { nextTick, ref, useAttrs, watch } from "vue";
import { View } from "@element-plus/icons-vue";
import { uploadFile } from "@/libs/axios";
import { getStore } from "@/libs/storage";
import { Message } from "@/utils/message";
import ossManage from "@/views/sys/oss-manage/ossManage";
@@ -110,7 +109,6 @@ const attrs = useAttrs();
const accessToken = ref({});
const currentValue = ref(props.modelValue ?? props.value ?? "");
const viewImage = ref(false);
const uploadFileUrl = ref(uploadFile);
const picModalFlag = ref(false);
const selectedFormBtnName = ref("");
const picIndex = ref("");

View File

@@ -84,7 +84,6 @@
<script setup>
import { computed, nextTick, onMounted, ref, watch } from "vue";
import { Camera, Delete, View } from "@element-plus/icons-vue";
import { uploadFile } from "@/libs/axios";
import { getStore } from "@/libs/storage";
import { Message } from "@/utils/message";
import vuedraggable from "vuedraggable";
@@ -123,7 +122,6 @@ const props = defineProps({
const emit = defineEmits(["update:modelValue", "input", "on-change", "uploadchange"]);
const accessToken = ref({});
const uploadFileUrl = uploadFile;
const uploadList = ref([]);
const viewImage = ref(false);
const imgUrl = ref("");

View File

@@ -28,7 +28,6 @@ defineOptions({ name: "map" });
const emit = defineEmits(["getAddress"]);
const showMap = ref(false);
const mapSearch = ref("");
const map = ref(null);
const autoComplete = ref(null);

View File

@@ -367,8 +367,6 @@ const afterSaleImage = ref([]); //会员申诉图片
const submitLoading = ref(false); // 添加或编辑提交状态
const confirmLoading = ref(false); // 确认收货提交状态
const storeMsg = ref({}); // 商家地址信息
// 原代码未在 data 声明、直接挂 this 上的字段,补声明避免 ReferenceError
let loading = false;
//商家处理意见
const params = reactive({
serviceStatus: "PASS",
@@ -480,9 +478,7 @@ const canConfirmReceipt = computed(() => {
// 获取售后详情
function getDetail() {
loading = true;
API_Order.getAfterSaleOrderDetail(sn.value).then((res) => {
loading = false;
if (res.success) {
afterSaleInfo.value = res.result;
afterSaleInfo.value.showDelivery = showDelivery(

View File

@@ -141,9 +141,7 @@ function downLoad() {
navigator.msSaveBlob(blob, "批量发货导入模板.xls");
}
})
.catch((err) => {
console.log(err);
});
.catch((err) => {});
}
</script>

View File

@@ -887,7 +887,6 @@ import { formatCardKeyStatus } from "@/constants/cardKey";
import {
collectCardKeyFulfillLines,
orderHasCardKeySection,
flattenOrderCardKeys,
cardKeyFulfillAlertType,
resolveCardKeyFulfillMessage,
} from "@/constants/goodsType";
@@ -1094,9 +1093,6 @@ const hasCardKeySection = computed(() => {
const cardKeyFulfillLines = computed(() => {
return collectCardKeyFulfillLines(data.value);
});
const ecouponCardKeyRows = computed(() => {
return flattenOrderCardKeys(data.value, true);
});
const canShip = computed(() => {
return canShowShipButton(allowOperation.value, orderInfo.value?.order);
});
@@ -1180,9 +1176,6 @@ function getPromotionText(row) {
}
return resultText === "" ? "未参与" : resultText;
}
function gotoHomes () {
return false
}
function getOrderItemId(item) {
return item && (item.id || item.orderItemId || item.sn);
}

View File

@@ -169,28 +169,6 @@ defineOptions({ name: "orderList" });
const route = useRoute();
const fields = ref({
订单编号: "sn",
下单时间: "createTime",
客户名称: "memberName",
支付方式: {
field: "clientType",
callback: (value) => {
if (value == "H5") return "移动端";
if (value == "PC") return "PC端";
if (value == "WECHAT_MP") return "小程序端";
if (value == "APP") return "移动应用端";
return value;
},
},
商品数量: "groupNum",
付款状态: {
field: "payStatus",
callback: (value) =>
value == "UNPAID" ? "未付款" : value == "PAID" ? "已付款" : "",
},
店铺: "storeName",
});
const loading = ref(true);
const searchForm = reactive({
pageNumber: 1,
@@ -318,16 +296,6 @@ function orderPromotionText(v) {
};
return map[v] || v || "-";
}
function orderPromotionTagType(v) {
const map = {
NORMAL: "primary",
PINTUAN: "danger",
GIFT: "success",
POINTS: "info",
KANJIA: "warning",
};
return map[v] || "info";
}
function paymentMethodText(v) {
const map = {
NOT_ACTUALLY_PAID: "-",
@@ -449,9 +417,7 @@ async function exportOrder() {
navigator.msSaveBlob(blob, "订单列表.xlsx");
}
})
.catch((err) => {
console.log(err);
});
.catch((err) => {});
}
function orderStatusClick(name) {
if (name === "ALL" || name === "" || name === undefined) {

View File

@@ -187,7 +187,6 @@ import { useRoute, useRouter } from "vue-router";
import {
getShopCouponList,
updateCouponStatus,
deleteShopCoupon,
} from "@/api/promotion";
import { formatPromotionCouponValidityHtml } from "@/utils/promotions";
import { Message, Modal } from "@/utils/message";
@@ -467,27 +466,6 @@ function close(v) {
});
}
function remove(v) {
Modal.confirm({
title: "确认删除",
content: "确认要删除此优惠券么?",
loading: true,
onOk: () => {
deleteShopCoupon(v.id)
.then((res) => {
Modal.remove();
if (res.success) {
Message.success("优惠券已删除");
getDataList();
}
})
.catch(() => {
Modal.remove();
});
},
});
}
function delAll() {
if (selectCount.value <= 0) {
Message.warning("您还未选择要下架的优惠券");

View File

@@ -125,7 +125,6 @@
<script setup>
import { onMounted, reactive, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { uploadFile } from "@/libs/axios";
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
import { addLive, addLiveGoods, editLive, getLiveInfo, delRoomLiveGoods } from "@/api/promotion";
import liveGoods from "./liveGoods";
@@ -140,7 +139,6 @@ const spinShow = ref(false);
const liveGoodsVisible = ref(false);
const imageVisible = ref(false);
const imageSrc = ref("");
const action = uploadFile;
const accessToken = ref({});
const liveStatus = ref("NEW");
const liveRulesForm = {

View File

@@ -128,8 +128,6 @@
import { onMounted, reactive, ref } from "vue";
import { useRoute } from "vue-router";
import { getLiveInfo } from "@/api/promotion.js";
import { Notice } from "@/utils/message";
import { getStore } from "@/libs/storage";
import { unixToDate } from "@/utils/filters";
const route = useRoute();
@@ -152,29 +150,16 @@ const commodityList = ref("");
// liveFormRef:模板 ref 改名避免与 liveForm 变量互相覆盖
const liveFormRef = ref(null);
// 原代码未在 data 声明、直接挂 this 的字段,script setup 下需显式声明
let accessToken;
let liveStatus;
onMounted(() => {
if (route.query.id) {
getLiveDetail();
}
accessToken = {
accessToken: getStore("accessToken"),
};
});
function handleView(src) {
imageVisible.value = true;
imageSrc.value = src;
}
function handleMaxSize(file) {
Notice.warning({
title: "文件大小过大",
desc: "所选文件大小过大, 不得超过 1M.",
});
}
async function getLiveDetail() {
let result = await getLiveInfo(route.query.id);
@@ -191,7 +176,6 @@ async function getLiveDetail() {
unixToDate(data.startTime, "yyyy-MM-dd hh:mm"),
unixToDate(data.endTime, "yyyy-MM-dd hh:mm"),
];
liveStatus = data.status;
}
}
</script>

View File

@@ -347,7 +347,6 @@ const orderParam = reactive({
endDate: null,
});
const orderTotal = ref(0);
const refundTotal = ref(0);
const billStatusList = ref([
{ status: "OUT", value: "已出账", title: "生成账单" },
{ status: "CHECK", value: "已对账", title: "商家对账" },
@@ -471,9 +470,7 @@ function download() {
navigator.msSaveBlob(blob, "结算单-" + id.value + ".xlsx");
}
})
.catch((err) => {
console.log(err);
});
.catch((err) => {});
}
function init() {
id.value = route.query.id;

View File

@@ -91,7 +91,7 @@
</template>
<script setup>
import { ref, reactive, watch, onMounted, nextTick } from "vue";
import { ref, reactive, watch, onMounted } from "vue";
// 自定义指令:script setup 中以 vXxx 命名的顶层变量即注册为指令
import vChangeSize from "../directives/changeSize";
import vDragItem from "../directives/dragItem";
@@ -112,7 +112,6 @@ const tooSmall = ref(false);
const showModal = ref(false);
const picModelFlag = ref(false);
const currentIndex = ref(0);
const currentShowIndex = ref(-1);
const zoneForm = reactive({
img: "",
link: "",
@@ -158,15 +157,6 @@ function showModalFn(index) {
showModal.value = true;
currentIndex.value = index;
}
// 选择图片
function handleSelectImg() {
picModelFlag.value = true;
nextTick(() => {
if (ossManageRef.value) {
ossManageRef.value.selectImage = true;
}
});
}
// 选择图片回调
function callbackSelected(item) {
picModelFlag.value = false;
@@ -217,13 +207,9 @@ function settingZone(val) {
break;
}
}
function saveZone() {}
function cancelZone() {
showModal.value = false;
}
function delZone() {
delItem(currentIndex.value);
}
function delItem(index) {
emit("delItem", index);
}

View File

@@ -159,7 +159,6 @@ const picModelFlag = ref(false);
const showModal = ref(false);
const showModalNav = ref(false);
const selectedNav = ref(null);
const promotionTags = ref(["买2免1", "领200神券", "199减100", "母婴5折抢", "充100送20"]);
const topAdvert = ref({
type: "topAdvert",
img: "",
@@ -227,9 +226,7 @@ function handleAddNav() {
});
}
function handleMoveEnd({ newIndex, oldIndex }) {
console.log("index", newIndex, oldIndex);
}
function handleMoveEnd({ newIndex, oldIndex }) {}
function handleModel(type) {
if (type == "topAdvert") {

View File

@@ -194,9 +194,7 @@ const showModal = ref(false);
const picModelFlag = ref(false);
const selectedData = ref(""); //选中的数据
const goodsIndex = ref(0); // 商品索引
const align = ref("");
const defaultCallbackImageType = ref("");
const current = ref("");
const liliDialogRef = ref(null);
const ossManageRef = ref(null);
@@ -244,17 +242,13 @@ function selectedGoodsData(val) {
props.data.options.data.hot.list[goodsIndex.value].price = val[0].price;
props.data.options.data.hot.list[goodsIndex.value].url =
formatLinkType(val[0]);
console.log(val, selectedData.value, goodsIndex.value);
}
// 选择链接回调
function selectedLink(val) {
console.log(val, selectedData.value)
if (selectedData.value == "image") {
props.data.options.data.image.url =
formatLinkType(val);
} else {
console.log(props.data.options.data.list, goodsIndex.value)
props.data.options.data.list[
goodsIndex.value
].url = formatLinkType(val);

View File

@@ -142,7 +142,6 @@ const tabIndex = ref(0);
const current = ref(0);
const showModal = ref(false);
const selected = ref({}); // 已选数据
const picModelFlag = ref(false);
const tabCurrentlyIndex = ref(0); // 选项卡索引
onMounted(() => {
@@ -187,7 +186,6 @@ function delGoods(val) {
// 切换选项卡
function handleClickTab(name) {
console.log(name);
tabCurrentlyIndex.value = name;
}
@@ -199,7 +197,6 @@ function addCurrentGoods() {
// 编辑模块
function handleSelectModel(item) {
console.log(item);
selected.value = item;
showModal.value = true;
}
@@ -226,14 +223,6 @@ function selectedLink(val) {
selected.value[current.value].url = formatLinkType(val);
selected.value[current.value].type =
val.___type === "other" && val.url === "" ? "link" : "other";
console.log(selected.value[current.value]);
}
function handleSelectLink(index) {
// 调起选择链接弹窗
liliDialog.value.open("link");
current.value = index;
}
</script>

View File

@@ -218,10 +218,8 @@ function handleSelectLink(val, index) {
function callbackSelected(val) {
picModelFlag.value = false;
if (defaultCallbackImageType.value == "default") {
console.log(current.value.data.image);
current.value.data.image.src = val.url;
} else {
console.log(goodsIndex.value, props.data.options[align.value].data.list);
props.data.options[align.value].data.list[goodsIndex.value].img = val.url;
// props.data.options[align.value].data[selectedData.value][goodsIndex.value].url = val.img
@@ -229,7 +227,6 @@ function callbackSelected(val) {
}
// 选择商品回调
function selectedGoodsData(val) {
console.log(val);
nextTick(() => {
props.data.options[align.value].data.list[goodsIndex.value].img =
val[0].thumbnail;
@@ -240,14 +237,12 @@ function selectedGoodsData(val) {
props.data.options[align.value].data.list[goodsIndex.value].url =
val[0].url;
});
console.log(props.data.options[align.value].data.list[goodsIndex.value]);
proxy.$forceUpdate();
}
// 选择链接回调
function selectedLink(val) {
if (selectedData.value != "list") {
props.data.options[align.value].data[selectedData.value].url = formatLinkType(val);
console.log(props.data.options[align.value].data[selectedData.value])
}
if (selectedData.value == "list") {
props.data.options[align.value].data[selectedData.value][goodsIndex.value]
@@ -262,7 +257,6 @@ function selectedLink(val) {
function handleSelectModel(alignVal) {
align.value = alignVal;
current.value = props.data.options[alignVal];
console.log(props.data.options[alignVal]);
showModal.value = true;
}
</script>

View File

@@ -88,7 +88,6 @@ const ossManageRef = ref(null);
function callbackSelected(val) {
picModelFlag.value = false;
selected.value[current.value].img = val.url;
console.log(selected.value)
}
// 编辑模块
@@ -100,7 +99,6 @@ function handleSelectModel(item) {
// 选择商品回调
function selectedGoodsData(val) {
console.log(val);
let goods = val[0];
selected.value.img = goods.thumbnail;
selected.value.price = goods.price;

View File

@@ -89,12 +89,9 @@ const props = defineProps({
},
});
const flag = ref(false);
const tabIndex = ref(0);
const current = ref(0);
const showModal = ref(false);
const selected = ref({}); // 已选数据
const picModelFlag = ref(false);
const liliDialog = ref(null);
@@ -108,7 +105,6 @@ function addCurrentGoods() {
}
// 编辑模块
function handleSelectModel(item) {
console.log(item);
selected.value = item;
showModal.value = true;
}
@@ -132,13 +128,6 @@ function selectedLink(val) {
selected.value[current.value].url = formatLinkType(val);
selected.value[current.value].type =
val.___type === "other" && val.url === "" ? "link" : "other";
console.log(selected.value[current.value]);
}
function handleSelectLink(index) {
// 调起选择链接弹窗
liliDialog.value.open("link");
current.value = index;
}
</script>

View File

@@ -284,7 +284,6 @@ function selectedLink(val) {
}
// 选择商品回调
function selectedGoodsData(val) {
console.log(val);
let goods = val[0];
selected.value.img = goods.thumbnail;
selected.value.price = goods.price;

View File

@@ -155,9 +155,7 @@ function getTemplateItem(id) {
});
}
watch(modelForm, function (val) {
console.log(val);
}, { deep: true });
watch(modelForm, function (val) {}, { deep: true });
</script>
<style lang="scss" scoped>
.renovation {

View File

@@ -89,12 +89,6 @@ defineOptions({ name: "logistics" });
const row = ref({});
const openModal = ref(false);
const loading = ref(true);
const searchForm = ref({
pageNumber: 1,
pageSize: 10,
sort: "createTime",
order: "desc",
});
const openModalTitle = ref("开启信息");
const ruleValidate = ref({});
const faceSheetForm = ref({

View File

@@ -133,16 +133,10 @@ import { Message } from "@/utils/message";
defineOptions({ name: "shopSetting" });
const currentKey = ref(""); //存储当前点击地址的key
const showMap = ref(false); // 是否展示地图
const type = ref("INFO");
const storeName = ref(""); //店铺名称
const regionId = ref([]); // 地区id
// 历史遗留:loading、regionGoods、regionIdS 未在原 data 中声明,仅在方法内赋值,保持原行为
let loading = false;
let regionGoods = null;
let regionIdS = null;
const addressForm = ref({
// 退货地址
salesConsigneeName: "", // 收货人姓名
@@ -155,11 +149,6 @@ const addressForm = ref({
const udeskForm = ref({
merchantEuid: "",
});
const udeskFormValidate = {
merchantEuid: [
{ required: true, message: "请输入店铺坐席ID", trigger: "blur" },
],
};
const afterFormValidate = {
salesConsigneeMobile: [
{ required: true, message: "手机号不能为空", trigger: "blur" },
@@ -261,7 +250,6 @@ const addressGoodsValidate = {
const formRef = ref(null);
const addressGoodsRef = ref(null);
const addressFormRef = ref(null);
const udeskFormRef = ref(null);
const mapRef = ref(null);
// 回调地址
@@ -315,8 +303,6 @@ function init() {
function setAddressGoods() {
console.log(addressGoodsRef.value)
addressGoodsRef.value.validate((valid) => {
if (valid) {
API_Shop.editDeliverAddress(addressGoods.value).then(res => {
@@ -329,9 +315,7 @@ function setAddressGoods() {
}
//获取店铺信息
function getShopInfo() {
loading = true;
API_Shop.getShopInfo().then((res) => {
loading = false;
if (res.success) {
form.value = res.result;
@@ -358,17 +342,11 @@ function getDeliverAddress() {
if (res.success) {
if (res.result != '' && res.result != null) {
addressGoods.value = res.result;
regionGoods = res.result.salesConsignorAddressPath;
regionIdS = res.result.salesConsignorAddressId;
}
}
})
}
//重置
function handleReset() {
formRef.value.resetFields();
}
//提交保存
function handleSubmit() {
formRef.value.validate((valid) => {
@@ -384,20 +362,6 @@ function handleSubmit() {
}
});
}
function merchantSubmit() {
udeskFormRef.value.validate((valid) => {
if (valid) {
submitLoading.value = true;
API_Shop.updatEmerchantId(udeskForm.value).then((res) => {
submitLoading.value = false;
if (res.success) {
Message.success("修改成功");
getShopInfo();
}
});
}
});
}
//tab切换
function handleClickType(v) {

View File

@@ -128,7 +128,6 @@ const loading = ref(true);
const maxHeight = ref("500px");
const strict = ref(true);
const userLoading = ref(false);
const loadingEdit = ref(false);
const modalVisible = ref(false);
const selectList = ref([]);
const selectCount = ref(0);
@@ -136,7 +135,6 @@ const showParent = ref(false);
const modalTitle = ref("");
const editTitle = ref("");
const selectedRole = ref([]);
const searchKey = ref("");
const currentNodeKey = ref(null);
const treeProps = {
label: "title",
@@ -165,7 +163,6 @@ const formValidate = {
};
const submitLoading = ref(false);
const data = ref([]);
const dataEdit = ref([]);
const users = ref([]);
function init() {
@@ -254,18 +251,6 @@ function cancelSelect() {
editTitle.value = "";
selectedRole.value = [];
}
function selectTreeEdit(v) {
if (v.length > 0) {
for (const attr in v[0]) {
if (v[0][attr] == null) {
v[0][attr] = "";
}
}
const data = JSON.parse(JSON.stringify(v[0]));
form.value.parentId = data.id;
form.value.parentTitle = data.title;
}
}
function cancelAdd() {
modalVisible.value = false;
}

View File

@@ -156,7 +156,6 @@ import {
addRole as addRoleReq,
editRole,
deleteRole,
loadDepartment,
selectRoleMenu,
saveRoleMenu,
} from "@/api/index";
@@ -178,15 +177,12 @@ const rolePermsWay = ref([]);
const openLevel = ref("0");
const loading = ref(true);
const treeLoading = ref(true);
const depTreeLoading = ref(true);
const submitPermLoading = ref(false);
const submitDepLoading = ref(false);
const sortColumn = ref("");
const sortType = ref("desc");
const modalType = ref(0);
const roleModalVisible = ref(false);
const permModalVisible = ref(false);
const depModalVisible = ref(false);
const modalTitle = ref("");
const roleForm = ref({
name: "",
@@ -204,10 +200,6 @@ const pageSize = ref(20);
const total = ref(0);
const permData = ref([]);
const editRolePermId = ref("");
const selectAllFlag = ref(false);
const depData = ref([]);
const dataType = ref(0);
const editDepartments = ref([]);
const saveRoleWay = ref([]);
const permTreeKey = ref(0);
const permCheckedKeys = ref([]);
@@ -474,24 +466,6 @@ function saveRole() {
}
});
}
function loadData(item, callback) {
loadDepartment(item.id, { openDataFilter: false }).then((res) => {
if (res.success) {
res.result.forEach(function (e) {
e.checked = false;
if (e.isParent) {
e.loading = false;
e.children = [];
}
if (e.status == -1) {
e.title = "[已禁用] " + e.title;
e.disabled = true;
}
});
callback(res.result);
}
});
}
function computeExpandedKeys(level) {
const keys = [];
const walk = (nodes, depth) => {

View File

@@ -530,7 +530,6 @@ import { CircleClose } from "@element-plus/icons-vue";
import { Message } from "@/utils/message";
import alignTextLeftImg from "@/assets/align-text-left.png";
import alignTextCenterImg from "@/assets/align-text-center.png";
import alignTextRightImg from "@/assets/align-text-right.png";
import ossManage from "@/views/sys/oss-manage/ossManage";
import { modelData } from "./config";
import hotzone from "@/views/shop/hotzone";
@@ -540,7 +539,7 @@ import categoryTemplate from "@/views/lili-dialog/template/category";
const props = defineProps(["res"]);
const emit = defineEmits(["handleDrawer"]);
// alignTextLeftImg/alignTextCenterImg/alignTextRightImg、ways(选择链接的类型)、modelData(装修数据) 为 import 常量,模板中直接使用
// alignTextLeftImg/alignTextCenterImg、ways(选择链接的类型)、modelData(装修数据) 为 import 常量,模板中直接使用
const picModelFlag = ref(false); //图片选择器
const linkType = ref("goods"); // dialog弹窗口类型
const styleFlag = ref(false); //广告魔方开关
@@ -548,10 +547,8 @@ const textAlign = ref(
props.res.options.list[0] ? props.res.options.list[0].textAlign : "center"
); //文字对齐方式
const promotionsFlag = ref(false); //广告魔方开关
const selectedLinkIndex = ref(""); //选择链接的索引
const selectedGoods = ref(""); // 已选商品
const selectedLinks = ref(""); // 已选链接
const modelList = ref(""); // 装修列表
const enableSelectCategory = ref(false); //商品是否绑定分类
const pendingCategory = ref(null); // 选择分类弹窗草稿
const goodsSelectedIndex = ref(0); //绑定商品分类的索引
@@ -601,8 +598,6 @@ function confirmCategory(val) {
}
);
props.res.options.list[0].titleWay[goodsSelectedIndex.value] = data;
console.log(props.res.options.list[0]);
}
// 商品排序
function slotGoods(list, key, val) {
@@ -639,7 +634,6 @@ function slotGoods(list, key, val) {
// 轮播图排序
function slotBanner(val, key, index, down) {
console.log(val);
if (down == "down") {
downData(val.options.list, index);
} else {
@@ -749,24 +743,9 @@ function clickLink(val, index, oval) {
liliDialogFlag(false);
}
}
function addZone(zoneInfo) {
selectedLinks.value.zoneInfo.push(zoneInfo);
}
function changeZone(zoneInfo) {
selectedLinks.value.zoneInfo = zoneInfo;
}
//点击图片解析成base64
function changeFile(item, index) {
const file = document.getElementById("files" + index).files[0];
if (file == void 0) return false;
const reader = new FileReader();
reader.readAsDataURL(file);
nextTick((res) => {
reader.onload = (e) => {
item.img = e.target.result;
};
});
}
//添加设置
function addDecorate(type, data) {
if (type === "notice") {
@@ -789,15 +768,6 @@ function addDecorate(type, data) {
props.res.options.list.push(way);
}
}
function addHotPoint() {
let way = {
img: "https://picsum.photos/id/264/200/200",
text: "标题",
link: "",
url: "",
};
props.res.options.list[0].points.push(way);
}
// 图片选择器回显
function callbackSelected(val) {
picModelFlag.value = false;

View File

@@ -91,14 +91,12 @@ const route = useRoute();
const appStore = useAppStore();
// templates: 模板类型,modelData: 装修模型,均为 import 常量,模板中直接使用
const qrcode = ref(""); // 二维码
const selected = ref(0); // 已选下标
const contentData = ref({
// 总数据
list: [],
});
const decorateData = ref(""); // 装修数据
const decoratePromotionsData = ref(""); // 装修数据
watch(
contentData,

View File

@@ -176,60 +176,10 @@ function updateHome() {
saveDialog.value = false;
Message.error("修改失败,请稍后重试");
}
console.log(res);
})
.catch(error => {});
}
// 更新
function update(submitWay) {
console.log(appStore.openStyleStore[0], "123123123");
if (appStore.openStyleStore == void 0) {
Message.error("请装修楼层!");
return false;
}
progress.value = false;
let id = route.query.id;
const pagetype = route.query.pagetype;
console.log(appStore.openStyleStore, submitWay);
const pageType = {
INDEX: "INDEX",
ALERT: "OPEN_SCREEN_PAGE",
OPEN_SCREEN_ANIMATION: "OPEN_SCREEN_ANIMATION",
}[pagetype ? pagetype : "INDEX"];
if (pagetype) {
submitWay.pageData = JSON.stringify(
appStore.openStyleStore[0]
);
submitWay.pageType = pageType;
id = appStore.openStoreId;
}
API_Other.updateHome(id, submitWay)
.then((res) => {
num.value = 50;
if (res.success) {
num.value = 80;
/**制作保存成功动画¸ */
setTimeout(() => {
saveDialog.value = false;
Message.success("修改成功");
goBack();
}, 1000);
} else {
saveDialog.value = false;
Message.error("修改失败,请稍后重试");
}
console.log(res);
})
.catch((error) => {});
}
// 返回查询数据页面
function goBack() {
router.go(-1);
@@ -254,7 +204,6 @@ function submit(submitWay) {
saveDialog.value = false;
Message.error("保存失败,请稍后重试");
}
console.log(res);
})
.catch(error => {});
}

View File

@@ -313,31 +313,7 @@ const chartList = ref([]); // 绘制订单图表数据
const orderChart = ref(""); //订单图表
const overViewList = ref({}); // 绘制订单统计概览
const overViewChart = ref(""); //订单订单统计概览图标
// 时间
const dateList = ref([
{
title: "今天",
selected: false,
value: "TODAY",
},
{
title: "昨天",
selected: false,
value: "YESTERDAY",
},
{
title: "过去7天",
selected: true,
value: "LAST_SEVEN",
},
{
title: "过去30天",
selected: false,
value: "LAST_THIRTY",
},
]);
// 订单传参
const orderParams = ref({
searchType: "LAST_SEVEN", // TODAY , YESTERDAY , LAST_SEVEN , LAST_THIRTY
@@ -352,12 +328,6 @@ const overViewParams = ref({
storeId: "",
year: "",
});
const defaultParams = ref({
month: "",
searchType: "LAST_SEVEN", // TODAY , YESTERDAY , LAST_SEVEN , LAST_THIRTY
storeId: "",
year: "",
});
// 退单订单
const refundParams = ref({
pageNumber: 1,
@@ -438,7 +408,6 @@ function initOrderChart() {
function clickBreadcrumb(item, index) {
let callback = JSON.parse(JSON.stringify(item));
console.log("callback", callback);
orderParams.value = callback;
overViewParams.value = callback;

View File

@@ -82,15 +82,6 @@ import { customRouterPush } from "@/utils/filters";
defineProps(["res"]);
const orderStatusList = reactive({ // 订单状态
UNDELIVERED: "待发货",
UNPAID: "未付款",
PAID: "已付款",
DELIVERED: "已发货",
CANCELLED: "已关闭",
COMPLETED: "已完成",
TAKE: "已完成",
});
// 售后类型
const serviceTypeList = reactive({
CANCEL: "取消",

View File

@@ -372,9 +372,6 @@
* - isComponent=true 时作为弹窗选择器嵌入商品编辑、店铺装修等页面
*/
const playIcon =
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23409eff' d='M8 5v14l11-7z'/%3E%3C/svg%3E";
// DPlayer 实例:原为模块级变量(多实例共享),保持原有作用域
let dp;
</script>
@@ -400,7 +397,6 @@ import {
updateFileDirectory,
} from "@/api/index";
import { sellerUrl } from "@/libs/axios";
import config from "@/config/index";
import { getStore } from "@/libs/storage";
defineOptions({ name: "oss-manage" });
@@ -432,7 +428,6 @@ const emit = defineEmits(["callback", "selected"]);
// $forceUpdate 依赖组件实例
const { proxy } = getCurrentInstance();
const fileDirectoryId = ref("");
const groupFormValidate = ref({
id: "",
level: 0,
@@ -452,10 +447,8 @@ const enableGroup = ref(false); // 是否展示分组
const selectImage = ref(false); //是否是选择
const accessToken = ref({}); // 上传token鉴权
const loading = ref(false); // 表单加载状态
const fileType = ref("pic"); // 兼容外部调用:pic / video
const showType = ref("list"); // 展示类型
const modalVisible = ref(false); // 添加或编辑显示
const uploadVisible = ref(false); // 上传展示
const videoVisible = ref(false); // 视频预览
const picVisible = ref(false); // 图片预览
const fileVisible = ref(false); // 文件预览
@@ -493,343 +486,6 @@ const formValidate = {
const submitLoading = ref(false); // 添加或编辑提交状态
const selectList = ref([]); // 多选数据
const selectCount = ref(0); // 多选计数
const totalSize = ref(""); // 文件大小统计
const columns = ref([
// 表头
{
type: "selection",
width: 60,
align: "center",
},
{
title: "缩略图(点击预览)",
key: "url",
width: 300,
align: "center",
render: (h, params) => {
if (isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
alt: "加载图片失败",
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showPic(params.row);
},
},
});
} else if (isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
"video",
{
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showVideo(params.row);
},
},
},
[
h("source", {
attrs: {
src: params.row.url,
},
}),
]
);
} else {
return h("img", {
attrs: {
src: playIcon,
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showVideo(params.row);
},
},
});
}
} else {
return h("span", "非多媒体类型");
}
},
},
{
title: "文件类型",
key: "fileType",
width: 115,
className: selectImage.value == true ? "none" : "",
},
{
title: "文件大小",
key: "fileSize",
width: 115,
sortable: true,
className: selectImage.value == true ? "none" : "",
render: (h, params) => {
let m =
((params.row.fileSize * 1.0) / (1024 * 1024)).toFixed(2) + " MB";
return h("span", m);
},
},
{
title: "上传者",
key: "createBy",
width: 200,
render: (h, params) => {
let m;
if (params.row.userEnums == "MANAGER") {
m = "[管理员]";
} else if (params.row.userEnums == "STORE") {
m = "[商家]";
} else if (params.row.userEnums == "CUSTOMER") {
m = "[客服]";
} else {
m = "[用户]";
}
m += params.row.createBy;
return h("span", m);
},
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
// width: 300,
render: (h, params) => {
return h("div", [
h(
"a",
{
style: {
color: "#2d8cf0",
cursor: "pointer",
textDecoration: "none",
marginRight: "5px",
display: selectImage.value === true ? "inline-block" : "none",
},
on: {
click: () => {
selectedParams(params.row);
},
},
},
"选择"
),
h(
"span",
{
style: {
margin: "0 8px",
color: "#dcdee2",
display: selectImage.value === true ? "inline-block" : "none",
},
},
"|"
),
h(
"a",
{
style: {
color: "#2d8cf0",
cursor: "pointer",
textDecoration: "none",
marginRight: "5px",
display: selectImage.value == true ? "none" : "inline-block",
},
on: {
click: () => {
download(params.row);
},
},
},
"下载"
),
h(
"span",
{
style: {
margin: "0 8px",
color: "#dcdee2",
display: selectImage.value == true ? "none" : "inline-block",
},
},
"|"
),
h(
"a",
{
style: {
color: "#2d8cf0",
cursor: "pointer",
textDecoration: "none",
display: selectImage.value == true ? "none" : "inline-block",
},
on: {
click: () => {
remove(params.row);
},
},
},
"删除"
),
]);
},
},
]);
const viewColumns = ref([
{
title: "缩略图(点击预览)",
key: "url",
// width: 150,
align: "center",
render: (h, params) => {
if (isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
alt: "加载图片失败",
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showPic(params.row);
},
},
});
} else if (isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
"video",
{
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showVideo(params.row);
},
},
},
[
h("source", {
attrs: {
src: params.row.url,
},
}),
]
);
} else {
return h("img", {
attrs: {
src: playIcon,
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
on: {
click: () => {
showVideo(params.row);
},
},
});
}
} else {
return h("span", "非多媒体类型");
}
},
},
{
title: "上传者",
key: "createBy",
width: 120,
sortable: true,
render: (h, params) => {
let m;
if (params.row.userEnums == "MANAGER") {
m = "[管理员]";
} else if (params.row.userEnums == "STORE") {
m = "[商家]";
} else if (params.row.userEnums == "CUSTOMER") {
m = "[客服]";
} else {
m = "[用户]";
}
m += params.row.createBy;
return h("span", m);
},
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 300,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "default",
size: "small",
},
style: {
marginRight: "5px",
display:
selectImage.value === true ? "inline-block" : "none",
},
on: {
click: () => {
selectedParams(params.row);
},
},
},
"选择"
)
]);
},
},
]);
const data = ref([]); // 表单数据
const total = ref(0); // 表单数据总数
const pageSizeOpts = ref([5, 10, 20]); // 页码展示项
@@ -843,51 +499,12 @@ const insertOrUpdate = ref("insert");
const groupLoading = ref(false);
// 图片列表
const selectedOss = ref([]);
const buttonProps = {type: 'default', size: 'small',};
// 历史遗留死代码:模板未使用 myData,其 render 中的 append 从未定义,原样保留
const myData = ref([
{
title: 'parent 1',
expand: true,
render: (h, {root, node, data}) => {
return h('span', {style: {display: 'inline-block', width: '100%'}}, [
h('span', [h("Icon", {type: 'ios-folder-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
h('span', {style: {display: 'inline-block', float: 'right', marginRight: '32px'}},
[h("Button", {
...buttonProps,
icon: 'ios-add',
type: 'primary',
style: {width: '64px'},
onClick: () => {
// eslint-disable-next-line no-undef -- 历史遗留:append 从未定义,原样保留
append(data)
}
})
])
]);
},
children: [
{
title: 'child 1-1',
expand: true,
children: [{title: 'leaf 1-1-1', expand: true}, {title: 'leaf 1-1-2', expand: true}]
},
{
title: 'child 1-2',
expand: true,
children: [{title: 'leaf 1-2-1', expand: true}, {title: 'leaf 1-2-1', expand: true}]
}
]
}
]);
// 模板 ref:up/form/formValidate 与顶层变量重名,改名避免互相覆盖
const upRef = ref(null);
const formRef = ref(null);
const formValidateRef = ref(null);
const dplayerRef = ref(null);
// 历史遗留:模板中不存在 ref="table",clearSelectAll 调用会报错,原样保留
const tableRef = ref(null);
watch(selectImage, (val) => {
if (val) {
@@ -989,18 +606,6 @@ function onMouseOver(item, index) {
function onMouseOut(item, index) {
data.value[index].isShowPreview = false;
}
function handleRoleTabChange(name) {
activeRoleTab.value = name;
searchForm.pageNumber = 1;
searchForm.userEnums = name;
delete searchForm.fileDirectoryId;
selectedGroupData.value = "";
groupFormValidate.value.id = "";
groupFormValidate.value.level = 0;
selectedOss.value = [];
updateTreeDataByRole();
getDataList();
}
function handleCategoryTabChange(name) {
activeCategoryTab.value = name;
searchForm.fileCategory = name;
@@ -1089,62 +694,7 @@ function pageChange(value) {
searchForm.pageNumber = value;
getDataList();
}
// 自定义tree节点显示内容和交互
function renderContent(h, {root, node, data}) {
if (data.value === '0') {
return h('span', {style: {display: 'inline-block', width: '100%'}},
[
h('span', [h("Icon", {type: 'ios-paper-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
h('span', {style: {display: 'inline-block', float: 'right', marginRight: '10px'}}, [])
]
);
} else {
return h('span', {style: {display: 'inline-block', width: '100%'}},
[
h('span', [h("Icon", {type: 'ios-paper-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
h('span', {style: {display: 'inline-block', float: 'right', marginRight: '10px'}},
[
h("Dropdown", {style: {marginLeft: "4px"}},
[
h("Icon", {
props: {type: 'ios-more', size: "20",},
style: {display: 'inline-block'},
on: {
click: () => {
}
}
}),
h("DropdownMenu", {
slot: "list"
}, [
h("DropdownItem", {
nativeOn: {
click: () => {
handleContextMenuEdit(root, node, data)
}
}
}, "编辑"),
h("DropdownItem", {
nativeOn: {
click: () => {
handleContextMenuDelete()
}
}
}, "删除"),
])
]),
])
]
);
}
}
function handleContextMenu(val) {
console.log('handleContextMenu', val);
selectedGroupData.value = val;
}
// 编辑分组
function handleContextMenuEdit(root, node, data) {
insertOrUpdate.value = "update";
@@ -1202,20 +752,6 @@ function handleClickAddGroup() {
};
enableGroup.value = true;
}
function copyFileUrl(row) {
const textArea = document.createElement("textarea");
textArea.value = row.url;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand("copy");
ElMessage.success("复制成功");
} catch (err) {
console.error("Unable to copy to clipboard", err);
}
document.body.removeChild(textArea);
}
// 获取全部文件目录
function getAllList(parent_id) {
@@ -1270,12 +806,6 @@ function handleCateChange(data) {
selectedOss.value = [];
}
}
/**
* 选择
*/
function selectedParams(val) {
emit("callback", val);
}
function handleSelectConfirm() {
if (!selectedOss.value.length) {
ElMessage.warning("请选择图片");
@@ -1341,38 +871,6 @@ function closeVideo() {
}
pendingVideoUrl.value = "";
}
// 分页 改变页码
function changePage(v) {
searchForm.pageNumber = v;
getDataList();
clearSelectAll();
}
// 分页 改变页数
function changePageSize(v) {
searchForm.pageNumber = 1;
searchForm.pageSize = v;
getDataList();
}
// 排序
function changeSort(e) {
searchForm.sort = e.key;
searchForm.order = e.order;
if (e.order == "normal") {
searchForm.order = "";
}
getDataList();
}
// 起止时间筛选已移除
// 改变查看方式
function changeShowType() {
searchForm.pageNumber = 1;
if (showType.value == "list") {
searchForm.pageSize = 20;
} else {
searchForm.pageSize = 12;
}
getDataList();
}
// 获取列表数据
function getDataList(type = null) {
if (showType.value == "list") {
@@ -1399,18 +897,6 @@ function getDataList(type = null) {
loading.value = false;
});
}
// 兼容外部按场景切换分类(如装修选图/选视频)
function changeFileType() {
const categoryMap = {
pic: "IMAGE",
video: "VIDEO",
file: "FILE",
all: "IMAGE",
};
const category = categoryMap[fileType.value] || "IMAGE";
activeCategoryTab.value = category;
handleCategoryTabChange(category);
}
function isImageFile(row) {
return row?.fileCategory === "IMAGE" || (row?.fileType && row.fileType.includes("image"));
}
@@ -1457,10 +943,6 @@ function handleSuccess(res, file) {
function handleError(error, file, fileList) {
ElMessage.error(error.toString());
}
// 清空上传文件
function clearFiles() {
upRef.value.clearFiles();
}
// 取消修改文件名
function handleCancel() {
modalVisible.value = false;
@@ -1491,9 +973,7 @@ function removeAll() {
ElMessage.success("批量删除文件成功");
}
})
.catch((err) => {
console.log("失败", err);
});
.catch((err) => {});
}).catch(() => {});
}
// 单个删除文件
@@ -1529,37 +1009,6 @@ function handleSubmit() {
}
});
}
// 修改文件名modal
function rename(v) {
modalTitle.value = "编辑文件名";
// 转换null为""
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
form.value = data;
oldKey.value = data.fileKey;
modalVisible.value = true;
}
// 清除选中状态
function clearSelectAll() {
tableRef.value.selectAll(false);
totalSize.value = "";
}
// 选中回调
function changeSelect(e) {
selectList.value = e;
selectCount.value = e.length;
let size = 0;
e.forEach((item) => {
size += item.fileSize * 1.0;
});
totalSize.value = ((size * 1.0) / (1024 * 1024)).toFixed(2) + " MB";
emit("selected", e)
}
onMounted(() => {
if (!props.isComponent) {

View File

@@ -112,6 +112,14 @@ module.exports = {
args[0].cdn = { css: [], js: [] };
return args;
});
if (enableProduction) {
// 生产构建剥离 console.*,防止调试日志残留上线
config.optimization.minimizer("terser").tap((args) => {
args[0].terserOptions.compress = args[0].terserOptions.compress || {};
args[0].terserOptions.compress.drop_console = true;
return args;
});
}
},
pluginOptions: {
"style-resources-loader": {