优化成员功能代码

This commit is contained in:
al 2024-09-10 14:53:06 +08:00
parent e56ff6fca0
commit 4a9bda5465
8 changed files with 22 additions and 31 deletions

View File

@ -35,7 +35,6 @@ export default function MessageCard({ data, listRef }) {
<Button <Button
title="删除" title="删除"
onPress={() => { onPress={() => {
console.log("删除");
reset(); reset();
}} }}
icon={{ name: "delete", color: "white" }} icon={{ name: "delete", color: "white" }}

View File

@ -45,7 +45,6 @@ export default function Message({ navigation }) {
return; return;
} }
setData(_data.data.list); setData(_data.data.list);
console.log("_data.data.list", _data.data);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

View File

@ -378,7 +378,6 @@ export default function Search({ navigation, route }) {
// offset: 0, // offset: 0,
// limit: 20, // limit: 20,
}); });
console.log(querryParams);
const response = await fetch(`${apiUrl}${api}?signature=${signature}`, { const response = await fetch(`${apiUrl}${api}?signature=${signature}`, {
method: "POST", method: "POST",

View File

@ -39,7 +39,7 @@ export default function AllSpaceMember({ zid }) {
body: JSON.stringify(body), body: JSON.stringify(body),
} }
); );
console.log(JSON.stringify(body)); // console.log(JSON.stringify(body));
const _data = await _response.json(); const _data = await _response.json();
if (_data.ret === -1) { if (_data.ret === -1) {
Toast.show({ Toast.show({
@ -61,10 +61,6 @@ export default function AllSpaceMember({ zid }) {
} }
}; };
useEffect(() => {
getData();
}, []);
// //
const renderItem = ({ item }) => { const renderItem = ({ item }) => {
return ( return (

View File

@ -55,15 +55,10 @@ export default function IronfanSpaceMember({ zid }) {
})); }));
setOffset(_data.data.offset); setOffset(_data.data.offset);
setMore(_data.data.more); setMore(_data.data.more);
console.log(_data);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}; };
useEffect(() => {
getData();
}, []);
// //
const renderItem = ({ item }) => { const renderItem = ({ item }) => {
return ( return (

View File

@ -59,11 +59,6 @@ export default function SuperFanSpaceMember({ zid }) {
console.error(error); console.error(error);
} }
}; };
useEffect(() => {
getData();
}, []);
// //
const renderItem = ({ item }) => { const renderItem = ({ item }) => {
return ( return (

View File

@ -6,7 +6,13 @@ import {
TouchableOpacity, TouchableOpacity,
Image as NativeImage, Image as NativeImage,
} from "react-native"; } 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 { useTailwind } from "tailwind-rn";
import Toast from "react-native-toast-message"; import Toast from "react-native-toast-message";
import Empty from "../../../components/Empty"; import Empty from "../../../components/Empty";
@ -25,9 +31,9 @@ export default function SpaceSearch({ navigation }) {
const [isloading, setIsloading] = useState(false); const [isloading, setIsloading] = useState(false);
const searchRef = useRef(null); const searchRef = useRef(null);
const getData = async (searchValue) => { const getData = async (searchValue) => {
// if (searchValue?.length != 6) { if (searchValue == "") {
// return; return;
// } }
if (/[^0-9]/.test(searchValue)) { if (/[^0-9]/.test(searchValue)) {
Toast.show({ Toast.show({
type: "error", type: "error",
@ -44,7 +50,6 @@ export default function SpaceSearch({ navigation }) {
member_user_id: Number(searchValue), member_user_id: Number(searchValue),
...base, ...base,
}; };
console.log("vvvvvv", JSON.stringify(body));
const signature = await generateSignature(body); const signature = await generateSignature(body);
const _response = await fetch( const _response = await fetch(
@ -94,9 +99,13 @@ export default function SpaceSearch({ navigation }) {
if (!search) return; if (!search) return;
}; };
// //
const RenderItem = ({ item }) => { const renderItem = useCallback((item, index) => {
return ( 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-1")}>
<View style={tailwind("flex flex-row items-center py-3")}> <View style={tailwind("flex flex-row items-center py-3")}>
<Image <Image
@ -203,7 +212,7 @@ export default function SpaceSearch({ navigation }) {
</View> </View>
</ListItem> </ListItem>
); );
}; }, []);
return ( return (
<View <View
@ -265,9 +274,10 @@ export default function SpaceSearch({ navigation }) {
</View> </View>
<ScrollView style={tailwind("flex-1")}> <ScrollView style={tailwind("flex-1")}>
<View style={tailwind("flex-1 px-4")}> <View style={tailwind("flex-1 px-4")}>
{data?.map((item, index) => ( {data?.map(
<RenderItem key={index} item={item} /> (item, index) => renderItem(item, index)
))} // <RenderItem key={index} item={item} />
)}
{data.length === 0 && <Empty type={search ? "search" : "nodata"} />} {data.length === 0 && <Empty type={search ? "search" : "nodata"} />}
</View> </View>
</ScrollView> </ScrollView>

View File

@ -9,7 +9,6 @@ export async function cryptoPassword(password) {
async function calcEncryptedPassword(password) { async function calcEncryptedPassword(password) {
if (!password || password.length <= 7) { if (!password || password.length <= 7) {
console.log("Invalid input");
return; return;
} }
@ -41,7 +40,6 @@ export async function generateSignature(body) {
async function calcSignature(s) { async function calcSignature(s) {
if (!s || s.length <= 20) { if (!s || s.length <= 20) {
console.log("Invalid input");
return; return;
} }