修改bug

This commit is contained in:
zhouyanli
2026-08-26 18:00:43 +08:00
parent c862c6ae4b
commit 56641cbc56
6 changed files with 35 additions and 36 deletions

View File

@@ -90,17 +90,14 @@
<!-- 招募要求 --> <!-- 招募要求 -->
<view class="section"> <view class="section">
<view class="section-title">招募要求</view> <view class="section-title">招募要求</view>
<view class="section-content"> <view class="section-content" v-html="formatRichText(activityConent.requirements)"></view>
{{activityConent.requirements}}
</view>
</view> </view>
<!-- 活动详情 --> <!-- 活动详情 -->
<view class="section" style="margin-bottom: 40rpx;"> <view class="section" style="margin-bottom: 40rpx;">
<view class="section-title">活动详情</view> <view class="section-title">活动详情</view>
<view class="section-content rich-content"> <view class="section-content rich-content">
<view v-html="activityConent.content"></view> <view v-html="formatRichText(activityConent.content)"></view>
<view></view>
</view> </view>
</view> </view>
</view> </view>
@@ -170,7 +167,7 @@
报名 报名
</button> </button>
<!-- 已报名状态显示取消报名按钮活动已结束则隐藏 --> <!-- 已报名状态显示取消报名按钮 -->
<button <button
v-if="hasSigned && !isActivityEnded && activeTab === 'detail'" v-if="hasSigned && !isActivityEnded && activeTab === 'detail'"
class="action-btn cancel-btn" class="action-btn cancel-btn"
@@ -246,10 +243,7 @@ const liveRecords = ref([])
// 判断活动是否已结束 // 判断活动是否已结束
const isActivityEnded = computed(() => { const isActivityEnded = computed(() => {
// 优先使用列表页传入的statusText
if (statusTextFromParam.value === '已结束') return true if (statusTextFromParam.value === '已结束') return true
// 其次使用后端详情接口返回的状态字段
// if (activityConent.value.statusText === '已结束') return true
// 报名截止时间已过 // 报名截止时间已过
if (activityConent.value.applyDeadline && moment().isAfter(moment(activityConent.value.applyDeadline))) return true if (activityConent.value.applyDeadline && moment().isAfter(moment(activityConent.value.applyDeadline))) return true
// 活动结束时间已过 // 活动结束时间已过
@@ -269,9 +263,6 @@ const isActivityEndedByTime = computed(() => {
return moment().isAfter(moment(activityConent.value.endTime)) return moment().isAfter(moment(activityConent.value.endTime))
}) })
// ========方法===== // ========方法=====
// 时间格式化函数 // 时间格式化函数
const formatTime = (timeStr) => { const formatTime = (timeStr) => {
@@ -279,13 +270,27 @@ const formatTime = (timeStr) => {
return moment(timeStr).format('YYYY-MM-DD HH:mm') return moment(timeStr).format('YYYY-MM-DD HH:mm')
} }
// 富文本处理:给 img 注入内联样式
const formatRichText = (html) => {
if (!html) return ''
return html.replace(/<img\b([^>]*)>/gi, (match, attrs) => {
// 去掉尾部自闭合斜杠,避免 style 追加到斜杠之后
const inner = attrs.replace(/\/\s*$/, '')
const imgStyle = 'max-width:100%;height:auto;display:block;'
if (/style\s*=/i.test(inner)) {
// 已有 style在 style 值开头注入
return `<img${inner.replace(/(style\s*=\s*["'])/i, `$1${imgStyle}`)}>`
}
return `<img${inner} style="${imgStyle}">`
})
}
// ---接收参数--- // ---接收参数---
const statusTextFromParam = ref('') // 从列表页传入的活动状态文本 const statusTextFromParam = ref('') // 从列表页传入的活动状态文本
onLoad((option) =>{ onLoad((option) =>{
navTitle.value = option?.title navTitle.value = option?.title
curActivityId.value = option?.id curActivityId.value = option?.id
statusTextFromParam.value = option?.statusText || '' statusTextFromParam.value = option?.statusText || ''
// 处理applied参数
hasSigned.value = option?.applied === 'true' hasSigned.value = option?.applied === 'true'
// console.log('hasSigned.value',hasSigned.value) // console.log('hasSigned.value',hasSigned.value)
// 2. 初始化数据 // 2. 初始化数据

View File

@@ -151,7 +151,7 @@ onLoad(() =>{
.door-open-page { .door-open-page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; min-height: 100%;
overflow: hidden; overflow: hidden;
background: linear-gradient(180deg, #E2F0FF, #F6FAFF); background: linear-gradient(180deg, #E2F0FF, #F6FAFF);
box-sizing: border-box; box-sizing: border-box;
@@ -161,7 +161,7 @@ onLoad(() =>{
flex: 1; flex: 1;
height: 0; height: 0;
overflow-y: auto; overflow-y: auto;
padding: 30rpx 40rpx; padding: 30rpx 40rpx 160rpx;
box-sizing: border-box; box-sizing: border-box;
} }
@@ -292,7 +292,12 @@ onLoad(() =>{
/* 确认按钮 */ /* 确认按钮 */
.confirm-btn { .confirm-btn {
width: 100%; position: fixed;
left: 40rpx;
right: 40rpx;
bottom: 20rpx;
bottom: calc(20rpx + constant(safe-area-inset-bottom));
bottom: calc(20rpx + env(safe-area-inset-bottom));
height: 88rpx; height: 88rpx;
line-height: 88rpx; line-height: 88rpx;
background-color: #2F77FD; background-color: #2F77FD;
@@ -300,7 +305,7 @@ onLoad(() =>{
font-size: 28rpx; font-size: 28rpx;
border-radius: 20rpx; border-radius: 20rpx;
border: none; border: none;
flex-shrink: 0; z-index: 10;
} }
.confirm-btn::after { .confirm-btn::after {
border: none; /* 去除uni-app默认按钮边框 */ border: none; /* 去除uni-app默认按钮边框 */

View File

@@ -313,7 +313,7 @@ onUnload(() =>{
.repair-type-tabs { .repair-type-tabs {
display: flex; display: flex;
/* background-color: #fff; */ /* background-color: #fff; */
padding: 10px; padding: 10px 0;
} }
.type-tab { .type-tab {
flex: 1; flex: 1;
@@ -321,7 +321,7 @@ onUnload(() =>{
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 85px; height: 90px;
border-radius: 8px; border-radius: 8px;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;

View File

@@ -2,7 +2,7 @@
<view class="contentStyle"> <view class="contentStyle">
<scroll-view class="page" scroll-y="true"> <scroll-view class="page" scroll-y="true">
<view class="survey-title">{{ detailItem.title || '' }}</view> <view class="survey-title">{{ detailItem.title || '' }}</view>
<view class="survey-desc"> <view class="survey-desc" v-if="questionList.length > 0">
为了给您提供更好的服务希望您能抽出几分钟时间将最近的感受和建议告诉我们 为了给您提供更好的服务希望您能抽出几分钟时间将最近的感受和建议告诉我们
我们十分重视每位用户的宝贵意见期待您的参与 我们十分重视每位用户的宝贵意见期待您的参与
</view> </view>

View File

@@ -12,7 +12,7 @@
<!-- 问卷说明 --> <!-- 问卷说明 -->
<!-- <view class="survey-desc">{{ detailItem.description || '' }}</view> --> <!-- <view class="survey-desc">{{ detailItem.description || '' }}</view> -->
<view class="survey-desc"> <view class="survey-desc" v-if="questionList.length >0">
为了给您提供更好的服务希望您能抽出几分钟时间将最近的感受和建议告诉我们 为了给您提供更好的服务希望您能抽出几分钟时间将最近的感受和建议告诉我们
我们十分重视每位用户的宝贵意见期待您的参与 我们十分重视每位用户的宝贵意见期待您的参与
</view> </view>

View File

@@ -4,11 +4,8 @@
<view class="loading-mask" v-if="!pageReady"> <view class="loading-mask" v-if="!pageReady">
<view class="loading-bg"></view> <view class="loading-bg"></view>
</view> </view>
<!-- 顶部渐变背景 -->
<!-- 顶部渐变背景固定在内容下方 -->
<view class="nar-top" v-if="pageReady"></view> <view class="nar-top" v-if="pageReady"></view>
<!-- 固定头部 --> <!-- 固定头部 -->
<view class="header-fixed" v-if="pageReady"> <view class="header-fixed" v-if="pageReady">
<view class="status-bar"></view> <view class="status-bar"></view>
@@ -136,8 +133,6 @@
</view> </view>
</uni-card> </uni-card>
<!-- 底部占位 -->
<view class="scroll-bottom-space"></view>
</view> </view>
</view> </view>
</template> </template>
@@ -249,9 +244,7 @@
bannerList.value = [] bannerList.value = []
bannerSwiperKey.value++ bannerSwiperKey.value++
} }
} catch (err) { } catch (err) {}
// 静默失败
}
} }
const bannerClick = (index) => { const bannerClick = (index) => {
@@ -299,7 +292,6 @@
currentVillageId.value = '' currentVillageId.value = ''
uni.removeStorageSync('currentVillageId') uni.removeStorageSync('currentVillageId')
saveHomeCache() saveHomeCache()
// 有 token 才提示错误(无 token 用户正常浏览首页API 401 属于预期行为)
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
if (token) { if (token) {
uni.showToast({ title: err.msg || '网络异常', icon: 'none' }) uni.showToast({ title: err.msg || '网络异常', icon: 'none' })
@@ -439,7 +431,8 @@
try { try {
const res = await getActivitylatest({ villageId: uni.getStorageSync('currentVillageId') }) const res = await getActivitylatest({ villageId: uni.getStorageSync('currentVillageId') })
if (res.code === 200) { if (res.code === 200) {
activityList.value = res.data || []; saveHomeCache() activityList.value = res.data || [];
saveHomeCache()
} else { } else {
activityList.value = [] activityList.value = []
} }
@@ -526,10 +519,6 @@
z-index: 1; z-index: 1;
} }
.scroll-bottom-space {
height: 40rpx;
}
.header-container { .header-container {
display: flex; display: flex;
align-items: center; align-items: center;