anln_0000001_1.8 #32

Merged
yezian merged 4 commits from anln_0000001_1.8 into main 2025-02-11 16:23:39 +08:00
12 changed files with 230 additions and 190 deletions

View File

@ -563,7 +563,7 @@ const App = () => {
onPress={() => navigation.goBack()}
/>
),
title: "动态",
title: "广场动态",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}

View File

@ -14,7 +14,6 @@ import { useImageViewer } from "../../context/ImageViewProvider";
import VideoModal from "../VideoModal";
import * as ImagePicker from "expo-image-picker";
import * as VideoThumbnails from "expo-video-thumbnails";
/*
props格式
setDragging 返回正在拖动的状态用于该组件嵌套在ScrollView中的时候禁用ScrollView的滚动
@ -65,6 +64,7 @@ export default function MediaPicker({
allowsMultipleSelection: true,
selectionLimit: maxCount - _assets.length,
quality: 1,
// exif: true,
});
if (!result.canceled) {

View File

@ -129,6 +129,7 @@ export default function Post({ data, isOwn = false, tagElement = null }) {
...tailwind(
"ml-1 justify-center items-center rounded-full px-3 h-6"
),
display: !isOwn ? "flex" : "none",
}}
>
<Text style={tailwind("text-white text-xs")}>
@ -166,51 +167,60 @@ export default function Post({ data, isOwn = false, tagElement = null }) {
<View
style={{
...tailwind("flex flex-row items-center justify-between h-8"),
display: !isOwn ? "flex" : "none",
}}
>
{data?.streamer_ext?.is_active_within_a_week === 1 ? (
<TouchableOpacity
onPress={() =>
navigation.navigate("SpaceIntroduce", { mid: data?.mid })
}
style={tailwind("flex flex-row items-center")}
>
<NativeImage
source={require("../../assets/icon/others/space_new_post.png")}
/>
<Text style={tailwind("text-[#FF669E] font-medium text-xs")}>
空间
{formatZoneUpdateTime(
data?.streamer_ext
?.days_elapsed_since_the_last_zones_update
)}
有更新
</Text>
<NativeImage
source={require("../../assets/icon/others/pinklink.png")}
/>
</TouchableOpacity>
) : (
data?.streamer_ext?.zones?.length !== 0 && (
<View
style={{
display: !isOwn ? "flex" : "none",
}}
>
{data?.streamer_ext?.is_active_within_a_week === 1 ? (
<TouchableOpacity
onPress={() =>
navigation.navigate("SpaceIntroduce", { mid: data?.mid })
}
style={tailwind("flex flex-row items-center")}
>
<NativeImage
source={require("../../assets/icon/others/space_new_post.png")}
/>
<Text
style={tailwind("text-[#FFFFFFB2] font-medium text-xs")}
style={tailwind("text-[#FF669E] font-medium text-xs")}
>
查看TA的空间
空间
{formatZoneUpdateTime(
data?.streamer_ext
?.days_elapsed_since_the_last_zones_update
)}
有更新
</Text>
<NativeImage
style={{ right: 10, transform: [{ scale: 0.75 }] }}
source={require("../../assets/icon/32DP/smalllink.png")}
source={require("../../assets/icon/others/pinklink.png")}
/>
</TouchableOpacity>
)
)}
) : (
data?.streamer_ext?.zones?.length !== 0 && (
<TouchableOpacity
onPress={() =>
navigation.navigate("SpaceIntroduce", {
mid: data?.mid,
})
}
style={tailwind("flex flex-row items-center")}
>
<Text
style={tailwind("text-[#FFFFFFB2] font-medium text-xs")}
>
查看TA的空间
</Text>
<NativeImage
style={{ right: 10, transform: [{ scale: 0.75 }] }}
source={require("../../assets/icon/32DP/smalllink.png")}
/>
</TouchableOpacity>
)
)}
</View>
<View style={tailwind("flex flex-row items-center ml-auto")}>
<TouchableOpacity
style={tailwind("flex flex-row items-center")}

View File

@ -189,7 +189,7 @@ export default function CreateImagePost({ navigation, route }) {
//Toast
Toast.show({
type: "success",
text1: "发布成功",
text1: "上传成功,请耐心等待审核",
topOffset: 60,
});
navigation.goBack();

View File

@ -95,7 +95,7 @@ export default function CreatePost({ navigation, route }) {
//Toast
Toast.show({
type: "success",
text1: "发布成功",
text1: "上传成功,请耐心等待审核",
topOffset: 60,
});
navigation.goBack();

View File

@ -165,7 +165,7 @@ export default function CreateVideoPost({ navigation, route }) {
//Toast
Toast.show({
type: "success",
text1: "发布成功",
text1: "上传成功,请耐心等待审核",
topOffset: 60,
});
navigation.goBack();

View File

@ -9,7 +9,7 @@ import {
TouchableOpacity,
Platform,
} from "react-native";
import React, { useState, useEffect, useCallback } from "react";
import React, { useState, useEffect } from "react";
import { useTailwind } from "tailwind-rn";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import MediaPicker from "../../components/MediaPicker";
@ -17,8 +17,6 @@ import Toast from "react-native-toast-message";
import { multiUpload } from "../../utils/upload";
import baseRequest from "../../utils/baseRequest";
import { generateSignature } from "../../utils/crypto";
import { Image } from "expo-image";
import { Icon } from "@rneui/themed";
import { Button, Switch } from "@rneui/themed";
import MediaGrid from "../../components/MediaGrid";
import requireAPI from "../../utils/requireAPI";
@ -92,6 +90,7 @@ export default function EditSpacePost({ navigation, route }) {
paid_text,
price,
media_visible_range,
text_visible_range,
is_creating_paid_text,
is_ironfan_visible,
is_blurring_cover,
@ -99,13 +98,16 @@ export default function EditSpacePost({ navigation, route }) {
media_component,
} = _data.data.list[0];
setContent(
paid_text ? text.slice(0, text.length - paid_text.length) : text
is_creating_paid_text
? text.slice(0, text.length - paid_text.length)
: text
);
setPrice(price ? price / 100 : 0);
setTextVisibleRange(media_visible_range);
setPrice((price ? price / 100 : 0).toString());
setTextVisibleRange(text_visible_range.toString());
setImageVisibleRange(media_visible_range.toString());
setBlurCover(is_blurring_cover === 1);
setIsFreeForIronfan(is_ironfan_visible === 1);
setPaidText(!paid_text ?? paid_text.substring(1));
setPaidText(paid_text ? paid_text.substring(1) : "");
setIsCreatingPaidText(is_creating_paid_text === 1);
setOldMediaAssets(
m_type === 1 ? media_component.images : media_component.videos
@ -411,7 +413,11 @@ export default function EditSpacePost({ navigation, route }) {
<MediaPicker
setDragging={setDragging}
maxCount={initalData.m_type === 1 ? 30 : 1}
maxCount={
initalData.m_type === 1
? 30 - oldMediaAssets.length
: 1 - oldMediaAssets.length
}
type={initalData.m_type === 1 ? "image" : "video"}
setAssets={setNewMediaAssets}
/>

View File

@ -4,12 +4,10 @@ import {
TextInput,
ScrollView,
ActivityIndicator,
Modal,
KeyboardAvoidingView,
TouchableOpacity,
Platform,
} from "react-native";
import React, { useState, useEffect, useCallback } from "react";
import React, { useState, useEffect } from "react";
import { useTailwind } from "tailwind-rn";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import MediaPicker from "../../components/MediaPicker";
@ -85,7 +83,7 @@ export default function EditStreamerPost({ navigation, route }) {
</Text>
),
});
}, [isSubmitting, handleSubmit, formData, mediaAssets]);
}, [isSubmitting, handleSubmit, formData, mediaAssets, oldMediaAssets]);
//ScrollView
const [dragging, setDragging] = useState(false);
@ -231,7 +229,11 @@ export default function EditStreamerPost({ navigation, route }) {
)}
<MediaPicker
setDragging={setDragging}
maxCount={mType === 1 ? 30 : 1}
maxCount={
mType === 1
? 9 - oldMediaAssets.length
: 1 - oldMediaAssets.length
}
type={mType === 1 ? "image" : "video"}
setAssets={setMediaAssets}
/>

View File

@ -3,6 +3,9 @@ import {
TouchableOpacity,
Image as NativeImage,
Text,
Platform,
ScrollView,
KeyboardAvoidingView,
} from "react-native";
import React, {
useState,
@ -20,14 +23,17 @@ import requireAPI from "../../../../utils/requireAPI";
import { Image } from "expo-image";
import { connect } from "react-redux";
import dayjs from "dayjs";
import { useFocusEffect } from "@react-navigation/native";
import ScrollNotice from "../ScrollNotice";
import { goToPage } from "../../../../utils/tools";
import { get } from "../../../../utils/storeInfo";
const MessageList = ({ navigation, noticeCount, refInstance }) => {
const dispatch = useDispatch();
const [data, setData] = useState([]);
const [scollNotice, setScollNotice] = useState({});
const tailwind = useTailwind();
const insets = useSafeAreaInsets();
const [account, setAccount] = useState(null);
const [infoItems, setInfoItems] = useState([
{
title: "系统通知",
@ -100,10 +106,17 @@ const MessageList = ({ navigation, noticeCount, refInstance }) => {
}
},
}));
useFocusEffect(() => {
const getAccount = async () => {
const account = await get("account");
setAccount(account?.mid);
};
getAccount();
});
useEffect(() => {
getData();
getActiveNotice();
}, [noticeCount]);
}, [noticeCount, account]);
const getData = async () => {
try {
const base = await baseRequest();
@ -129,6 +142,7 @@ const MessageList = ({ navigation, noticeCount, refInstance }) => {
return;
}
const noticeObj = _data.data.result;
const noticeCount = Object.values(noticeObj).reduce(
(acc, cur) => acc + cur.unread_cnt,
0
@ -146,6 +160,9 @@ const MessageList = ({ navigation, noticeCount, refInstance }) => {
);
newInfoItems[parseInt(it)]["subtitle"] =
noticeObj[it].most_recent_notif.title;
} else {
newInfoItems[parseInt(it)]["time"] = "";
newInfoItems[parseInt(it)]["subtitle"] = "暂无新消息";
}
});
return newInfoItems;
@ -262,120 +279,130 @@ const MessageList = ({ navigation, noticeCount, refInstance }) => {
// }),
// });
return (
<View
<KeyboardAvoidingView
behavior={Platform.OS == "ios" ? "padding" : "height"}
keyboardVerticalOffset={insets.bottom + 60}
style={{
paddingTop: insets.top,
paddingLeft: insets.left,
paddingRight: insets.right,
...tailwind("flex flex-1 p-4"),
...tailwind("flex-1"),
}}
>
{/* 广告轮播 */}
{!!scollNotice?.content && (
<ScrollNotice
navigation={navigation}
content={scollNotice?.content}
length={scollNotice?.content.length}
url={(() => {
const links = scollNotice?.hyperlinks;
let link = null;
if (links.length > 1) {
link = links.filter((it) => it.action === "inward")[0]?.url;
} else {
link = links[0]?.url;
}
const linkAndParams = goToPage({
action: links[0]?.action,
url: link,
});
return linkAndParams;
})()}
action={scollNotice?.hyperlinks[0]?.action}
/>
)}
{/* 官方消息 */}
<View
style={{
...tailwind("flex flex-col rounded-2xl mt-3.5"),
// backgroundColor: "#ffffff6d",
}}
>
{infoItems.map((it, index) => renderSystemItem(it, index, navigation))}
</View>
{/* 私聊消息 */}
<View
style={{
...tailwind("flex flex-col rounded-2xl mt-2 border-2"),
}}
>
<TouchableOpacity
onPress={() =>
navigation.navigate("MessageDetail", {
mid: 1,
})
}
style={{
...tailwind("flex flex-row items-center py-4 mb-2 rounded-xl"),
}}
>
<View style={tailwind("px-4")}>
<Image
width={54}
height={54}
source={require("../../../../assets/images/icon_border.png")}
<ScrollView style={tailwind("px-4")}>
<View style={tailwind("my-2")}>
{/* 广告轮播 */}
{!!scollNotice?.content && (
<ScrollNotice
navigation={navigation}
content={scollNotice?.content}
length={4}
url={(() => {
const links = scollNotice?.hyperlinks;
let link = null;
if (links.length > 1) {
link = links.filter((it) => it.action === "inward")[0]?.url;
} else {
link = links[0]?.url;
}
const linkAndParams = goToPage({
action: links[0]?.action,
url: link,
});
return linkAndParams;
})()}
action={scollNotice?.hyperlinks[0]?.action}
/>
</View>
)}
{/* 官方消息 */}
<View
style={tailwind(
"flex flex-row justify-between items-center flex-1"
)}
style={{
...tailwind("flex flex-col rounded-2xl mt-3.5"),
// backgroundColor: "#ffffff6d",
}}
>
<View style={tailwind("flex flex-col")}>
<View style={tailwind("flex flex-row items-center mb-2")}>
<Text
style={tailwind("text-base text-white font-medium mr-2")}
>
铁粉空间官网
</Text>
<View
style={{
...tailwind("font-medium mr-2 px-1 rounded"),
backgroundColor: "#FF669E",
}}
>
<Text style={tailwind("text-xs text-white")}>官方</Text>
{infoItems.map((it, index) =>
renderSystemItem(it, index, navigation)
)}
</View>
{/* 私聊消息 */}
<View
style={{
...tailwind("flex flex-col rounded-2xl mt-2 border-2"),
}}
>
<TouchableOpacity
onPress={() =>
navigation.navigate("MessageDetail", {
mid: 1,
})
}
style={{
...tailwind("flex flex-row items-center py-4 mb-2 rounded-xl"),
}}
>
<View style={tailwind("px-4")}>
<Image
width={54}
height={54}
source={require("../../../../assets/images/icon_border.png")}
/>
</View>
<View
style={tailwind(
"flex flex-row justify-between items-center flex-1"
)}
>
<View style={tailwind("flex flex-col")}>
<View style={tailwind("flex flex-row items-center mb-2")}>
<Text
style={tailwind("text-base text-white font-medium mr-2")}
>
铁粉空间官网
</Text>
<View
style={{
...tailwind("font-medium mr-2 px-1 rounded"),
backgroundColor: "#FF669E",
}}
>
<Text style={tailwind("text-xs text-white")}>官方</Text>
</View>
</View>
<Text style={{ ...tailwind("text-xs"), color: "#FFFFFFB2" }}>
{data?.recent_contact_cs_msg || "暂无新消息"}
</Text>
</View>
<View style={{ ...tailwind("w-12"), width: 60 }}>
<Text
style={{ ...tailwind("text-xs mb-2"), color: "#FFFFFF80" }}
></Text>
{!!data.contact_cs_urc && (
<View
style={{
...tailwind("relative rounded-full"),
}}
>
<Badge
status="error"
value={
data.contact_cs_urc > 99 ? "99+" : data.contact_cs_urc
}
// containerStyle={{ position: "absolute", top: 0, right: 40 }}
badgeStyle={{
borderWidth: 0,
backgroundColor: "#FF669E",
}}
/>
</View>
)}
</View>
</View>
<Text style={{ ...tailwind("text-xs"), color: "#FFFFFFB2" }}>
{data?.recent_contact_cs_msg || "暂无新消息"}
</Text>
</View>
<View style={{ ...tailwind("w-12"), width: 60 }}>
<Text
style={{ ...tailwind("text-xs mb-2"), color: "#FFFFFF80" }}
></Text>
{!!data.contact_cs_urc && (
<View
style={{
...tailwind("relative rounded-full"),
}}
>
<Badge
status="error"
value={
data.contact_cs_urc > 99 ? "99+" : data.contact_cs_urc
}
// containerStyle={{ position: "absolute", top: 0, right: 40 }}
badgeStyle={{ borderWidth: 0, backgroundColor: "#FF669E" }}
/>
</View>
)}
</View>
</TouchableOpacity>
</View>
</TouchableOpacity>
</View>
</View>
</View>
</ScrollView>
</KeyboardAvoidingView>
);
};

