diff --git a/screeens/NoticeDetail/components/MessageList/index.jsx b/screeens/NoticeDetail/components/MessageList/index.jsx index 98504b5..05e1d89 100644 --- a/screeens/NoticeDetail/components/MessageList/index.jsx +++ b/screeens/NoticeDetail/components/MessageList/index.jsx @@ -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 ( - - {/* 广告轮播 */} - {!!scollNotice?.content && ( - { - 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} - /> - )} - - {/* 官方消息 */} - - {infoItems.map((it, index) => renderSystemItem(it, index, navigation))} - - {/* 私聊消息 */} - - - navigation.navigate("MessageDetail", { - mid: 1, - }) - } - style={{ - ...tailwind("flex flex-row items-center py-4 mb-2 rounded-xl"), - }} - > - - + + {/* 广告轮播 */} + {!!scollNotice?.content && ( + { + 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} /> - + )} + + {/* 官方消息 */} - - - - 铁粉空间官网 - - - 官方 + {infoItems.map((it, index) => + renderSystemItem(it, index, navigation) + )} + + {/* 私聊消息 */} + + + navigation.navigate("MessageDetail", { + mid: 1, + }) + } + style={{ + ...tailwind("flex flex-row items-center py-4 mb-2 rounded-xl"), + }} + > + + + + + + + + 铁粉空间官网 + + + 官方 + + + + {data?.recent_contact_cs_msg || "暂无新消息"} + + + + + {!!data.contact_cs_urc && ( + + 99 ? "99+" : data.contact_cs_urc + } + // containerStyle={{ position: "absolute", top: 0, right: 40 }} + badgeStyle={{ + borderWidth: 0, + backgroundColor: "#FF669E", + }} + /> + + )} - - {data?.recent_contact_cs_msg || "暂无新消息"} - - - - - {!!data.contact_cs_urc && ( - - 99 ? "99+" : data.contact_cs_urc - } - // containerStyle={{ position: "absolute", top: 0, right: 40 }} - badgeStyle={{ borderWidth: 0, backgroundColor: "#FF669E" }} - /> - - )} - + - - - + + + ); }; diff --git a/screeens/NoticeDetail/components/ScrollNotice/index.js b/screeens/NoticeDetail/components/ScrollNotice/index.js index 1805c11..e907711 100644 --- a/screeens/NoticeDetail/components/ScrollNotice/index.js +++ b/screeens/NoticeDetail/components/ScrollNotice/index.js @@ -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({ > { 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({ > 10 ? fadeAnim : 0, }, ], - paddingBottom: 5, + // transform: [ + // { + // translateX: -(length * 75), + // }, + // ], + // paddingBottom: 5, }} > - + {content} diff --git a/screeens/Refund/RefundDetail/index.jsx b/screeens/Refund/RefundDetail/index.jsx index 5176025..54ff6fe 100644 --- a/screeens/Refund/RefundDetail/index.jsx +++ b/screeens/Refund/RefundDetail/index.jsx @@ -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"), }} > - + {item.account.name} @@ -149,7 +148,7 @@ export default function Reviewed({ navigation, zid }) { {item?.refunds_status === 3 && ( 2小时无条件