feat(helpCenter): 帮助中心列表接入内容接口、问题详情页富文本渲染

This commit is contained in:
17792275749
2026-08-20 17:13:57 +08:00
parent f53f11e6e9
commit fce9701254
6 changed files with 117 additions and 96 deletions
@@ -1,55 +1,19 @@
.questionDetails {
width: 100%;
min-height: 100%;
padding: 24rpx 32rpx;
box-sizing: border-box;
background-color: #F5F7FB;
height: 100%;
.card {
.scrollViewContent {
width: 100%;
background-color: #FFFFFF;
border-radius: 24rpx;
padding: 0 40rpx;
height: 100%;
padding: 24rpx 30rpx;
box-sizing: border-box;
.title {
color: #1385FA;
height: 36rpx;
font-size: 36rpx;
line-height: 36rpx;
padding: 40rpx 0;
border-bottom: 2rpx solid #EAECF1;
}
.step {
display: flex;
align-items: flex-start;
padding: 32rpx 0;
border-bottom: 2rpx solid #EAECF1;
&:last-of-type {
border-bottom: none;
}
.badge {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
background-color: #1385FA;
color: #FFFFFF;
font-size: 24rpx;
line-height: 36rpx;
text-align: center;
flex-shrink: 0;
margin-right: 20rpx;
}
.step-text {
flex: 1;
color: #252535;
font-size: 26rpx;
line-height: 26rpx;
}
.card {
width: 100%;
padding: 30rpx;
box-sizing: border-box;
border-radius: 24rpx;
background-color: #FFFFFF;
}
}
}
@@ -1,19 +1,34 @@
// pages/questionDetails/questionDetails.ts
import { get } from '../../utils/request/index'
/** 内容详情 */
interface ContentDetail {
id: string
title: string
content: string
}
Page({
data: {
title: '如何连接蓝牙设备',
steps: [
'进入"设备"页面,点击设备的"成员管理"按钮;',
'点击"添加新成员"进入添加页面;',
'选择用户类型(员工/家庭成员);',
'填写成员信息后保存;',
'在设备连接状态下,点击"同步成员至设备"将用户信息同步到设备。'
]
content: '',
},
onLoad(options: { title?: string }) {
if (options.title) {
this.setData({ title: options.title })
onLoad(options: { id?: string }) {
if (options.id) {
this.loadDetail(options.id)
}
}
},
async loadDetail(id: string) {
try {
const res = await get<ContentDetail>('weighingScale/v6/content/detail', { id })
wx.setNavigationBarTitle({
title: res.result.title
})
this.setData({
content: res.result.content,
})
} catch {
// 请求失败已由 request 层统一 toast
}
},
})
@@ -1,12 +1,9 @@
<view class="questionDetails">
<view class="card">
<view class="title">{{ title }}</view>
<block wx:for="{{ steps }}" wx:key="index">
<view class="step">
<view class="badge">{{ index + 1 }}</view>
<view class="step-text">{{ item }}</view>
<scroll-view scroll-y class="scrollView">
<view class="scrollViewContent">
<view class="card">
<rich-text nodes="{{ content }}"></rich-text>
</view>
</block>
</view>
</view>
</scroll-view>
</view>