View File

@ -19,13 +19,13 @@ export default function ScrollNotice({
action,
}) {
const tailwind = useTailwind();
const [fadeAnim] = useState(new Animated.Value(300)); // 透明度初始值为0
const [fadeAnim] = useState(new Animated.Value(length * 75 + 4));
let animation = Animated.timing(fadeAnim, {
toValue: -(length * 60),
duration: 4000,
delay: 500,
toValue: -(length * 75),
duration: 15000,
delay: 0,
easing: Easing.linear,
useNativeDriver: false,
useNativeDriver: true,
useNativeDriverForTransform: true, // 如果动画涉及transform属性则需要此设置
});
useEffect(() => {
@ -39,13 +39,13 @@ export default function ScrollNotice({
animation &&
animation.start(() => {
// 动画完成时的回调,重置动画值并再次运行动画以实现循环
fadeAnim.setValue(length * 80); // 重置动画值(如果需要)
fadeAnim.setValue(length * 75); // 重置动画值(如果需要)
runAnimation(); // 再次运行动画
});
};
useEffect(() => {
runAnimation(); // 组件挂载时开始动画
content.length > 10 && runAnimation(); // 组件挂载时开始动画
// 注意:这里没有清理函数,因为动画是无限循环的。
// 如果你需要在组件卸载时停止动画,你需要实现一个机制来跟踪组件的状态,并在适当时调用`stopAnimation`。
}, [fadeAnim]);
@ -58,7 +58,7 @@ export default function ScrollNotice({
>
<View
style={{
...tailwind("mr-2"),
...tailwind("mr-2 "),
}}
>
<NativeImage
@ -68,32 +68,19 @@ export default function ScrollNotice({
<TouchableOpacity
onPress={() => {
if (typeof url === "string") {
try {
// 尝试启动微信客户端
Linking.openURL(url).catch(() => {
// 启动微信客户端失败,弹出提示安装对话框
Alert.alert(
"错误提醒",
"打开链接失败,请返回重试或者联系在线客服",
[{ text: "确认", style: "cancel" }],
{ cancelable: false }
);
});
} catch (error) {
// 启动微信客户端失败继续加载URL
console.error(error);
}
} else {
navigation.navigate(...url);
}
if (typeof url === "string") {
if (action === "webViewHeader") {
if (
action === "webViewHeaderInward" ||
action === "webViewHeaderOutward"
) {
navigation.navigate("WebWithHeader", {
title: "",
uri: url,
});
return;
} else if (action === "webViewWithOutHeader") {
} else if (
action === "webViewWithOutHeaderInward" ||
action === "webViewWithOutHeaderOutward"
) {
navigation.navigate("WebWithoutHeader", {
title: "",
uri: url,
@ -126,17 +113,27 @@ export default function ScrollNotice({
>
<Animated.View
style={{
width: `${100}%`,
width: length * 75,
// opacity: fadeAnim,
transform: [
{
translateX: fadeAnim,
translateX: content.length > 10 ? fadeAnim : 0,
},
],
paddingBottom: 5,
// transform: [
// {
// translateX: -(length * 75),
// },
// ],
// paddingBottom: 5,
}}
>
<Text style={{ ...tailwind("text-white ml-2 text-[#FF669E]") }}>
<Text
numberOfLines={1}
style={{
...tailwind("text-white text-[#FF669E]"),
}}
>
{content}
</Text>
</Animated.View>

View File

@ -20,7 +20,6 @@ export default function RefundDetail({ navigation, route }) {
const tailwind = useTailwind();
const insets = useSafeAreaInsets();
const [data, setData] = useState(null);
const [dragging, setDragging] = useState(true);
const [isSubmitting, setIsSubmitting] = useState(false);
const [selectedIndex, setIndex] = useState(2);
const [checkAble, setCheckAble] = useState(true);
@ -119,7 +118,7 @@ export default function RefundDetail({ navigation, route }) {
...tailwind("flex-1"),
}}
>
<ScrollView scrollEnabled={!dragging} style={tailwind("px-4")}>
<ScrollView style={tailwind("px-4")}>
<View style={tailwind("my-2")}>
<View style={tailwind("bg-[#FFFFFF1A] px-4 py-2 my-2 rounded-2xl")}>
<View

View File

@ -92,7 +92,6 @@ export default function Reviewed({ navigation, zid }) {
<Text
style={tailwind("mr-2 text-base text-white font-medium")}
numberOfLines={1}
ellipsizeMode="tail"
>
{item.account.name}
</Text>
@ -149,7 +148,7 @@ export default function Reviewed({ navigation, zid }) {
</View>
{item?.refunds_status === 3 && (
<Text
style={tailwind("mt-2 text-white text-xs text-[#F53030]")}
style={tailwind("mt-2 text-white text-xs text-[#FFFFFF80]")}
>
2小时无条件
</Text>