Rorschach 6 years ago
parent
commit
dcb50b36ef

+ 1 - 1
component/hot/hot.wxml

@@ -47,7 +47,7 @@
             </view>
         </view>
         <view class="hotWares"  >
-            <view wx:for="{{hotData.hotWorks}}" wx:key="{{index}}" class="hotWareCard" bindtap="openWorks" data-readId="1541489786444388" data-title="{{item.title}}">
+            <view wx:for="{{hotData.hotWorks}}" wx:key="{{index}}" class="hotWareCard" bindtap="openWorks" data-readId="{{item.classId}}" data-title="{{item.title}}">
                 <image class="wareCardImg" src="{{item.img}}" />
                 <text class="wareCardTitle">{{item.title}}</text>
                 <view class="bottomData">

+ 5 - 3
component/share/share.js

@@ -48,7 +48,7 @@ Component({
         ctx.fillText('已使出洪荒之力,声情并茂的为', (370 - ctx.measureText('已使出洪荒之力,声情并茂的为').width) / 2, 138)
         ctx.fillText(`《${this.data.title}》`, (370 - ctx.measureText(`《${this.data.title}》`).width) / 2, 160)
         ctx.fillText(`配了一段惊世之作`, (370 - ctx.measureText(`配了一段惊世之作`).width) / 2, 182)
-        ctx.drawImage(this.data.iconImg, 9, 205, 352, 145);
+        // ctx.drawImage(this.data.iconImg, 9, 205, 352, 145);
         ctx.setFontSize(18)
         ctx.setFillStyle('#000')
         ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
@@ -88,9 +88,8 @@ Component({
         ctx.setFillStyle('#000')
         ctx.fillText('长按识别二维码参加团购', 9, 493)
       }
-
-
       ctx.drawImage('../../../static/groupImg/code.png', 217, 374, 135, 135);
+      console.log(ctx)
       ctx.draw(true, function (res) {
         wx.canvasToTempFilePath({
           x: 0,
@@ -111,6 +110,9 @@ Component({
             that.setData({
               imgUrls: res.tempFilePath
             })
+          },
+          fail: (res) => {
+            console.log(res)
           }
         })
       })

+ 1 - 1
pages/main/class/class.js

@@ -54,7 +54,7 @@ Page({
     let id = this.data.id;
     let title = this.data.title;
     wx.navigateTo({
-      url: `../../main/reading/reading?id=${id}&title=${this.data.title}&img=${this.data.img}&video=${this.data.videoUrl}`
+      url: `../../main/reading/reading?id=${id}&title=${this.data.title}&img=${this.data.iconImg}&video=${this.data.videoUrl}`
     })
   },
   goToWorks: function (e) {

+ 42 - 12
pages/social/replyDetail/replyDetail.js

@@ -1,12 +1,14 @@
 import httpRequestApi from '../../../utils/APIClient';
-import {formatDate} from '../../../utils/util';
+import {
+    formatDate
+} from '../../../utils/util';
 Page({
     data: {
         class1: 'commentItem commentItemFirst',
         classNormal: 'commentItem',
         postId: '',
-        comment:[]
-        
+        comment: []
+
     },
     onLoad: function (option) {
         console.log(option)
@@ -14,14 +16,16 @@ Page({
             postId: option.id
         })
         wx.setNavigationBarTitle({
-            title: option.count + '条回复'//页面标题为路由参数
+            title: option.count + '条回复' //页面标题为路由参数
         })
+        this.uid = wx.getStorageSync('uid');
         this.getReplyDetail();
     },
     // 查询回复详情
     getReplyDetail: function () {
-        let uid = wx.getStorageSync('uid');
-        httpRequestApi.getReplyComment(uid, this.data.postId).success((res) => {
+        // let uid = wx.getStorageSync('uid');
+        httpRequestApi.getReplyComment(this.uid, this.data.postId).success((res) => {
+            debugger;
             console.log(res);
             const replyList = res.data.data.replyVOList;
             const replied = res.data.data;
@@ -29,7 +33,7 @@ Page({
             const authorDetail = {};
             authorDetail.name = replied.user.wechatName;
             authorDetail.text = replied.detailDesc;
-            authorDetail.time = formatDate(replied.gmtCreated,3);
+            authorDetail.time = formatDate(replied.gmtCreated, 3);
             authorDetail.likes = replied.postsAttributeInfo.favors;
             authorDetail.avatar = replied.user.avatar;
             replyTemp.push(authorDetail);
@@ -37,7 +41,7 @@ Page({
                 const temp = {};
                 temp.name = item.user.wechatName;
                 temp.text = item.content;
-                temp.time = formatDate(item.gmtCreated,3);
+                temp.time = formatDate(item.gmtCreated, 3);
                 temp.likes = 0;
                 temp.id = item.postId;
                 temp.avatar = item.user.avatar;
@@ -49,13 +53,13 @@ Page({
             })
         });
     },
-      // 点赞评论
-      likeCommend: function (e) {
+    // 点赞评论
+    likeCommend: function (e) {
         console.log(e);
-        let uid = wx.getStorageSync('uid');
+        // let uid = wx.getStorageSync('uid');
         let followUid = e.currentTarget.dataset.id;
         let index = e.currentTarget.dataset.index;
-        httpRequestApi.likeCommend(uid, followUid).success(res => {
+        httpRequestApi.likeCommend(this.uid, followUid).success(res => {
             console.log(res);
             const str = `comment[${index}].likes`;
             this.setData({
@@ -63,4 +67,30 @@ Page({
             })
         });
     },
+    // 设置点击时的id
+    setSBId: function (e) {
+        console.log(e)
+        this.setData({
+            // replySBId: e.currentTarget.dataset.id,
+            replyModal: true
+        })
+    },
+    // 回复某个评论
+    replySB: function () {
+        const data = {
+            postsId: this.data.postId,
+            content: this.data.inputSBValue
+        }
+        httpRequestApi.postReplyComment(this.uid, data).success(res => {
+            this.setData({
+                replyModal: false
+            })
+        });
+    },
+    // 获取回复楼中楼的内容
+    inputSBValue: function (e) {
+        this.setData({
+            inputSBValue: e.detail.value
+        });
+    },
 })

+ 19 - 15
pages/social/replyDetail/replyDetail.wxml

@@ -1,16 +1,20 @@
- <view class="commentArea">
-        <view class="{{index === 0? class1 : classNormal}}" wx:for="{{comment}}" wx:key="{{index}}" >
-            <image class="avatar" src="{{item.avatar}}" />
-            <view class="commentCore">
-                <text class="nickName">{{item.name}}</text>
-                <text class="time">{{item.time}}</text>
-                <text class="gut">{{item.text}}</text>
-            </view>
-            <view class="btnWrapper">
-                <image class="commentBtn" src="../../../static/image/comment.png" wx:if="{{index===0}}" />
-                <text class="commentText" wx:if="{{index===0}}">评论</text>
-                <!-- <image class="likeBtn" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" src="../../../static/image/like.png" bindtap="likeCommend" /> -->
-                <!-- <text class="likeText" >{{item.likes}}</text> -->
-            </view>
+<view class="commentArea">
+    <view class="{{index === 0? class1 : classNormal}}" wx:for="{{comment}}" wx:key="{{index}}">
+        <image class="avatar" src="{{item.avatar}}" />
+        <view class="commentCore">
+            <text class="nickName">{{item.name}}</text>
+            <text class="time">{{item.time}}</text>
+            <text class="gut">{{item.text}}</text>
         </view>
-    </view>
+        <view class="btnWrapper">
+            <image class="commentBtn" src="../../../static/image/comment.png" wx:if="{{index===0}}" bindtap="setSBId" />
+            <text class="commentText" wx:if="{{index===0}}">评论</text>
+            <!-- <image class="likeBtn" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" src="../../../static/image/like.png" bindtap="likeCommend" /> -->
+            <!-- <text class="likeText" >{{item.likes}}</text> -->
+        </view>
+    </view>
+    <!-- 评论框 -->
+    <view class="replySection" wx:if="{{replyModal}}">
+        <input bindblur="bindTextAreaBlur" bindconfirm="replySB" confirm-type="send" placeholder="回复" bindinput="inputSBValue" auto-focus auto-height />
+    </view>
+</view>

+ 12 - 0
pages/social/replyDetail/replyDetail.wxss

@@ -87,4 +87,16 @@
     width: 32rpx;
     height: 28rpx;
     margin-left: 8rpx;
+}
+.replySection{
+    width: 100%;
+    height: 300rpx;
+    position: fixed;
+    bottom: 0;
+    background: #eee;
+}
+.replySection input{
+    width: 100%;
+    height: 300rpx;
+    text-indent: 4rpx;
 }

+ 58 - 5
pages/social/works/works.js

@@ -12,13 +12,15 @@ Page({
         total: '',
         authorAvatar: '',
         user: [],
-        inputValue: 'smdx',
+        inputValue: '',
+        inputSBValue:'',
         replyList: [],
         howMuch: '200',
         moneySelect: 'moneySelect',
         moneyNormal: 'moneyNormal',
         ifReward: false,
         id: '',
+        replyModal: false
         // shareFlag: false
     },
     onLoad: function (option) {
@@ -41,6 +43,7 @@ Page({
     getWorks: function (uid, id) {
         httpRequestApi.getWorksDetail(uid, id).success((res) => {
             console.log(res);
+            console.log(id)
             const others = res.data.data.otherRead;
             const author = res.data.data.user;
             const works = res.data.data.userRead;
@@ -58,7 +61,9 @@ Page({
                 authorUid: author.uid,
                 videoSrc: works.originVideo,
                 audioSrc: works.audioPath,
-                iconImg: works.iconImg
+                iconImg: works.iconImg,
+                isLike: res.data.data.isLike,
+                isFans: res.data.data.isFans,
             })
             // 设置音频路径
             this.innerAudioContext = wx.createInnerAudioContext();
@@ -70,8 +75,21 @@ Page({
         });
     },
     likeWorks: function (e) {
+        if(this.data.isLike){
+            wx.showToast({
+                title: '不要重复点赞哦',
+                icon: 'fail',
+                duration: 1000
+              })
+            return;
+        }
         httpRequestApi.likeWorks(this.uid, this.data.id).success(res => {
             console.log(this.uid)
+            wx.showToast({
+                title: '点赞数+1',
+                icon: 'success',
+                duration: 1000
+              })
         });
     },
     // 弹出分享框
@@ -105,7 +123,7 @@ Page({
         let id = this.data.id;
         let title = this.data.title;
         wx.navigateTo({
-            url: `../../main/reading/reading?id=${id}&title=${title}`
+            url: `../../main/reading/reading?id=${id}&title=${title}&img=${this.data.iconImg}&video=${this.data.videoSrc}`
         })
     },
     onShareAppMessage: function (res) {
@@ -120,9 +138,13 @@ Page({
     },
     follow: function () {
         // let uid = wx.getStorageSync('uid');
-        let followUid = 2;
+        let followUid = this.data.authorUid;
         httpRequestApi.followUser(this.uid, followUid).success((res) => {
-            console.log(res)
+            wx.showToast({
+                title: !this.data.isFans? '取消关注' : '关注啦',
+                icon: 'success',
+                duration: 1000
+              })
         });
     },
     // 点赞评论
@@ -203,6 +225,32 @@ Page({
             });
         }
     },
+    // 设置点击时的id
+    setSBId: function(e){
+        console.log(e)
+        this.setData({
+            replySBId: e.currentTarget.dataset.id,
+            replyModal: true
+        })
+    },
+    // 回复某个评论
+    replySB: function () {
+        const data = {
+            postsId: this.data.replySBId,
+            content: this.data.inputSBValue
+        }
+        httpRequestApi.postReplyComment(this.uid, data).success(res => {
+            this.setData({
+                replyModal: false
+            })
+        });
+    },
+    // 获取回复楼中楼的内容
+    inputSBValue: function(e){
+        this.setData({
+            inputSBValue: e.detail.value
+        });
+    },
     // 选择金额
     setMoney: function (e) {
         this.setData({
@@ -214,6 +262,11 @@ Page({
             ifReward: true
         })
     },
+    quitReward:function () {
+        this.setData({
+            ifReward: false
+        })
+    },
     // 奖励
     rewardMoney: function () {
         console.log(this.data.authorUid);

+ 9 - 4
pages/social/works/works.wxml

@@ -5,10 +5,10 @@
         <text class="nickName">{{author}}</text>
         <view class="like" bindtap="likeWorks">
             <image src="../../../static/image/liked.png" />
-            <text class="likeBtn">点赞</text>
+            <text class="likeBtn">{{isLike ? '已' : ''}}点赞</text>
         </view>
         <view class="follow">
-            <text class="followBtn" bindtap="follow">关注</text>
+            <text class="followBtn" bindtap="follow">{{isFans ? '已' : ''}}关注</text>
         </view>
     </view>
     <view class="userSection">
@@ -40,7 +40,7 @@
                 </view>
             </view>
             <view class="btnWrapper">
-                <image class="commentBtn" src="../../../static/image/comment.png" />
+                <image class="commentBtn" src="../../../static/image/comment.png" bindtap="setSBId" data-id="{{item.id}}" />
                 <text class="commentText">评论</text>
                 <image class="likeBtn" src="../../../static/image/like.png" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend" />
                 <text class="likeText">{{item.likes}}</text>
@@ -66,6 +66,10 @@
             <text>分享</text>
         </view>
     </view>
+    <!-- 评论框 -->
+    <view class="replySection" wx:if="{{replyModal}}">
+        <input bindblur="bindTextAreaBlur"  bindconfirm="replySB" confirm-type="send" placeholder="回复" bindinput="inputSBValue" auto-focus auto-height />
+    </view>
     <!-- 奖励弹窗 -->
     <cover-view class="modalWrapper" wx:if="{{ifReward}}">
         <cover-view class="rewardContent">
@@ -85,7 +89,8 @@
             </cover-view>
             <cover-view class="rewardBtn" bindtap="rewardMoney">立即奖励</cover-view>
         </cover-view>
+        <cover-image class="quitBtn" bindtap="quitReward" src="../../../static/groupImg/cha.png" />
     </cover-view>
     <canvas canvas-id="myCanvas" style="width:370px;z-index=99999; height: 507px; position: absolute; left: -99rpx; top: -999rpx;"></canvas>
-    <shareDialog id="share-dialog" shareType = 'works'/>
+    <shareDialog id="share-dialog" shareType='works' />
 </view>

+ 24 - 1
pages/social/works/works.wxss

@@ -409,6 +409,7 @@ button::after {
     color: #fff;
     border: 0;
 }
+
 .rewardBtn {
     width: 464rpx;
     height: 80rpx;
@@ -419,7 +420,7 @@ button::after {
     background: -o-linear-gradient(180deg, #FEC953, #FCA40F);
     background: -moz-linear-gradient(180deg, #FEC953, #FCA40F);
     box-shadow: 0 6rpx 18rpx 0 rgba(0, 0, 0, 0.5);
-    background:  #FCA40F;
+    background: #FCA40F;
     font-size: 40rpx;
     color: #fff;
     line-height: 80rpx;
@@ -428,5 +429,27 @@ button::after {
     z-index: 9999;
     top: 718rpx;
     left: 115rpx;
+}
+
+.quitBtn {
+    width: 68rpx;
+    height: 68rpx;
+    position: absolute;
+    left: 345rpx;
+    bottom: 110rpx;
+
+}
 
+.replySection {
+    width: 100%;
+    height: 300rpx;
+    position: fixed;
+    bottom: 0;
+    background: #eee;
+}
+
+.replySection input {
+    width: 100%;
+    height: 300rpx;
+    text-indent: 4rpx;
 }