|
|
|
@ -14,7 +14,12 @@ |
|
|
|
<view class="meta">{{post.createTime || ''}} · {{post.regionName || '本校'}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="title">{{post.title}}</view> |
|
|
|
<view class="title-row"> |
|
|
|
<view class="title">{{post.title}}</view> |
|
|
|
<button class="card-share-btn" open-type="share"> |
|
|
|
<uni-icons type="redo" size="18" color="#21b886"></uni-icons> |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
<view class="content">{{post.contentText || stripHtml(post.content)}}</view> |
|
|
|
<view v-if="imageList.length" class="image-grid" :class="'image-grid--' + Math.min(imageList.length, 3)"> |
|
|
|
<image |
|
|
|
@ -111,6 +116,7 @@ |
|
|
|
} from '@/common/campusApi.js' |
|
|
|
import { getIeProfile } from '@/common/ieApi.js' |
|
|
|
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js' |
|
|
|
import { buildHomeSharePath } from '@/utils/sharePath.js' |
|
|
|
import IeAuthDialog from '@/package1/components/ie-auth-dialog/ie-auth-dialog.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
@ -132,6 +138,7 @@ |
|
|
|
replyTarget: {}, |
|
|
|
currentUserId: String(uni.getStorageSync('id') || ''), |
|
|
|
defaultAvatar: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png', |
|
|
|
defaultShareImage: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png', |
|
|
|
likeLocked: false, |
|
|
|
imageSizeMap: {} |
|
|
|
} |
|
|
|
@ -152,6 +159,17 @@ |
|
|
|
this.loadDetail() |
|
|
|
this.loadComments(true) |
|
|
|
}, |
|
|
|
onShareAppMessage() { |
|
|
|
return this.buildShareInfo() |
|
|
|
}, |
|
|
|
onShareTimeline() { |
|
|
|
const info = this.buildShareInfo() |
|
|
|
return { |
|
|
|
title: info.title, |
|
|
|
query: info.path.split('?')[1] || '', |
|
|
|
imageUrl: info.imageUrl |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
back() { uni.navigateBack() }, |
|
|
|
loadDetail() { |
|
|
|
@ -224,6 +242,17 @@ |
|
|
|
return item && item.userAvatar ? item.userAvatar : this.defaultAvatar |
|
|
|
}, |
|
|
|
stripHtml(html = '') { return String(html).replace(/<[^>]+>/g, '') }, |
|
|
|
buildShareInfo() { |
|
|
|
const isPartner = this.post && this.post.postType === 'partner' |
|
|
|
const title = this.post && this.post.title ? this.post.title : (isPartner ? '校园搭子' : '校园圈内容') |
|
|
|
const prefix = isPartner ? '同学正在找搭子:' : '校园圈:' |
|
|
|
const targetPath = `/package1/post/postDetail?id=${this.id || ''}&source=campus` |
|
|
|
return { |
|
|
|
title: prefix + title, |
|
|
|
path: buildHomeSharePath(targetPath), |
|
|
|
imageUrl: this.imageList.length ? this.imageList[0] : this.defaultShareImage |
|
|
|
} |
|
|
|
}, |
|
|
|
async ensureVerified(actionText) { |
|
|
|
const profile = await getIeProfile().catch(() => null) |
|
|
|
return ensureIeVerifiedBeforeAction({ |
|
|
|
@ -382,7 +411,10 @@ |
|
|
|
.author { font-size: 27rpx; font-weight: 700; color: #263d38; } |
|
|
|
.author text { margin-left: 10rpx; padding: 4rpx 10rpx; border-radius: 999rpx; background: #e9faf5; color: #23a987; font-size: 20rpx; } |
|
|
|
.meta, .stats { margin-top: 8rpx; color: #8b9995; font-size: 23rpx; } |
|
|
|
.title { margin-top: 24rpx; color: #172d28; font-size: 36rpx; font-weight: 800; } |
|
|
|
.title-row { margin-top: 24rpx; display: flex; align-items: flex-start; gap: 16rpx; } |
|
|
|
.title { flex: 1; min-width: 0; color: #172d28; font-size: 36rpx; font-weight: 800; } |
|
|
|
.card-share-btn { width: 48rpx; height: 48rpx; margin: 4rpx 0 0; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 24rpx; background: #e8fbf3; line-height: 48rpx; flex-shrink: 0; } |
|
|
|
.card-share-btn::after { border: 0; } |
|
|
|
.content { margin-top: 16rpx; color: #4d625d; font-size: 28rpx; line-height: 1.7; } |
|
|
|
.image-grid { display: grid; gap: 10rpx; margin-top: 18rpx; } |
|
|
|
.image-grid--1 { display: flex; align-items: center; justify-content: flex-start; max-width: 640rpx; max-height: 520rpx; overflow: hidden; border-radius: 20rpx; background: transparent; } |
|
|
|
|