diff --git a/src/components/ListCard/index.tsx b/src/components/ListCard/index.tsx index 55d5246..5f5eb27 100644 --- a/src/components/ListCard/index.tsx +++ b/src/components/ListCard/index.tsx @@ -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 = ({ id, @@ -45,7 +46,7 @@ const ListCard: React.FC = ({ 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 = ({ 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 = ({ 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 = ({ maxChars++; } - return location.slice(0, maxChars) + '...'; + return location.slice(0, maxChars) + "..."; }, [location, court_type, distance_km]); // 根据图片数量决定展示样式 @@ -220,9 +225,10 @@ const ListCard: React.FC = ({ - + - {Number(skill_level_min)?.toFixed(1)} - {Number(skill_level_max)?.toFixed(1)} + {Number(skill_level_min)?.toFixed(1)} -{" "} + {Number(skill_level_max)?.toFixed(1)} {/* 分割线 */} @@ -251,22 +257,16 @@ const ListCard: React.FC = ({ /> {/* {game_type} */} - { - venue_description && () - } - { - venue_description && - ( - - - 场馆方: - - - {venue_description} - + {venue_description && } + {venue_description && ( + + 场馆方: + + + {venue_description} - ) - } + + )} )} diff --git a/src/components/ListLoadError/index.tsx b/src/components/ListLoadError/index.tsx index daddcfa..3d6be09 100644 --- a/src/components/ListLoadError/index.tsx +++ b/src/components/ListLoadError/index.tsx @@ -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) => { {text && {text}} diff --git a/src/components/UserInfo/index.tsx b/src/components/UserInfo/index.tsx index fb6f2c1..3fb9ede 100644 --- a/src/components/UserInfo/index.tsx +++ b/src/components/UserInfo/index.tsx @@ -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 = ({ }) => { 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 = ({ // 处理地区选择 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 = ({ // 处理职业选择 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 = ({ 选择职业 ) : null} - {user_info.country || user_info.province || user_info.city ? ( + {user_info.province || user_info.city || user_info.district ? ( editable && handle_open_edit_modal("location")} > - {`${user_info.province}${user_info.city}`} + {`${user_info.city}${user_info.district}`} ) : is_current_user ? ( = ({ 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 = ({ 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} /> )} diff --git a/src/config/images.js b/src/config/images.js index 62eaddb..9f84625 100644 --- a/src/config/images.js +++ b/src/config/images.js @@ -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"), +}; diff --git a/src/main_pages/components/MyselfPageContent.tsx b/src/main_pages/components/MyselfPageContent.tsx index fbffc5e..7c9145f 100644 --- a/src/main_pages/components/MyselfPageContent.tsx +++ b/src/main_pages/components/MyselfPageContent.tsx @@ -16,7 +16,9 @@ interface MyselfPageContentProps { isActive?: boolean; } -const MyselfPageContent: React.FC = ({ isActive = true }) => { +const MyselfPageContent: React.FC = ({ + isActive = true, +}) => { const pickerOption = usePickerOption(); const { statusNavbarHeightInfo } = useGlobalState() || {}; const { totalHeight = 98 } = statusNavbarHeightInfo || {}; @@ -292,9 +294,8 @@ const MyselfPageContent: React.FC = ({ isActive = true } overflow: "hidden", }} listLoadErrorWrapperHeight="fit-content" - listLoadErrorWidth="320px" - listLoadErrorHeight="152px" - listLoadErrorScale="1.2" + listLoadErrorWidth="410px" + listLoadErrorHeight="185px" defaultShowNum={3} /> @@ -316,9 +317,8 @@ const MyselfPageContent: React.FC = ({ 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} /> diff --git a/src/services/userService.ts b/src/services/userService.ts index 4c7a7cc..fe75426 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -2,7 +2,7 @@ import { UserInfo } from "@/components/UserInfo"; import { API_CONFIG } from "@/config/api"; import httpService, { ApiResponse } from "./httpService"; import uploadFiles from "./uploadFiles"; -import * as Taro from "@tarojs/taro"; +import * as Taro from "@tarojs/taro"; import getCurrentConfig from "@/config/env"; import { clear_login_state } from "@/services/loginService"; @@ -318,7 +318,7 @@ export class UserService { if (response.code === 0) { const userData = response.data; - + return { id: userData.id || "", nickname: userData.nickname || "", @@ -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) { diff --git a/src/static/emptyStatus/publish-empty-card.png b/src/static/emptyStatus/publish-empty-card.png deleted file mode 100644 index 95da019..0000000 Binary files a/src/static/emptyStatus/publish-empty-card.png and /dev/null differ diff --git a/src/store/pickerOptionsStore.ts b/src/store/pickerOptionsStore.ts index 0c7ccc4..af789a8 100644 --- a/src/store/pickerOptionsStore.ts +++ b/src/store/pickerOptionsStore.ts @@ -5,7 +5,7 @@ import { UserService } from "@/services/userService"; export interface PickerOptionState { cities: any[]; professions: any[]; - ntrpLevels: string[]; + ntrpLevels: any[]; getCities: () => Promise; getProfessions: () => Promise; } @@ -13,7 +13,40 @@ export interface PickerOptionState { export const usePickerOption = create((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(); diff --git a/src/store/userStore.ts b/src/store/userStore.ts index b7f839f..4912277 100644 --- a/src/store/userStore.ts +++ b/src/store/userStore.ts @@ -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; } - const getTimeNextDate = (time: string) => { const date = new Date(time); date.setDate(date.getDate() + 1); @@ -51,8 +52,6 @@ export const useUser = create()((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()((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()((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()((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; } } diff --git a/src/user_pages/edit/index.tsx b/src/user_pages/edit/index.tsx index 91fde3f..9010dff 100644 --- a/src/user_pages/edit/index.tsx +++ b/src/user_pages/edit/index.tsx @@ -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 = () => { - {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}` : "选择所在地区"} { 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} /> )} diff --git a/src/user_pages/other/index.tsx b/src/user_pages/other/index.tsx index 0dd9222..037a915 100644 --- a/src/user_pages/other/index.tsx +++ b/src/user_pages/other/index.tsx @@ -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} /> @@ -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} />