feat: 协议标题
This commit is contained in:
parent
792c3a0888
commit
1d420773cd
@ -5,8 +5,21 @@ import { Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'rea
|
|||||||
import RenderHtml from 'react-native-render-html';
|
import RenderHtml from 'react-native-render-html';
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
|
|
||||||
const PrivacyModal = (props: { modalVisible: boolean, setModalVisible: (visible: boolean) => void, type: string }) => {
|
interface PrivacyModalProps {
|
||||||
const { modalVisible, setModalVisible, type } = props;
|
modalVisible: boolean;
|
||||||
|
setModalVisible: (visible: boolean) => void;
|
||||||
|
type: 'ai' | 'terms' | 'privacy' | 'user' | 'membership';
|
||||||
|
}
|
||||||
|
|
||||||
|
const titleMap = {
|
||||||
|
ai: 'AI Policy',
|
||||||
|
terms: 'Terms of Service',
|
||||||
|
privacy: 'Privacy Policy',
|
||||||
|
user: 'User Agreement',
|
||||||
|
membership: 'Membership Agreement'
|
||||||
|
};
|
||||||
|
|
||||||
|
const PrivacyModal = ({ modalVisible, setModalVisible, type }: PrivacyModalProps) => {
|
||||||
const [article, setArticle] = useState<Policy>({} as Policy);
|
const [article, setArticle] = useState<Policy>({} as Policy);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -44,7 +57,7 @@ const PrivacyModal = (props: { modalVisible: boolean, setModalVisible: (visible:
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 会员协议
|
// 会员协议
|
||||||
if (type === 'member') {
|
if (type === 'membership') {
|
||||||
fetchApi<Policy>(`/system-config/policy/membership_agreement`).then((res: any) => {
|
fetchApi<Policy>(`/system-config/policy/membership_agreement`).then((res: any) => {
|
||||||
setArticle(res)
|
setArticle(res)
|
||||||
}).catch((error: any) => {
|
}).catch((error: any) => {
|
||||||
@ -77,7 +90,9 @@ const PrivacyModal = (props: { modalVisible: boolean, setModalVisible: (visible:
|
|||||||
<View style={styles.modalView}>
|
<View style={styles.modalView}>
|
||||||
<View style={styles.modalHeader}>
|
<View style={styles.modalHeader}>
|
||||||
<Text style={{ opacity: 0 }}>Settings</Text>
|
<Text style={{ opacity: 0 }}>Settings</Text>
|
||||||
<Text style={styles.modalTitle}>{type === 'ai' ? 'AI Policy' : type === 'terms' ? 'Terms of Service' : type === 'privacy' ? 'Privacy Policy' : 'User Agreement'}</Text>
|
<Text style={styles.modalTitle}>
|
||||||
|
{titleMap[type] || 'User Agreement'}
|
||||||
|
</Text>
|
||||||
<TouchableOpacity onPress={() => setModalVisible(false)}>
|
<TouchableOpacity onPress={() => setModalVisible(false)}>
|
||||||
<Text style={styles.closeButton}>×</Text>
|
<Text style={styles.closeButton}>×</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user