diff --git a/src/components/CreateServiceOrder/index.vue b/src/components/CreateServiceOrder/index.vue index 2fb5914..172224d 100644 --- a/src/components/CreateServiceOrder/index.vue +++ b/src/components/CreateServiceOrder/index.vue @@ -129,7 +129,7 @@ const handleChooseImage = () => { updateImagehandle(file); }, fail: () => { - uni.showToast({ title: "选择图片失败", icon: "none" }); + showToast("选择图片失败"); }, }); }; @@ -160,7 +160,7 @@ const handleCall = async () => { } if (!roomId.value.trim()) { - uni.showToast({ title: "请填写所在位置", icon: "none" }); + showToast("请填写所在位置"); return; } @@ -168,12 +168,12 @@ const handleCall = async () => { ? contactPhone.value : originalPhone.value; if (!phoneToSubmit.trim()) { - uni.showToast({ title: "请填写联系电话", icon: "none" }); + showToast("请填写联系电话"); return; } if (!contactText.value.trim()) { - uni.showToast({ title: "请填写需求信息描述内容", icon: "none" }); + showToast("请填写需求信息描述内容"); return; } @@ -201,12 +201,12 @@ const sendCreateWorkOrder = async (phoneToSubmit) => { // 设置成功状态 isCallSuccess.value = true; - uni.showToast({ title: "呼叫成功", icon: "success" }); + showToast("呼叫成功"); } else { - uni.showToast({ title: res.message || "呼叫失败", icon: "none" }); + showToast(res.message || "呼叫失败"); } } catch (error) { - uni.showToast({ title: "网络错误,请重试", icon: "none" }); + showToast("网络错误,请重试"); } }; diff --git a/src/components/Feedback/index.vue b/src/components/Feedback/index.vue index e91bb88..dd76212 100644 --- a/src/components/Feedback/index.vue +++ b/src/components/Feedback/index.vue @@ -57,12 +57,12 @@ const appName = computed(() => getCurrentConfig().name); const handleCall = async () => { if (!contactPhone.value.trim()) { - uni.showToast({ title: "请填写联系电话", icon: "none" }); + showToast("请填写联系电话"); return; } if (!contactText.value.trim()) { - uni.showToast({ title: "请填写意见内容", icon: "none" }); + showToast("请填写意见内容"); return; } @@ -81,22 +81,13 @@ const sendFeedback = async () => { // 设置成功状态 isCallSuccess.value = true; - uni.showToast({ - title: "反馈意见成功", - icon: "success", - }); + showToast("反馈意见成功"); } else { - uni.showToast({ - title: res.message || "反馈意见失败", - icon: "none", - }); + showToast(res.message || "反馈意见失败"); } } catch (error) { console.error("反馈意见失败:", error); - uni.showToast({ - title: "网络错误,请重试", - icon: "none", - }); + showToast("网络错误,请重试"); } }; diff --git a/src/components/Qrcode/index.vue b/src/components/Qrcode/index.vue index 0b01c54..197731e 100644 --- a/src/components/Qrcode/index.vue +++ b/src/components/Qrcode/index.vue @@ -1,25 +1,12 @@ @@ -176,11 +163,7 @@ const _makeCode = () => { } } else { console.log("二维码内容为空"); - uni.showToast({ - title: "二维码内容不能为空", - icon: "none", - duration: 2000, - }); + showToast("二维码内容不能为空"); } }; @@ -196,11 +179,7 @@ const _saveCode = () => { uni.saveImageToPhotosAlbum({ filePath: result.value, success: function () { - uni.showToast({ - title: "二维码保存成功", - icon: "success", - duration: 2000, - }); + showToast("二维码保存成功"); }, }); } diff --git a/src/pages/home/components/ChatMainList/index.vue b/src/pages/home/components/ChatMainList/index.vue index cafdab0..742fbbb 100644 --- a/src/pages/home/components/ChatMainList/index.vue +++ b/src/pages/home/components/ChatMainList/index.vue @@ -908,10 +908,7 @@ const sendMessage = async (message, isInstruct = false) => { if (!isWsConnected()) { // uni.hideLoading(); setTimeout(() => { - // uni.showToast({ - // title: "连接服务器失败,请稍后重试", - // icon: "none", - // }); + showToast("连接服务器失败,请稍后重试"); }, 100); return; } @@ -920,20 +917,14 @@ const sendMessage = async (message, isInstruct = false) => { console.error("重新连接WebSocket失败:", error); // uni.hideLoading(); setTimeout(() => { - // uni.showToast({ - // title: "连接服务器失败,请稍后重试", - // icon: "none", - // }); + showToast("连接服务器失败,请稍后重试"); }, 100); return; } } if (isSessionActive.value) { - // uni.showToast({ - // title: "请等待当前回复完成", - // icon: "none", - // }); + showToast("请等待当前回复完成"); return; } isSessionActive.value = true; diff --git a/src/pages/home/components/DrawerSection/components/MineSetting/index.vue b/src/pages/home/components/DrawerSection/components/MineSetting/index.vue index 536036e..be0dc89 100644 --- a/src/pages/home/components/DrawerSection/components/MineSetting/index.vue +++ b/src/pages/home/components/DrawerSection/components/MineSetting/index.vue @@ -79,7 +79,7 @@ const handleMenuClick = (item) => { uni.navigateTo({ url: item.url }); } else if (item.type === "action") { if (item.action === "contactService") { - uni.showToast({ title: "联系客服功能待实现", icon: "none" }); + showToast("联系客服功能待实现"); } else if (item.action === "cancelAccount") { handleLogout(); } else if (item.action === "subscribeMessage") { diff --git a/src/pages/home/components/LongTextGuideCardPreview/guide.vue b/src/pages/home/components/LongTextGuideCardPreview/guide.vue index 0bdebf2..0ac6cf3 100644 --- a/src/pages/home/components/LongTextGuideCardPreview/guide.vue +++ b/src/pages/home/components/LongTextGuideCardPreview/guide.vue @@ -121,10 +121,7 @@ const products = [ const faq = ["几岁的孩子能玩", "会不会全身湿透", "漂完去哪儿歇脚"]; const showToast = (title) => { - uni.showToast({ - title, - icon: "none", - }); + showToast(title); }; const goodsDetail = (item) => { diff --git a/src/pages/home/components/LongTextGuideCardPreview/index.vue b/src/pages/home/components/LongTextGuideCardPreview/index.vue index 0770fc2..cd27441 100644 --- a/src/pages/home/components/LongTextGuideCardPreview/index.vue +++ b/src/pages/home/components/LongTextGuideCardPreview/index.vue @@ -101,10 +101,7 @@ const getBadgeClass = (tone) => { const openDetail = (item) => { const url = getLongTextGuideDetailRoute(item.type); if (!url) { - uni.showToast({ - title: "暂未配置详情页", - icon: "none", - }); + showToast("暂未配置详情页"); return; } diff --git a/src/pages/home/components/LongTextGuideCardPreview/photo.vue b/src/pages/home/components/LongTextGuideCardPreview/photo.vue index 178f1bc..efcf8be 100644 --- a/src/pages/home/components/LongTextGuideCardPreview/photo.vue +++ b/src/pages/home/components/LongTextGuideCardPreview/photo.vue @@ -129,10 +129,7 @@ const predivPhoto = () => { }; const showToast = (title) => { - uni.showToast({ - title, - icon: "none", - }); + showToast(title); }; const jumpAigcClick = () => { diff --git a/src/pages/home/components/LongTextGuideCardPreview/poi.vue b/src/pages/home/components/LongTextGuideCardPreview/poi.vue index 08eca86..1915879 100644 --- a/src/pages/home/components/LongTextGuideCardPreview/poi.vue +++ b/src/pages/home/components/LongTextGuideCardPreview/poi.vue @@ -95,10 +95,7 @@ import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant"; const faq = ["古桥有什么传说", "最佳观赏时间", "旁边还有什么景点"]; const showToast = (title) => { - uni.showToast({ - title, - icon: "none", - }); + showToast(title); }; // 打开地图 diff --git a/src/pages/home/components/LongTextGuideCardPreview/route.vue b/src/pages/home/components/LongTextGuideCardPreview/route.vue index 601ddc4..bb20fdb 100644 --- a/src/pages/home/components/LongTextGuideCardPreview/route.vue +++ b/src/pages/home/components/LongTextGuideCardPreview/route.vue @@ -151,10 +151,7 @@ const facilities = [ const faq = ["上湖下湖哪个好玩", "玻璃船和铁皮船怎么选", "两个湖都玩来得及吗"]; const showToast = (title) => { - uni.showToast({ - title, - icon: "none", - }); + showToast(title); }; const sendReply = (item) => { diff --git a/src/pages/order/order/components/FooterSection/index.vue b/src/pages/order/order/components/FooterSection/index.vue index f554c33..19aa4c0 100644 --- a/src/pages/order/order/components/FooterSection/index.vue +++ b/src/pages/order/order/components/FooterSection/index.vue @@ -84,10 +84,7 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => { if (!res || !res.data) { uni.hideLoading(); setTimeout(() => { - uni.showToast({ - title: res.msg || "订单创建失败,请重试", - icon: "none", - }); + showToast(res.msg || "订单创建失败,请重试"); }, 100); return; } @@ -99,7 +96,7 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => { if (!nonceStr || !packageVal || !paySign || !signType || !timeStamp) { uni.hideLoading(); setTimeout(() => { - uni.showToast({ title: "支付参数错误,请重试", icon: "none" }); + showToast("支付参数错误,请重试"); }, 100); return; } @@ -116,18 +113,12 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => { package: String(packageVal), // 确保为字符串类型 signType: String(signType), paySign: String(paySign), - success: () => { - uni.showToast({ - title: "支付成功", - icon: "success", - success: () => { - console.log("支付成功,刷新订单详情"); - emit("refresh", { orderId: orderId }); - }, - }); + success: async () => { + await showToast("支付成功"); + emit("refresh", { orderId: orderId }); }, fail: () => { - uni.showToast({ title: "支付失败,请重试", icon: "none" }); + showToast("支付失败,请重试"); }, }); // #endif diff --git a/src/pages/order/order/components/VoucherList/index.vue b/src/pages/order/order/components/VoucherList/index.vue index 3ffc58a..cd49b56 100644 --- a/src/pages/order/order/components/VoucherList/index.vue +++ b/src/pages/order/order/components/VoucherList/index.vue @@ -46,10 +46,7 @@ const props = defineProps({ const handleShowQrcode = (item, index) => { console.log("显示核销凭证二维码,凭证信息:", item); if (item.packageStatus !== 0) { - uni.showToast({ - title: "该凭证已核销使用", - icon: "none", - }); + showToast("该凭证已核销使用"); return; } emit("selected", { item, index }); diff --git a/src/pages/order/order/detail.vue b/src/pages/order/order/detail.vue index a938b4a..5cb4134 100644 --- a/src/pages/order/order/detail.vue +++ b/src/pages/order/order/detail.vue @@ -90,13 +90,13 @@ const handleRefundConfirm = async ({ orderId }) => { // 调用退款API await orderRefund({ orderId }); - uni.showToast({ title: "退款申请已提交", icon: "success" }); + showToast("退款申请已提交"); // 刷新订单状态 const res = await userOrderDetail({ orderId }); orderData.value = res.data; } catch (error) { - uni.showToast({ title: "退款申请失败,请重试", icon: "none" }); + showToast("退款申请失败,请重试"); } }; diff --git a/src/pages/service/order/components/OrderCard/index.vue b/src/pages/service/order/components/OrderCard/index.vue index 984e41e..46ea9c1 100644 --- a/src/pages/service/order/components/OrderCard/index.vue +++ b/src/pages/service/order/components/OrderCard/index.vue @@ -93,10 +93,6 @@ const cancelCall = async () => { if (res.data) { isCancelWork.value = true; } - uni.showToast({ - title: res.data ? "取消呼叫成功" : res.message || "取消呼叫失败", - icon: "success", - duration: 2000, - }); + showToast(res.data ? "取消呼叫成功" : res.message || "取消呼叫失败"); };