|
|
@@ -79,7 +79,7 @@
|
|
|
<text class="bottom-vendor" v-if="activity.vendorName">{{ activity.vendorName }}</text>
|
|
|
</view>
|
|
|
<view class="action-btns">
|
|
|
- <button class="share-btn" open-type="share" @click="onShareTap">
|
|
|
+ <button class="share-btn" @click="generatePoster">
|
|
|
<text class="share-btn-icon">📤</text>
|
|
|
</button>
|
|
|
<!-- 报名按钮(仅 requireRegistration=1 时显示) -->
|
|
|
@@ -241,17 +241,32 @@
|
|
|
<view v-else class="empty-wrap">
|
|
|
<text class="empty-text">活动不存在或已下架</text>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 分享海报 -->
|
|
|
+ <ContentSharePoster
|
|
|
+ :show="showPoster"
|
|
|
+ :title="activity && activity.title"
|
|
|
+ :coverImage="activity && activity.coverImage"
|
|
|
+ :qrCodeBase64="posterQrCode"
|
|
|
+ typeLabel="活动推荐"
|
|
|
+ :dimensionCode="activity && activity.dimensionCode"
|
|
|
+ :summary="posterSummary"
|
|
|
+ :priceText="posterPriceText"
|
|
|
+ :inviteText="posterInviteText"
|
|
|
+ @close="closePoster"
|
|
|
+ />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getActivityDetail, activityCheckin, registerActivity, cancelActivityRegistration, getMyActivityRegistrations, submitActivityFeedback, getActivityFeedbackList, getMyActivityFeedback, getFamilyMembers } from '@/utils/api.js'
|
|
|
+import { getActivityDetail, activityCheckin, registerActivity, cancelActivityRegistration, getMyActivityRegistrations, submitActivityFeedback, getActivityFeedbackList, getMyActivityFeedback, getFamilyMembers, getShareQrCode } from '@/utils/api.js'
|
|
|
import shareMixin from '../../../components/share-mixin.js'
|
|
|
import MpHtml from '@/components/mp-html/mp-html.vue'
|
|
|
+import ContentSharePoster from '@/components/ContentSharePoster.vue'
|
|
|
|
|
|
export default {
|
|
|
mixins: [shareMixin],
|
|
|
- components: { MpHtml },
|
|
|
+ components: { MpHtml, ContentSharePoster },
|
|
|
data() {
|
|
|
return {
|
|
|
activityId: null,
|
|
|
@@ -278,7 +293,13 @@ export default {
|
|
|
showRegModal: false,
|
|
|
familyMembers: [],
|
|
|
registrants: [],
|
|
|
- regSubmitting: false
|
|
|
+ regSubmitting: false,
|
|
|
+ // 分享海报
|
|
|
+ showPoster: false,
|
|
|
+ posterQrCode: '',
|
|
|
+ posterSummary: '',
|
|
|
+ posterPriceText: '',
|
|
|
+ posterInviteText: ''
|
|
|
}
|
|
|
},
|
|
|
onLoad: function(options) {
|
|
|
@@ -575,6 +596,33 @@ export default {
|
|
|
this.registrants = []
|
|
|
this.familyMembers = []
|
|
|
},
|
|
|
+ // ===== 分享海报 =====
|
|
|
+ async generatePoster() {
|
|
|
+ if (!this.activity || !this.activity.id) return
|
|
|
+ uni.showLoading({ title: '生成海报中...' })
|
|
|
+ try {
|
|
|
+ var res = await getShareQrCode('pages/activity/activity-detail/activity-detail', 'id=' + this.activity.id)
|
|
|
+ if (res && res.data) {
|
|
|
+ this.posterQrCode = res.data.qrCodeBase64 || ''
|
|
|
+ this.posterSummary = this.buildPosterSummary()
|
|
|
+ this.posterPriceText = this.activity.price > 0 ? '¥' + this.activity.price : '免费'
|
|
|
+ this.posterInviteText = '「' + (uni.getStorageSync('nickname') || '好友') + '」邀请你一起参加这个活动'
|
|
|
+ this.showPoster = true
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ uni.showToast({ title: '生成失败', icon: 'none' })
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ buildPosterSummary: function() {
|
|
|
+ var desc = (this.activity && this.activity.description) || ''
|
|
|
+ desc = desc.replace(/<[^>]+>/g, ' ').replace(/ /g, ' ').replace(/\s+/g, ' ').trim()
|
|
|
+ return desc.length > 60 ? desc.substring(0, 60) + '...' : desc
|
|
|
+ },
|
|
|
+ closePoster: function() {
|
|
|
+ this.showPoster = false
|
|
|
+ },
|
|
|
submitRegistration: function() {
|
|
|
var self = this
|
|
|
// Validate
|