瀏覽代碼

优化分享逻辑和分享作品后的页面

bayi 2 年之前
父節點
當前提交
21b5851d47

+ 1 - 1
mixins/share.js

@@ -108,7 +108,7 @@ module.exports = Behavior({
                               let title = wx.getStorageSync('uid') == video.user.uid ? '我的新作品发布啦,快来捧场点赞!' : video.userRead.type == 'READ' ? '发现一篇宝藏作品,这声音让人爱了!不信你不着迷!' : '我正在听这篇朗读示范,这发音,播音专业水准!你也来听听!'
                               resolve({
                                 title,
-                                path: `${path}?videoId=${video.userRead.id}&uid=${wx.getStorageSync('uid')}`,
+                                path: `${path}?videoId=${video.userRead.id}&uid=${wx.getStorageSync('uid')}&isShare=true`,
                                 imageUrl: res.tempFilePath
                               })
                             },

+ 9 - 9
pages/editUser/index.wxml

@@ -62,15 +62,15 @@
       <image class='black' src='/static/black.png'></image>
     </view>
   </view>
-  <!--   <view class="editRow mt40">
-        <view class="name">绑定手机</view>
-        <view class="right">
-            <view class="name">
-                手机号
-            </view>
-            <image class='black' src='/static/black.png'></image>
-        </view>
-    </view> -->
+  <!-- <view class="editRow mt40">
+    <view class="name">绑定手机</view>
+    <view class="right">
+      <view class="name">
+        手机号
+      </view>
+      <image class='black' src='/static/black.png'></image>
+    </view>
+  </view> -->
   <!--    <view class="switchAccount mt40">
         切换账号
     </view> -->

+ 8 - 2
pages/pkPage/index.js

@@ -11,6 +11,7 @@ Page({
   data: {
     videoInfo: '',
     videoId: '',
+    isShare: false,
     recordList: []
   },
   /**
@@ -19,7 +20,8 @@ Page({
   onLoad(options) {
     let videoId = options.videoId
     this.setData({
-      videoId
+      videoId,
+      isShare: options.isShare
     })
     this.getreadInfo(videoId)
     this.getPkRecord()
@@ -40,7 +42,6 @@ Page({
     this.setData({
       recordList
     })
-    console.log(recordList);
   },
   jumpUserInfo({
     currentTarget
@@ -49,6 +50,11 @@ Page({
       url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
     })
   },
+  jumpIndex() {
+    wx.switchTab({
+      url: '/pages/index/index',
+    })
+  },
   addCommentNum() {
     this.setData({
       ['videoInfo.userRead.commentAmount']: ++this.data.videoInfo.userRead.commentAmount

+ 25 - 0
pages/pkPage/index.less

@@ -88,4 +88,29 @@
       }
     }
   }
+
+  .footer {
+    position: fixed;
+    bottom: 0px;
+    left: 0px;
+    width: 100%;
+    padding: 20rpx 104rpx;
+    box-sizing: border-box;
+    z-index: 9;
+    background-color: rgb(255, 255, 255);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+
+    .stBtn {
+      padding: 16rpx 0rpx;
+      text-align: center;
+      border-radius: 50rpx;
+      width: 220rpx;
+      font-size: 30rpx;
+      color: white;
+      background-color: #66C5FF;
+      box-shadow: 0 6px 14px 0 rgba(50, 197, 255, 0.65);
+    }
+  }
 }

+ 3 - 0
pages/pkPage/index.wxml

@@ -26,6 +26,9 @@
       </view>
     </scroll-view>
   </view>
+  <view class="footer">
+    <view class="stBtn" bindtap="jumpIndex">回到首页</view>
+  </view>
   <Comment id="comment" bind:addCommentNum="addCommentNum" />
   <canvas id='share' type="2d"> </canvas>
 </view>

+ 23 - 0
pages/pkPage/index.wxss

@@ -76,3 +76,26 @@
   width: 40rpx;
   height: 40rpx;
 }
+.pkBox .footer {
+  position: fixed;
+  bottom: 0px;
+  left: 0px;
+  width: 100%;
+  padding: 20rpx 104rpx;
+  box-sizing: border-box;
+  z-index: 9;
+  background-color: #ffffff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.pkBox .footer .stBtn {
+  padding: 16rpx 0rpx;
+  text-align: center;
+  border-radius: 50rpx;
+  width: 220rpx;
+  font-size: 30rpx;
+  color: white;
+  background-color: #66C5FF;
+  box-shadow: 0 6px 14px 0 rgba(50, 197, 255, 0.65);
+}

+ 6 - 20
pages/pkResult/index.js

@@ -110,24 +110,6 @@ Page({
       })
     })
   },
-  /*   // 设置时间文案
-    setDuration(s) {
-      let t = '';
-      s = Math.floor(s);
-      if (s > -1) {
-        let min = Math.floor(s / 60) % 60;
-        let sec = s % 60;
-        if (min < 10) {
-          t += "0";
-        }
-        t += min + ":";
-        if (sec < 10) {
-          t += "0";
-        }
-        t += sec;
-      }
-      return t
-    }, */
   result({
     currentTarget
   }) {
@@ -135,9 +117,13 @@ Page({
       wx.redirectTo({
         url: `/pages/reading/index?videoId=${this.data.victory.userRead.exampleId}&readingType=pk`,
       })
-    } else {
+    } else if (currentTarget.dataset.type == 'index') {
       wx.switchTab({
-        url: `/pages/index/index`,
+        url: '/pages/index/index',
+      })
+    } else {
+      wx.redirectTo({
+        url: `/pages/pkPage/index?videoId=${this.data.pkRecord.challengerUserReadId}&isShare=true`,
       })
     }
   },

+ 0 - 8
pages/pkResult/index.less

@@ -149,12 +149,4 @@
       box-shadow: 0 6px 14px 0 rgba(50, 197, 255, 0.65);
     }
   }
-
-  .footer2 {
-    justify-content: center;
-
-    .stBtn {
-      width: 320rpx;
-    }
-  }
 }

+ 3 - 2
pages/pkResult/index.wxml

@@ -34,8 +34,9 @@
       分享战绩
     </button>
   </view>
-  <view class="footer footer2" wx:else>
-    <view class="stBtn" bindtap="result" data-type="index">查看更多优秀作品</view>
+  <view class="footer" wx:else>
+    <view class="stBtn" bindtap="result" data-type="wantPlay">我也要玩</view>
+    <view class="btn" bindtap="result" data-type="index">回到首页</view>
   </view>
 </view>
 <canvas id='share' type="2d"> </canvas>

+ 0 - 6
pages/pkResult/index.wxss

@@ -131,9 +131,3 @@
   background-color: #66C5FF;
   box-shadow: 0 6px 14px 0 rgba(50, 197, 255, 0.65);
 }
