diff --git a/src/pages.json b/src/pages.json index e7afde2..7e4b9af 100644 --- a/src/pages.json +++ b/src/pages.json @@ -26,6 +26,24 @@ "navigationBarTitleText": "我的" } }, + { + "path": "pages/mine/about/index", + "style": { + "navigationBarTitleText": "关于我们" + } + }, + { + "path": "pages/mine/privacy/index", + "style": { + "navigationBarTitleText": "隐私政策" + } + }, + { + "path": "pages/mine/network-test/index", + "style": { + "navigationBarTitleText": "网络测试" + } + }, { "path": "pages/login/index", "style": { diff --git a/src/pages/mine/about/index.vue b/src/pages/mine/about/index.vue new file mode 100644 index 0000000..c812206 --- /dev/null +++ b/src/pages/mine/about/index.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index f0b9401..7369c1c 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -10,14 +10,18 @@ {{ userInfo!.nickname }} - 您还未登录,请先 登录 + 您还未登录,请先 + + 登录 + + - 个人信息 + 个人信息 + @@ -32,25 +36,41 @@ - - - - + + + + + + + + - + + + + + 正在清理... + + @@ -72,24 +92,113 @@ const goToLoginPage = () => { const goToProfile = () => { uni.navigateTo({ url: "/pages/mine/profile/index" }); }; -const goToEditProfile = () => { - uni.navigateTo({ url: "/pages/edit-profile/index" }); +const goToPrivacy = () => { + uni.navigateTo({ url: "/pages/mine/privacy/index" }); +}; +const goToNetworkTest = () => { + uni.navigateTo({ url: "/pages/mine/network-test/index" }); }; const goToFAQ = () => { uni.navigateTo({ url: "/pages/faq/index" }); }; const goToAbout = () => { - uni.navigateTo({ url: "/pages/about/index" }); + uni.navigateTo({ url: "/pages/mine/about/index" }); }; const goToSettings = () => { - uni.navigateTo({ url: "/pages/settings/index" }); + uni.showToast({ + title: "建设中...", + icon: "none", + }); + //uni.navigateTo({ url: "/pages/settings/index" }); }; - const handleLogout = () => { userStore.logout().then(() => { uni.showToast({ title: "已退出登录", icon: "success" }); }); }; +// 是否正在清理 +const clearing = ref(false); +// 缓存大小 +const cacheSize = ref("计算中..."); +// 获取缓存大小 +const getCacheSize = async () => { + try { + // #ifdef MP-WEIXIN + const res = await uni.getStorageInfo(); + cacheSize.value = formatSize(res.currentSize); + // #endif + // #ifdef H5 + cacheSize.value = formatSize( + Object.keys(localStorage).reduce((size, key) => size + localStorage[key].length, 0) + ); + // #endif + if (!cacheSize.value) { + cacheSize.value = "0B"; + } + } catch (error) { + console.error("获取缓存大小失败:", error); + cacheSize.value = "获取失败"; + } +}; + +// 格式化存储大小 +const formatSize = (size: number) => { + if (size < 1024) { + return size + "B"; + } else if (size < 1024 * 1024) { + return (size / 1024).toFixed(2) + "KB"; + } else { + return (size / 1024 / 1024).toFixed(2) + "MB"; + } +}; + +// 处理清除缓存 +const handleClearCache = async () => { + if (cacheSize.value === "获取失败") { + uni.showToast({ + title: "获取缓存信息失败,请稍后重试", + icon: "none", + duration: 2000, + }); + return; + } + if (cacheSize.value === "0B") { + uni.showToast({ + title: "暂无缓存需要清理", + icon: "none", + duration: 2000, + }); + return; + } + if (clearing.value) { + return; + } + + try { + clearing.value = true; + // 模拟清理过程 + await new Promise((resolve) => setTimeout(resolve, 1500)); + // 清除缓存 + await uni.clearStorage(); + // 更新缓存大小显示 + await getCacheSize(); + // 提示清理成功 + uni.showToast({ + title: "清理成功", + icon: "success", + }); + } catch (error) { + uni.showToast({ + title: "清理失败", + icon: "error", + }); + } finally { + clearing.value = false; + } +}; +onShow(() => { + getCacheSize(); +}); diff --git a/src/pages/mine/network-test/index.vue b/src/pages/mine/network-test/index.vue new file mode 100644 index 0000000..4842367 --- /dev/null +++ b/src/pages/mine/network-test/index.vue @@ -0,0 +1,316 @@ + + + + + diff --git a/src/pages/mine/privacy/index.vue b/src/pages/mine/privacy/index.vue new file mode 100644 index 0000000..4751861 --- /dev/null +++ b/src/pages/mine/privacy/index.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/src/pages/work/config/index.vue b/src/pages/work/config/index.vue index fc0da07..fdd8bf6 100644 --- a/src/pages/work/config/index.vue +++ b/src/pages/work/config/index.vue @@ -59,7 +59,9 @@ diff --git a/src/pages/work/notice/index.vue b/src/pages/work/notice/index.vue index e57039c..3603532 100644 --- a/src/pages/work/notice/index.vue +++ b/src/pages/work/notice/index.vue @@ -76,7 +76,7 @@ diff --git a/src/static/images/youlaiorg.png b/src/static/images/youlaiorg.png new file mode 100644 index 0000000..2c45027 Binary files /dev/null and b/src/static/images/youlaiorg.png differ