mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化 - 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
This commit is contained in:
37
im/src/utils/app-bridge.js
Normal file
37
im/src/utils/app-bridge.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import { h } from "vue";
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import MainMixin from "@/mixins/main-mixin";
|
||||
|
||||
let refreshViewFn = null;
|
||||
|
||||
const mixinCtx = {
|
||||
get $store() {
|
||||
return store;
|
||||
},
|
||||
get $router() {
|
||||
return router;
|
||||
},
|
||||
get $route() {
|
||||
return router.currentRoute.value;
|
||||
},
|
||||
};
|
||||
|
||||
export function setRefreshView(fn) {
|
||||
refreshViewFn = fn;
|
||||
}
|
||||
|
||||
export function refreshView() {
|
||||
refreshViewFn?.();
|
||||
}
|
||||
|
||||
export function getAppBridge() {
|
||||
return {
|
||||
$store: store,
|
||||
$router: router,
|
||||
$route: router.currentRoute.value,
|
||||
$createElement: h,
|
||||
loadUserSetting: MainMixin.methods.loadUserSetting.bind(mixinCtx),
|
||||
refreshView,
|
||||
};
|
||||
}
|
||||
11
im/src/utils/message.js
Normal file
11
im/src/utils/message.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
|
||||
|
||||
export { ElNotification, ElMessage, ElMessageBox };
|
||||
|
||||
export function setupLegacyMessage(app) {
|
||||
app.config.globalProperties.$message = ElMessage;
|
||||
app.config.globalProperties.$notify = ElNotification;
|
||||
app.config.globalProperties.$confirm = ElMessageBox.confirm;
|
||||
app.config.globalProperties.$prompt = ElMessageBox.prompt;
|
||||
app.config.globalProperties.$alert = ElMessageBox.alert;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
import config from "@/config/config";
|
||||
import { getToken, removeAll } from "@/utils/auth";
|
||||
|
||||
import { Notification, MessageBox } from "element-ui";
|
||||
import { ElNotification, ElMessageBox } from "element-plus";
|
||||
import qs from "qs";
|
||||
|
||||
// 创建 axios 实例
|
||||
@@ -33,7 +33,7 @@ const errorHandler = (error) => {
|
||||
/**
|
||||
* 403提示将重新从商家移动端进入当前页面
|
||||
*/
|
||||
MessageBox("当前登录已失效,请从关闭重新进入。", "提示", {
|
||||
ElMessageBox("当前登录已失效,请从关闭重新进入。", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
closeOnPressEscape: false,
|
||||
@@ -43,7 +43,7 @@ const errorHandler = (error) => {
|
||||
.then(() => {
|
||||
isRefreshing = true
|
||||
window.close();
|
||||
Notification({
|
||||
ElNotification({
|
||||
title:"登录失效提示",
|
||||
message: "请手动关闭当前页面",
|
||||
type:"error",
|
||||
@@ -53,7 +53,7 @@ const errorHandler = (error) => {
|
||||
})
|
||||
.catch(() => {
|
||||
isRefreshing = true
|
||||
Notification({
|
||||
ElNotification({
|
||||
title:"登录失效提示",
|
||||
message: "请手动关闭当前页面",
|
||||
type:"error",
|
||||
@@ -63,7 +63,7 @@ const errorHandler = (error) => {
|
||||
isRefreshing = false
|
||||
}
|
||||
} else if(error.response.status == 400){
|
||||
Notification({
|
||||
ElNotification({
|
||||
message: error.response.data.message,
|
||||
position: "top-right",
|
||||
type:"error",
|
||||
|
||||
Reference in New Issue
Block a user