feat(家庭功能): 添加步数排行榜功能并重构区域选择逻辑
- 在points.js中添加步数排行榜API接口 - 将上海区域信息提取到config.js中统一管理 - 在FamilyRank页面引入步数排行榜功能 - 重构CreateFamily和EditFamily页面的区域选择器,使用统一的区域数据 - 移除不再使用的syncWxStepAPI接口
Showing
6 changed files
with
63 additions
and
48 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-12-22 10:29:37 | 2 | * @Date: 2023-12-22 10:29:37 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-08 12:24:35 | 4 | + * @LastEditTime: 2025-09-09 11:32:38 |
| 5 | * @FilePath: /lls_program/src/api/points.js | 5 | * @FilePath: /lls_program/src/api/points.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | import { fn, fetch } from './fn'; | 8 | import { fn, fetch } from './fn'; |
| 9 | 9 | ||
| 10 | const Api = { | 10 | const Api = { |
| 11 | - SYNC_WX_STEP: '/srv/?a=point&t=sync_wx_step', | ||
| 12 | COLLECT_POINT: '/srv/?a=point&t=collect', | 11 | COLLECT_POINT: '/srv/?a=point&t=collect', |
| 13 | POINT_LIST: '/srv/?a=point&t=list', | 12 | POINT_LIST: '/srv/?a=point&t=list', |
| 13 | + STEP_LEADERBOARD: '/srv/?a=point&t=step_leaderboard', | ||
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | - * @description: 同步微信步数 | ||
| 18 | - * @returns | ||
| 19 | - */ | ||
| 20 | -export const syncWxStepAPI = (params) => fn(fetch.post(Api.SYNC_WX_STEP, params)); | ||
| 21 | - | ||
| 22 | -/** | ||
| 23 | * @description: 汇总积分到家庭 | 17 | * @description: 汇总积分到家庭 |
| 24 | * @param {*} params | 18 | * @param {*} params |
| 25 | * @param {string} params.family_id - 家庭ID | 19 | * @param {string} params.family_id - 家庭ID |
| ... | @@ -53,3 +47,29 @@ export const collectPointAPI = (params) => fn(fetch.post(Api.COLLECT_POINT, para | ... | @@ -53,3 +47,29 @@ export const collectPointAPI = (params) => fn(fetch.post(Api.COLLECT_POINT, para |
| 53 | * @returns {string} response.data.logs[].created_time - 创建时间 | 47 | * @returns {string} response.data.logs[].created_time - 创建时间 |
| 54 | */ | 48 | */ |
| 55 | export const getPointListAPI = (params) => fn(fetch.get(Api.POINT_LIST, params)); | 49 | export const getPointListAPI = (params) => fn(fetch.get(Api.POINT_LIST, params)); |
| 50 | + | ||
| 51 | +/** | ||
| 52 | + * @description: 查询步数排行榜 | ||
| 53 | + * @param {Object} params - 请求参数 | ||
| 54 | + * @param {string} params.county - 区县 | ||
| 55 | + * @returns {Object} response - 响应对象 | ||
| 56 | + * @returns {number} response.code - 响应状态码 | ||
| 57 | + * @returns {string} response.msg - 响应消息 | ||
| 58 | + * @returns {Object} response.data - 响应数据 | ||
| 59 | + * @returns {Array} response.data.yesterday - 昨天日期 | ||
| 60 | + * @returns {Array} response.data.families[] - 家庭列表 | ||
| 61 | + * @returns {string} response.data.families[].family_id - 家庭ID | ||
| 62 | + * @returns {string} response.data.families[].name - 家庭名称 | ||
| 63 | + * @returns {string} response.data.families[].avatar_url - 头像URL | ||
| 64 | + * @returns {string} response.data.families[].created_by_nickname - 创建人昵称 | ||
| 65 | + * @returns {number} response.data.families[].step - 步数 | ||
| 66 | + * @returns {number} response.data.families[].rank - 排名 | ||
| 67 | + * @returns {Array} response.data.current_family[] - 当前家庭列表 | ||
| 68 | + * @returns {string} response.data.current_family[].family_id - 家庭ID | ||
| 69 | + * @returns {string} response.data.current_family[].name - 家庭名称 | ||
| 70 | + * @returns {string} response.data.current_family[].avatar_url - 头像URL | ||
| 71 | + * @returns {string} response.data.current_family[].created_by_nickname - 创建人昵称 | ||
| 72 | + * @returns {number} response.data.current_family[].step - 步数 | ||
| 73 | + * @returns {number} response.data.current_family[].rank - 排名 | ||
| 74 | + */ | ||
| 75 | +export const getStepLeaderboardAPI = (params) => fn(fetch.get(Api.STEP_LEADERBOARD, params)); | ... | ... |
| ... | @@ -47,7 +47,6 @@ | ... | @@ -47,7 +47,6 @@ |
| 47 | import { ref, onMounted, defineEmits, defineProps } from 'vue' | 47 | import { ref, onMounted, defineEmits, defineProps } from 'vue' |
| 48 | import Taro from '@tarojs/taro' | 48 | import Taro from '@tarojs/taro' |
| 49 | 49 | ||
| 50 | -// import { syncWxStepAPI } from '@/api/points' | ||
| 51 | import { fetch } from '@/api/fn' | 50 | import { fetch } from '@/api/fn' |
| 52 | 51 | ||
| 53 | // 定义props | 52 | // 定义props | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:44:53 | 2 | * @Date: 2025-08-27 17:44:53 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-04 17:59:11 | 4 | + * @LastEditTime: 2025-09-09 11:38:58 |
| 5 | * @FilePath: /lls_program/src/pages/CreateFamily/index.vue | 5 | * @FilePath: /lls_program/src/pages/CreateFamily/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -176,6 +176,8 @@ import { Tips, Photograph, Right } from '@nutui/icons-vue-taro'; | ... | @@ -176,6 +176,8 @@ import { Tips, Photograph, Right } from '@nutui/icons-vue-taro'; |
| 176 | import BASE_URL from '@/utils/config'; | 176 | import BASE_URL from '@/utils/config'; |
| 177 | // 接口信息 | 177 | // 接口信息 |
| 178 | import { createFamilyAPI } from '@/api/family'; | 178 | import { createFamilyAPI } from '@/api/family'; |
| 179 | +// 区域信息 | ||
| 180 | +import { SHANGHAI_REGION } from '@/utils/config'; | ||
| 179 | 181 | ||
| 180 | const defaultFamilyCoverSvg = 'https://cdn.ipadbiz.cn/lls_prog/images/default-family-cover.png'; | 182 | const defaultFamilyCoverSvg = 'https://cdn.ipadbiz.cn/lls_prog/images/default-family-cover.png'; |
| 181 | const familyName = ref(''); | 183 | const familyName = ref(''); |
| ... | @@ -192,24 +194,7 @@ const familyIntroError = ref(''); | ... | @@ -192,24 +194,7 @@ const familyIntroError = ref(''); |
| 192 | // 区域选择器相关 | 194 | // 区域选择器相关 |
| 193 | const showDistrictPicker = ref(false); | 195 | const showDistrictPicker = ref(false); |
| 194 | const districtValue = ref([]); | 196 | const districtValue = ref([]); |
| 195 | -const districtColumns = ref([ | 197 | +const districtColumns = ref(SHANGHAI_REGION); |
| 196 | - { text: '黄浦区', value: 310101 }, | ||
| 197 | - { text: '徐汇区', value: 310104 }, | ||
| 198 | - { text: '长宁区', value: 310105 }, | ||
| 199 | - { text: '静安区', value: 310106 }, | ||
| 200 | - { text: '普陀区', value: 310107 }, | ||
| 201 | - { text: '虹口区', value: 310109 }, | ||
| 202 | - { text: '杨浦区', value: 310110 }, | ||
| 203 | - { text: '闵行区', value: 310112 }, | ||
| 204 | - { text: '宝山区', value: 310113 }, | ||
| 205 | - { text: '嘉定区', value: 310114 }, | ||
| 206 | - { text: '浦东新区', value: 310115 }, | ||
| 207 | - { text: '金山区', value: 310116 }, | ||
| 208 | - { text: '松江区', value: 310117 }, | ||
| 209 | - { text: '青浦区', value: 310118 }, | ||
| 210 | - { text: '奉贤区', value: 310120 }, | ||
| 211 | - { text: '崇明区', value: 310151 } | ||
| 212 | -]); | ||
| 213 | const familyAvatar = ref(''); | 198 | const familyAvatar = ref(''); |
| 214 | const focusedIndex = ref(-1); | 199 | const focusedIndex = ref(-1); |
| 215 | const inputRefs = ref([]); | 200 | const inputRefs = ref([]); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:44:53 | 2 | * @Date: 2025-08-27 17:44:53 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-08 11:55:03 | 4 | + * @LastEditTime: 2025-09-09 11:39:20 |
| 5 | * @FilePath: /lls_program/src/pages/EditFamily/index.vue | 5 | * @FilePath: /lls_program/src/pages/EditFamily/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -175,6 +175,8 @@ import BASE_URL from '@/utils/config'; | ... | @@ -175,6 +175,8 @@ import BASE_URL from '@/utils/config'; |
| 175 | const defaultFamilyCoverSvg = 'https://cdn.ipadbiz.cn/lls_prog/images/default-family-cover.png'; | 175 | const defaultFamilyCoverSvg = 'https://cdn.ipadbiz.cn/lls_prog/images/default-family-cover.png'; |
| 176 | // 获取接口信息 | 176 | // 获取接口信息 |
| 177 | import { editFamilyAPI, getFamilyInfoAPI } from '@/api/family'; | 177 | import { editFamilyAPI, getFamilyInfoAPI } from '@/api/family'; |
| 178 | +// 区域信息 | ||
| 179 | +import { SHANGHAI_REGION } from '@/utils/config'; | ||
| 178 | 180 | ||
| 179 | const familyId = ref(''); | 181 | const familyId = ref(''); |
| 180 | const familyName = ref(''); | 182 | const familyName = ref(''); |
| ... | @@ -191,24 +193,7 @@ const familyIntroError = ref(''); | ... | @@ -191,24 +193,7 @@ const familyIntroError = ref(''); |
| 191 | // 区域选择器相关 | 193 | // 区域选择器相关 |
| 192 | const showDistrictPicker = ref(false); | 194 | const showDistrictPicker = ref(false); |
| 193 | const districtValue = ref([]); | 195 | const districtValue = ref([]); |
| 194 | -const districtColumns = ref([ | 196 | +const districtColumns = ref(SHANGHAI_REGION); |
| 195 | - { text: '黄浦区', value: 310101 }, | ||
| 196 | - { text: '徐汇区', value: 310104 }, | ||
| 197 | - { text: '长宁区', value: 310105 }, | ||
| 198 | - { text: '静安区', value: 310106 }, | ||
| 199 | - { text: '普陀区', value: 310107 }, | ||
| 200 | - { text: '虹口区', value: 310109 }, | ||
| 201 | - { text: '杨浦区', value: 310110 }, | ||
| 202 | - { text: '闵行区', value: 310112 }, | ||
| 203 | - { text: '宝山区', value: 310113 }, | ||
| 204 | - { text: '嘉定区', value: 310114 }, | ||
| 205 | - { text: '浦东新区', value: 310115 }, | ||
| 206 | - { text: '金山区', value: 310116 }, | ||
| 207 | - { text: '松江区', value: 310117 }, | ||
| 208 | - { text: '青浦区', value: 310118 }, | ||
| 209 | - { text: '奉贤区', value: 310120 }, | ||
| 210 | - { text: '崇明区', value: 310151 } | ||
| 211 | -]); | ||
| 212 | const familyAvatar = ref(''); | 197 | const familyAvatar = ref(''); |
| 213 | const focusedIndex = ref(-1); | 198 | const focusedIndex = ref(-1); |
| 214 | const defaultFamilyCover = ref(defaultFamilyCoverSvg); | 199 | const defaultFamilyCover = ref(defaultFamilyCoverSvg); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-09-01 13:07:52 | 2 | * @Date: 2025-09-01 13:07:52 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-06 12:51:49 | 4 | + * @LastEditTime: 2025-09-09 11:40:05 |
| 5 | * @FilePath: /lls_program/src/pages/FamilyRank/index.vue | 5 | * @FilePath: /lls_program/src/pages/FamilyRank/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -131,6 +131,12 @@ | ... | @@ -131,6 +131,12 @@ |
| 131 | <script setup> | 131 | <script setup> |
| 132 | import { ref, computed } from 'vue' | 132 | import { ref, computed } from 'vue' |
| 133 | import BackToTop from '@/components/BackToTop.vue' | 133 | import BackToTop from '@/components/BackToTop.vue' |
| 134 | +// 导入接口 | ||
| 135 | +import { getStepLeaderboardAPI } from '@/api/points' | ||
| 136 | +import { getFamilyInfoAPI } from '@/api/family' | ||
| 137 | + | ||
| 138 | +// 区域信息 | ||
| 139 | +import { SHANGHAI_REGION } from '@/utils/config' | ||
| 134 | 140 | ||
| 135 | // 当前激活的tab | 141 | // 当前激活的tab |
| 136 | const activeTab = ref('huangpu') | 142 | const activeTab = ref('huangpu') | ... | ... |
| ... | @@ -53,3 +53,23 @@ export const THEME_COLORS = { | ... | @@ -53,3 +53,23 @@ export const THEME_COLORS = { |
| 53 | WARNING: '#F59E0B', | 53 | WARNING: '#F59E0B', |
| 54 | ERROR: '#EF4444' | 54 | ERROR: '#EF4444' |
| 55 | } | 55 | } |
| 56 | + | ||
| 57 | +// 上海区域信息 | ||
| 58 | +export const SHANGHAI_REGION = [ | ||
| 59 | + { text: '黄浦区', value: 310101 }, | ||
| 60 | + { text: '徐汇区', value: 310104 }, | ||
| 61 | + { text: '长宁区', value: 310105 }, | ||
| 62 | + { text: '静安区', value: 310106 }, | ||
| 63 | + { text: '普陀区', value: 310107 }, | ||
| 64 | + { text: '虹口区', value: 310109 }, | ||
| 65 | + { text: '杨浦区', value: 310110 }, | ||
| 66 | + { text: '闵行区', value: 310112 }, | ||
| 67 | + { text: '宝山区', value: 310113 }, | ||
| 68 | + { text: '嘉定区', value: 310114 }, | ||
| 69 | + { text: '浦东新区', value: 310115 }, | ||
| 70 | + { text: '金山区', value: 310116 }, | ||
| 71 | + { text: '松江区', value: 310117 }, | ||
| 72 | + { text: '青浦区', value: 310118 }, | ||
| 73 | + { text: '奉贤区', value: 310120 }, | ||
| 74 | + { text: '崇明区', value: 310151 } | ||
| 75 | +] | ... | ... |
-
Please register or login to post a comment