"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { __name: "index", setup(__props) { const notifications = common_vendor.ref({ system: true, crop: true, weather: true }); const cacheSize = common_vendor.ref("0.00MB"); const version = common_vendor.ref("1.0.0"); const getCacheSize = () => { common_vendor.index.getStorageInfo({ success: (res) => { const size = (res.currentSize / 1024).toFixed(2); cacheSize.value = size + "MB"; } }); }; const handleClearCache = () => { common_vendor.index.showModal({ title: "提示", content: "确定要清除缓存吗?", success: (res) => { if (res.confirm) { common_vendor.index.clearStorage({ success: () => { common_vendor.index.showToast({ title: "清除成功", icon: "success" }); getCacheSize(); } }); } } }); }; const checkUpdate = () => { common_vendor.index.showLoading({ title: "检查更新中..." }); setTimeout(() => { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: "已是最新版本", icon: "none" }); }, 1500); }; const handleSystemNotification = (e) => { notifications.value.system = e.detail.value; saveNotificationSettings(); }; const handleCropNotification = (e) => { notifications.value.crop = e.detail.value; saveNotificationSettings(); }; const handleWeatherNotification = (e) => { notifications.value.weather = e.detail.value; saveNotificationSettings(); }; const saveNotificationSettings = () => { common_vendor.index.setStorageSync("notifications", notifications.value); }; const loadNotificationSettings = () => { const savedSettings = common_vendor.index.getStorageSync("notifications"); if (savedSettings) { notifications.value = savedSettings; } }; const navigateToAboutUs = () => { common_vendor.index.navigateTo({ url: "/pages/about/index" }); }; const navigateToPrivacy = () => { common_vendor.index.navigateTo({ url: "/pages/privacy/index" }); }; const handleContact = () => { common_vendor.index.makePhoneCall({ phoneNumber: "400-xxx-xxxx" // 替换为实际的客服电话 }); }; common_vendor.onShow(() => { getCacheSize(); loadNotificationSettings(); }); return (_ctx, _cache) => { return { a: notifications.value.system, b: common_vendor.o(handleSystemNotification), c: notifications.value.crop, d: common_vendor.o(handleCropNotification), e: notifications.value.weather, f: common_vendor.o(handleWeatherNotification), g: common_vendor.t(cacheSize.value), h: common_vendor.o(handleClearCache), i: common_vendor.t(version.value), j: common_vendor.o(checkUpdate), k: common_vendor.o(navigateToAboutUs), l: common_vendor.o(handleContact), m: common_vendor.o(navigateToPrivacy) }; }; } }; wx.createPage(_sfc_main);