diff --git a/screeens/CreateImagePost/index.jsx b/screeens/CreateImagePost/index.jsx
index cb3c086..ccc09c7 100644
--- a/screeens/CreateImagePost/index.jsx
+++ b/screeens/CreateImagePost/index.jsx
@@ -132,7 +132,7 @@ export default function CreateImagePost({ navigation, route }) {
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
try {
const base = await baseRequest();
- const signature = await generateSignature({
+ const body = {
...base,
c_type: parseFloat(price) ? 1 : 0,
is_ironfan_visible: isFreeForIronfan ? 1 : 0,
@@ -146,7 +146,8 @@ export default function CreateImagePost({ navigation, route }) {
? parseInt(imageVisibleRange, 10)
: 1,
price: parseFloat(price) ? parseInt(parseFloat(price) * 100, 10) : null,
- });
+ };
+ const signature = await generateSignature(body);
const response = await fetch(
`${apiUrl}/api/zone_moment/create?signature=${signature}`,
{
@@ -154,23 +155,7 @@ export default function CreateImagePost({ navigation, route }) {
headers: {
"Content-Type": "application/json",
},
- body: JSON.stringify({
- ...base,
- c_type: parseFloat(price) ? 1 : 0,
- is_ironfan_visible: isFreeForIronfan ? 1 : 0,
- m_type: 1,
- text: content,
- media_component: media,
- text_visible_range: textVisibleRange
- ? parseInt(textVisibleRange, 10)
- : 999,
- media_visible_range: imageVisibleRange
- ? parseInt(imageVisibleRange, 10)
- : 0,
- price: parseFloat(price)
- ? parseInt(parseFloat(price) * 100, 10)
- : null,
- }),
+ body: JSON.stringify(body),
}
);
const data = await response.json();
diff --git a/screeens/CreateVideoPost/index.jsx b/screeens/CreateVideoPost/index.jsx
index 312d98b..f3d122b 100644
--- a/screeens/CreateVideoPost/index.jsx
+++ b/screeens/CreateVideoPost/index.jsx
@@ -110,7 +110,7 @@ export default function CreateVideoPost({ navigation, route }) {
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
try {
const base = await baseRequest();
- const signature = await generateSignature({
+ const body = {
...base,
c_type: parseFloat(price) ? 1 : 0,
is_ironfan_visible: isFreeForIronfan ? 1 : 0,
@@ -122,7 +122,8 @@ export default function CreateVideoPost({ navigation, route }) {
: 999,
is_blurring_cover: blurCover ? 1 : 0,
price: parseFloat(price) ? parseInt(parseFloat(price) * 100, 10) : null,
- });
+ };
+ const signature = await generateSignature(body);
const response = await fetch(
`${apiUrl}/api/zone_moment/create?signature=${signature}`,
{
@@ -130,21 +131,7 @@ export default function CreateVideoPost({ navigation, route }) {
headers: {
"Content-Type": "application/json",
},
- body: JSON.stringify({
- ...base,
- c_type: parseFloat(price) ? 1 : 0,
- is_ironfan_visible: isFreeForIronfan ? 1 : 0,
- m_type: 2,
- text: content,
- media_component: media,
- text_visible_range: textVisibleRange
- ? parseInt(textVisibleRange, 10)
- : 999,
- is_blurring_cover: blurCover ? 1 : 0,
- price: parseFloat(price)
- ? parseInt(parseFloat(price) * 100, 10)
- : null,
- }),
+ body: JSON.stringify(body),
}
);
const data = await response.json();
diff --git a/screeens/ShareSpace/index.jsx b/screeens/ShareSpace/index.jsx
index 1d2bd8b..1ebddfb 100644
--- a/screeens/ShareSpace/index.jsx
+++ b/screeens/ShareSpace/index.jsx
@@ -7,7 +7,6 @@ import MyDivider from "../../components/MyDivider";
import { Icon } from "@rneui/themed";
import * as Clipboard from "expo-clipboard";
-//todo:修改生成分享卡片的跳转链接
export default function ShareSpace({ navigation, route }) {
const tailwind = useTailwind();
const insets = useSafeAreaInsets();
diff --git a/screeens/Space/SpaceList/index.jsx b/screeens/Space/SpaceList/index.jsx
index bd99b13..03d7366 100644
--- a/screeens/Space/SpaceList/index.jsx
+++ b/screeens/Space/SpaceList/index.jsx
@@ -1,5 +1,5 @@
import { View, Text, RefreshControl, TouchableOpacity } from "react-native";
-import React, { useState, useEffect, useCallback } from "react";
+import React, { useState, useCallback } from "react";
import { useTailwind } from "tailwind-rn";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Toast from "react-native-toast-message";
@@ -9,6 +9,7 @@ import { useNavigation } from "@react-navigation/native";
import SpaceCard from "../../../components/SpaceCard";
import baseRequest from "../../../utils/baseRequest";
import { generateSignature } from "../../../utils/crypto";
+import { useFocusEffect } from "@react-navigation/native";
export default function SpaceList() {
const tailwind = useTailwind();
@@ -17,6 +18,7 @@ export default function SpaceList() {
const navigation = useNavigation();
const [data, setData] = useState([]);
+
const getData = async () => {
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
@@ -57,6 +59,12 @@ export default function SpaceList() {
console.error(error);
}
};
+ //每次focus都更新一次数据
+ useFocusEffect(
+ useCallback(() => {
+ getData();
+ }, [])
+ );
const renderItem = ({ item }) => ;
@@ -108,7 +116,6 @@ export default function SpaceList() {
return (
handleRefresh()}
/>
}
- onEndReached={getData}
ListEmptyComponent={EmptyComponent}
/>
diff --git a/screeens/SpaceIntroduce/index.jsx b/screeens/SpaceIntroduce/index.jsx
index 0c326f9..779cad2 100644
--- a/screeens/SpaceIntroduce/index.jsx
+++ b/screeens/SpaceIntroduce/index.jsx
@@ -19,6 +19,7 @@ import VideoModal from "../../components/VideoModal";
import SpaceIntroduceSkeleton from "./skeleton";
import { usePreventScreenCapture } from "expo-screen-capture";
import { useFocusEffect } from "@react-navigation/native";
+import ImageViewer from "../../components/ImageViewer";
export default function SpaceIntroduce({ navigation, route }) {
usePreventScreenCapture();
@@ -78,6 +79,16 @@ export default function SpaceIntroduce({ navigation, route }) {
}, [])
);
+ //控制图片modal可见性
+ const [imagesVisible, setImagesVisible] = useState(false);
+ //控制图片modal中打开的图片索引
+ const [imageIndex, setImageIndex] = useState("");
+ const images = data?.streamer_ext?.album?.images?.map((image, index) => {
+ if (index > 4) return;
+ return image?.urls[0];
+ });
+ const imagesForImageViewer = images?.map((url) => ({ url }));
+
//当空间价格为0时,直接加入空间
const handleJoinFreeSpace = async () => {
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
@@ -263,7 +274,15 @@ export default function SpaceIntroduce({ navigation, route }) {
{data?.streamer_ext?.album?.images?.map((item, index) => {
if (index > 4) return;
return (
-
+ {
+ setImageIndex(index);
+ setImagesVisible(true);
+ }}
+ key={index}
+ style={tailwind("basis-1/3 p-0.5")}
+ >
-
+
);
})}
@@ -330,13 +349,15 @@ export default function SpaceIntroduce({ navigation, route }) {
"flex flex-row items-center justify-center h-12 rounded-full px-10 bg-[#FF669E]"
)}
>
-
+ {data?.admission_price !== 0 && (
+
+ )}
{data?.admission_price === 0
- ? "立即加入"
+ ? "免费加入"
: `${data?.admission_price / 100}元立即加入`}
@@ -363,6 +384,13 @@ export default function SpaceIntroduce({ navigation, route }) {
setVisible={setShowVideo}
url={data?.streamer_ext?.shorts?.videos[0]?.urls[0]}
/>
+ {/* 展示图片的modal */}
+
);
}
diff --git a/screeens/SpaceSetting/AgencySetting/index.jsx b/screeens/SpaceSetting/AgencySetting/index.jsx
index bc54542..e7a3bd4 100644
--- a/screeens/SpaceSetting/AgencySetting/index.jsx
+++ b/screeens/SpaceSetting/AgencySetting/index.jsx
@@ -200,7 +200,7 @@ export default function AgencySetting({ navigation, route }) {
const generateItems = useCallback((min, max) => {
const items = [];
for (let i = min; i <= max; i++) {
- items.push({ label: i.toString(), value: i.toString() });
+ items.push({ label: `${i.toString()}%`, value: i.toString() });
}
return items;
}, []);
diff --git a/screeens/SpaceSetting/CollaboratorSetting/index.jsx b/screeens/SpaceSetting/CollaboratorSetting/index.jsx
index 5127a85..ed3ef64 100644
--- a/screeens/SpaceSetting/CollaboratorSetting/index.jsx
+++ b/screeens/SpaceSetting/CollaboratorSetting/index.jsx
@@ -7,6 +7,7 @@ import {
KeyboardAvoidingView,
TouchableOpacity,
Image as NativeImage,
+ ActivityIndicator,
} from "react-native";
import React, { useState, useEffect, useCallback, useMemo } from "react";
import { useTailwind } from "tailwind-rn";
@@ -30,41 +31,47 @@ export default function CollaboratorSetting({ navigation, route }) {
//获取数据
const [data, setData] = useState();
- useEffect(() => {
- const getData = async () => {
- try {
- const base = await baseRequest();
- const body = {
- zid: route.params.data.id,
- visitor_role: route.params.data.visitor_role,
- ...base,
- };
- const signature = await generateSignature(body);
- const _response = await fetch(
- `${apiUrl}/api/zone_collaborator/list?signature=${signature}`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(body),
- }
- );
- const _data = await _response.json();
- console.log(_data);
- if (_data.ret === -1) {
- Toast.show({
- type: "error",
- text1: _data.msg,
- topOffset: 60,
- });
- return;
+ const [selfMid, setSelfMid] = useState();
+ const [isFetching, setIsFetching] = useState(true);
+ const getData = async () => {
+ setIsFetching(true);
+ try {
+ const base = await baseRequest();
+ setSelfMid(base.b_mid);
+ const body = {
+ zid: route.params.data.id,
+ visitor_role: route.params.data.visitor_role,
+ ...base,
+ };
+ const signature = await generateSignature(body);
+ const _response = await fetch(
+ `${apiUrl}/api/zone_collaborator/list?signature=${signature}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(body),
}
- setData(_data.data.list);
- } catch (error) {
- console.error(error);
+ );
+ const _data = await _response.json();
+ console.log(_data);
+ if (_data.ret === -1) {
+ Toast.show({
+ type: "error",
+ text1: _data.msg,
+ topOffset: 60,
+ });
+ return;
}
- };
+ setData(_data.data);
+ } catch (error) {
+ console.error(error);
+ } finally {
+ setIsFetching(false);
+ }
+ };
+ useEffect(() => {
getData();
}, []);
@@ -125,15 +132,28 @@ export default function CollaboratorSetting({ navigation, route }) {
//分成比例
const [rate, setRate] = useState();
+ //计算代运营剩余比例
+ const remainingRate = useMemo(() => {
+ if (!data) return;
+ const totalRate = data?.list?.reduce(
+ (acc, cur) => acc + cur.sharing_ratio,
+ 0
+ );
+ return (data?.zone_third_partner?.sharing_ratio - totalRate).toFixed(2);
+ }, [data]);
+
//生成比例选项
const generateItems = useCallback((min, max) => {
const items = [];
for (let i = min; i <= max; i++) {
- items.push({ label: i.toString(), value: i.toString() });
+ items.push({ label: `${i.toString()}%`, value: i.toString() });
}
return items;
}, []);
- const rates = useMemo(() => generateItems(1, 50), []);
+ const rates = useMemo(
+ () => generateItems(1, parseInt(remainingRate * 100)),
+ [remainingRate]
+ );
//提交
const handleSubmit = async () => {
@@ -188,6 +208,8 @@ export default function CollaboratorSetting({ navigation, route }) {
text1: "添加合伙人成功",
topOffset: 60,
});
+ getData();
+ handleCancel();
} catch (error) {
console.error(error);
}
@@ -237,13 +259,15 @@ export default function CollaboratorSetting({ navigation, route }) {
text1: "移除合伙人成功",
topOffset: 60,
});
+ getData();
+ handleCancel();
} catch (error) {
console.error(error);
}
};
//单个协作者组件
- const CollaboratorItem = ({ item }) => {
+ const CollaboratorItem = useCallback(({ item }) => {
return (
@@ -298,7 +322,7 @@ export default function CollaboratorSetting({ navigation, route }) {
- {route.params.data.visitor_role === 1 && (
+ {!item?.isDeleteBtnInvisible && (
);
- };
+ }, []);
+
+ if (isFetching) {
+ return (
+
+
+
+ );
+ }
+
+ if (route.params.data.visitor_role === 2) {
+ const selfData = data?.list?.filter(
+ (item) => item.collaborator_mid === selfMid
+ );
+ return (
+
+
+ 合伙人昵称:{selfData.collaborator_account.name}
+
+
+ ID:{selfData.collaborator_account.user_id}
+
+
+ 分成比例:{data.sharing_ratio * 100}%
+
+
+ );
+ }
return (
- 35%
+ {data?.zone_third_partner?.sharing_ratio * 100}%
修改比例请联系平台客服
-
- {route.params.data.visitor_role === 1 && (
- setIsAddCollaboratorModalVisible(true)}
- type="ionicon"
- name="add"
- size={40}
- color="white"
- containerStyle={tailwind(
- "border border-white rounded-full w-[4.6rem] h-[4.6rem] flex items-center justify-center"
- )}
+
+
+
- )}
-
- {data?.map((item, index) => (
+ {data?.list?.map((item, index) => (
))}
+ setIsAddCollaboratorModalVisible(true)}
+ type="ionicon"
+ name="add"
+ size={40}
+ color="white"
+ containerStyle={tailwind(
+ "border border-white rounded-full w-[4.6rem] h-[4.6rem] flex items-center justify-center mt-4"
+ )}
+ />
注意事项:
diff --git a/screeens/SpaceSetting/SpaceRefund/index.jsx b/screeens/SpaceSetting/SpaceRefund/index.jsx
index 5212607..833654a 100644
--- a/screeens/SpaceSetting/SpaceRefund/index.jsx
+++ b/screeens/SpaceSetting/SpaceRefund/index.jsx
@@ -56,6 +56,7 @@ export default function SpaceRefund({ navigation, route }) {
if (isSubmitting) return;
setIsSubmitting(true);
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
+ const base = await baseRequest();
try {
const body = {
zid: route.params.data.id,
@@ -76,7 +77,6 @@ export default function SpaceRefund({ navigation, route }) {
}
);
const _data = await _response.json();
- console.log(_data);
if (_data.ret === -1) {
Toast.show({
type: "error",
diff --git a/screeens/StreamerSpace/index.jsx b/screeens/StreamerSpace/index.jsx
index b4d85ea..fb1b70a 100644
--- a/screeens/StreamerSpace/index.jsx
+++ b/screeens/StreamerSpace/index.jsx
@@ -145,12 +145,21 @@ export default function StreamerSpace({ navigation, route }) {
//tab组件相关
const layout = useWindowDimensions();
const [index, setIndex] = useState(0);
- const [routes] = useState([
+ const [routes, setRoutes] = useState([
{ key: "all", title: "全部" },
{ key: "ironFan", title: "铁粉专享" },
{ key: "superFan", title: "超粉专享" },
]);
+ //当主播没开通超粉功能时不展示超粉专享tab
+ useEffect(() => {
+ if (data?.is_superfanship_enabled === 0)
+ setRoutes([
+ { key: "all", title: "全部" },
+ { key: "ironFan", title: "铁粉专享" },
+ ]);
+ }, [data]);
+
const renderScene = useCallback(
SceneMap({
all: () => ,
diff --git a/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx b/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
index b5dc3e8..dd51a01 100644
--- a/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
+++ b/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
@@ -19,7 +19,6 @@ import Toast from "react-native-toast-message";
import * as Clipboard from "expo-clipboard";
import { generateSignature } from "../../../utils/crypto";
-//todo:等待接口上线,完善样式,测试
export default function AlreadyAddWechat({}) {
const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";