35 lines
740 B
TypeScript
35 lines
740 B
TypeScript
import { get } from '../../utils/request/index'
|
|
|
|
/** 内容详情 */
|
|
interface ContentDetail {
|
|
id: string
|
|
title: string
|
|
content: string
|
|
}
|
|
|
|
Page({
|
|
data: {
|
|
content: '',
|
|
},
|
|
|
|
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
|
|
}
|
|
},
|
|
})
|