-.pkResult .footer2 {
-  justify-content: center;
-}
-.pkResult .footer2 .stBtn {
-  width: 320rpx;
-}

+ 1 - 1
pages/reading/index.js

@@ -635,7 +635,7 @@ Page({
                           success(res) {
                             resolve({
                               title: '我的新作品发布啦,快来捧场点赞!',
-                              path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}`,
+                              path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
                               imageUrl: res.tempFilePath
                             })
                           },

+ 2 - 2
pages/score/index.js

@@ -128,7 +128,7 @@ Page({
                           success(res) {
                             resolve({
                               title: '我的新作品发布啦,快来捧场点赞!',
-                              path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}`,
+                              path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
                               imageUrl: res.tempFilePath
                             })
                           },
@@ -177,7 +177,7 @@ Page({
                         success(res) {
                           resolve({
                             title: '我的新作品发布啦,快来捧场点赞!',
-                            path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}`,
+                            path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
                             imageUrl: res.tempFilePath
                           })
                         },

+ 7 - 7
utils/request.js

@@ -6,13 +6,13 @@ const {
     envVersion
   }
 } = wx.getAccountInfoSync();
-/* if (envVersion == 'develop') {
-baseUrl = 'https://reader-api.efunbox.cn/wx'
-oldUrl = 'https://reader-api.efunbox.cn'
-} else { */
-baseUrl = 'https://reader-api.ai160.com/wx'
-oldUrl = 'https://reader-api.ai160.com'
-// }
+if (envVersion == 'develop') {
+  baseUrl = 'https://reader-api.efunbox.cn/wx'
+  oldUrl = 'https://reader-api.efunbox.cn'
+} else {
+  baseUrl = 'https://reader-api.ai160.com/wx'
+  oldUrl = 'https://reader-api.ai160.com'
+}
 
 function request(url, method, data, oldBaseUrl = false) {
   let header = {