Просмотр исходного кода

feat(cfc-frontend): 文章详情去掉分享按钮,海报传维度/简介/邀请语

iwt 3 месяцев назад
Родитель
Сommit
70b93511a2
1 измененных файлов с 18 добавлено и 6 удалено
  1. 18 6
      cfc-frontend/pages/article-center/article-detail.vue

+ 18 - 6
cfc-frontend/pages/article-center/article-detail.vue

@@ -40,10 +40,6 @@
 
 
       <!-- 底部 -->
       <!-- 底部 -->
       <view class="detail-footer">
       <view class="detail-footer">
-        <button class="share-btn" open-type="share" @click="onShareTap">
-          <text class="share-btn-icon">📤</text>
-          <text class="share-btn-text">分享</text>
-        </button>
         <view class="share-btn" @click="generatePoster">
         <view class="share-btn" @click="generatePoster">
           <text class="share-btn-icon">🖼</text>
           <text class="share-btn-icon">🖼</text>
           <text class="share-btn-text">海报</text>
           <text class="share-btn-text">海报</text>
@@ -51,7 +47,7 @@
       </view>
       </view>
     </template>
     </template>
 
 
-    <ContentSharePoster :show="showPoster" :title="article && article.title" :coverImage="article && article.coverImage" :qrCodeBase64="posterQrCode" typeLabel="好文推荐" @close="closePoster" />
+    <ContentSharePoster :show="showPoster" :title="article && article.title" :coverImage="article && article.coverImage" :qrCodeBase64="posterQrCode" typeLabel="好文推荐" :dimensionCode="posterDimension" :summary="posterSummary" :inviteText="posterInviteText" @close="closePoster" />
 
 
     <!-- 浠宝答题弹窗 -->
     <!-- 浠宝答题弹窗 -->
     <view class="quiz-mask" v-if="showQuiz" @click="closeQuiz">
     <view class="quiz-mask" v-if="showQuiz" @click="closeQuiz">
@@ -97,6 +93,7 @@ export default {
       readingSeconds: 0, lastReportedSeconds: 0, readingCompleted: false,
       readingSeconds: 0, lastReportedSeconds: 0, readingCompleted: false,
       isTimerRunning: false, timerHandle: null, syncHandle: null,
       isTimerRunning: false, timerHandle: null, syncHandle: null,
       showPoster: false, posterQrCode: '',
       showPoster: false, posterQrCode: '',
+      posterDimension: '', posterSummary: '', posterInviteText: '',
       // 答题
       // 答题
       showQuiz: false, quizQuestions: [], quizAnswers: [], showResult: false, quizResult: {},
       showQuiz: false, quizQuestions: [], quizAnswers: [], showResult: false, quizResult: {},
       mascotList: [{ icon: '🐶', name: '浠宝' }, { icon: '🐼', name: '福宝' }],
       mascotList: [{ icon: '🐶', name: '浠宝' }, { icon: '🐼', name: '福宝' }],
@@ -138,6 +135,15 @@ export default {
       }
       }
       return raw.filter(function(c) { return dimMap[c] }).map(function(c) { return { code: dimMap[c].code, name: dimMap[c].name, color: dimMap[c].color, weight: (weights && weights[c]) ? weights[c] : 20 } })
       return raw.filter(function(c) { return dimMap[c] }).map(function(c) { return { code: dimMap[c].code, name: dimMap[c].name, color: dimMap[c].color, weight: (weights && weights[c]) ? weights[c] : 20 } })
     },
     },
+    getMainDimension: function() {
+      var dims = this.article ? this.parseDimensions(this.article) : []
+      var best = null
+      var i
+      for (i = 0; i < dims.length; i++) {
+        if (!best || dims[i].weight > best.weight) best = dims[i]
+      }
+      return best ? best.code : ''
+    },
     onScrollToBottom() {},
     onScrollToBottom() {},
     startReadingTimer: function() {
     startReadingTimer: function() {
       if (this.isTimerRunning || this.readingCompleted) return
       if (this.isTimerRunning || this.readingCompleted) return
@@ -182,7 +188,13 @@ export default {
       uni.showLoading({ title: '生成海报中...' })
       uni.showLoading({ title: '生成海报中...' })
       try {
       try {
         var res = await getShareQrCode('pages/article-center/article-detail', 'id=' + this.articleId)
         var res = await getShareQrCode('pages/article-center/article-detail', 'id=' + this.articleId)
-        if (res && res.data) { this.posterQrCode = res.data.qrCodeBase64 || ''; this.showPoster = true }
+        if (res && res.data) {
+          this.posterQrCode = res.data.qrCodeBase64 || ''
+          this.posterDimension = this.getMainDimension()
+          this.posterSummary = (this.article && this.article.summary) || ''
+          this.posterInviteText = '「' + (uni.getStorageSync('nickname') || '好友') + '」邀请你一起阅读这篇文章'
+          this.showPoster = true
+        }
       } catch (e) { uni.showToast({ title: '生成失败', icon: 'none' }) }
       } catch (e) { uni.showToast({ title: '生成失败', icon: 'none' }) }
       finally { uni.hideLoading() }
       finally { uni.hideLoading() }
     },
     },