diff --git a/components/MySlider/index.jsx b/components/MySlider/index.jsx index 8ed6e0d..3e31971 100644 --- a/components/MySlider/index.jsx +++ b/components/MySlider/index.jsx @@ -1,20 +1,12 @@ -import { - View, - Text, - TouchableOpacity, - Modal, - PanResponder, - Dimensions, -} from "react-native"; +import { View, Text, PanResponder, Dimensions } from "react-native"; import React, { useState, useEffect, useRef } from "react"; import { useTailwind } from "tailwind-rn"; -import { Image } from "expo-image"; export default function MySlider({ lower_bound, upper_bound, step, unit, - lable, + unitSite = "right", height = 60, width = Dimensions.get("window").width - 44, onChange, @@ -296,10 +288,20 @@ export default function MySlider({ right: 24, }} > + {unitSite == "left" && ( + + {unit} + + )} @@ -317,46 +319,54 @@ export default function MySlider({ - {hasInfinity && rightProcess == 1 ? ">" + upper_bound : rightValue} + {hasInfinity && rightProcess >= 1 ? ">" + upper_bound : rightValue} + + {unitSite == "right" && ( + + {unit} + + )} + + + + {lower_bound} - {unit} + {hasInfinity ? ">" + upper_bound : upper_bound} - - {lower_bound} - - - {hasInfinity ? ">" + upper_bound : upper_bound} - ); } diff --git a/components/Picker/index.jsx b/components/Picker/index.jsx index a07370d..d0ce503 100644 --- a/components/Picker/index.jsx +++ b/components/Picker/index.jsx @@ -3,7 +3,12 @@ import RNPickerSelect from "react-native-picker-select"; import { useTailwind } from "tailwind-rn"; import { Icon } from "@rneui/themed"; -export default function Picker({ value, items, onChange }) { +export default function Picker({ + value, + items, + onChange, + placeholder = { label: "未填写", value: "" }, +}) { const tailwind = useTailwind(); return ( { + const getFiltersResult = async (obj) => { const apiUrl = process.env.EXPO_PUBLIC_API_URL; + const newObj = obj || filtersValue; let api; let querryParams; api = "/api/streamer/filter"; - let currentFilterValue = { ...filtersValue }; + let currentFilterValue = { + ...newObj, + zone_admission_price: { + lower_bound: newObj.zone_admission_price.lower_bound * 100, + upper_bound: newObj.zone_admission_price.upper_bound * 100, + }, + }; delete currentFilterValue.comprehensiveUsed; delete currentFilterValue.priceUsed; querryParams = currentFilterValue; @@ -308,8 +315,8 @@ export default function Search({ navigation, route }) { const signature = await generateSignature({ ...base, ...querryParams, - offset: 0, - limit: 20, + // offset: 0, + // limit: 20, }); const response = await fetch(`${apiUrl}${api}?signature=${signature}`, { method: "POST", @@ -319,8 +326,8 @@ export default function Search({ navigation, route }) { body: JSON.stringify({ ...base, ...querryParams, - offset: 0, - limit: 20, + // offset: 0, + // limit: 20, }), }); const data = await response.json(); @@ -393,18 +400,23 @@ export default function Search({ navigation, route }) { priceUsed: { show: false, used: false }, }; } - setFiltersValue((old) => ({ - ...old, - ...obj, - })); - if (!obj.comprehensiveUsed.used && !obj.priceUsed.used) { - setRecommList([]); - setStreamers([]); - setZones([]); - } + setFiltersValue((old) => { + const newObj = { + ...old, + ...obj, + }; + if (!obj.comprehensiveUsed.used && !obj.priceUsed.used) { + setRecommList([]); + setStreamers([]); + setZones([]); + } else { + getFiltersResult(newObj); + } + return newObj; + }); }; //空间组件 - const ZoneItem = ({ item }) => { + const ZoneItem = ({ item, onlyOne }) => { return ( @@ -449,11 +461,11 @@ export default function Search({ navigation, route }) { numberOfLines={1} ellipsizeMode="tail" > - {item.zones[0].profile} + {item.zones[0]?.profile} - {zones.length === 1 && ( + {onlyOne && ( @@ -847,6 +859,7 @@ export default function Search({ navigation, route }) { minimumTrackTintColor="#ff75c8" processHeight={5} unit={item.unit} + unitSite={item.key == "zone" ? "left" : "right"} thumbImage={require("../../assets/icon/32DP/edit.png")} /> @@ -874,6 +887,7 @@ export default function Search({ navigation, route }) { label: it, value: it, }))} + placeholder={{ label: "不限", value: "" }} value={ item.key == "constellation" ? filtersValue.constellation @@ -1021,7 +1035,8 @@ export default function Search({ navigation, route }) { borderRadius: 12, // flex: 1, // position: "relative", - height: screenDimensions.height - 120, + height: + screenDimensions.height - (Platform.OS != "ios" ? 84 : 120), }} > {priceFilters.map((item, index) => ( @@ -1084,13 +1099,14 @@ export default function Search({ navigation, route }) { minimumTrackTintColor="#ff75c8" processHeight={5} unit={item.unit} + unitSite={item.key == "zone" ? "left" : "right"} thumbImage={require("../../assets/icon/32DP/edit.png")} /> ))} )} {zones?.map((item, index) => ( - + ))} {zones.length > 0 && } {streamers.length > 0 && ( @@ -1209,9 +1225,12 @@ export default function Search({ navigation, route }) { 猜你喜欢 )} - {recommList?.map((item, index) => ( - - ))} + {recommList + .filter((it) => it.zones.length > 0) + ?.map((item, index) => ( + + ))} + {streamers.length === 0 && recommList.length === 0 && ( )} diff --git a/screeens/SpaceSetting/SpaceSearch/index.jsx b/screeens/SpaceSetting/SpaceSearch/index.jsx index ed2195b..ca7351b 100644 --- a/screeens/SpaceSetting/SpaceSearch/index.jsx +++ b/screeens/SpaceSetting/SpaceSearch/index.jsx @@ -29,6 +29,15 @@ export default function SpaceSearch({ navigation }) { setIsloading(false); return; } + if (/[^0-9]/.test(searchValue)) { + setIsloading(false); + Toast.show({ + type: "error", + text1: "请输入六位用户ID", + topOffset: 60, + }); + return; + } const apiUrl = process.env.EXPO_PUBLIC_API_URL; try { const base = await baseRequest(); @@ -60,6 +69,7 @@ export default function SpaceSearch({ navigation }) { }); return; } + console.log("******", _data.data.list); setData(_data.data.list); setIsloading(false); } catch (error) { @@ -112,13 +122,14 @@ export default function SpaceSearch({ navigation }) { {item?.account?.name} - {item?.is_ironfan != 1 && ( + {item?.is_ironfan == 1 && ( - 空间铁粉 + 铁粉 )} - {item?.is_superfan != 1 && ( + {item?.is_superfan == 1 && ( - 超级粉丝 + 超丝 )} @@ -221,7 +234,7 @@ export default function SpaceSearch({ navigation }) { inputContainerStyle={tailwind("h-10 bg-[#FFFFFF1A]")} inputStyle={tailwind("text-white")} inputMode="numeric" - placeholder="搜索Ta的昵称或id" + placeholder="请输入六位用户ID" platform="ios" cancelButtonProps={tailwind("text-[#FF669E]")} cancelButtonTitle="清空"