mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 01:18:54 +08:00
- 抽离通用 useTable composable,并迁移 13 个典型列表页(采购/报损/订单/售后/统计/营销等) - 增加表格与树组件全局空状态 (el-empty) 样式规范 - 补齐视图图片语义化 alt,并添加全局图片加载异常 SVG 占位兜底 - 替换遗留的 $Message 兼容语法为 ElMessage - 将 WAP 店铺装修模板的 Options API 统一为 defineOptions - 优化数据报表卡片视觉样式,并移除失效的品牌筛选选项 - 清理冗余依赖 vuex,将 sass-loader 调整至 devDependencies
90 lines
2.7 KiB
JavaScript
90 lines
2.7 KiB
JavaScript
import { createApp } from "vue";
|
||
import { createPinia } from "pinia";
|
||
import "./styles/theme.less";
|
||
import App from "./App.vue";
|
||
import { router } from "./router/index";
|
||
import { setupElementPlus } from "@/plugins/element";
|
||
import { setupLegacyMessage } from "@/utils/message";
|
||
import { setupImgFallback } from "@/utils/imgFallback";
|
||
import liliDialog from "@/views/lili-dialog";
|
||
import PriceColorScheme from "@/components/price-color-scheme.vue";
|
||
import { install as installVueQr } 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 { md5 } from "@/utils/md5.js";
|
||
import * as filters from "@/utils/filters";
|
||
import config from "@/config/index";
|
||
|
||
const { aMapSecurityJsCode, mainColor } = config;
|
||
|
||
if (aMapSecurityJsCode) {
|
||
window._AMapSecurityConfig = {
|
||
securityJsCode: aMapSecurityJsCode,
|
||
};
|
||
}
|
||
|
||
const PC_URL = BASE.PC_URL;
|
||
const WAP_URL = BASE.WAP_URL;
|
||
|
||
util.bootstrapDynamicRoutesFromCache();
|
||
|
||
const app = createApp(App);
|
||
|
||
setupElementPlus(app);
|
||
setupLegacyMessage(app);
|
||
setupImgFallback();
|
||
installVueQr(app);
|
||
|
||
app.use(router);
|
||
app.use(createPinia());
|
||
|
||
app.component("liliDialog", liliDialog);
|
||
app.component("priceColorScheme", PriceColorScheme);
|
||
|
||
app.config.globalProperties.getRequest = getRequest;
|
||
app.config.globalProperties.postRequest = postRequest;
|
||
app.config.globalProperties.putRequest = putRequest;
|
||
app.config.globalProperties.deleteRequest = deleteRequest;
|
||
app.config.globalProperties.importRequest = importRequest;
|
||
app.config.globalProperties.uploadFileRequest = uploadFileRequest;
|
||
app.config.globalProperties.setStore = setStore;
|
||
app.config.globalProperties.getStore = getStore;
|
||
app.config.globalProperties.removeStore = removeStore;
|
||
app.config.globalProperties.$mainColor = mainColor;
|
||
app.config.globalProperties.md5 = md5;
|
||
app.config.globalProperties.$filters = filters;
|
||
|
||
app.config.globalProperties.linkTo = function (goodsId, skuId) {
|
||
window.open(
|
||
`${PC_URL}/goodsDetail?skuId=${skuId}&goodsId=${goodsId}`,
|
||
"_blank"
|
||
);
|
||
};
|
||
|
||
app.config.globalProperties.wapLinkTo = function (goodsId, skuId) {
|
||
return `${WAP_URL}/pages/product/goods?id=${skuId}&goodsId=${goodsId}`;
|
||
};
|
||
|
||
router.isReady().then(() => {
|
||
app.mount("#app");
|
||
});
|
||
|
||
// axios 拦截器已对所有请求失败统一弹出提示(Message.error),
|
||
// 调用方未写 .catch 的 axios rejection 不再触发开发环境错误弹层;
|
||
// 非 axios 的未处理 rejection(真代码 bug)仍会正常暴露
|
||
window.addEventListener("unhandledrejection", (event) => {
|
||
if (event.reason && event.reason.isAxiosError) {
|
||
event.preventDefault();
|
||
}
|
||
});
|
||
|
||
export { app, util };
|