修改bug
This commit is contained in:
@@ -90,17 +90,14 @@
|
||||
<!-- 招募要求 -->
|
||||
<view class="section">
|
||||
<view class="section-title">招募要求</view>
|
||||
<view class="section-content">
|
||||
{{activityConent.requirements}}
|
||||
</view>
|
||||
<view class="section-content" v-html="formatRichText(activityConent.requirements)"></view>
|
||||
</view>
|
||||
|
||||
<!-- 活动详情 -->
|
||||
<view class="section" style="margin-bottom: 40rpx;">
|
||||
<view class="section-title">活动详情</view>
|
||||
<view class="section-content rich-content">
|
||||
<view v-html="activityConent.content"></view>
|
||||
<view></view>
|
||||
<view v-html="formatRichText(activityConent.content)"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -170,7 +167,7 @@
|
||||
报名
|
||||
</button>
|
||||
|
||||
<!-- 已报名状态显示取消报名按钮(活动已结束则隐藏) -->
|
||||
<!-- 已报名状态显示取消报名按钮 -->
|
||||
<button
|
||||
v-if="hasSigned && !isActivityEnded && activeTab === 'detail'"
|
||||
class="action-btn cancel-btn"
|
||||
@@ -246,10 +243,7 @@ const liveRecords = ref([])
|
||||
|
||||
// 判断活动是否已结束
|
||||
const isActivityEnded = computed(() => {
|
||||
// 优先使用列表页传入的statusText
|
||||
if (statusTextFromParam.value === '已结束') return true
|
||||
// 其次使用后端详情接口返回的状态字段
|
||||
// if (activityConent.value.statusText === '已结束') 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))
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// ========方法=====
|
||||
// 时间格式化函数
|
||||
const formatTime = (timeStr) => {
|
||||
@@ -279,13 +270,27 @@ const formatTime = (timeStr) => {
|
||||
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('') // 从列表页传入的活动状态文本
|
||||
onLoad((option) =>{
|
||||
navTitle.value = option?.title
|
||||
curActivityId.value = option?.id
|
||||
statusTextFromParam.value = option?.statusText || ''
|
||||
// 处理applied参数
|
||||
hasSigned.value = option?.applied === 'true'
|
||||
// console.log('hasSigned.value',hasSigned.value)
|
||||
// 2. 初始化数据
|
||||
|
||||
@@ -151,7 +151,7 @@ onLoad(() =>{
|
||||
.door-open-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 100%;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(180deg, #E2F0FF, #F6FAFF);
|
||||
box-sizing: border-box;
|
||||
@@ -161,7 +161,7 @@ onLoad(() =>{
|
||||
flex: 1;
|
||||
height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 30rpx 40rpx;
|
||||
padding: 30rpx 40rpx 160rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,12 @@ onLoad(() =>{
|
||||
|
||||
/* 确认按钮 */
|
||||
.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;
|
||||
line-height: 88rpx;
|
||||
background-color: #2F77FD;
|
||||
@@ -300,7 +305,7 @@ onLoad(() =>{
|
||||
font-size: 28rpx;
|
||||
border-radius: 20rpx;
|
||||
border: none;
|
||||
flex-shrink: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.confirm-btn::after {
|
||||
border: none; /* 去除uni-app默认按钮边框 */
|
||||
|
||||
@@ -313,7 +313,7 @@ onUnload(() =>{
|
||||
.repair-type-tabs {
|
||||
display: flex;
|
||||
/* background-color: #fff; */
|
||||
padding: 10px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.type-tab {
|
||||
flex: 1;
|
||||
@@ -321,7 +321,7 @@ onUnload(() =>{
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 85px;
|
||||
height: 90px;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="contentStyle">
|
||||
<scroll-view class="page" scroll-y="true">
|
||||
<view class="survey-title">{{ detailItem.title || '' }}</view>
|
||||
<view class="survey-desc">
|
||||
<view class="survey-desc" v-if="questionList.length > 0">
|
||||
为了给您提供更好的服务,希望您能抽出几分钟时间,将最近的感受和建议告诉我们,
|
||||
我们十分重视每位用户的宝贵意见,期待您的参与!
|
||||
</view>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<!-- 问卷说明 -->
|
||||
<!-- <view class="survey-desc">{{ detailItem.description || '' }}</view> -->
|
||||
<view class="survey-desc">
|
||||
<view class="survey-desc" v-if="questionList.length >0">
|
||||
为了给您提供更好的服务,希望您能抽出几分钟时间,将最近的感受和建议告诉我们,
|
||||
我们十分重视每位用户的宝贵意见,期待您的参与!
|
||||
</view>
|
||||
|
||||
@@ -4,11 +4,8 @@
|
||||
<view class="loading-mask" v-if="!pageReady">
|
||||
<view class="loading-bg"></view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 顶部渐变背景(固定在内容下方) -->
|
||||
<!-- 顶部渐变背景 -->
|
||||
<view class="nar-top" v-if="pageReady"></view>
|
||||
|
||||
<!-- 固定头部 -->
|
||||
<view class="header-fixed" v-if="pageReady">
|
||||
<view class="status-bar"></view>
|
||||
@@ -136,8 +133,6 @@
|
||||
</view>
|
||||
</uni-card>
|
||||
|
||||
<!-- 底部占位 -->
|
||||
<view class="scroll-bottom-space"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -249,9 +244,7 @@
|
||||
bannerList.value = []
|
||||
bannerSwiperKey.value++
|
||||
}
|
||||
} catch (err) {
|
||||
// 静默失败
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
const bannerClick = (index) => {
|
||||
@@ -299,7 +292,6 @@
|
||||
currentVillageId.value = ''
|
||||
uni.removeStorageSync('currentVillageId')
|
||||
saveHomeCache()
|
||||
// 有 token 才提示错误(无 token 用户正常浏览首页,API 401 属于预期行为)
|
||||
const token = uni.getStorageSync('token')
|
||||
if (token) {
|
||||
uni.showToast({ title: err.msg || '网络异常', icon: 'none' })
|
||||
@@ -439,7 +431,8 @@
|
||||
try {
|
||||
const res = await getActivitylatest({ villageId: uni.getStorageSync('currentVillageId') })
|
||||
if (res.code === 200) {
|
||||
activityList.value = res.data || []; saveHomeCache()
|
||||
activityList.value = res.data || [];
|
||||
saveHomeCache()
|
||||
} else {
|
||||
activityList.value = []
|
||||
}
|
||||
@@ -526,10 +519,6 @@
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.scroll-bottom-space {
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.header-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user