From eb56c0fb2f80f85a14296a0428d9024871b9738f Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Thu, 14 Aug 2025 17:06:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D=E9=9D=99?= =?UTF-8?q?=E6=80=81=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enum/common.js | 2 +- pages.json | 35 +++ pages/activity/ReservationSuccess.vue | 13 + pages/activity/application.vue | 239 ++++++++++++++++++ pages/activity/appointmentSuccess.vue | 13 + pages/activity/myReservation.vue | 82 ++++++ pages/activity/reservationVegetarianMeals.vue | 82 ++++++ utils/loading-manager.js | 153 +++++------ 8 files changed, 545 insertions(+), 74 deletions(-) create mode 100644 pages/activity/ReservationSuccess.vue create mode 100644 pages/activity/application.vue create mode 100644 pages/activity/appointmentSuccess.vue create mode 100644 pages/activity/myReservation.vue create mode 100644 pages/activity/reservationVegetarianMeals.vue diff --git a/enum/common.js b/enum/common.js index 84eec7d..b2d0121 100644 --- a/enum/common.js +++ b/enum/common.js @@ -18,6 +18,6 @@ export const CommonEnum = { Refresh: "https://api.ccttiot.com/image-1754377032112.png", //刷新 LotusMeditation: "https://api.ccttiot.com/image-1754377169541.png", //莲坐禅心 CENTER_TILES: "https://api.ccttiot.com/image-1754897751419.png", //腰部瓦片组 - SUCCESS_APPOINTMENT: "https://api.ccttiot.com/image-1754897751419.png", //预约成功 + SUCCESS_APPOINTMENT: "https://api.ccttiot.com/image-1755156093304.png", //预约成功 }; export default CommonEnum; diff --git a/pages.json b/pages.json index c8d82e9..702d111 100644 --- a/pages.json +++ b/pages.json @@ -172,6 +172,41 @@ "style": { "navigationStyle": "custom" } + }, + { + "path" : "pages/activity/application", + "style" : + { + "navigationStyle": "custom" + } + }, + { + "path" : "pages/activity/appointmentSuccess", + "style" : + { + "navigationStyle": "custom" + } + }, + { + "path" : "pages/activity/reservationVegetarianMeals", + "style" : + { + "navigationStyle": "custom" + } + }, + { + "path" : "pages/activity/ReservationSuccess", + "style" : + { + "navigationStyle": "custom" + } + }, + { + "path" : "pages/activity/myReservation", + "style" : + { + "navigationStyle": "custom" + } } ], "subPackages": [ diff --git a/pages/activity/ReservationSuccess.vue b/pages/activity/ReservationSuccess.vue new file mode 100644 index 0000000..bb787c0 --- /dev/null +++ b/pages/activity/ReservationSuccess.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/pages/activity/application.vue b/pages/activity/application.vue new file mode 100644 index 0000000..30413e8 --- /dev/null +++ b/pages/activity/application.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/pages/activity/appointmentSuccess.vue b/pages/activity/appointmentSuccess.vue new file mode 100644 index 0000000..bb787c0 --- /dev/null +++ b/pages/activity/appointmentSuccess.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/pages/activity/myReservation.vue b/pages/activity/myReservation.vue new file mode 100644 index 0000000..29383cb --- /dev/null +++ b/pages/activity/myReservation.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/pages/activity/reservationVegetarianMeals.vue b/pages/activity/reservationVegetarianMeals.vue new file mode 100644 index 0000000..29383cb --- /dev/null +++ b/pages/activity/reservationVegetarianMeals.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/utils/loading-manager.js b/utils/loading-manager.js index 36d61c3..166fd49 100644 --- a/utils/loading-manager.js +++ b/utils/loading-manager.js @@ -6,50 +6,50 @@ // 环境配置 const ENV_CONFIG = { develop: { - loadingText: '开发环境加载中~', + loadingText: "加载中~", loadingTime: 100, }, trial: { - loadingText: '体验版加载中~', + loadingText: "加载中~", loadingTime: 100, }, release: { - loadingText: '加载中~', + loadingText: "加载中~", loadingTime: 100, }, -} +}; // 获取当前环境配置 const getCurrentConfig = () => { try { - const { envVersion } = wx.getAccountInfoSync().miniProgram - console.log('当前环境:', envVersion) - return ENV_CONFIG[envVersion] || ENV_CONFIG.release + const { envVersion } = wx.getAccountInfoSync().miniProgram; + console.log("当前环境:", envVersion); + return ENV_CONFIG[envVersion] || ENV_CONFIG.release; } catch (error) { - console.warn('获取环境失败,默认使用正式环境:', error) - return ENV_CONFIG.release + console.warn("获取环境失败,默认使用正式环境:", error); + return ENV_CONFIG.release; } -} +}; -const config = getCurrentConfig() +const config = getCurrentConfig(); // 全局状态管理 -let isLoading = false -let loadingTimer = null -let loadingCount = 0 // 请求计数器 +let isLoading = false; +let loadingTimer = null; +let loadingCount = 0; // 请求计数器 /** * 设置loading超时自动清除 */ const setLoadingTimeout = () => { if (loadingTimer) { - clearTimeout(loadingTimer) + clearTimeout(loadingTimer); } loadingTimer = setTimeout(() => { - console.warn('Loading超时,强制清除') - forceHideLoading() - }, 30000) // 30秒超时 -} + console.warn("Loading超时,强制清除"); + forceHideLoading(); + }, 30000); // 30秒超时 +}; /** * 显示加载状态 @@ -57,19 +57,19 @@ const setLoadingTimeout = () => { */ function showLoading(text = config.loadingText) { try { - loadingCount++ + loadingCount++; if (!isLoading) { - isLoading = true + isLoading = true; uni.showLoading({ title: text, mask: true, - }) + }); // 设置超时清除 - setLoadingTimeout() - console.log('显示Loading:', text) + setLoadingTimeout(); + console.log("显示Loading:", text); } } catch (error) { - console.warn('显示loading失败:', error) + console.warn("显示loading失败:", error); } } @@ -78,23 +78,26 @@ function showLoading(text = config.loadingText) { */ function hideLoading() { try { - loadingCount-- + loadingCount--; if (loadingCount > 0) { - console.log('还有其他请求在进行,不隐藏Loading, 剩余请求数:', loadingCount) - return // 还有其他请求在进行 + console.log( + "还有其他请求在进行,不隐藏Loading, 剩余请求数:", + loadingCount, + ); + return; // 还有其他请求在进行 } if (isLoading) { - isLoading = false + isLoading = false; // 清除超时定时器 if (loadingTimer) { - clearTimeout(loadingTimer) - loadingTimer = null + clearTimeout(loadingTimer); + loadingTimer = null; } - uni.hideLoading() - console.log('隐藏Loading') + uni.hideLoading(); + console.log("隐藏Loading"); } } catch (error) { - console.warn('隐藏loading失败:', error) + console.warn("隐藏loading失败:", error); } } @@ -103,16 +106,16 @@ function hideLoading() { */ export function forceHideLoading() { try { - isLoading = false - loadingCount = 0 + isLoading = false; + loadingCount = 0; if (loadingTimer) { - clearTimeout(loadingTimer) - loadingTimer = null + clearTimeout(loadingTimer); + loadingTimer = null; } - uni.hideLoading() - console.log('强制隐藏Loading') + uni.hideLoading(); + console.log("强制隐藏Loading"); } catch (error) { - console.warn('强制隐藏loading失败:', error) + console.warn("强制隐藏loading失败:", error); } } @@ -125,7 +128,7 @@ export function getLoadingStatus() { isLoading, loadingCount, hasTimer: !!loadingTimer, - } + }; } /** @@ -133,8 +136,8 @@ export function getLoadingStatus() { * @param {Object} newConfig - 新的配置 */ export function setLoadingConfig(newConfig) { - Object.assign(config, newConfig) - console.log('更新Loading配置:', config) + Object.assign(config, newConfig); + console.log("更新Loading配置:", config); } /** @@ -142,7 +145,7 @@ export function setLoadingConfig(newConfig) { * @returns {Object} 当前配置 */ export function getLoadingConfig() { - return { ...config } + return { ...config }; } /** @@ -150,10 +153,13 @@ export function getLoadingConfig() { * @param {string} text - 加载提示文字 * @param {number} delay - 延迟时间(毫秒) */ -export function showLoadingWithDelay(text = config.loadingText, delay = config.loadingTime) { +export function showLoadingWithDelay( + text = config.loadingText, + delay = config.loadingTime, +) { setTimeout(() => { - showLoading(text) - }, delay) + showLoading(text); + }, delay); } /** @@ -162,8 +168,8 @@ export function showLoadingWithDelay(text = config.loadingText, delay = config.l */ export function hideLoadingWithDelay(delay = 500) { setTimeout(() => { - hideLoading() - }, delay) + hideLoading(); + }, delay); } /** @@ -171,35 +177,36 @@ export function hideLoadingWithDelay(delay = 500) { */ export function initGlobalLoadingManager() { // 监听页面显示事件 - uni.$on('page-show', () => { - console.log('页面显示,检查loading状态') + uni.$on("page-show", () => { + console.log("页面显示,检查loading状态"); // 页面显示时检查loading状态,如果超时则清除 if (isLoading && loadingTimer) { - const remainingTime = 30000 - (Date.now() - (loadingTimer._startTime || Date.now())) + const remainingTime = + 30000 - (Date.now() - (loadingTimer._startTime || Date.now())); if (remainingTime <= 0) { - console.warn('页面显示时发现超时loading,强制清除') - forceHideLoading() + console.warn("页面显示时发现超时loading,强制清除"); + forceHideLoading(); } } - }) + }); // 监听页面隐藏事件 - uni.$on('page-hide', () => { - console.log('页面隐藏') - }) + uni.$on("page-hide", () => { + console.log("页面隐藏"); + }); // 监听应用显示事件 - uni.$on('app-show', () => { - console.log('应用显示') - }) + uni.$on("app-show", () => { + console.log("应用显示"); + }); // 监听应用隐藏事件 - uni.$on('app-hide', () => { - console.log('应用隐藏,清除loading') - forceHideLoading() - }) + uni.$on("app-hide", () => { + console.log("应用隐藏,清除loading"); + forceHideLoading(); + }); - console.log('全局loading管理器已初始化') + console.log("全局loading管理器已初始化"); } /** @@ -207,30 +214,30 @@ export function initGlobalLoadingManager() { */ export class AutoLoadingManager { constructor() { - this.isActive = false + this.isActive = false; } // 显示loading(可选) - show(text = '加载中...') { - this.isActive = true + show(text = "加载中...") { + this.isActive = true; // 这里可以选择是否显示额外的loading // 默认情况下,所有API调用都会自动显示loading } // 隐藏loading(可选) hide() { - this.isActive = false + this.isActive = false; // 这里可以选择是否手动隐藏loading // 默认情况下,API调用完成后会自动隐藏loading } // 销毁管理器 destroy() { - this.isActive = false + this.isActive = false; // 页面卸载时可以选择是否强制清除loading // forceHideLoading() } } // 导出内部方法供request.js使用 -export { showLoading, hideLoading, config } +export { showLoading, hideLoading, config };