mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-04-23 20:08:35 +08:00
v1.1
1、提货点 2、客服(腾讯云智服) 3、接口权限控制 4、复制第三方商品可配置 4、优化附件上传配置 5、手机端核销订单 6、手机端订单统计、订单管理 7、短信优化 8、订阅消息全自动化
This commit is contained in:
57
admin/src/libs/dialog.js
Normal file
57
admin/src/libs/dialog.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import {
|
||||
Confirm as confirm,
|
||||
Alert as alert,
|
||||
Toast as toast,
|
||||
Notify as notify,
|
||||
Loading as loading
|
||||
} from "vue-ydui/dist/lib.rem/dialog";
|
||||
|
||||
const dialog = {
|
||||
confirm,
|
||||
alert,
|
||||
toast,
|
||||
notify,
|
||||
loading
|
||||
};
|
||||
|
||||
const icons = { error: "操作失败", success: "操作成功" };
|
||||
Object.keys(icons).reduce((dialog, key) => {
|
||||
dialog[key] = (mes, obj = {}) => {
|
||||
return new Promise(function(resolve) {
|
||||
toast({
|
||||
mes: mes || icons[key],
|
||||
timeout: 1000,
|
||||
icon: key,
|
||||
callback: () => {
|
||||
resolve();
|
||||
},
|
||||
...obj
|
||||
});
|
||||
});
|
||||
};
|
||||
return dialog;
|
||||
}, dialog);
|
||||
|
||||
dialog.message = (mes = "操作失败", obj = {}) => {
|
||||
return new Promise(function(resolve) {
|
||||
toast({
|
||||
mes,
|
||||
timeout: 1000,
|
||||
callback: () => {
|
||||
resolve();
|
||||
},
|
||||
...obj
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
dialog.validateError = (...args) => {
|
||||
validatorDefaultCatch(...args);
|
||||
};
|
||||
|
||||
export function validatorDefaultCatch(err, type = "message") {
|
||||
console.log(err)
|
||||
return dialog[type](err.errors[0].message);
|
||||
}
|
||||
|
||||
export default dialog;
|
||||
Reference in New Issue
Block a user