From e68e8b71411aee6f34d71c467e29d87502174679 Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Thu, 17 Jul 2025 17:35:12 +0800 Subject: [PATCH] feat: setting --- app/(tabs)/owner.tsx | 15 +++++++-- assets/icons/svg/moreArrow.svg | 3 ++ components/owner/ranking.tsx | 7 ++-- components/owner/resource.tsx | 45 ++++++++++++------------- components/owner/setting.tsx | 60 +++++++++++++++++----------------- components/owner/userName.tsx | 4 --- i18n/locales/en/personal.json | 3 +- i18n/locales/zh/personal.json | 17 +++++----- types/user.ts | 1 + 9 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 assets/icons/svg/moreArrow.svg diff --git a/app/(tabs)/owner.tsx b/app/(tabs)/owner.tsx index 40f5d46..5754d1b 100644 --- a/app/(tabs)/owner.tsx +++ b/app/(tabs)/owner.tsx @@ -1,4 +1,5 @@ import ConversationsSvg from '@/assets/icons/svg/conversations.svg'; +import MoreArrowSvg from '@/assets/icons/svg/moreArrow.svg'; import PointsSvg from '@/assets/icons/svg/points.svg'; import StoriesSvg from '@/assets/icons/svg/stories.svg'; import UsedStorageSvg from '@/assets/icons/svg/usedStorage.svg'; @@ -74,8 +75,11 @@ export default function OwnerPage() { {/* 资源数据 */} - } style={{ flex: 1 }} isFormatBytes={true} /> - } style={{ flex: 1 }} /> + + } isFormatBytes={true} /> + } /> + + {/* 数据统计 */} + + diff --git a/components/owner/ranking.tsx b/components/owner/ranking.tsx index c4a9166..ea797ee 100644 --- a/components/owner/ranking.tsx +++ b/components/owner/ranking.tsx @@ -27,9 +27,7 @@ const Ranking = ({ data }: { data: TitleRankings[] }) => { renderItem={({ item }) => ( No.{item.ranking} - {item.region} - {item.display_name} - {item.value} + {item.region}{item.display_name} )} /> @@ -73,8 +71,8 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center', width: "100%", - justifyContent: 'space-between', paddingVertical: 8, // 建议加行高 + justifyContent: 'space-between', }, rank: { fontSize: 20, @@ -86,7 +84,6 @@ const styles = StyleSheet.create({ fontSize: 16, fontWeight: '700', color: '#4C320C', - flex: 1, marginHorizontal: 8, // 新增 }, number: { diff --git a/components/owner/resource.tsx b/components/owner/resource.tsx index fcfe6b5..92b2566 100644 --- a/components/owner/resource.tsx +++ b/components/owner/resource.tsx @@ -1,4 +1,4 @@ -import { StyleProp, StyleSheet, View, ViewStyle } from "react-native"; +import { Dimensions, StyleProp, StyleSheet, View, ViewStyle } from "react-native"; import * as Progress from 'react-native-progress'; import { ThemedText } from "../ThemedText"; import { formatBytes } from "../utils/bytes"; @@ -17,29 +17,20 @@ interface ResourceProps { isFormatBytes?: boolean; } const ResourceComponent = (props: ResourceProps) => { + // 获取设备的宽度 + const width = Dimensions.get("window").width; return ( - - + + {props.title} - {props.subtitle || " "} + - + + {props.isFormatBytes ? formatBytes(props.data.used) : props.data.used}/{props.isFormatBytes ? formatBytes(props.data.all) : props.data.all} {props.icon} - - {props.isFormatBytes ? formatBytes(props.data.used) : props.data.used}/{props.isFormatBytes ? formatBytes(props.data.all) : props.data.all} - - ); }; @@ -47,25 +38,35 @@ const ResourceComponent = (props: ResourceProps) => { const styles = StyleSheet.create({ container: { width: "100%", - backgroundColor: "#FAF9F6", - padding: 16, - borderRadius: 18, + position: "relative", }, - header: { + content: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", }, + titleContent: { + width: "90%", + flexDirection: "row", + alignItems: "center", + gap: 16, + }, title: { fontSize: 12, fontWeight: "700", + width: 100 }, subtitle: { fontSize: 10, fontWeight: "400", }, dataContainer: { - flexDirection: "column", + position: "absolute", + right: 0, + top: -16, + flexDirection: "row", + alignItems: "center", + gap: 8, }, dataText: { fontSize: 12, diff --git a/components/owner/setting.tsx b/components/owner/setting.tsx index 29b716a..2193ac5 100644 --- a/components/owner/setting.tsx +++ b/components/owner/setting.tsx @@ -7,7 +7,7 @@ import * as Location from 'expo-location'; import { useRouter } from 'expo-router'; import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Linking, Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; +import { Linking, Modal, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { ThemedText } from '../ThemedText'; import LcensesModal from './qualification/lcenses'; import PrivacyModal from './qualification/privacy'; @@ -205,7 +205,7 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: currentLocation={currentLocation} /> {/* 升级版本 */} - + {/* {t('generalSetting.subscription', { ns: 'personal' })} @@ -223,9 +223,9 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: - + */} {/* 消息通知 */} - + {/* {t('permission.pushNotification', { ns: 'personal' })} @@ -236,7 +236,7 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: toggleSwitch={toggleNotifications} /> - + */} {/* 权限信息 */} {t('permission.permissionManagement', { ns: 'personal' })} @@ -261,7 +261,16 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: toggleSwitch={toggleLocation} /> - {/* */} + + + + {t('permission.pushNotification', { ns: 'personal' })} + + + {/* 相册成片权限 */} {/* @@ -298,26 +307,11 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: {t('lcenses.title', { ns: 'personal' })} - { setLcensesModalVisible(true) }} > - {t('lcenses.qualification', { ns: 'personal' })} - - - - Linking.openURL("https://beian.miit.gov.cn/")} > - {t('lcenses.ICP', { ns: 'personal' })}沪ICP备2023032876号-4 - - - { setModalType('privacy'); setPrivacyModalVisible(true) }} > {t('lcenses.privacyPolicy', { ns: 'personal' })} - { setModalType('ai'); setPrivacyModalVisible(true) }} > - {t('lcenses.aiPolicy', { ns: 'personal' })} - - - { setModalType('terms'); setPrivacyModalVisible(true) }} > {t('lcenses.applyPermission', { ns: 'personal' })} @@ -327,6 +321,21 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: {t('lcenses.userAgreement', { ns: 'personal' })} + + { setModalType('ai'); setPrivacyModalVisible(true) }} > + {t('lcenses.aiPolicy', { ns: 'personal' })} + + + + { setLcensesModalVisible(true) }} > + {t('lcenses.qualification', { ns: 'personal' })} + + + + Linking.openURL("https://beian.miit.gov.cn/")} > + {t('lcenses.ICP', { ns: 'personal' })}沪ICP备2023032876号-4 + + {/* 其他信息 */} @@ -338,15 +347,6 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: {/* */} - {Platform.OS !== 'ios' && ( - - Linking.openURL("https://work.weixin.qq.com/kfid/kfca0ac87f4e05e8bfd")} > - {t('generalSetting.cleanCache', { ns: 'personal' })} - {/* */} - - - - )} {t('generalSetting.version', { ns: 'personal' })} {"0.5.0"} diff --git a/components/owner/userName.tsx b/components/owner/userName.tsx index 691c276..c75e889 100644 --- a/components/owner/userName.tsx +++ b/components/owner/userName.tsx @@ -64,12 +64,8 @@ export default function UserInfo({ userInfo }: { userInfo: UserInfoDetails }) { source={{ uri: userInfo.user_info.avatar_file_url }} style={{ width: 80, height: 80, borderRadius: 40 }} onError={() => { - console.log('图片加载失败:', userInfo.user_info.avatar_file_url); setImageError(true); }} - onLoad={() => { - console.log('图片加载成功'); - }} /> ) : ( diff --git a/i18n/locales/en/personal.json b/i18n/locales/en/personal.json index 8fc1e2f..0fbadeb 100644 --- a/i18n/locales/en/personal.json +++ b/i18n/locales/en/personal.json @@ -82,6 +82,7 @@ "live": "Live Photos", "videoLength": "Video Duration", "storiesCreated": "Stories Created", - "conversationsWithMemo": "Conversations with Memo" + "conversationsWithMemo": "Conversations with Memo", + "setting": "Settings" } } \ No newline at end of file diff --git a/i18n/locales/zh/personal.json b/i18n/locales/zh/personal.json index ae05a98..3f0c5f9 100644 --- a/i18n/locales/zh/personal.json +++ b/i18n/locales/zh/personal.json @@ -40,30 +40,30 @@ "otherLcenses": "其他协议", "userAgreement": "用户协议", "privacyPolicy": "隐私政策", - "aiPolicy": "《AI功能使用规范》", - "applyPermission": "申请使用权限", + "aiPolicy": "AI功能使用规范", + "applyPermission": "服务协议", "qualification": "资质证照" }, "permission": { - "permissionManagement": "权限管理设置", + "permissionManagement": "权限管理", "pushNotification": "推送权限", "galleryAccess": "相册权限", "locationPermission": "位置权限", - "personalizedRecommendation": "个性化推荐设置" + "personalizedRecommendation": "个性化推荐" }, "generalSetting": { "title": "通用设置", - "permissionManagement": "权限管理设置", + "permissionManagement": "权限管理", "pushNotification": "推送权限", "galleryAccess": "相册权限", - "personalizedRecommendation": "个性化推荐设置", + "personalizedRecommendation": "个性化推荐", "deleteAccount": "注销账号", "logout": "退出登录", "upgrade": "升级", "subscription": "订阅", "subscriptionTitle": "MemoWake Premium", "subscriptionText": "Unlock more of what you love", - "otherInformation": "其他信息", + "otherInformation": "通用设置", "contactUs": "联系客服", "version": "版本号", "cleanCache": "清理缓存", @@ -82,6 +82,7 @@ "live": "动图", "videoLength": "视频时长", "storiesCreated": "创作视频", - "conversationsWithMemo": "Memo对话" + "conversationsWithMemo": "Memo对话", + "setting": "设置" } } \ No newline at end of file diff --git a/types/user.ts b/types/user.ts index 05dd862..ff1665d 100644 --- a/types/user.ts +++ b/types/user.ts @@ -54,6 +54,7 @@ export interface UserInfoDetails { remain_points: number, total_points: number, title_rankings: TitleRankings[], + total_bytes: number, medal_infos: { "id": number, "url": string