"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { data() { return { // 通知设置状态 notifications: { system: true, crop: true, weather: true }, // 缓存大小 cacheSize: "0.00MB", // 版本号 version: "1.0.0" }; }, methods: { // 获取缓存大小 getCacheSize() { common_vendor.index.getStorageInfo({ success: (res) => { const size = (res.currentSize / 1024).toFixed(2); this.cacheSize = size + "MB"; } }); }, // 清除缓存 handleClearCache() { common_vendor.index.showModal({ title: "提示", content: "确定要清除缓存吗?", success: (res) => { if (res.confirm) { common_vendor.index.clearStorage({ success: () => { common_vendor.index.showToast({ title: "清除成功", icon: "success" }); this.getCacheSize(); } }); } } }); }, // 检查更新 checkUpdate() { common_vendor.index.showLoading({ title: "检查更新中..." }); setTimeout(() => { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: "已是最新版本", icon: "none" }); }, 1500); }, // 通知设置处理函数 handleSystemNotification(e) { this.notifications.system = e.detail.value; this.saveNotificationSettings(); }, handleCropNotification(e) { this.notifications.crop = e.detail.value; this.saveNotificationSettings(); }, handleWeatherNotification(e) { this.notifications.weather = e.detail.value; this.saveNotificationSettings(); }, // 保存通知设置 saveNotificationSettings() { common_vendor.index.setStorageSync("notifications", this.notifications); }, // 加载通知设置 loadNotificationSettings() { const savedSettings = common_vendor.index.getStorageSync("notifications"); if (savedSettings) { this.notifications = savedSettings; } }, // 页面跳转 navigateToAboutUs() { common_vendor.index.navigateTo({ url: "/pages/about/index" }); }, navigateToPrivacy() { common_vendor.index.navigateTo({ url: "/pages/privacy/index" }); }, handleContact() { common_vendor.index.makePhoneCall({ phoneNumber: "400-xxx-xxxx" // 替换为实际的客服电话 }); } }, // 页面显示时加载数据 onShow() { this.getCacheSize(); this.loadNotificationSettings(); } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: $data.notifications.system, b: common_vendor.o((...args) => $options.handleSystemNotification && $options.handleSystemNotification(...args)), c: $data.notifications.crop, d: common_vendor.o((...args) => $options.handleCropNotification && $options.handleCropNotification(...args)), e: $data.notifications.weather, f: common_vendor.o((...args) => $options.handleWeatherNotification && $options.handleWeatherNotification(...args)), g: common_vendor.t($data.cacheSize), h: common_vendor.o((...args) => $options.handleClearCache && $options.handleClearCache(...args)), i: common_vendor.t($data.version), j: common_vendor.o((...args) => $options.checkUpdate && $options.checkUpdate(...args)), k: common_vendor.o((...args) => $options.navigateToAboutUs && $options.navigateToAboutUs(...args)), l: common_vendor.o((...args) => $options.handleContact && $options.handleContact(...args)), m: common_vendor.o((...args) => $options.navigateToPrivacy && $options.navigateToPrivacy(...args)) }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/settings/index.js.map