Files
bodyWeight/miniprogram/pages/helpCenter/helpCenter.ts
T
17792275749andClaude Opus 4.7 d6e59df4e9 feat: 详细报告接入 v3 测量历史接口,设备列表接入设备接口
- 详细报告按 scaleType 区分 4/8 电极渲染,节段卡片 8 电极专属
- 设备列表改为接口驱动并新增空态
- 登录后统一跳首页,请求层兼容 code 0 返回风格

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-20 17:20:07 +08:00

64 lines
1.8 KiB
TypeScript

import { get } from '../../utils/request/index'
/** 展示用问题项 */
interface QuestionItem {
id: string
title: string
}
/** 内容列表项 */
interface ContentRecord {
id: string
title: string
}
Page({
data: {
tabs: [
{ name: '全部', categoryId: '', active: true },
{ name: '操作说明', categoryId: '1', active: false },
{ name: '常见问题', categoryId: '2', active: false },
{ name: '新手指引', categoryId: '3', active: false },
{ name: '系统版本', categoryId: '4', active: false },
{ name: '其他', categoryId: '5', active: false },
],
questions: [] as QuestionItem[],
},
onLoad() {
this.loadQuestions('')
},
/** 拉取内容列表(categoryId 为空查全部) */
async loadQuestions(categoryId: string) {
try {
const res = await get<{ records: ContentRecord[] }>(
'weighingScale/v6/content/list',
categoryId ? { categoryId } : undefined,
)
this.setData({
questions: res.result.records.map(item => ({
id: item.id,
title: item.title,
})),
})
} catch {
// 请求失败已由 request 层统一 toast
}
},
onTapTab(e: WechatMiniprogram.TouchEvent) {
const index = e.currentTarget.dataset.index as number
const tabs = this.data.tabs.map((t, i) => ({ ...t, active: i === index }))
this.setData({ tabs })
this.loadQuestions(tabs[index].categoryId)
},
onTapQuestion(e: WechatMiniprogram.TouchEvent) {
const id = e.currentTarget.dataset.id as string
wx.navigateTo({
url: '/pages/questionDetails/questionDetails?id=' + id
})
}
})