buddhism/pages/basePage/basePagePicture.vue

83 lines
1.9 KiB
Vue
Raw Permalink Normal View History

2025-08-02 17:35:47 +08:00
<template>
<view class="page">
<base-background />
<!-- 使用自定义导航栏组件 -->
2025-08-14 11:22:53 +08:00
<custom-navbar title="带图片背景的基础界面" ref="customNavbar" />
2025-08-02 17:35:47 +08:00
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }">
<!-- 状态展示 -->
2025-08-14 11:22:53 +08:00
<status-display v-if="loading" type="loading" loading-text="加载中..." />
2025-08-02 17:35:47 +08:00
<!-- 页面内容将在这里添加 -->
</view>
2025-08-14 11:22:53 +08:00
</view>
2025-08-02 17:35:47 +08:00
</template>
<script>
2025-08-14 11:22:53 +08:00
import { CommonEnum } from '@/enum/common.js'
import { MonkEnum } from '@/enum/monk.js'
import { getMonkList } from '@/api/monk/monk.js'
2025-08-08 10:15:16 +08:00
2025-08-14 11:22:53 +08:00
import SearchBox from '../../components/search-box/search-box.vue'
2025-08-02 17:35:47 +08:00
2025-08-14 11:22:53 +08:00
export default {
components: {
MonkSearchBox: SearchBox,
},
data() {
return {
bgc: {
backgroundColor: '#F5F0E7',
},
CommonEnum,
MonkEnum,
monkList: [],
searchName: '',
}
},
onLoad() {
this.fetchMonkList()
},
methods: {
async fetchMonkList() {
try {
const res = await getMonkList({ name: this.searchName })
if (res.code === 200 && Array.isArray(res.rows)) {
this.monkList = res.rows
} else {
uni.showToast({
title: res.msg || '获取失败',
icon: 'none',
})
}
} catch (e) {
2025-08-02 17:35:47 +08:00
uni.showToast({
2025-08-14 11:22:53 +08:00
title: '网络错误',
icon: 'none',
2025-08-02 17:35:47 +08:00
})
}
2025-08-14 11:22:53 +08:00
},
2025-08-02 17:35:47 +08:00
2025-08-14 11:22:53 +08:00
// 去除 HTML 标签,返回纯文本
stripHtmlTags(html) {
if (!html) return '' // 处理空值
return html.replace(/<[^>]+>/g, '') // 正则替换所有 HTML 标签
},
2025-08-02 17:35:47 +08:00
},
}
</script>
2025-08-06 09:55:40 +08:00
<style lang="scss" scoped>
2025-08-14 11:22:53 +08:00
.page {
width: 100%;
min-height: 100vh;
}
2025-08-02 17:35:47 +08:00
2025-08-14 11:22:53 +08:00
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 0 15rpx 40rpx 15rpx;
}
</style>