longz
2026-04-27 25df88d0ab9d7444ed1d162b9efa1259ac2f6f66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { fetchSystemSettings } from '@/api/systemSettings'
 
definePage({
  name: 'aboutUs',
  layout: 'default',
  style: {
    navigationBarTitleText: '内容详情',
    navigationBarBackgroundColor: '#FFFFFF',
    navigationBarTextStyle: 'black',
  },
})
 
const pageTitle = ref('内容详情')
const settingCode = ref('CONTENT_ABOUT_US_HTML')
const loading = ref(false)
const htmlContent = ref('')
 
async function loadContent() {
  loading.value = true
  try {
    const result = await fetchSystemSettings(settingCode.value)
    htmlContent.value = result[settingCode.value] || ''
  }
  catch (error) {
    htmlContent.value = ''
    uni.showToast({
      title: error instanceof Error ? error.message : '加载内容失败',
      icon: 'none',
    })
  }
  finally {
    loading.value = false
  }
}
 
onLoad((query) => {
  pageTitle.value = typeof query?.title === 'string' && query.title ? decodeURIComponent(query.title) : '内容详情'
  settingCode.value = typeof query?.code === 'string' && query.code ? query.code : 'CONTENT_ABOUT_US_HTML'
  uni.setNavigationBarTitle({
    title: pageTitle.value,
  })
  void loadContent()
})
</script>
 
<template>
  <view class="min-h-screen bg-white px-[32rpx] py-[24rpx] box-border">
    <view v-if="loading" class="min-h-[320rpx] flex items-center justify-center text-[28rpx] text-[#999999]">
      加载中...
    </view>
    <view v-else-if="!htmlContent" class="min-h-[320rpx] flex items-center justify-center text-[28rpx] text-[#999999]">
      暂无内容
    </view>
    <rich-text v-else class="html-content text-[26rpx] leading-[44rpx] text-[#333333]" :nodes="htmlContent" />
  </view>
</template>
 
<style scoped>
.html-content {
  word-break: break-word;
}
</style>