2025-07-29 15:14:31 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="page">
|
|
|
|
|
|
<u-navbar title="寺庙高僧" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
|
|
|
|
|
|
title-size='36' height='36' id="navbar">
|
|
|
|
|
|
</u-navbar>
|
|
|
|
|
|
<view class="container">
|
|
|
|
|
|
<image class="background-image" :src="CommonEnum.BACKGROUND" mode="aspectFill"></image>
|
|
|
|
|
|
<view class='searchBox'>
|
|
|
|
|
|
<image class="search-icon" :src="MonkEnum.SEARCH" mode="aspectFit"></image>
|
2025-07-29 16:39:21 +08:00
|
|
|
|
<input
|
|
|
|
|
|
class="search-input"
|
|
|
|
|
|
v-model="searchName"
|
|
|
|
|
|
placeholder="请输入高僧姓名"
|
|
|
|
|
|
placeholder-class="search-placeholder"
|
|
|
|
|
|
@confirm="onSearch"
|
|
|
|
|
|
confirm-type="search"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<view class="search-btn" @click="onSearch">搜索</view>
|
2025-07-29 15:14:31 +08:00
|
|
|
|
</view>
|
2025-07-29 15:38:02 +08:00
|
|
|
|
<view class="monk-list">
|
2025-07-29 16:24:38 +08:00
|
|
|
|
<view class="monk-item" v-for="(item, idx) in monkList" :key="item.id">
|
|
|
|
|
|
<image class="monk-avatar" :src="item.imgUrl" mode="aspectFill"></image>
|
2025-07-29 15:38:02 +08:00
|
|
|
|
<view class="monk-info">
|
2025-07-29 16:24:38 +08:00
|
|
|
|
<view class="desc-row">
|
|
|
|
|
|
<view class="monk-desc">{{ item.name }},{{ stripHtmlTags(item.profile) }}</view>
|
|
|
|
|
|
<view class="monk-detail" @click="goDetail(item)">查看详情></view>
|
|
|
|
|
|
</view>
|
2025-07-29 15:38:02 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-07-29 15:14:31 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-07-29 16:24:38 +08:00
|
|
|
|
import {
|
|
|
|
|
|
CommonEnum
|
|
|
|
|
|
} from '@/enum/common.js'
|
|
|
|
|
|
import {
|
|
|
|
|
|
MonkEnum
|
|
|
|
|
|
} from '@/enum/monk.js'
|
|
|
|
|
|
import {
|
|
|
|
|
|
getMonkList
|
|
|
|
|
|
} from '@/api/monk.js'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
bgc: {
|
|
|
|
|
|
backgroundColor: "#F5F0E7"
|
2025-07-29 15:38:02 +08:00
|
|
|
|
},
|
2025-07-29 16:24:38 +08:00
|
|
|
|
CommonEnum,
|
|
|
|
|
|
MonkEnum,
|
2025-07-29 16:39:21 +08:00
|
|
|
|
monkList: [],
|
|
|
|
|
|
searchName: ''
|
2025-07-29 16:24:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad() {
|
|
|
|
|
|
this.fetchMonkList()
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
async fetchMonkList() {
|
|
|
|
|
|
try {
|
2025-07-29 16:39:21 +08:00
|
|
|
|
const res = await getMonkList({ name: this.searchName })
|
2025-07-29 16:24:38 +08:00
|
|
|
|
if (res.code === 200 && Array.isArray(res.rows)) {
|
|
|
|
|
|
this.monkList = res.rows
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: res.msg || '获取失败',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '网络错误',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
2025-07-29 15:38:02 +08:00
|
|
|
|
}
|
2025-07-29 16:24:38 +08:00
|
|
|
|
},
|
2025-07-29 16:39:21 +08:00
|
|
|
|
onSearch() {
|
|
|
|
|
|
this.fetchMonkList()
|
|
|
|
|
|
},
|
2025-07-29 16:24:38 +08:00
|
|
|
|
// 去除 HTML 标签,返回纯文本
|
|
|
|
|
|
stripHtmlTags(html) {
|
|
|
|
|
|
if (!html) return ''; // 处理空值
|
|
|
|
|
|
return html.replace(/<[^>]+>/g, ''); // 正则替换所有 HTML 标签
|
|
|
|
|
|
},
|
|
|
|
|
|
goDetail(item) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '详情功能待开发',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-07-29 15:14:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2025-07-29 16:24:38 +08:00
|
|
|
|
.page {
|
|
|
|
|
|
width: 750rpx;
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
background: #F5F0E7;
|
|
|
|
|
|
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
margin: 20px 14px 40rpx 14px;
|
|
|
|
|
|
width: 694rpx;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.background-image {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
z-index: -1;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.searchBox {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
width: 660rpx;
|
|
|
|
|
|
height: 70rpx;
|
|
|
|
|
|
background: #FFFBF5;
|
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
|
border: 1rpx solid #C7A26D;
|
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
|
padding: 0 12rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-icon {
|
|
|
|
|
|
width: 32rpx;
|
|
|
|
|
|
height: 32rpx;
|
2025-07-29 16:39:21 +08:00
|
|
|
|
margin: 0 28rpx;
|
2025-07-29 16:24:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-29 16:39:21 +08:00
|
|
|
|
.search-input {
|
2025-07-29 16:24:38 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
font-size: 28rpx;
|
2025-07-29 16:39:21 +08:00
|
|
|
|
color: #333;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-placeholder {
|
2025-07-29 16:24:38 +08:00
|
|
|
|
color: #bfa16b;
|
2025-07-29 16:39:21 +08:00
|
|
|
|
font-size: 28rpx;
|
2025-07-29 16:24:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-btn {
|
|
|
|
|
|
background: #bfa16b;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
|
border-radius: 6rpx;
|
|
|
|
|
|
padding: 0 24rpx;
|
|
|
|
|
|
height: 48rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
margin-left: 16rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-list {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
margin-top: 24rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
margin-bottom: 24rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-avatar {
|
|
|
|
|
|
width: 184rpx;
|
|
|
|
|
|
height: 184rpx;
|
|
|
|
|
|
background: #e5e5e5;
|
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
|
margin-right: 18rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-info {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.desc-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-end;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-desc {
|
|
|
|
|
|
line-height: 38rpx;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #695347;
|
|
|
|
|
|
margin-top: 8rpx;
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
|
// 让内容最多显示4行,超出省略
|
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
|
-webkit-line-clamp: 4;
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.monk-detail {
|
|
|
|
|
|
color: #bfa16b;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
2025-07-29 15:14:31 +08:00
|
|
|
|
</style>
|