Ver código fonte

针对不同作品配置分享文案

bayi 2 anos atrás
pai
commit
1cd8b1dd03

+ 9 - 9
mixins/share.js

@@ -7,21 +7,20 @@ module.exports = Behavior({
     }) {
       if (from == 'button') {
         let video = target.dataset.info
-        console.log(video, 'info,,.,.');
         const promise = new Promise(resolve => {
           this.creatShare(video).then(res => {
             resolve(res)
           })
         })
         return {
-          title: '请欣赏我的课文朗读作品,点赞+评论。',
-          path: `/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
-          imageUrl: video.coverImg,
+          title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
+          path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
+          imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png',
           promise
         }
       } else {
         return {
-          title: '课文朗读,从未如此有趣。',
+          title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
           path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
           imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png'
         }
@@ -94,21 +93,22 @@ module.exports = Behavior({
                   let pl = canvas.createImage();
                   pl.src = '/static/comment.png'
                   pl.onload = () => {
-                    ctx.drawImage(pl, 318, 222, 22, 22)
+                    ctx.drawImage(pl, 228, 222, 22, 22)
                     ctx.fillText(video.userRead.commentAmount || 0, 340, 238)
                     //点赞
                     let dz = canvas.createImage();
                     dz.src = video.isLike ? '/static/heart_colored.png' : '/static/heart.png'
                     dz.onload = () => {
-                      ctx.drawImage(dz, 228, 222, 22, 22)
+                      ctx.drawImage(dz, 318, 222, 22, 22)
                       ctx.fillText(video.userRead.likeAmount || 0, 254, 238)
                       setTimeout(() => {
                         wx.canvasToTempFilePath({
                           canvas: canvas,
                           success(res) {
+                            let title = wx.getStorageSync('uid') == video.user.uid ? '我的新作品发布啦,快来捧场点赞!' : video.userRead.type == 'READ' ? '发现一篇宝藏作品,这声音让人爱了!不信你不着迷!' : '我正在听这篇朗读示范,这发音,播音专业水准!你也来听听!'
                             resolve({
-                              title: '请欣赏我的课文朗读作品,点赞+评论。',
-                              path: `/pages/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
+                              title,
+                              path: `/pages/pkPage/index?videoId=${video.userRead.id}&uid=${wx.getStorageSync('uid')}`,
                               imageUrl: res.tempFilePath
                             })
                           },

+ 1 - 0
pages/pkPage/index.js

@@ -17,6 +17,7 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+      console.log(options);
         let videoId = options.videoId
         this.setData({
             videoId

+ 2 - 1
pages/rankIntro/index.wxml

@@ -1,3 +1,4 @@
 <view class="rankInfoBox">
-    <image src="{{explain}}" mode="widthFix" />
+  <image src="{{explain}}" mode="widthFix" />
+  <!-- <image src="/static/ewm.png" mode="widthFix" show-menu-by-longpress="{{true}}" /> -->
 </view>

+ 63 - 56
pages/ranking/index.js

@@ -1,63 +1,70 @@
 import {
-    getRankingData
+  getRankingData
 } from '~/api/global'
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        ranking: '',
-        userList: [],
-        //2:邀新榜,3:热播榜,4:挑战pk榜
-        rankingType: '',
-        icon: '',
-        podiumBoxBg: '',
-        explain: ''
-    },
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    ranking: '',
+    userList: [],
+    //2:邀新榜,3:热播榜,4:挑战pk榜
+    rankingType: '',
+    icon: '',
+    podiumBoxBg: '',
+    explain: ''
+  },
 
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-        this.setData({
-            rankingType: options.type,
-            icon: options.type == '2' ? '/static/yx.png' : options.type == '3' ? '/static/play.png' : '/static/win.png',
-            podiumBoxBg: options.type == '2' ? 'invitation' : options.type == '3' ? 'hot' : 'pk',
-        })
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.setData({
+      rankingType: options.type,
+      icon: options.type == '2' ? '/static/yx.png' : options.type == '3' ? '/static/play.png' : '/static/win.png',
+      podiumBoxBg: options.type == '2' ? 'invitation' : options.type == '3' ? 'hot' : 'pk',
+    })
 
-        wx.setNavigationBarColor({
-            frontColor: '#ffffff',
-            backgroundColor: options.type == '2' ? '#ff7f6c' : options.type == '3' ? '#6D9FFE' : '#967DFF',
-        })
-        this.getRankingData(options.id)
-    },
-    async getRankingData(id) {
-        let {
-            ranking,
-            userList,
-            title,
-            explain
-        } = await getRankingData(id)
-        wx.setNavigationBarTitle({
-            title
-        })
-        this.setData({
-            ranking,
-            userList,
-            explain
-        })
-    },
-    jumpIntro() {
-        wx.navigateTo({
-            url: `/pages/rankIntro/index?title=榜单说明&img=${this.data.explain}`,
-        })
-    },
-    jumpUserInfo({
-        currentTarget
-    }) {
-        wx.navigateTo({
-            url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=${this.data.rankingType==4?'pk':'user'}`,
-        })
-    },
+    wx.setNavigationBarColor({
+      frontColor: '#ffffff',
+      backgroundColor: options.type == '2' ? '#ff7f6c' : options.type == '3' ? '#6D9FFE' : '#967DFF',
+    })
+    this.getRankingData(options.id)
+  },
+  async getRankingData(id) {
+    let {
+      ranking,
+      userList,
+      title,
+      explain
+    } = await getRankingData(id)
+    wx.setNavigationBarTitle({
+      title
+    })
+    this.setData({
+      ranking,
+      userList,
+      explain
+    })
+  },
+  jumpIntro() {
+    wx.navigateTo({
+      url: `/pages/rankIntro/index?title=榜单说明&img=${this.data.explain}`,
+    })
+  },
+  jumpUserInfo({
+    currentTarget
+  }) {
+    wx.navigateTo({
+      url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=${this.data.rankingType==4?'pk':'user'}`,
+    })
+  },
+  onShareAppMessage() {
+    return {
+      title: this.data.rankingType == 3 ? '我要上热门,就差你的一个赞,快来帮帮我吧!' : this.data.rankingType == 2 ? '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!' : '',
+      path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
+      imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png'
+    }
+  }
 })

+ 3 - 3
pages/ranking/index.wxml

@@ -55,8 +55,8 @@
   </view>
   <view class="footer">
     <view class="left">我的排名<text>{{ranking?ranking:'100+'}}</text></view>
-    <view class="rigth">
-      <image src="/static/forward.png" class="share"/>{{rankingType!=4?'呼朋唤友来加热':'我要冲榜'}}
-    </view>
+    <button class="resetBtn rigth" open-type="share" wx:if="{{rankingType!=4}}">
+      <image src="/static/forward.png" class="share" />呼朋唤友来加热
+    </button>
   </view>
 </view>