优化省市区和占位图片
This commit is contained in:
@@ -5,8 +5,9 @@ import img from "../../config/images";
|
||||
import { ListCardProps } from "../../../types/list/types";
|
||||
import { formatGameTime, calculateDuration } from "@/utils/timeUtils";
|
||||
import { navigateTo } from "@/utils/navigation";
|
||||
import images from '@/config/images'
|
||||
import images from "@/config/images";
|
||||
import "./index.scss";
|
||||
import { OSS_BASE } from "@/config/api";
|
||||
|
||||
const ListCard: React.FC<ListCardProps> = ({
|
||||
id,
|
||||
@@ -45,7 +46,7 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
className="image"
|
||||
mode="aspectFill"
|
||||
lazyLoad
|
||||
defaultSource={require("@/static/emptyStatus/publish-empty-card.png")}
|
||||
defaultSource={`${OSS_BASE}/front/ball/images/publish-empty-card.svg`}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -67,7 +68,9 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
const containerWidthPx = screenWidth - 130;
|
||||
|
||||
// 计算固定信息宽度
|
||||
const extraInfo = `${court_type ? `・${court_type}` : ''}${distance_km ? `・${distance_km}km` : ''}`;
|
||||
const extraInfo = `${court_type ? `・${court_type}` : ""}${
|
||||
distance_km ? `・${distance_km}km` : ""
|
||||
}`;
|
||||
|
||||
// 估算字符宽度(基于 12px 字体)
|
||||
const getTextWidth = (text: string) => {
|
||||
@@ -98,7 +101,9 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
let currentWidth = 0;
|
||||
for (let i = 0; i < location.length; i++) {
|
||||
const char = location[i];
|
||||
const charWidth = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef]/.test(char) ? 12 : 6;
|
||||
const charWidth = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef]/.test(char)
|
||||
? 12
|
||||
: 6;
|
||||
if (currentWidth + charWidth > availableWidth) {
|
||||
break;
|
||||
}
|
||||
@@ -106,7 +111,7 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
maxChars++;
|
||||
}
|
||||
|
||||
return location.slice(0, maxChars) + '...';
|
||||
return location.slice(0, maxChars) + "...";
|
||||
}, [location, court_type, distance_km]);
|
||||
|
||||
// 根据图片数量决定展示样式
|
||||
@@ -220,9 +225,10 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
</Text>
|
||||
</View>
|
||||
<View className="tag ntprTag">
|
||||
<Image src={images.ICON_LIST_NTPR} className='ntprIcon' />
|
||||
<Image src={images.ICON_LIST_NTPR} className="ntprIcon" />
|
||||
<Text className="tag-text">
|
||||
{Number(skill_level_min)?.toFixed(1)} - {Number(skill_level_max)?.toFixed(1)}
|
||||
{Number(skill_level_min)?.toFixed(1)} -{" "}
|
||||
{Number(skill_level_max)?.toFixed(1)}
|
||||
</Text>
|
||||
{/* 分割线 */}
|
||||
<View className="typeLine" />
|
||||
@@ -251,13 +257,8 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
/>
|
||||
{/* <Text className="smoothTitle">{game_type}</Text> */}
|
||||
</View>
|
||||
{
|
||||
venue_description && (<View className="line" />)
|
||||
}
|
||||
{
|
||||
venue_description &&
|
||||
(
|
||||
|
||||
{venue_description && <View className="line" />}
|
||||
{venue_description && (
|
||||
<View className="localAreaContainer">
|
||||
<View className="localAreaTitle">场馆方:</View>
|
||||
<View className="localAreaWrapper">
|
||||
@@ -265,8 +266,7 @@ const ListCard: React.FC<ListCardProps> = ({
|
||||
<Text className="localAreaText">{venue_description}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -24,7 +24,6 @@ const ListLoadError = (props: IProps) => {
|
||||
wrapperHeight = "",
|
||||
width = "",
|
||||
height = "",
|
||||
scale = "",
|
||||
} = props;
|
||||
const handleReload = () => {
|
||||
reload && typeof reload === "function" && reload();
|
||||
@@ -34,7 +33,7 @@ const ListLoadError = (props: IProps) => {
|
||||
<View className={styles.listLoadError} style={{ height: wrapperHeight }}>
|
||||
<Image
|
||||
className={styles.listLoadErrorImg}
|
||||
style={{ width, height, transform: `scale(${scale})` }}
|
||||
style={{ width, height }}
|
||||
src={errorImg ? img[errorImg] : img.ICON_LIST_LOAD_ERROR}
|
||||
/>
|
||||
{text && <Text className={styles.listLoadErrorText}>{text}</Text>}
|
||||
|
||||
@@ -6,7 +6,11 @@ import "./index.scss";
|
||||
import { EditModal } from "@/components";
|
||||
import { UserService, PickerOption } from "@/services/userService";
|
||||
import { PopupPicker } from "@/components/Picker/index";
|
||||
import { useUserActions, useNicknameChangeStatus, useLastTestResult } from "@/store/userStore";
|
||||
import {
|
||||
useUserActions,
|
||||
useNicknameChangeStatus,
|
||||
useLastTestResult,
|
||||
} from "@/store/userStore";
|
||||
import { UserInfoType } from "@/services/userService";
|
||||
import {
|
||||
useCities,
|
||||
@@ -82,7 +86,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
}) => {
|
||||
const nickname_change_status = useNicknameChangeStatus();
|
||||
const { setShowGuideBar } = useGlobalState();
|
||||
const { updateUserInfo, updateNickname, fetchLastTestResult } = useUserActions();
|
||||
const { updateUserInfo, updateNickname, fetchLastTestResult } =
|
||||
useUserActions();
|
||||
const ntrpLevels = useNtrpLevels();
|
||||
// 使用全局状态中的测试结果,避免重复调用接口
|
||||
const lastTestResult = useLastTestResult();
|
||||
@@ -295,8 +300,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
|
||||
// 处理地区选择
|
||||
const handle_location_change = (e: any) => {
|
||||
const [country, province, city] = e;
|
||||
handle_field_edit({ country, province, city });
|
||||
const [province, city, district] = e;
|
||||
handle_field_edit({ province, city, district });
|
||||
};
|
||||
|
||||
// 处理NTRP水平选择
|
||||
@@ -307,8 +312,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
|
||||
// 处理职业选择
|
||||
const handle_occupation_change = (e: any) => {
|
||||
const [country, province, city] = e;
|
||||
handle_field_edit("occupation", `${country} ${province} ${city}`);
|
||||
const [firstVal, secondVal, thirdVal] = e;
|
||||
handle_field_edit("occupation", `${firstVal} ${secondVal} ${thirdVal}`);
|
||||
};
|
||||
const handle_edit_modal_cancel = () => {
|
||||
// 关闭编辑弹窗时显示 GuideBar
|
||||
@@ -565,12 +570,12 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
<Text>选择职业</Text>
|
||||
</View>
|
||||
) : null}
|
||||
{user_info.country || user_info.province || user_info.city ? (
|
||||
{user_info.province || user_info.city || user_info.district ? (
|
||||
<View
|
||||
className="tag_item"
|
||||
onClick={() => editable && handle_open_edit_modal("location")}
|
||||
>
|
||||
<Text className="tag_text">{`${user_info.province}${user_info.city}`}</Text>
|
||||
<Text className="tag_text">{`${user_info.city}${user_info.district}`}</Text>
|
||||
</View>
|
||||
) : is_current_user ? (
|
||||
<View
|
||||
@@ -665,8 +670,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
visible={location_picker_visible}
|
||||
setvisible={setLocationPickerVisible}
|
||||
value={
|
||||
form_data.country
|
||||
? [form_data.country, form_data.province, form_data.city]
|
||||
form_data.province
|
||||
? [form_data.province, form_data.city, form_data.district]
|
||||
: getDefaultOption(cities)
|
||||
}
|
||||
onChange={handle_location_change}
|
||||
@@ -678,15 +683,12 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
showHeader={true}
|
||||
title="选择 NTRP 自评水平"
|
||||
ntrpTested={ntrpTested}
|
||||
options={ntrpLevels.map((level) => ({
|
||||
text: level,
|
||||
value: level,
|
||||
}))}
|
||||
options={ntrpLevels}
|
||||
type="ntrp"
|
||||
img={user_info.avatar_url || ""}
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={[form_data.ntrp_level || "2.5"]}
|
||||
value={!form_data.ntrp_level ? ["2.5"] : [form_data.ntrp_level]}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,74 +1,75 @@
|
||||
import { OSS_BASE } from "@/config/api";
|
||||
export default {
|
||||
ICON_REMOVE: require('@/static/publishBall/icon-remove.svg'),
|
||||
ICON_UPLOAD: require('@/static/publishBall/icon-upload.svg'),
|
||||
ICON_LOCATION: require('@/static/publishBall/icon-location.svg'),
|
||||
ICON_GAMEPLAY: require('@/static/publishBall/icon-gameplay.svg'),
|
||||
ICON_PERSONAL: require('@/static/publishBall/icon-personal.svg'),
|
||||
ICON_CHANGDA: require('@/static/publishBall/icon-changda.svg'),
|
||||
ICON_COST: require('@/static/publishBall/icon-cost.svg'),
|
||||
ICON_TIPS: require('@/static/publishBall/icon-tips.svg'),
|
||||
ICON_ARROW_RIGHT: require('@/static/publishBall/icon-arrow-right.svg'),
|
||||
ICON_FILTER: require('@/static/list/icon-filter.svg'),
|
||||
ICON_FILTER_SELECTED: require('@/static/list/icon-filter-selected.svg'),
|
||||
ICON_SEARCH: require('@/static/list/icon-search.svg'),
|
||||
ICON_PLAY: require('@/static/list/icon-play.svg'),
|
||||
ICON_SITE: require('@/static/list/icon-site.svg'),
|
||||
ICON_ARROW_DOWN: require('@/static/list/icon-arrow-down.svg'),
|
||||
ICON_MENU_ITEM_SELECTED: require('@/static/list/icon-menu-item-selected.svg'),
|
||||
ICON_ARROW_DOWN_WHITE: require('@/static/list/icon-arrow-down-white.svg'),
|
||||
ICON_LIST_RIGHT_ARROW: require('@/static/list/icon-list-right-arrow.svg'),
|
||||
ICON_ARROW_LEFT: require('@/static/detail/icon-arrow-left.svg'),
|
||||
ICON_LOGO_GO: require('@/static/detail/icon-logo-go.svg'),
|
||||
ICON_MAP: require('@/static/publishBall/icon-map.svg'),
|
||||
ICON_STADIUM: require('@/static/publishBall/icon-stadium.svg'),
|
||||
ICON_ARRORW_SMALL: require('@/static/publishBall/icon-arrow-small.svg'),
|
||||
ICON_MAP_SEARCH: require('@/static/publishBall/icon-map-search.svg'),
|
||||
ICON_HEART_CIRCLE: require('@/static/publishBall/icon-heartcircle.png'),
|
||||
ICON_ADD: require('@/static/publishBall/icon-add.svg'),
|
||||
ICON_COPY: require('@/static/publishBall/icon-arrow-right.svg'),
|
||||
ICON_DELETE: require('@/static/publishBall/icon-delete.svg'),
|
||||
ICON_RIGHT_MAX: require('@/static/publishBall/icon-right-max.svg'),
|
||||
ICON_PLUS: require('@/static/publishBall/icon-plus.svg'),
|
||||
ICON_GROUP: require('@/static/publishBall/icon-group.svg'),
|
||||
ICON_PERSON: require('@/static/publishBall/icon-person.svg'),
|
||||
ICON_PUBLISH: require('@/static/publishBall/icon-publish.png'),
|
||||
ICON_CIRCLE_UNSELECT: require('@/static/publishBall/icon-circle-unselect.svg'),
|
||||
ICON_CIRCLE_SELECT: require('@/static/publishBall/icon-circle-select-ring.svg'),
|
||||
ICON_CIRCLE_SELECT_ARROW: require('@/static/publishBall/icon-circle-select-arrow.svg'),
|
||||
ICON_LOGO: require('@/static/logo.svg'),
|
||||
ICON_CHANGE: require('@/static/list/icon-change.svg'),
|
||||
ICON_DETAIL_MAP: require('@/static/detail/icon-map.svg'),
|
||||
ICON_DETAIL_ARROW_RIGHT: require('@/static/detail/icon-arrow-right.svg'),
|
||||
ICON_DETAIL_NOTICE: require('@/static/detail/icon-notice.svg'),
|
||||
ICON_DETAIL_APPLICATION_ADD: require('@/static/detail/icon-application-add.svg'),
|
||||
ICON_DETAIL_COMMENT: require('@/static/detail/icon-comment.svg'),
|
||||
ICON_DETAIL_COMMENT_LIGHT: require('@/static/detail/icon-comment-light.svg'),
|
||||
ICON_DETAIL_SHARE: require('@/static/detail/icon-share-light.svg'),
|
||||
ICON_GUIDE_BAR_PUBLISH: require('@/static/common/guide-bar-publish.svg'),
|
||||
ICON_NAVIGATOR_BACK: require('@/static/common/navigator-back.svg'),
|
||||
ICON_LIST_PLAYING_GAME: require('@/static/list/icon-paying-game.svg'),
|
||||
ICON_LIST_LOAD_ERROR: require('@/static/list/icon-load-error.svg'),
|
||||
ICON_LIST_RELOAD: require('@/static/list/icon-reload.svg'),
|
||||
ICON_LIST_EMPTY: require('@/static/emptyStatus/publish-empty.png'),
|
||||
ICON_LIST_EMPTY_CARD: require('@/static/emptyStatus/publish-empty-card.png'),
|
||||
ICON_LIST_SEARCH_SEARCH: require('@/static/search/icon-search.svg'),
|
||||
ICON_LIST_SEARCH_BACK: require('@/static/search/icon-back.svg'),
|
||||
ICON_LIST_SEARCH_CLEAR: require('@/static/search/icon-search-clear.svg'),
|
||||
ICON_LIST_SEARCH_CLEAR_HISTORY: require('@/static/search/icon-clear-history.svg'),
|
||||
ICON_LIST_SEARCH_SUGGESTION: require('@/static/search/icon-search-suggestion.svg'),
|
||||
ICON_LIST_INPUT_LOGO: require('@/static/list/icon-input-logo.svg'),
|
||||
ICON_IMPORTANT_BTN: require('@/static/publishBall/icon-important-btn.svg'),
|
||||
ICON_IMPORTANT_BLACK: require('@/static/publishBall/icon-important-black.svg'),
|
||||
ICON_ARROW_RIGHT_WHITE: require('@/static/publishBall/icon-arrow-right-white.svg'),
|
||||
ICON_ARROW_RIGHT_BLACK: require('@/static/publishBall/icon-arrow-right-black.svg'),
|
||||
ICON_EXAMINATION: require('@/static/userInfo/examination.svg'),
|
||||
ICON_ARROW_GREEN: require('@/static/userInfo/arrow-green.svg'),
|
||||
ICON_COPY: require('@/static/publishBall/icon-copy.svg'),
|
||||
ICON_UPLOAD_IMG: require('@/static/publishBall/icon-upload-img.svg'),
|
||||
ICON_UPLOAD_SUCCESS: require('@/static/publishBall/icon-upload-success.svg'),
|
||||
ICON_CLOSE: require('@/static/publishBall/icon-close.svg'),
|
||||
ICON_LIST_NTPR: require('@/static/list/ntpr.svg'),
|
||||
ICON_LIST_CHANGDA: require('@/static/list/icon-changda.svg'),
|
||||
ICON_LIST_CHANGDA_QIuju: require('@/static/list/changdaqiuju.png'),
|
||||
ICON_RELOCATE: require('@/static/list/icon-relocate.svg'),
|
||||
}
|
||||
ICON_REMOVE: require("@/static/publishBall/icon-remove.svg"),
|
||||
ICON_UPLOAD: require("@/static/publishBall/icon-upload.svg"),
|
||||
ICON_LOCATION: require("@/static/publishBall/icon-location.svg"),
|
||||
ICON_GAMEPLAY: require("@/static/publishBall/icon-gameplay.svg"),
|
||||
ICON_PERSONAL: require("@/static/publishBall/icon-personal.svg"),
|
||||
ICON_CHANGDA: require("@/static/publishBall/icon-changda.svg"),
|
||||
ICON_COST: require("@/static/publishBall/icon-cost.svg"),
|
||||
ICON_TIPS: require("@/static/publishBall/icon-tips.svg"),
|
||||
ICON_ARROW_RIGHT: require("@/static/publishBall/icon-arrow-right.svg"),
|
||||
ICON_FILTER: require("@/static/list/icon-filter.svg"),
|
||||
ICON_FILTER_SELECTED: require("@/static/list/icon-filter-selected.svg"),
|
||||
ICON_SEARCH: require("@/static/list/icon-search.svg"),
|
||||
ICON_PLAY: require("@/static/list/icon-play.svg"),
|
||||
ICON_SITE: require("@/static/list/icon-site.svg"),
|
||||
ICON_ARROW_DOWN: require("@/static/list/icon-arrow-down.svg"),
|
||||
ICON_MENU_ITEM_SELECTED: require("@/static/list/icon-menu-item-selected.svg"),
|
||||
ICON_ARROW_DOWN_WHITE: require("@/static/list/icon-arrow-down-white.svg"),
|
||||
ICON_LIST_RIGHT_ARROW: require("@/static/list/icon-list-right-arrow.svg"),
|
||||
ICON_ARROW_LEFT: require("@/static/detail/icon-arrow-left.svg"),
|
||||
ICON_LOGO_GO: require("@/static/detail/icon-logo-go.svg"),
|
||||
ICON_MAP: require("@/static/publishBall/icon-map.svg"),
|
||||
ICON_STADIUM: require("@/static/publishBall/icon-stadium.svg"),
|
||||
ICON_ARRORW_SMALL: require("@/static/publishBall/icon-arrow-small.svg"),
|
||||
ICON_MAP_SEARCH: require("@/static/publishBall/icon-map-search.svg"),
|
||||
ICON_HEART_CIRCLE: require("@/static/publishBall/icon-heartcircle.png"),
|
||||
ICON_ADD: require("@/static/publishBall/icon-add.svg"),
|
||||
ICON_COPY: require("@/static/publishBall/icon-arrow-right.svg"),
|
||||
ICON_DELETE: require("@/static/publishBall/icon-delete.svg"),
|
||||
ICON_RIGHT_MAX: require("@/static/publishBall/icon-right-max.svg"),
|
||||
ICON_PLUS: require("@/static/publishBall/icon-plus.svg"),
|
||||
ICON_GROUP: require("@/static/publishBall/icon-group.svg"),
|
||||
ICON_PERSON: require("@/static/publishBall/icon-person.svg"),
|
||||
ICON_PUBLISH: require("@/static/publishBall/icon-publish.png"),
|
||||
ICON_CIRCLE_UNSELECT: require("@/static/publishBall/icon-circle-unselect.svg"),
|
||||
ICON_CIRCLE_SELECT: require("@/static/publishBall/icon-circle-select-ring.svg"),
|
||||
ICON_CIRCLE_SELECT_ARROW: require("@/static/publishBall/icon-circle-select-arrow.svg"),
|
||||
ICON_LOGO: require("@/static/logo.svg"),
|
||||
ICON_CHANGE: require("@/static/list/icon-change.svg"),
|
||||
ICON_DETAIL_MAP: require("@/static/detail/icon-map.svg"),
|
||||
ICON_DETAIL_ARROW_RIGHT: require("@/static/detail/icon-arrow-right.svg"),
|
||||
ICON_DETAIL_NOTICE: require("@/static/detail/icon-notice.svg"),
|
||||
ICON_DETAIL_APPLICATION_ADD: require("@/static/detail/icon-application-add.svg"),
|
||||
ICON_DETAIL_COMMENT: require("@/static/detail/icon-comment.svg"),
|
||||
ICON_DETAIL_COMMENT_LIGHT: require("@/static/detail/icon-comment-light.svg"),
|
||||
ICON_DETAIL_SHARE: require("@/static/detail/icon-share-light.svg"),
|
||||
ICON_GUIDE_BAR_PUBLISH: require("@/static/common/guide-bar-publish.svg"),
|
||||
ICON_NAVIGATOR_BACK: require("@/static/common/navigator-back.svg"),
|
||||
ICON_LIST_PLAYING_GAME: require("@/static/list/icon-paying-game.svg"),
|
||||
ICON_LIST_LOAD_ERROR: require("@/static/list/icon-load-error.svg"),
|
||||
ICON_LIST_RELOAD: require("@/static/list/icon-reload.svg"),
|
||||
ICON_LIST_EMPTY: require("@/static/emptyStatus/publish-empty.png"),
|
||||
ICON_LIST_EMPTY_CARD: `${OSS_BASE}/front/ball/images/publish-empty-card.svg`,
|
||||
ICON_LIST_SEARCH_SEARCH: require("@/static/search/icon-search.svg"),
|
||||
ICON_LIST_SEARCH_BACK: require("@/static/search/icon-back.svg"),
|
||||
ICON_LIST_SEARCH_CLEAR: require("@/static/search/icon-search-clear.svg"),
|
||||
ICON_LIST_SEARCH_CLEAR_HISTORY: require("@/static/search/icon-clear-history.svg"),
|
||||
ICON_LIST_SEARCH_SUGGESTION: require("@/static/search/icon-search-suggestion.svg"),
|
||||
ICON_LIST_INPUT_LOGO: require("@/static/list/icon-input-logo.svg"),
|
||||
ICON_IMPORTANT_BTN: require("@/static/publishBall/icon-important-btn.svg"),
|
||||
ICON_IMPORTANT_BLACK: require("@/static/publishBall/icon-important-black.svg"),
|
||||
ICON_ARROW_RIGHT_WHITE: require("@/static/publishBall/icon-arrow-right-white.svg"),
|
||||
ICON_ARROW_RIGHT_BLACK: require("@/static/publishBall/icon-arrow-right-black.svg"),
|
||||
ICON_EXAMINATION: require("@/static/userInfo/examination.svg"),
|
||||
ICON_ARROW_GREEN: require("@/static/userInfo/arrow-green.svg"),
|
||||
ICON_COPY: require("@/static/publishBall/icon-copy.svg"),
|
||||
ICON_UPLOAD_IMG: require("@/static/publishBall/icon-upload-img.svg"),
|
||||
ICON_UPLOAD_SUCCESS: require("@/static/publishBall/icon-upload-success.svg"),
|
||||
ICON_CLOSE: require("@/static/publishBall/icon-close.svg"),
|
||||
ICON_LIST_NTPR: require("@/static/list/ntpr.svg"),
|
||||
ICON_LIST_CHANGDA: require("@/static/list/icon-changda.svg"),
|
||||
ICON_LIST_CHANGDA_QIuju: require("@/static/list/changdaqiuju.png"),
|
||||
ICON_RELOCATE: require("@/static/list/icon-relocate.svg"),
|
||||
};
|
||||
|
||||
@@ -16,7 +16,9 @@ interface MyselfPageContentProps {
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
const MyselfPageContent: React.FC<MyselfPageContentProps> = ({ isActive = true }) => {
|
||||
const MyselfPageContent: React.FC<MyselfPageContentProps> = ({
|
||||
isActive = true,
|
||||
}) => {
|
||||
const pickerOption = usePickerOption();
|
||||
const { statusNavbarHeightInfo } = useGlobalState() || {};
|
||||
const { totalHeight = 98 } = statusNavbarHeightInfo || {};
|
||||
@@ -292,9 +294,8 @@ const MyselfPageContent: React.FC<MyselfPageContentProps> = ({ isActive = true }
|
||||
overflow: "hidden",
|
||||
}}
|
||||
listLoadErrorWrapperHeight="fit-content"
|
||||
listLoadErrorWidth="320px"
|
||||
listLoadErrorHeight="152px"
|
||||
listLoadErrorScale="1.2"
|
||||
listLoadErrorWidth="410px"
|
||||
listLoadErrorHeight="185px"
|
||||
defaultShowNum={3}
|
||||
/>
|
||||
</ScrollView>
|
||||
@@ -316,9 +317,8 @@ const MyselfPageContent: React.FC<MyselfPageContentProps> = ({ isActive = true }
|
||||
collapse={true}
|
||||
style={{ paddingBottom: "90px", overflow: "hidden" }}
|
||||
listLoadErrorWrapperHeight="fit-content"
|
||||
listLoadErrorWidth="320px"
|
||||
listLoadErrorHeight="152px"
|
||||
listLoadErrorScale="1.2"
|
||||
listLoadErrorWidth="410px"
|
||||
listLoadErrorHeight="185px"
|
||||
defaultShowNum={3}
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
@@ -347,8 +347,6 @@ export class UserService {
|
||||
last_location_province: userData.last_location_province || "",
|
||||
last_location_city: userData.last_location_city || "",
|
||||
};
|
||||
|
||||
|
||||
} else {
|
||||
throw new Error(response.message || "获取用户信息失败");
|
||||
}
|
||||
@@ -735,7 +733,7 @@ export const updateUserLocation = async (
|
||||
const response = await httpService.post("/user/update_location", {
|
||||
latitude,
|
||||
longitude,
|
||||
force
|
||||
force,
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
@@ -5,7 +5,7 @@ import { UserService } from "@/services/userService";
|
||||
export interface PickerOptionState {
|
||||
cities: any[];
|
||||
professions: any[];
|
||||
ntrpLevels: string[];
|
||||
ntrpLevels: any[];
|
||||
getCities: () => Promise<any>;
|
||||
getProfessions: () => Promise<any>;
|
||||
}
|
||||
@@ -13,7 +13,40 @@ export interface PickerOptionState {
|
||||
export const usePickerOption = create<PickerOptionState>((set) => ({
|
||||
cities: [],
|
||||
professions: [],
|
||||
ntrpLevels: ["1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.5+"],
|
||||
ntrpLevels: [
|
||||
{
|
||||
text: "1.5",
|
||||
value: "1.5",
|
||||
},
|
||||
{
|
||||
text: "2.0",
|
||||
value: "2.0",
|
||||
},
|
||||
{
|
||||
text: "2.5",
|
||||
value: "2.5",
|
||||
},
|
||||
{
|
||||
text: "3.0",
|
||||
value: "3.0",
|
||||
},
|
||||
{
|
||||
text: "3.5",
|
||||
value: "3.5",
|
||||
},
|
||||
{
|
||||
text: "4.0",
|
||||
value: "4.0",
|
||||
},
|
||||
{
|
||||
text: "4.5",
|
||||
value: "4.5",
|
||||
},
|
||||
{
|
||||
text: "4.5+",
|
||||
value: "4.5+",
|
||||
},
|
||||
],
|
||||
getCities: async () => {
|
||||
try {
|
||||
const res = await UserService.getCities();
|
||||
|
||||
@@ -8,7 +8,9 @@ import {
|
||||
NicknameChangeStatus,
|
||||
updateNickname as updateNicknameApi,
|
||||
} from "@/services/userService";
|
||||
import evaluateService, { LastTimeTestResult } from "@/services/evaluateService";
|
||||
import evaluateService, {
|
||||
LastTimeTestResult,
|
||||
} from "@/services/evaluateService";
|
||||
import { useListStore } from "./listStore";
|
||||
|
||||
export interface UserState {
|
||||
@@ -23,7 +25,6 @@ export interface UserState {
|
||||
fetchLastTestResult: () => Promise<LastTimeTestResult | null>;
|
||||
}
|
||||
|
||||
|
||||
const getTimeNextDate = (time: string) => {
|
||||
const date = new Date(time);
|
||||
date.setDate(date.getDate() + 1);
|
||||
@@ -51,8 +52,6 @@ export const useUser = create<UserState>()((set) => ({
|
||||
|
||||
const cachedCity = (Taro as any).getStorageSync?.(CITY_CACHE_KEY);
|
||||
|
||||
|
||||
|
||||
if (cachedCity && Array.isArray(cachedCity) && cachedCity.length === 2) {
|
||||
// 如果有缓存的城市,使用缓存,不更新 area
|
||||
console.log("[userStore] 检测到缓存的城市,使用缓存,不更新 area");
|
||||
@@ -66,7 +65,10 @@ export const useUser = create<UserState>()((set) => ({
|
||||
|
||||
// 只有当 area 不存在时才使用用户信息中的位置
|
||||
if (!currentArea) {
|
||||
const newArea: [string, string] = [userData.last_location_province||"", userData.last_location_city||""];
|
||||
const newArea: [string, string] = [
|
||||
userData.last_location_province || "",
|
||||
userData.last_location_city || "",
|
||||
];
|
||||
listStore.updateArea(newArea);
|
||||
// 保存到缓存
|
||||
useUser.getState().updateCache(newArea);
|
||||
@@ -102,8 +104,14 @@ export const useUser = create<UserState>()((set) => ({
|
||||
const listStore = useListStore.getState();
|
||||
const currentArea = listStore.area;
|
||||
// 只有当 area 不存在或与 userLastLocationProvince 不一致时才更新
|
||||
if (!currentArea || currentArea[1] !== userInfo.last_location_province) {
|
||||
const newArea: [string, string] = [userInfo.last_location_province || "", userInfo.last_location_city || ""];
|
||||
if (
|
||||
!currentArea ||
|
||||
currentArea[1] !== userInfo.last_location_province
|
||||
) {
|
||||
const newArea: [string, string] = [
|
||||
userInfo.last_location_province || "",
|
||||
userInfo.last_location_city || "",
|
||||
];
|
||||
listStore.updateArea(newArea);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +135,10 @@ export const useUser = create<UserState>()((set) => ({
|
||||
// 如果已经有状态数据且不是强制更新,跳过,避免重复调用
|
||||
if (!force) {
|
||||
const currentState = useUser.getState();
|
||||
if (currentState.nicknameChangeStatus && Object.keys(currentState.nicknameChangeStatus).length > 0) {
|
||||
if (
|
||||
currentState.nicknameChangeStatus &&
|
||||
Object.keys(currentState.nicknameChangeStatus).length > 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ const EditProfilePage: React.FC = () => {
|
||||
country: info?.country ?? "",
|
||||
province: info?.province ?? "",
|
||||
city: info?.city ?? "",
|
||||
district: info?.district ?? "",
|
||||
};
|
||||
};
|
||||
const [form_data, setFormData] = useState(getInitialFormData());
|
||||
@@ -85,6 +86,7 @@ const EditProfilePage: React.FC = () => {
|
||||
country: info?.country ?? "",
|
||||
province: info?.province ?? "",
|
||||
city: info?.city ?? "",
|
||||
district: info?.district ?? "",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -358,11 +360,11 @@ const EditProfilePage: React.FC = () => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const [country, province, city] = e;
|
||||
const [province, city, district] = e;
|
||||
handle_field_edit({
|
||||
country: String(country ?? ""),
|
||||
province: String(province ?? ""),
|
||||
city: String(city ?? ""),
|
||||
district: String(district ?? ""),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -660,15 +662,17 @@ const EditProfilePage: React.FC = () => {
|
||||
<View className="item_right">
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.country ||
|
||||
form_data.province ||
|
||||
form_data.city
|
||||
form_data.city ||
|
||||
form_data.district
|
||||
? ""
|
||||
: "placehoder"
|
||||
}`}
|
||||
>
|
||||
{form_data.country || form_data.province || form_data.city
|
||||
? `${form_data.country} ${form_data.province} ${form_data.city}`
|
||||
{form_data.province ||
|
||||
form_data.city ||
|
||||
form_data.district
|
||||
? `${form_data.province} ${form_data.city} ${form_data.district}`
|
||||
: "选择所在地区"}
|
||||
</Text>
|
||||
<Image
|
||||
@@ -885,8 +889,8 @@ const EditProfilePage: React.FC = () => {
|
||||
visible={location_picker_visible}
|
||||
setvisible={setLocationPickerVisible}
|
||||
value={
|
||||
form_data.country
|
||||
? [form_data.country, form_data.province, form_data.city]
|
||||
form_data.province
|
||||
? [form_data.province, form_data.city, form_data.district]
|
||||
: getDefaultOption(cities)
|
||||
}
|
||||
onChange={handle_location_change}
|
||||
@@ -899,15 +903,12 @@ const EditProfilePage: React.FC = () => {
|
||||
title="选择 NTRP 自评水平"
|
||||
confirmText="保存"
|
||||
ntrpTested={ntrpTested}
|
||||
options={ntrpLevels.map((level) => ({
|
||||
text: level,
|
||||
value: level,
|
||||
}))}
|
||||
options={ntrpLevels}
|
||||
type="ntrp"
|
||||
// img={(user_info as UserInfoType)?.avatar_url}
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={[form_data.ntrp_level || "2.5"]}
|
||||
value={!form_data.ntrp_level ? ["2.5"] : [form_data.ntrp_level]}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -329,9 +329,8 @@ const OtherUserPage: React.FC = () => {
|
||||
overflow: "hidden",
|
||||
}}
|
||||
listLoadErrorWrapperHeight="fit-content"
|
||||
listLoadErrorWidth="320px"
|
||||
listLoadErrorHeight="152px"
|
||||
listLoadErrorScale="1.2"
|
||||
listLoadErrorWidth="410px"
|
||||
listLoadErrorHeight="185px"
|
||||
defaultShowNum={3}
|
||||
/>
|
||||
</ScrollView>
|
||||
@@ -375,9 +374,8 @@ const OtherUserPage: React.FC = () => {
|
||||
collapse={true}
|
||||
style={{ paddingBottom: "90px", overflow: "hidden" }}
|
||||
listLoadErrorWrapperHeight="fit-content"
|
||||
listLoadErrorWidth="320px"
|
||||
listLoadErrorHeight="152px"
|
||||
listLoadErrorScale="1.2"
|
||||
listLoadErrorWidth="410px"
|
||||
listLoadErrorHeight="185px"
|
||||
defaultShowNum={3}
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
Reference in New Issue
Block a user