diff --git a/pages/index/auth-form.vue b/pages/index/auth-form.vue index 46572d5..2e0ccdc 100644 --- a/pages/index/auth-form.vue +++ b/pages/index/auth-form.vue @@ -54,7 +54,7 @@ 与产权人关系 - {{ state.form.relationType || '请输入' }} + {{ state.form.relationType ? (state.relationList.find(item => item.value == state.form.relationType)?.label || '请输入') : '请输入' }} @@ -95,7 +95,7 @@ 证件类型 - {{ state.form.idType || '请选择证件类型' }} + {{ state.form.idType ? (state.idTypeList.find(item => item.value == state.form.idType)?.label || '请选择证件类型') : '请选择证件类型' }} @@ -119,7 +119,7 @@ 性别 - {{ state.form.sex === 1 ? '男' : state.form.sex === 2 ? '女' : '请选择' }} + {{ state.form.sex ? (state.sexList.find(item => item.value == state.form.sex)?.label || '请选择') : '请选择' }} @@ -187,6 +187,7 @@ import { onLoad } from '@dcloudio/uni-app'; import MemberHouseApi from '@/sheep/api/community/memberHouse'; import CommunityApi from '@/sheep/api/community/community'; import FileApi from '@/sheep/api/infra/file'; +import DictApi from '@/sheep/api/system/dict'; import { tenantId } from '@/sheep/config'; import sheep from '@/sheep'; @@ -216,11 +217,19 @@ const state = reactive({ houseTree: [], // 房屋树(楼号->单元->房号) attachmentUrl: '', // 附件URL facePhotoUrl: '', // 人脸照片URL + idTypeList: [], // 证件类型字典 + relationList: [], // 与产权人关系字典 + sexList: [], // 性别字典 }); onLoad(async () => { + // 并行加载字典数据 + loadDict('comm_id_type', 'idTypeList'); + loadDict('comm_relation_type', 'relationList'); + loadDict('system_user_sex', 'sexList'); + // 获取小区列表 - const { code, data } = await CommunityApi.getSimpleList(); + const { code, data } = await CommunityApi.getSimpleList({ all: true }); if (code === 0 && data && data.length > 0) { state.communityList = data; // 优先匹配 SHOPRO_TENANT_ID 配置的小区,没有则选第一个 @@ -235,6 +244,14 @@ onLoad(async () => { } }); +// 加载字典数据 +const loadDict = async (type, field) => { + const { code, data } = await DictApi.getDictDataListByType(type); + if (code === 0 && data) { + state[field] = data; + } +}; + // 加载房屋树 const loadHouseTree = async (communityId) => { if (!communityId) return; @@ -284,7 +301,7 @@ const showHousePicker = () => { const units = building.children || []; if (!units.length) { state.form.houseId = building.value; - state.form.buildingNo = building.label; + state.form.buildingNo = building.value; state.form.unitNo = ''; state.form.roomNo = ''; return; @@ -299,8 +316,8 @@ const showHousePicker = () => { const rooms = unit.children || []; if (!rooms.length) { state.form.houseId = unit.value; - state.form.buildingNo = building.label; - state.form.unitNo = unit.label; + state.form.buildingNo = building.value; + state.form.unitNo = unit.value; state.form.roomNo = ''; return; } @@ -310,9 +327,9 @@ const showHousePicker = () => { success: (roomRes) => { const room = rooms[roomRes.tapIndex]; state.form.houseId = room.value; - state.form.buildingNo = building.label; - state.form.unitNo = unit.label; - state.form.roomNo = room.label; + state.form.buildingNo = building.value; + state.form.unitNo = unit.value; + state.form.roomNo = room.value; } }); } @@ -323,32 +340,45 @@ const showHousePicker = () => { // 显示关系选择器 const showRelationPicker = () => { + if (!state.relationList.length) { + uni.showToast({ title: '数据加载中', icon: 'none' }); + return; + } + const itemList = state.relationList.map((item) => item.label); uni.showActionSheet({ - itemList: ['本人', '配偶', '父母', '子女', '其他'], + itemList, success: (res) => { - const relations = ['本人', '配偶', '父母', '子女', '其他']; - state.form.relationType = relations[res.tapIndex]; + state.form.relationType = state.relationList[res.tapIndex].value; } }); }; // 显示证件类型选择器 const showIdTypePicker = () => { + if (!state.idTypeList.length) { + uni.showToast({ title: '数据加载中', icon: 'none' }); + return; + } + const itemList = state.idTypeList.map((item) => item.label); uni.showActionSheet({ - itemList: ['身份证', '护照', '军官证', '港澳通行证'], + itemList, success: (res) => { - const types = ['身份证', '护照', '军官证', '港澳通行证']; - state.form.idType = types[res.tapIndex]; + state.form.idType = state.idTypeList[res.tapIndex].value; } }); }; // 显示性别选择器 const showGenderPicker = () => { + if (!state.sexList.length) { + uni.showToast({ title: '数据加载中', icon: 'none' }); + return; + } + const itemList = state.sexList.map((item) => item.label); uni.showActionSheet({ - itemList: ['男', '女'], + itemList, success: (res) => { - state.form.sex = res.tapIndex === 0 ? 1 : 2; + state.form.sex = state.sexList[res.tapIndex].value; } }); }; diff --git a/pages/index/check-page.vue b/pages/index/check-page.vue index a72c938..887d92b 100644 --- a/pages/index/check-page.vue +++ b/pages/index/check-page.vue @@ -25,7 +25,7 @@ {{ item.communityName }} {{ getStatusText(item.status) }} - {{ item.address }} + {{ item.ful1Address }} diff --git a/pages/index/index.vue b/pages/index/index.vue index 4d617bd..237b373 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -29,13 +29,7 @@ indicator-active-color="#FF7F69" > - + @@ -406,47 +400,18 @@ const handleBannerTap = (item) => { .banner-card { height: 298rpx; margin: 0 24rpx 24rpx; - padding: 45.8rpx 38rpx; background-color: #FFFFFF; border-radius: 38rpx; overflow: hidden; box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); - + .banner-swiper { width: 100%; height: 100%; - - .banner-content { - display: flex; - justify-content: space-between; - align-items: center; - padding: 32rpx; + + .banner-img { + width: 100%; height: 100%; - - .banner-text { - flex: 1; - - .banner-title { - display: block; - font-size: 44rpx; - font-weight: 600; - color: #333333; - margin-bottom: 12rpx; - font-family: 'PingFang SC', sans-serif; - } - - .banner-subtitle { - display: block; - font-size: 24rpx; - color: #999999; - font-family: 'PingFang SC', sans-serif; - } - } - - .banner-icon { - width: 160rpx; - height: 160rpx; - } } } } diff --git a/pages/index/switch-house.vue b/pages/index/switch-house.vue index f500f51..2492047 100644 --- a/pages/index/switch-house.vue +++ b/pages/index/switch-house.vue @@ -126,9 +126,22 @@ const selectHouse = async (item) => { communityId: item.communityId, }); if (switchRes.code === 0) { - // 切换成功后刷新用户信息 - await sheep.$store('user').getInfo(); + const resData = switchRes.data || {}; + + if (resData.needRelogin) { + // 后端要求重新登录:刷新 token 并自动拉取用户信息 + await sheep.$store('user').setToken(resData.accessToken, resData.refreshToken); + } else { + // 仅刷新用户信息 + await sheep.$store('user').getInfo(); + } + uni.showToast({ title: '已切换至 ' + item.name, icon: 'none' }); + + // 回到首页重新加载数据 + setTimeout(() => { + uni.switchTab({ url: '/pages/index/index' }); + }, 800); } }; diff --git a/sheep/api/community/community.js b/sheep/api/community/community.js index 065c3cf..9567fdc 100644 --- a/sheep/api/community/community.js +++ b/sheep/api/community/community.js @@ -2,10 +2,11 @@ import request from '@/sheep/request'; const CommunityApi = { // 获取小区简单列表 - getSimpleList: () => { + getSimpleList: (data) => { return request({ url: '/community/community/simple-list', method: 'GET', + data, custom: { showLoading: true, auth: true,