refactor: replace uni.showToast calls with shared toast
consolidates repeated toast display logic into a centralized utility, reducing code duplication and standardizing toast behavior across the codebase
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -121,10 +121,7 @@ const products = [
|
||||
const faq = ["几岁的孩子能玩", "会不会全身湿透", "漂完去哪儿歇脚"];
|
||||
|
||||
const showToast = (title) => {
|
||||
uni.showToast({
|
||||
title,
|
||||
icon: "none",
|
||||
});
|
||||
showToast(title);
|
||||
};
|
||||
|
||||
const goodsDetail = (item) => {
|
||||
|
||||
@@ -101,10 +101,7 @@ const getBadgeClass = (tone) => {
|
||||
const openDetail = (item) => {
|
||||
const url = getLongTextGuideDetailRoute(item.type);
|
||||
if (!url) {
|
||||
uni.showToast({
|
||||
title: "暂未配置详情页",
|
||||
icon: "none",
|
||||
});
|
||||
showToast("暂未配置详情页");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,10 +129,7 @@ const predivPhoto = () => {
|
||||
};
|
||||
|
||||
const showToast = (title) => {
|
||||
uni.showToast({
|
||||
title,
|
||||
icon: "none",
|
||||
});
|
||||
showToast(title);
|
||||
};
|
||||
|
||||
const jumpAigcClick = () => {
|
||||
|
||||
@@ -95,10 +95,7 @@ import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant";
|
||||
const faq = ["古桥有什么传说", "最佳观赏时间", "旁边还有什么景点"];
|
||||
|
||||
const showToast = (title) => {
|
||||
uni.showToast({
|
||||
title,
|
||||
icon: "none",
|
||||
});
|
||||
showToast(title);
|
||||
};
|
||||
|
||||
// 打开地图
|
||||
|
||||
@@ -151,10 +151,7 @@ const facilities = [
|
||||
const faq = ["上湖下湖哪个好玩", "玻璃船和铁皮船怎么选", "两个湖都玩来得及吗"];
|
||||
|
||||
const showToast = (title) => {
|
||||
uni.showToast({
|
||||
title,
|
||||
icon: "none",
|
||||
});
|
||||
showToast(title);
|
||||
};
|
||||
|
||||
const sendReply = (item) => {
|
||||
|
||||
Reference in New Issue
Block a user