From 616415e66756dc0b338373d4950dbe64841b64a5 Mon Sep 17 00:00:00 2001 From: yezian Date: Wed, 24 Apr 2024 16:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=A9=BA=E9=97=B4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/GetWechatModal/index.jsx | 3 +- components/ImageViewer/index.jsx | 72 +++--- components/SpacePost/index.jsx | 125 +++++++++- components/SubmitWechatModal/index.jsx | 231 ++++++++++-------- .../SpaceMember/AllSpaceMember/index.jsx | 7 +- .../SpaceMember/IronfanSpaceMember/index.jsx | 7 +- .../SpaceMember/SuperFanSpaceMember/index.jsx | 7 +- screeens/SpaceSetting/SpaceMember/index.jsx | 13 +- 8 files changed, 299 insertions(+), 166 deletions(-) diff --git a/components/GetWechatModal/index.jsx b/components/GetWechatModal/index.jsx index 7038a2a..7289df6 100644 --- a/components/GetWechatModal/index.jsx +++ b/components/GetWechatModal/index.jsx @@ -101,8 +101,9 @@ export default function GetWechatModal({ visible, setVisible, streamerMid }) { } }; if (!streamerMid) return; + if (!visible) return; getInitData(); - }, [streamerMid]); + }, [streamerMid, visible]); //点击解锁微信按钮 const unlockWechat = async () => { diff --git a/components/ImageViewer/index.jsx b/components/ImageViewer/index.jsx index 1035908..8d79bda 100644 --- a/components/ImageViewer/index.jsx +++ b/components/ImageViewer/index.jsx @@ -17,20 +17,22 @@ import { get } from "../../utils/storeInfo"; import { useNavigation } from "@react-navigation/native"; import MyModal from "../MyModal"; import { Image } from "expo-image"; -import { LinearProgress, Button } from "@rneui/themed"; +import { Button } from "@rneui/themed"; import { LinearGradient } from "expo-linear-gradient"; //imageUrls [{ url: string }] //index int +//lockedStartIndex int +//onPressUnlockBtn () => void export function ImageViewer({ isShow, onClose, + onChange, imageUrls, index, lockedStartIndex, - unlockUrl, - onChange, + onPressUnlockBtn, }) { const tailwind = useTailwind(); const insets = useSafeAreaInsets(); @@ -135,7 +137,7 @@ export function ImageViewer({ } if (isSaving) return; setIsSaving(true); - const isSuccess = await saveImage(imageUrls[index].url); + await saveImage(imageUrls[index].url); setIsSaving(false); }; @@ -146,7 +148,7 @@ export function ImageViewer({ index={index} onClick={closeImageViewer} onSwipeDown={closeImageViewer} - onChange={(index) => onChange(index)} + onChange={onChange ? (index) => onChange(index) : () => null} enableSwipeDown backgroundColor="#07050A" renderImage={(props) => { @@ -165,9 +167,7 @@ export function ImageViewer({ @@ -188,36 +188,32 @@ export function ImageViewer({ } return ; }} - renderFooter={ - Platform.OS === "android" - ? (index) => ( - hanldSaveImage(index)} - style={{ - marginLeft: 20, - marginBottom: insets.bottom, - ...tailwind( - "flex justify-center items-center w-12 h-12 bg-[#FFFFFF1A] rounded-full" - ), - }} - > - {isSaving && } - {!isSaving && ( - - )} - - ) - : () => <> - } - onSave={async (url) => { - const isSuccess = await saveImage(url); + renderFooter={(index) => ( + hanldSaveImage(index)} + style={{ + marginLeft: 20, + marginBottom: insets.bottom, + ...tailwind( + "flex justify-center items-center w-12 h-12 bg-[#FFFFFF1A] rounded-full" + ), + }} + > + {isSaving && } + {!isSaving && ( + + )} + + )} + onSave={(url) => { + saveImage(url); }} - saveToLocalByLongPress={Platform.OS === "android"} + saveToLocalByLongPress menus={MenusComponent} loadingRender={() => } /> diff --git a/components/SpacePost/index.jsx b/components/SpacePost/index.jsx index 47aa5a6..d40ae21 100644 --- a/components/SpacePost/index.jsx +++ b/components/SpacePost/index.jsx @@ -201,6 +201,7 @@ export default function SpacePost({ data }) { data.media_component.video_ids === null ? ( )} + {/* 用户已解锁时展示 */} + {data.c_type === 1 && + data.is_zone_moment_unlocked === 1 && + !isCreator && ( + + + + + + {data.price / 100} + + + 元 + + + + + {data.is_ironfanship_unlocked === 1 && + data.is_ironfan_visible === 1 && + "已使用铁粉特权解锁"} + {data.is_superfanship_unlocked === 1 && + data.is_ironfan_visible === 0 && + "已使用超粉特权解锁"} + {data.is_superfanship_unlocked === 0 && + data.is_ironfanship_unlocked === 0 && + "已付费解锁"} + + + + + + )} {/* 仅对发帖人展示 */} {data.c_type === 1 && isCreator && ( + navigation.navigate("WebWithoutHeader", { + uri: + process.env.EXPO_PUBLIC_WEB_URL + + "/zone/pay/" + + data?.zid + + "/h5_zone_moment/" + + data?.id, + }), }); }} style={ @@ -526,6 +618,23 @@ function ImageDisplay({ data, isUnlocked, visibleRange, mediaAmount, media }) { transition={100} cachePolicy="disk" /> + {isCreator && visibleRange < index + 1 && ( + + + 不可预览 + + + )} {index === 8 && isCollapsed && ( { @@ -174,12 +176,13 @@ export default function SubmitWechatModal({ const apiUrl = process.env.EXPO_PUBLIC_API_URL; const base = await baseRequest(); //提交用户微信和备注 - const signature2 = await generateSignature({ + const body = { order_id: order_id, wechat: userWechat, note: remarks, ...base, - }); + }; + const signature2 = await generateSignature(body); try { const submitWechatResponse = await fetch( `${apiUrl}/api/vas/consumer_fill_contact?signature=${signature2}`, @@ -188,12 +191,7 @@ export default function SubmitWechatModal({ headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ - order_id: unlockData.data.order_id, - wechat: userWechat, - note: remarks, - ...base, - }), + body: JSON.stringify(body), } ); const submitWechatData = await submitWechatResponse.json(); @@ -245,116 +243,133 @@ export default function SubmitWechatModal({ onPress={() => setVisible(false)} style={{ backgroundColor: "#00000080", - ...tailwind("flex-1 justify-center items-center"), + ...tailwind("flex flex-1 justify-center items-center"), }} > - Keyboard.dismiss()} - style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")} + - {isMoneyEnough ? ( - <> - - - - - {streamerData?.name} - - {/* 提交微信区 */} - {isWechatUnlocked && streamerData?.wechat_order_status !== 2 ? ( - - - {(streamerData?.wechat_order_status === 0 || - streamerData?.wechat_order_status === 3) && - "已成功提交您的微信,请耐心等待"} - {(streamerData?.wechat_order_status === 4 || - streamerData?.wechat_order_status === 5) && - "已确认添加,订单完成"} - - - ) : ( - - - *您的微信 - - setUserWechat(value)} - value={userWechat} - /> - - 备注 - - setRemarks(value)} - value={remarks} + Keyboard.dismiss()} + style={tailwind( + "flex flex-col p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4" + )} + > + {isMoneyEnough ? ( + <> + + - )} - - 若解锁后72小时未通过好友,请联系客服 - - {(!isWechatUnlocked || - streamerData?.wechat_order_status === 2) && ( + + {streamerData?.name} + + {/* 提交微信区 */} + {isWechatUnlocked && streamerData?.wechat_order_status !== 2 ? ( + + + {(streamerData?.wechat_order_status === 0 || + streamerData?.wechat_order_status === 3) && + "已成功提交您的微信,请耐心等待"} + {(streamerData?.wechat_order_status === 4 || + streamerData?.wechat_order_status === 5) && + "已确认添加,订单完成"} + + + ) : ( + + + *您的微信 + + setUserWechat(value)} + value={userWechat} + /> + + 备注 + + setRemarks(value)} + value={remarks} + /> + + )} + + 若解锁后72小时未通过好友,请联系客服 + + {(!isWechatUnlocked || + streamerData?.wechat_order_status === 2) && ( + + {!isWechatUnlocked && ( + + 提交并支付({streamerData?.wechat_coin_price}金币) + + )} + {streamerData?.wechat_order_status === 2 && ( + + 提交微信 + + )} + + )} + + ) : ( + <> + + 余额不足 + { + navigation.navigate("Wallet"); + setVisible(false); + }} style={tailwind( "px-4 py-2 bg-[#FF669E] rounded-full items-center justify-center" )} > - {!isWechatUnlocked && ( - - 提交并支付({streamerData?.wechat_coin_price}金币) - - )} - {streamerData?.wechat_order_status === 2 && ( - - 提交微信) - - )} + 前往充值 - )} - - ) : ( - <> - - 余额不足 - - { - navigation.navigate("Wallet"); - setVisible(false); - }} - style={tailwind( - "px-4 py-2 bg-[#FF669E] rounded-full items-center justify-center" - )} - > - 前往充值 - - - )} - + + )} + + ); diff --git a/screeens/SpaceSetting/SpaceMember/AllSpaceMember/index.jsx b/screeens/SpaceSetting/SpaceMember/AllSpaceMember/index.jsx index 57bbc06..899d20b 100644 --- a/screeens/SpaceSetting/SpaceMember/AllSpaceMember/index.jsx +++ b/screeens/SpaceSetting/SpaceMember/AllSpaceMember/index.jsx @@ -5,7 +5,7 @@ import { RefreshControl, Image as NativeImage, } from "react-native"; -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { useTailwind } from "tailwind-rn"; import Toast from "react-native-toast-message"; import Empty from "../../../../components/Empty"; @@ -57,6 +57,10 @@ export default function AllSpaceMember({ zid }) { } }; + useEffect(() => { + getData(); + }, []); + //下拉刷新 const [refreshing, setRefreshing] = useState(false); @@ -143,7 +147,6 @@ export default function AllSpaceMember({ zid }) { onRefresh={() => handleRefresh()} /> } - onEndReached={getData} ListEmptyComponent={} /> diff --git a/screeens/SpaceSetting/SpaceMember/IronfanSpaceMember/index.jsx b/screeens/SpaceSetting/SpaceMember/IronfanSpaceMember/index.jsx index 19fdc38..6f230d9 100644 --- a/screeens/SpaceSetting/SpaceMember/IronfanSpaceMember/index.jsx +++ b/screeens/SpaceSetting/SpaceMember/IronfanSpaceMember/index.jsx @@ -5,7 +5,7 @@ import { RefreshControl, Image as NativeImage, } from "react-native"; -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { useTailwind } from "tailwind-rn"; import Toast from "react-native-toast-message"; import Empty from "../../../../components/Empty"; @@ -57,6 +57,10 @@ export default function IronfanSpaceMember({ zid }) { } }; + useEffect(() => { + getData(); + }, []); + //下拉刷新 const [refreshing, setRefreshing] = useState(false); @@ -143,7 +147,6 @@ export default function IronfanSpaceMember({ zid }) { onRefresh={() => handleRefresh()} /> } - onEndReached={getData} ListEmptyComponent={} /> diff --git a/screeens/SpaceSetting/SpaceMember/SuperFanSpaceMember/index.jsx b/screeens/SpaceSetting/SpaceMember/SuperFanSpaceMember/index.jsx index eabbf08..75be5f5 100644 --- a/screeens/SpaceSetting/SpaceMember/SuperFanSpaceMember/index.jsx +++ b/screeens/SpaceSetting/SpaceMember/SuperFanSpaceMember/index.jsx @@ -5,7 +5,7 @@ import { RefreshControl, Image as NativeImage, } from "react-native"; -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { useTailwind } from "tailwind-rn"; import Toast from "react-native-toast-message"; import Empty from "../../../../components/Empty"; @@ -57,6 +57,10 @@ export default function SuperFanSpaceMember({ zid }) { } }; + useEffect(() => { + getData(); + }, []); + //下拉刷新 const [refreshing, setRefreshing] = useState(false); @@ -143,7 +147,6 @@ export default function SuperFanSpaceMember({ zid }) { onRefresh={() => handleRefresh()} /> } - onEndReached={getData} ListEmptyComponent={} /> diff --git a/screeens/SpaceSetting/SpaceMember/index.jsx b/screeens/SpaceSetting/SpaceMember/index.jsx index 8918ebc..b098685 100644 --- a/screeens/SpaceSetting/SpaceMember/index.jsx +++ b/screeens/SpaceSetting/SpaceMember/index.jsx @@ -27,11 +27,14 @@ export default function SpaceMember({ navigation, route }) { { key: "superFan", title: "空间超粉" }, ]); - const renderScene = SceneMap({ - all: () => , - ironFan: () => , - superFan: () => , - }); + const renderScene = useCallback( + SceneMap({ + all: () => , + ironFan: () => , + superFan: () => , + }), + [route] + ); const renderIndicator = useCallback((props) => { const { position, navigationState, getTabWidth } = props;