Merge pull request 'anln' (#19) from anln into main
Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/tiefen_space_app/pulls/19
This commit is contained in:
commit
ea61a3f7fd
|
@ -35,7 +35,6 @@ export default function MessageCard({ data, listRef }) {
|
|||
<Button
|
||||
title="删除"
|
||||
onPress={() => {
|
||||
console.log("删除");
|
||||
reset();
|
||||
}}
|
||||
icon={{ name: "delete", color: "white" }}
|
||||
|
|
|
@ -45,7 +45,6 @@ export default function Message({ navigation }) {
|
|||
return;
|
||||
}
|
||||
setData(_data.data.list);
|
||||
console.log("_data.data.list", _data.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ export default function Search({ navigation, route }) {
|
|||
},
|
||||
{
|
||||
name: "微信价格",
|
||||
desc: "10金币=¥1",
|
||||
desc: "10金币=1元",
|
||||
upper_bound: 30000,
|
||||
lower_bound: 0,
|
||||
default: 24,
|
||||
|
@ -378,7 +378,6 @@ export default function Search({ navigation, route }) {
|
|||
// offset: 0,
|
||||
// limit: 20,
|
||||
});
|
||||
console.log(querryParams);
|
||||
|
||||
const response = await fetch(`${apiUrl}${api}?signature=${signature}`, {
|
||||
method: "POST",
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
View,
|
||||
Text,
|
||||
FlatList,
|
||||
RefreshControl,
|
||||
Image as NativeImage,
|
||||
} from "react-native";
|
||||
import { View, Text, FlatList, Image as NativeImage } from "react-native";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTailwind } from "tailwind-rn";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
@ -21,7 +15,7 @@ export default function AllSpaceMember({ zid }) {
|
|||
const tailwind = useTailwind();
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [more, setMore] = useState(1);
|
||||
const [data, setData] = useState([]);
|
||||
const [data, setData] = useState({ list: [], total: 0 });
|
||||
const getData = async () => {
|
||||
if (zid === undefined || !more) return;
|
||||
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
|
@ -45,6 +39,7 @@ export default function AllSpaceMember({ zid }) {
|
|||
body: JSON.stringify(body),
|
||||
}
|
||||
);
|
||||
// console.log(JSON.stringify(body));
|
||||
const _data = await _response.json();
|
||||
if (_data.ret === -1) {
|
||||
Toast.show({
|
||||
|
@ -54,7 +49,11 @@ export default function AllSpaceMember({ zid }) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
setData(_data.data.list);
|
||||
setData((old) => ({
|
||||
...old,
|
||||
list: [...old.list, ..._data.data.list],
|
||||
total: _data.data.total,
|
||||
}));
|
||||
setOffset(_data.data.offset);
|
||||
setMore(_data.data.more);
|
||||
} catch (error) {
|
||||
|
@ -62,20 +61,6 @@ export default function AllSpaceMember({ zid }) {
|
|||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
//下拉刷新
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
//下拉刷新
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true);
|
||||
await getData();
|
||||
setRefreshing(false);
|
||||
};
|
||||
|
||||
//单个成员组件
|
||||
const renderItem = ({ item }) => {
|
||||
return (
|
||||
|
@ -141,17 +126,9 @@ export default function AllSpaceMember({ zid }) {
|
|||
return (
|
||||
<View style={tailwind("px-4 flex-1")}>
|
||||
<FlatList
|
||||
data={data}
|
||||
data={data?.list}
|
||||
renderItem={renderItem}
|
||||
initialNumToRender={12}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
colors={["#FF669E"]}
|
||||
tintColor="white"
|
||||
refreshing={refreshing}
|
||||
onRefresh={() => handleRefresh()}
|
||||
/>
|
||||
}
|
||||
onEndReached={() => getData()}
|
||||
ListEmptyComponent={<Empty type="nodata" />}
|
||||
ListHeaderComponent={() => (
|
||||
|
@ -161,7 +138,7 @@ export default function AllSpaceMember({ zid }) {
|
|||
)}
|
||||
>
|
||||
<Text style={tailwind("text-white text-sm font-medium")}>
|
||||
空间总人数:{data?.length}
|
||||
空间总人数:{data?.total}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
View,
|
||||
Text,
|
||||
FlatList,
|
||||
RefreshControl,
|
||||
Image as NativeImage,
|
||||
} from "react-native";
|
||||
import { View, Text, FlatList, Image as NativeImage } from "react-native";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTailwind } from "tailwind-rn";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
@ -21,7 +15,7 @@ export default function IronfanSpaceMember({ zid }) {
|
|||
const tailwind = useTailwind();
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [more, setMore] = useState(1);
|
||||
const [data, setData] = useState([]);
|
||||
const [data, setData] = useState({ list: [], total: 0 });
|
||||
const getData = async () => {
|
||||
if (zid === undefined || !more) return;
|
||||
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
|
@ -36,7 +30,7 @@ export default function IronfanSpaceMember({ zid }) {
|
|||
};
|
||||
const signature = await generateSignature(body);
|
||||
const _response = await fetch(
|
||||
`${apiUrl}/api/zone/member_list?signature=${signature}`,
|
||||
`${apiUrl}/api/zone/member_list_v2?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
@ -54,28 +48,17 @@ export default function IronfanSpaceMember({ zid }) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
setData(_data.data.list);
|
||||
setData((old) => ({
|
||||
...old,
|
||||
list: [...old.list, ..._data.data.list],
|
||||
total: _data.data.total,
|
||||
}));
|
||||
setOffset(_data.data.offset);
|
||||
setMore(_data.data.more);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
//下拉刷新
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
//下拉刷新
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true);
|
||||
await getData();
|
||||
setRefreshing(false);
|
||||
};
|
||||
|
||||
//单个成员组件
|
||||
const renderItem = ({ item }) => {
|
||||
return (
|
||||
|
@ -141,17 +124,9 @@ export default function IronfanSpaceMember({ zid }) {
|
|||
return (
|
||||
<View style={tailwind("px-4 flex-1")}>
|
||||
<FlatList
|
||||
data={data}
|
||||
data={data.list}
|
||||
renderItem={renderItem}
|
||||
initialNumToRender={12}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
colors={["#FF669E"]}
|
||||
tintColor="white"
|
||||
refreshing={refreshing}
|
||||
onRefresh={() => handleRefresh()}
|
||||
/>
|
||||
}
|
||||
onEndReached={() => getData()}
|
||||
ListEmptyComponent={<Empty type="nodata" />}
|
||||
ListHeaderComponent={() => (
|
||||
|
@ -161,7 +136,7 @@ export default function IronfanSpaceMember({ zid }) {
|
|||
)}
|
||||
>
|
||||
<Text style={tailwind("text-white text-sm font-medium")}>
|
||||
铁粉总人数:{data?.length}
|
||||
铁粉总人数:{data?.total}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
View,
|
||||
Text,
|
||||
FlatList,
|
||||
RefreshControl,
|
||||
Image as NativeImage,
|
||||
} from "react-native";
|
||||
import { View, Text, FlatList, Image as NativeImage } from "react-native";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTailwind } from "tailwind-rn";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
@ -21,7 +15,7 @@ export default function SuperFanSpaceMember({ zid }) {
|
|||
const tailwind = useTailwind();
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [more, setMore] = useState(1);
|
||||
const [data, setData] = useState([]);
|
||||
const [data, setData] = useState({ list: [], total: 0 });
|
||||
const getData = async () => {
|
||||
if (zid === undefined || !more) return;
|
||||
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
|
||||
|
@ -36,7 +30,7 @@ export default function SuperFanSpaceMember({ zid }) {
|
|||
};
|
||||
const signature = await generateSignature(body);
|
||||
const _response = await fetch(
|
||||
`${apiUrl}/api/zone/member_list?signature=${signature}`,
|
||||
`${apiUrl}/api/zone/member_list_v2?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
@ -54,28 +48,17 @@ export default function SuperFanSpaceMember({ zid }) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
setData(_data.data.list);
|
||||
setData((old) => ({
|
||||
...old,
|
||||
list: [...old.list, ..._data.data.list],
|
||||
total: _data.data.total,
|
||||
}));
|
||||
setOffset(_data.data.offset);
|
||||
setMore(_data.data.more);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
//下拉刷新
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
//下拉刷新
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true);
|
||||
await getData();
|
||||
setRefreshing(false);
|
||||
};
|
||||
|
||||
//单个成员组件
|
||||
const renderItem = ({ item }) => {
|
||||
return (
|
||||
|
@ -141,17 +124,9 @@ export default function SuperFanSpaceMember({ zid }) {
|
|||
return (
|
||||
<View style={tailwind("px-4 flex-1")}>
|
||||
<FlatList
|
||||
data={data}
|
||||
data={data.list}
|
||||
renderItem={renderItem}
|
||||
initialNumToRender={12}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
colors={["#FF669E"]}
|
||||
tintColor="white"
|
||||
refreshing={refreshing}
|
||||
onRefresh={() => handleRefresh()}
|
||||
/>
|
||||
}
|
||||
onEndReached={() => getData()}
|
||||
ListEmptyComponent={<Empty type="nodata" />}
|
||||
ListHeaderComponent={() => (
|
||||
|
@ -161,7 +136,7 @@ export default function SuperFanSpaceMember({ zid }) {
|
|||
)}
|
||||
>
|
||||
<Text style={tailwind("text-white text-sm font-medium")}>
|
||||
超粉总人数:{data?.length}
|
||||
超粉总人数:{data?.total}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
|
|
@ -6,7 +6,13 @@ import {
|
|||
TouchableOpacity,
|
||||
Image as NativeImage,
|
||||
} from "react-native";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
useRef,
|
||||
useMemo,
|
||||
useCallback,
|
||||
} from "react";
|
||||
import { useTailwind } from "tailwind-rn";
|
||||
import Toast from "react-native-toast-message";
|
||||
import Empty from "../../../components/Empty";
|
||||
|
@ -18,7 +24,6 @@ import { generateSignature } from "../../../utils/crypto";
|
|||
import formatTimestamp from "../../../utils/formatTimestamp";
|
||||
export default function SpaceSearch({ navigation }) {
|
||||
const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
|
||||
|
||||
const tailwind = useTailwind();
|
||||
const insets = useSafeAreaInsets();
|
||||
const [data, setData] = useState([]);
|
||||
|
@ -26,9 +31,9 @@ export default function SpaceSearch({ navigation }) {
|
|||
const [isloading, setIsloading] = useState(false);
|
||||
const searchRef = useRef(null);
|
||||
const getData = async (searchValue) => {
|
||||
// if (searchValue?.length != 6) {
|
||||
// return;
|
||||
// }
|
||||
if (searchValue == "") {
|
||||
return;
|
||||
}
|
||||
if (/[^0-9]/.test(searchValue)) {
|
||||
Toast.show({
|
||||
type: "error",
|
||||
|
@ -45,7 +50,6 @@ export default function SpaceSearch({ navigation }) {
|
|||
member_user_id: Number(searchValue),
|
||||
...base,
|
||||
};
|
||||
console.log("vvvvvv", JSON.stringify(body));
|
||||
|
||||
const signature = await generateSignature(body);
|
||||
const _response = await fetch(
|
||||
|
@ -77,7 +81,6 @@ export default function SpaceSearch({ navigation }) {
|
|||
//进入页面默认focus
|
||||
useEffect(() => {
|
||||
searchRef.current.focus();
|
||||
getData();
|
||||
}, []);
|
||||
//搜索框文本变化时进行搜索
|
||||
// useEffect(() => {
|
||||
|
@ -96,9 +99,13 @@ export default function SpaceSearch({ navigation }) {
|
|||
if (!search) return;
|
||||
};
|
||||
//单个成员组件
|
||||
const RenderItem = ({ item }) => {
|
||||
const renderItem = useCallback((item, index) => {
|
||||
return (
|
||||
<ListItem bottomDivider containerStyle={tailwind("p-0 bg-transparent")}>
|
||||
<ListItem
|
||||
key={index}
|
||||
bottomDivider
|
||||
containerStyle={tailwind("p-0 bg-transparent")}
|
||||
>
|
||||
<View style={tailwind("flex-1")}>
|
||||
<View style={tailwind("flex flex-row items-center py-3")}>
|
||||
<Image
|
||||
|
@ -205,7 +212,7 @@ export default function SpaceSearch({ navigation }) {
|
|||
</View>
|
||||
</ListItem>
|
||||
);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View
|
||||
|
@ -267,9 +274,10 @@ export default function SpaceSearch({ navigation }) {
|
|||
</View>
|
||||
<ScrollView style={tailwind("flex-1")}>
|
||||
<View style={tailwind("flex-1 px-4")}>
|
||||
{data?.map((item, index) => (
|
||||
<RenderItem key={index} item={item} />
|
||||
))}
|
||||
{data?.map(
|
||||
(item, index) => renderItem(item, index)
|
||||
// <RenderItem key={index} item={item} />
|
||||
)}
|
||||
{data.length === 0 && <Empty type={search ? "search" : "nodata"} />}
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
|
|
@ -9,7 +9,6 @@ export async function cryptoPassword(password) {
|
|||
|
||||
async function calcEncryptedPassword(password) {
|
||||
if (!password || password.length <= 7) {
|
||||
console.log("Invalid input");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,7 +40,6 @@ export async function generateSignature(body) {
|
|||
|
||||
async function calcSignature(s) {
|
||||
if (!s || s.length <= 20) {
|
||||
console.log("Invalid input");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue