优化成员功能代码

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
title="删除"
onPress={() => {
console.log("删除");
reset();
}}
icon={{ name: "delete", color: "white" }}

View File

@ -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);
}

View File

@ -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",

View File

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

View File

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

View File

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

View File

@ -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";
@ -25,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",
@ -44,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(
@ -94,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
@ -203,7 +212,7 @@ export default function SpaceSearch({ navigation }) {
</View>
</ListItem>
);
};
}, []);
return (
<View
@ -265,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>

View File

@ -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;
}