webview改为隐身模式;视频显示封面;去除推荐滚动到最上动画;钱包每次聚焦都刷新;完善待添加微信

This commit is contained in:
yezian 2023-12-30 18:47:12 +08:00
parent 9002e59541
commit 3ccca0a488
8 changed files with 104 additions and 78 deletions

View File

@ -261,11 +261,11 @@ export default function EditStreamerProfile({ navigation, route }) {
{ {
notChanged: true, notChanged: true,
id: { video_ids: streamerData.data.streamer.shorts.video_ids }, id: { video_ids: streamerData.data.streamer.shorts.video_ids },
//todo:uri old_uri:
uri: streamerData?.data?.streamer?.shorts?.videos[0]?.urls[0], streamerData?.data?.streamer?.shorts?.videos[0]?.cover_urls[0],
}, },
setOldPhotos(streamerData.data.streamer.album.images),
]); ]);
setOldPhotos(streamerData.data.streamer.album.images);
setIsloading(false); setIsloading(false);
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -175,7 +175,7 @@ export default function FeedStream() {
// //
const handleRefresh = async () => { const handleRefresh = async () => {
startRotation(); startRotation();
flatListRef.current.scrollToOffset({ animated: true, offset: 0 }); flatListRef.current.scrollToOffset({ animated: false, offset: 0 });
setRefreshing(true); setRefreshing(true);
await getData("top"); await getData("top");
setRefreshing(false); setRefreshing(false);

View File

@ -1,5 +1,5 @@
import { View, Text, Image, TouchableOpacity } from "react-native"; import { View, Text, Image, TouchableOpacity } from "react-native";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect, useCallback } from "react";
import { useTailwind } from "tailwind-rn"; import { useTailwind } from "tailwind-rn";
import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Divider, Icon } from "@rneui/themed"; import { Divider, Icon } from "@rneui/themed";
@ -10,6 +10,7 @@ import baseRequest from "../../utils/baseRequest";
import Toast from "react-native-toast-message"; import Toast from "react-native-toast-message";
import * as Linking from "expo-linking"; import * as Linking from "expo-linking";
import { generateSignature } from "../../utils/crypto"; import { generateSignature } from "../../utils/crypto";
import { useFocusEffect } from "@react-navigation/native";
export default function Wallet({ navigation, route }) { export default function Wallet({ navigation, route }) {
const tailwind = useTailwind(); const tailwind = useTailwind();
@ -19,52 +20,57 @@ export default function Wallet({ navigation, route }) {
const [tokenAndMobilePhone, setTokenAndMobilePhone] = useState(""); const [tokenAndMobilePhone, setTokenAndMobilePhone] = useState("");
const [data, setData] = useState(""); const [data, setData] = useState("");
//focus //focus
useEffect(() => { useFocusEffect(
const getData = async () => { useCallback(() => {
// const getData = async () => {
const apiUrl = process.env.EXPO_PUBLIC_API_URL; //
const account = await get("account"); const apiUrl = process.env.EXPO_PUBLIC_API_URL;
const base = await baseRequest(); const account = await get("account");
const signature = await generateSignature({ const base = await baseRequest();
...base, const signature = await generateSignature({
mid: account.mid, ...base,
}); mid: account.mid,
try { });
// try {
const accountResponse = await fetch( //
`${apiUrl}/api/account/list_by_mid?signature=${signature}`, const accountResponse = await fetch(
{ `${apiUrl}/api/account/list_by_mid?signature=${signature}`,
method: "POST", {
headers: { method: "POST",
"Content-Type": "application/json", headers: {
}, "Content-Type": "application/json",
body: JSON.stringify({ },
...base, body: JSON.stringify({
mid: account.mid, ...base,
}), mid: account.mid,
}),
}
);
const accountData = await accountResponse.json();
if (accountData.ret === -1) {
Toast.show({
type: "error",
text1: accountData.msg,
topOffset: 60,
});
return;
} }
); await save("account", accountData.data.account);
const accountData = await accountResponse.json(); setData(accountData.data.account);
if (accountData.ret === -1) { const tokenCache = await get("token");
Toast.show({ const temToken = encodeURIComponent(tokenCache);
type: "error", const mobilePhone = await get("mobile_phone");
text1: accountData.msg, setTokenAndMobilePhone({
topOffset: 60, token: temToken,
mobile_phone: mobilePhone,
}); });
return; } catch (error) {
console.error(error);
} }
await save("account", accountData.data.account); };
setData(accountData.data.account); getData();
const tokenCache = await get("token"); }, [])
const temToken = encodeURIComponent(tokenCache); );
const mobilePhone = await get("mobile_phone");
setTokenAndMobilePhone({ token: temToken, mobile_phone: mobilePhone });
} catch (error) {
console.error(error);
}
};
getData();
}, []);
return ( return (
<View <View

View File

@ -143,6 +143,7 @@ export default function WebWithHeader({ navigation, route }) {
return ( return (
<> <>
<WebView <WebView
incognito
source={{ source={{
uri: route.params.uri, uri: route.params.uri,
}} }}

View File

@ -6,6 +6,7 @@ import {
Modal, Modal,
TouchableOpacity, TouchableOpacity,
Image as NativeImage, Image as NativeImage,
Alert,
} from "react-native"; } from "react-native";
import { Image } from "expo-image"; import { Image } from "expo-image";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
@ -49,7 +50,7 @@ export default function AlreadyAddWechat({}) {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({ body: JSON.stringify({
tab: 1, tab: 2,
offset: top ? 0 : offset, // offset: top ? 0 : offset, //
limit: 20, limit: 20,
...base, ...base,
@ -97,11 +98,7 @@ export default function AlreadyAddWechat({}) {
// //
const copy = async (data) => { const copy = async (data) => {
await Clipboard.setStringAsync(data); await Clipboard.setStringAsync(data);
Toast.show({ Alert.alert(null, "复制成功");
type: "success",
text1: "已复制到剪贴板",
topOffset: 60,
});
}; };
return ( return (
<Modal <Modal
@ -123,7 +120,7 @@ export default function AlreadyAddWechat({}) {
style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")} style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")}
> >
{currentOrder.consumer_wechat ? ( {currentOrder.consumer_wechat ? (
<View style={tailwind("flex flex-col")}> <View style={tailwind("flex flex-col w-full")}>
<View <View
style={tailwind("flex flex-row items-center justify-center")} style={tailwind("flex flex-row items-center justify-center")}
> >
@ -139,10 +136,14 @@ export default function AlreadyAddWechat({}) {
{currentOrder?.account?.name} {currentOrder?.account?.name}
</Text> </Text>
</View> </View>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("mt-2 text-white text-base font-medium")}>
Ta的微信号 Ta的微信号
</Text> </Text>
<View style={tailwind("flex flex-row")}> <View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_wechat} {currentOrder?.consumer_wechat}
</Text> </Text>
@ -158,10 +159,14 @@ export default function AlreadyAddWechat({}) {
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("mt-2 text-white text-base font-medium")}>
添加时请备注 添加时请备注
</Text> </Text>
<View style={tailwind("flex flex-row")}> <View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] mb-4 px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_note} {currentOrder?.consumer_note}
</Text> </Text>

View File

@ -6,6 +6,7 @@ import {
Modal, Modal,
TouchableOpacity, TouchableOpacity,
Image as NativeImage, Image as NativeImage,
Alert,
} from "react-native"; } from "react-native";
import { Image } from "expo-image"; import { Image } from "expo-image";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
@ -97,11 +98,7 @@ export default function HaveNotAddWechat({}) {
// //
const copy = async (data) => { const copy = async (data) => {
await Clipboard.setStringAsync(data); await Clipboard.setStringAsync(data);
Toast.show({ Alert.alert(null, "复制成功");
type: "success",
text1: "已复制到剪贴板",
topOffset: 60,
});
}; };
// //
const handleConfirm = async () => { const handleConfirm = async () => {
@ -160,7 +157,7 @@ export default function HaveNotAddWechat({}) {
style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")} style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")}
> >
{currentOrder.consumer_wechat ? ( {currentOrder.consumer_wechat ? (
<View style={tailwind("flex flex-col")}> <View style={tailwind("flex flex-col w-full")}>
<View <View
style={tailwind("flex flex-row items-center justify-center")} style={tailwind("flex flex-row items-center justify-center")}
> >
@ -176,10 +173,14 @@ export default function HaveNotAddWechat({}) {
{currentOrder?.account?.name} {currentOrder?.account?.name}
</Text> </Text>
</View> </View>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("mt-2 text-white text-base font-medium")}>
Ta的微信号 Ta的微信号
</Text> </Text>
<View style={tailwind("flex flex-row")}> <View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_wechat} {currentOrder?.consumer_wechat}
</Text> </Text>
@ -195,10 +196,14 @@ export default function HaveNotAddWechat({}) {
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("mt-2 text-white text-base font-medium")}>
添加时请备注 添加时请备注
</Text> </Text>
<View style={tailwind("flex flex-row")}> <View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] mb-4 px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}> <Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_note} {currentOrder?.consumer_note}
</Text> </Text>

View File

@ -593,10 +593,6 @@
background-color: rgb(255 255 255 / var(--tw-bg-opacity)) background-color: rgb(255 255 255 / var(--tw-bg-opacity))
} }
.bg-white\/30 {
background-color: rgb(255 255 255 / 0.3)
}
.bg-yellow-400 { .bg-yellow-400 {
--tw-bg-opacity: 1; --tw-bg-opacity: 1;
background-color: rgb(250 204 21 / var(--tw-bg-opacity)) background-color: rgb(250 204 21 / var(--tw-bg-opacity))
@ -721,6 +717,14 @@
text-align: right text-align: right
} }
.text-start {
text-align: start
}
.text-end {
text-align: end
}
.text-2xl { .text-2xl {
font-size: 1.5rem; font-size: 1.5rem;
line-height: 2rem line-height: 2rem

View File

@ -788,11 +788,6 @@
"backgroundColor": "rgb(255 255 255 / var(--tw-bg-opacity))" "backgroundColor": "rgb(255 255 255 / var(--tw-bg-opacity))"
} }
}, },
"bg-white/30": {
"style": {
"backgroundColor": "rgb(255 255 255 / 0.3)"
}
},
"bg-yellow-400": { "bg-yellow-400": {
"style": { "style": {
"--tw-bg-opacity": 1, "--tw-bg-opacity": 1,
@ -960,6 +955,16 @@
"textAlign": "right" "textAlign": "right"
} }
}, },
"text-start": {
"style": {
"textAlign": "start"
}
},
"text-end": {
"style": {
"textAlign": "end"
}
},
"text-2xl": { "text-2xl": {
"style": { "style": {
"fontSize": 24, "fontSize": 24,