Переглянути джерело

跳转详情页和点赞联调,取消生成海报

Limengbo 6 роки тому
батько
коміт
bc75638d4d

+ 30 - 1
compontents/chat/chat.js

@@ -1,4 +1,7 @@
 // compontents/chat/chat.js
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
 Component({
   /**
@@ -69,13 +72,39 @@ Component({
       //分享查询单条的时候会用到这两个值
       const postId = e.currentTarget.dataset.postsid;
       this.share.showPopup(postId);
+
     },
     //跳转详情页
     particulars: function (e) {
       const postId = e.currentTarget.dataset.postsid;
+      const type = e.currentTarget.dataset.type;
+      //取消小点
+      login.getOpenidSessionKey(function(res) {
+        APIClient.cancelDian({
+          uid: res.data.data.uid
+        }, {
+          "postsId":postId
+        }).success((res) => {
+          console.log(res);
+        })
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
       wx.navigateTo({
-        url: '../../pages/particulars/particulars?postId=' + postId
+        url: '../../pages/particulars/particulars?postId=' + postId + '&type=' + type
       })
+
     },
     //查看更多
     examine: function () {

+ 8 - 3
compontents/chat/chat.wxml

@@ -8,7 +8,7 @@
     </view>
     <view wx:if="{{productionData.list}}">
         <view class="share-con" wx:for="{{productionData.list}}" wx:key="{{index}}">
-            <view bindtap="particulars" data-postsId="{{item.id}}">
+            <view bindtap="particulars" data-postsId="{{item.id}}" data-type="{{type}}">
                 <view class="head">
                     <view class="head-img">
                         <image src="{{item.featureMap.headImgUrl}}"></image>
@@ -17,11 +17,11 @@
                         <text>{{item.featureMap.wechatName}}</text>
                         <text style="height: 100%">{{item.title}}</text>
                     </view>
-                    <image wx:if="{{type == 1}}" class="message" src="../../pages/image/message.png"></image>
+                    <view wx:if="{{type == 1 && (item.currentReplyCount > 0)}}" class="message"></view>
                 </view>
                 <view class="picture" wx:if="{{type == 2}}">
                     <block wx:for="{{item.imagesList}}" wx:for-item="items" wx:key="{{items.id}}">
-                        <image src="{{items.path}}" bindtap="listenerButtonPreviewImage" data-img="{{items.path}}"></image>
+                        <image src="{{items.path}}" catchtap="listenerButtonPreviewImage" data-img="{{items.path}}"></image>
                     </block>
                 </view>
                 <view class="icon" wx:if="{{type == 2}}">
@@ -40,9 +40,14 @@
                 </view>
             </view>
             <!--分享按钮 -->
+            <!--暂时注释海报分享功能改为直接分享
             <view class="share-up-box" wx:if="{{type == 2}}" bindtap="shareImage" data-postsId="{{item.id}}">
                 <image class="share_up" src="../../pages/image/share_up.png"></image>
             </view>
+            -->
+            <button class='transmit' open-type="share" id="transmit" data-userId="{{userId}}" data-postId="{{item.id}}"  wx:if="{{type == 2}}">
+                <image class="share_up" src="../../pages/image/share_up.png"></image>
+            </button> 
         </view>
         <view class="more" bindtap="examine">查看更多</view>
     </view>

+ 33 - 4
compontents/chat/chat.wxss

@@ -87,10 +87,11 @@
 
 .picture {
     display: flex;
-    justify-content: center;    
+    justify-content: center; 
+    height:176rpx;   
     margin: 24rpx 112rpx 17rpx 103rpx;
-
 }
+
 .picture image {
      width: 236rpx;
      height: 176rpx;
@@ -121,8 +122,10 @@
     position: absolute;
     right: 0;
     top: 10rpx;
-    width: 68rpx;
-    height: 56rpx;    
+    width: 20rpx;
+    height: 20rpx;
+    background: red;
+    border-radius: 50%;    
 }
 
 .icon {
@@ -210,4 +213,30 @@
     font-size: 24rpx;
     color: #C0C0C0;
     transform: translate(-50%);
+}
+
+/*分享按钮*/
+.transmit {
+    position: absolute;
+    right: -20rpx;
+    top: -20rpx;
+    height: 100rpx;
+    width: 100rpx;
+    background: #fff;
+    margin:0;
+    padding:0;
+    line-height: normal;
+}
+
+.transmit:after {
+    content: '';
+    border: none;
+}
+
+.transmit image {
+    position: absolute;
+    right: 20rpx;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;    
 }

+ 29 - 8
pages/art/art.js

@@ -12,6 +12,8 @@ Page({
     courseData: {},
     num1: 0,
     num2: 0,
+    position: '',
+    questionsdian: ''
   },
 
   /* 区分答疑和分享 */
@@ -41,7 +43,7 @@ Page({
       })
     });
   },
-
+  /*点击加载更多*/
   onMyEvent: function(e){
     let type = e.currentTarget.dataset.type;
     const columnId = util.column('6').columnId;
@@ -54,8 +56,13 @@ Page({
         if(res.data.success) {
           console.log(res.data.data)
           this.setData({
-            questionsData: res.data.data,
-          })      
+            questionsData: res.data.data
+          }) 
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }    
         }
       });
     }
@@ -70,12 +77,23 @@ Page({
           console.log(res.data.data)
           this.setData({
             productionData: res.data.data,
-          })   
+          })  
         }
       });
     }
   },
 
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
+
+
+
   onLoad: function (options) {
     //分享按钮
     wx.showShareMenu({
@@ -90,7 +108,7 @@ Page({
       if(res.data.success) {
         console.log(res.data.data)
         this.setData({
-          productionData: res.data.data,
+          productionData: res.data.data
         })
       }
       
@@ -100,19 +118,22 @@ Page({
       if(res.data.success) {
         console.log(res.data.data)
         this.setData({
-          questionsData: res.data.data,
+          questionsData: res.data.data
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        }
       }
     });
     /*科目信息*/
     login.getOpenidSessionKey((res) => {
-      //console.log(res.data.data.uid);
       APIClient.getEachSchedule({
         uid: res.data.data.uid
       }, {
         "category": 6
       }).success((res) => {
-        //console.log('科目信息' + JSON.stringify(res));
         this.setData({
           courseData: res.data.data
         })

+ 6 - 7
pages/art/art.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 科学艺术 -->
           <view class="art">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="upload"
                 productionData="{{productionData}}" 
                 title="作品分享"
                 query="分享作品"
@@ -22,7 +22,7 @@
                 bind:myevent="onMyEvent"
                 data-type="2"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -31,14 +31,13 @@
                 bind:myevent="onMyEvent"
                 data-type="1"/>
 
-            <view class="questions-one">
+            <view class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
 
-            <view class="upload-one">
+            <view class="upload-one" data-id="upload" bindtap="location">
                 <image src="../image/works.png" ></image>
-                <text class="row" wx:if="{{productionData.list.length}}">{{productionData.list.length}}</text>
             </view>  
           </view>
       </scroll-view>

+ 24 - 4
pages/chinese/chinese.js

@@ -9,7 +9,9 @@ Page({
     flag: false,
     questionsData: {},
     courseData: {},
-    num1: 0
+    num1: 0,
+    position: '',
+    questionsdian: ''
   },
 
   /* 区分答疑和分享 */
@@ -52,12 +54,25 @@ Page({
         if(res.data.success) {
           console.log(res.data.data)
           this.setData({
-            questionsData: res.data.data,
-          })      
+            questionsData: res.data.data
+          })
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }      
         }
       });
     }
   },
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
 
   onLoad: function (options) {
    
@@ -70,8 +85,13 @@ Page({
       if(res.data.success) {
         console.log(res.data.data)
         this.setData({
-          questionsData: res.data.data,
+          questionsData: res.data.data
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        }
       }
     });
     /*科目信息*/

+ 4 - 4
pages/chinese/chinese.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!--中文  -->
           <view class="chinese">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -23,9 +23,9 @@
                 data-type="1"/>
 
 
-            <view class="questions-one">
+            <view class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
           </view>
       </scroll-view>

+ 22 - 2
pages/english/english.js

@@ -9,7 +9,9 @@ Page({
     flag: false,
     questionsData: {},
     courseData: {},
-    num1: 0
+    num1: 0,
+    position: '',
+    questionsdian: ''
   },
 
   /* 区分答疑和分享 */
@@ -53,11 +55,24 @@ Page({
           console.log(res.data.data)
           this.setData({
             questionsData: res.data.data,
-          })      
+          })
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }       
         }
       });
     }
   },
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
 
   onLoad: function (options) {
 
@@ -72,6 +87,11 @@ Page({
         this.setData({
           questionsData: res.data.data,
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        } 
       }
     });
     /*科目信息*/

+ 4 - 4
pages/english/english.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 英语分级阅读 -->
           <view class="english">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -23,9 +23,9 @@
                 data-type="1"/>
 
 
-            <view class="questions-one">
+            <view class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
           </view>
       </scroll-view>

BIN
pages/image/input.png


BIN
pages/image/nozan.png


+ 1 - 1
pages/index/index.wxml

@@ -69,7 +69,7 @@
                   <text>第{{rankData.userQuestionRank.rank}}名</text>
                 </view>
                 <view class="rank">
-                  <text>答题准确率:{{rankData.userQuestionCorrectRank.numberCorrect * 100}}%</text>
+                  <text>答题准确率:{{rankData.userQuestionCorrectRank.numberCorrect}}%</text>
                   <text>第{{rankData.userQuestionCorrectRank.rank}}名</text>
                 </view>
               </view>

+ 22 - 2
pages/language/language.js

@@ -9,7 +9,9 @@ Page({
     flag: false,
     questionsData: {},
     courseData: {},
-    num1: 0
+    num1: 0,
+    position: '',
+    questionsdian: ''
   },
 
   /* 区分答疑和分享 */
@@ -53,11 +55,24 @@ Page({
           console.log(res.data.data)
           this.setData({
             questionsData: res.data.data,
-          })      
+          })  
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }           
         }
       });
     }
   },
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
 
   onLoad: function (options) {
   },
@@ -71,6 +86,11 @@ Page({
         this.setData({
           questionsData: res.data.data,
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        }       
       }
     });
     /*科目信息*/

+ 4 - 4
pages/language/language.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 语文 -->
           <view class="language">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -23,9 +23,9 @@
                 data-type="1"/>
 
 
-            <view class="questions-one">
+            <view class="questions-one" class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
           </view>
       </scroll-view>

+ 22 - 2
pages/mathematics/mathematics.js

@@ -9,7 +9,9 @@ Page({
     flag: false,
     questionsData: {},
     courseData: {},
-    num1: 0
+    num1: 0,
+    position: '',
+    questionsdian: ''
   },
 
   /* 区分答疑和分享 */
@@ -53,7 +55,12 @@ Page({
           console.log(res.data.data)
           this.setData({
             questionsData: res.data.data,
-          })      
+          })
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }           
         }
       });
     }
@@ -61,6 +68,14 @@ Page({
 
   onLoad: function (options) {
   },
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
 
   onShow: function () {
     const columnId = util.column('2').columnId;
@@ -71,6 +86,11 @@ Page({
         this.setData({
           questionsData: res.data.data,
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        }     
       }
     });
     /*科目信息*/

+ 4 - 4
pages/mathematics/mathematics.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 数学 -->
           <view class="mathematics">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -23,9 +23,9 @@
                 data-type="1"/>
 
 
-            <view class="questions-one">
+            <view class="questions-one" class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
           </view>
       </scroll-view>

+ 90 - 5
pages/particulars/particulars.js

@@ -9,8 +9,76 @@ Page({
    * 页面的初始数据
    */
   data: {
-    productionData: {}
+    productionData: {},
+    text: '',
+    discussDatas: [],
+    messageLength: '',
+    type: '',
+    favors: '',
+    like: false
   },
+  /* 获取输入内容 */
+  bindKeyInput (e) {
+    this.setData({
+      text: e.detail.value
+    })
+  },
+  /* 发送评论 */
+  sendText (e) {
+    let text = this.data.text.trim();
+    let postsId = e.currentTarget.dataset.id;
+    let _this = this;
+    if(text == ''){
+      wx.showModal({
+        title: '提示',
+        content: '请输入评论内容',
+        success: function(res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+      return false;
+    }
+    this.data.text = "";
+    let data = {
+      "postsId": postsId,
+      "content": text
+    };
+    login.getOpenidSessionKey((res) => {
+      //console.log(res.data.data.uid);
+      APIClient.getDiscussSchedule({
+        uid: res.data.data.uid
+      }, data).success((res) => {
+        if(res.data.success) {
+          this.data.discussDatas.push(res.data.data);
+          this.setData({
+            discussDatas: this.data.discussDatas,
+            messageLength: this.data.discussDatas.length
+          });
+        };
+      });        
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });
+    this.setData({
+      text: ''
+    })
+  },
+
   /*预览图片*/
   listenerButtonPreviewImage: function(e) {
     let imgUrl = [];
@@ -30,7 +98,7 @@ Page({
   },
   /*点赞接口*/
   like: function () {
-    const postsId = util.getUrl().postsId;
+    const postsId = util.getUrl().postId;
     //判断分享过来的参数是否有postId查询单挑显示
     if(postsId) {
       login.getOpenidSessionKey(res => {
@@ -42,7 +110,8 @@ Page({
           console.log(res.data)
           if(res.data.success) {
             this.setData({
-              productionData: res.data.data,
+              favors: res.data.data.favors,
+              like: true
             })
           }
         })
@@ -68,9 +137,22 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    wx.setNavigationBarTitle({
-      title: '作品分享'
+    const type = options.type;
+    this.setData({
+      type: type
     })
+    if(type == 2) {
+      wx.setNavigationBarTitle({
+        title: '作品分享'
+      })
+    }
+    if(type == 1) {
+      wx.setNavigationBarTitle({
+        title: '答疑讨论'
+      })
+    }
+
+
     const postsId = options.postId || '';
     //判断分享过来的参数是否有postId查询单挑显示
     if(postsId) {
@@ -84,6 +166,9 @@ Page({
           if(res.data.success) {
             this.setData({
               productionData: res.data.data,
+              discussDatas: res.data.data.replyList,
+              messageLength: res.data.data.replyList.length,
+              favors:res.data.data.postsAttributeInfo.favors
             })
           }
         })

+ 19 - 7
pages/particulars/particulars.wxml

@@ -1,8 +1,7 @@
 <!--pages/particulars/particulars.wxml-->
 <view class="content">
-    <scroll-view scroll-y="true" bindscroll="lower" scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+    <scroll-view scroll-y="true" scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
         <!-- 科学艺术 -->
-        <view class="art">
         <view class="works">
             <view class="share-con">
                 <view class="head">
@@ -14,15 +13,16 @@
                         <text style="height: 100%">{{productionData.title}}</text>
                     </view>
                 </view>
-                <view class="picture">
+                <view class="picture" wx:if="{{type == 2}}">
                     <block wx:for="{{productionData.imagesList}}" wx:for-item="items" wx:key="{{items.id}}">
                         <image src="{{items.path}}" bindtap="listenerButtonPreviewImage" data-img="{{items.path}}"></image>
                     </block>
                 </view>
-                <view class="icon">
+                <view class="icon" wx:if="{{type == 2}}">
                     <view bindtap="like">
-                        <image src="../../pages/image/zan.png" class="zan"></image>
-                        <text>{{productionData.postsAttributeInfo ? productionData.postsAttributeInfo.favors : '0'}}</text>
+                        <image src="../../pages/image/zan.png" class="zan" wx:if="{{like}}"></image>
+                        <image src="../../pages/image/nozan.png" class="zan" wx:else></image>
+                        <text>{{favors ? favors : '0'}}</text>
                     </view>
                     <view>
                         <image src="../../pages/image/weatch.png" class="weatch"></image>
@@ -30,12 +30,24 @@
                     </view>
                     <view>
                         <image src="../../pages/image/discuss.png" class="discuss"></image>
-                        <text>{{productionData.replyCount}}</text>
+                        <text>{{messageLength}}</text>
                     </view>
                 </view>
             </view>
         </view>            
+        <view class="comment" >
+            <view  wx:for="{{discussDatas}}" wx:key="{{item.id}}">
+                <text style="color: {{productionData.userId == item.userId ? '#000' : '#f7085e'}}">{{item.featureMap.wechatName}}:</text>
+                <text>{{item.content}}</text>
+            </view>  
         </view>
     </scroll-view>
 </view>
+<view class="text">
+    <image src="../../pages/image/input.png" class="input-img"></image>
+    <view class="input-text">
+        <input placeholder="Enter You My Essage" value="{{text}}" bindinput="bindKeyInput" type="text" />
+        <view bindtap="sendText" data-id="{{productionData.id}}"></view>
+    </view>
+</view>
 

+ 54 - 10
pages/particulars/particulars.wxss

@@ -1,15 +1,12 @@
 /* pages/particulars/particulars.wxss */
-.art {
-  width: 100%;
-  padding: 0 15rpx;
-  box-sizing: border-box;
+.content {
+    padding-bottom: 140rpx;
+    box-sizing: border-box;
 }
 
 .works {
     width: 100%;
-    margin: 20rpx 0;
     border-radius: 25rpx;
-    padding: 20rpx 0;
     box-sizing: border-box;
     background: #fff;
     position: relative;
@@ -17,15 +14,12 @@
 
 /* 分享评论 */
 .works {
-    padding: 16rpx 25rpx;
+    padding: 0 25rpx;
 }
 
 .share-con,
 .questions {
     position:relative;
-    margin-top: 28rpx;
-    padding-bottom: 58rpx;
-    border-bottom: 2rpx #878787 solid;
 }
 
 .share-con .head {
@@ -144,4 +138,54 @@
     font-size: 28rpx;
     text-align: center;
     color: #787878;
+}
+
+/* 评论内容展开 */
+ .comment {
+    width: 100%;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+ }
+
+ .comment view {
+     margin-top: 20rpx; 
+     font-size: 28rpx;
+ }
+
+ .text {
+     position: absolute;
+     bottom: 0;
+     width: 100%;
+     height: 140rpx;
+     background: #fff;
+ }
+
+ .input-text {
+    position: absolute;
+    left: 0;
+    bottom: 0;
+    width: 100%;
+    height: 140rpx;
+    z-index: 99; 
+ }
+
+ .text input {
+     width: 80%;
+     float: left;
+     height: 100%;
+     padding-left: 30rpx;
+ }
+
+.input-text view {
+    width: 15%;
+    height: 140rpx;
+    float: right;
+}
+
+.input-img {
+    position: absolute;
+    left: 0;
+    bottom: 0;
+    width: 100%;
+    height: 140rpx;
 }

+ 24 - 4
pages/science/science.js

@@ -11,7 +11,9 @@ Page({
     questionsData: {},
     courseData: {},
     num1: 0,
-    num2: 0
+    num2: 0,
+    position: '',
+    questionsdian: ''
   },
   /* 区分答疑和分享 */
   distinction: function(type, columnId, pageNo, pageSize, success) {
@@ -54,7 +56,12 @@ Page({
           console.log(res.data.data)
           this.setData({
             questionsData: res.data.data,
-          })      
+          })
+          if(res.data.data) {
+            this.setData({
+              questionsdian: util.replyNo(res.data.data.list)
+            })
+          }        
         }
       });
     }
@@ -69,11 +76,19 @@ Page({
           console.log(res.data.data)
           this.setData({
             productionData: res.data.data,
-          })   
+          })  
         }
       });
     }
   },
+  /*点击定位*/
+  location: function (e) {
+    const position = e.currentTarget.dataset.id;
+    console.log(position)
+    this.setData({
+      position: position
+    })
+  },
   onLoad: function (options) {
     //分享按钮
     wx.showShareMenu({
@@ -89,7 +104,7 @@ Page({
         console.log(res.data.data)
         this.setData({
           productionData: res.data.data,
-        })
+        }) 
       }
       
     });
@@ -100,6 +115,11 @@ Page({
         this.setData({
           questionsData: res.data.data,
         })
+        if(res.data.data) {
+          this.setData({
+            questionsdian: util.replyNo(res.data.data.list)
+          })
+        }  
       }
     });
     /*科目信息*/

+ 6 - 7
pages/science/science.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 科学 -->
           <view class="science">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
@@ -13,7 +13,7 @@
 
             <preview materialData="{{courseData.lessonPage.list}}"/>
 
-            <chat 
+            <chat id="upload"
                 productionData="{{productionData}}" 
                 title="作品分享"
                 query="分享作品"
@@ -22,7 +22,7 @@
                 bind:myevent="onMyEvent"
                 data-type="2"/>
 
-            <chat 
+            <chat id="questions"
                 productionData="{{questionsData}}" 
                 title="答疑讨论"
                 query="我有疑问"
@@ -31,14 +31,13 @@
                 bind:myevent="onMyEvent"
                 data-type="1"/>
 
-            <view class="questions-one">
+            <view class="questions-one" data-id="questions" bindtap="location">
                 <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsData.list.length}}">{{questionsData.list.length}}</text>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
 
-            <view class="upload-one">
+            <view class="upload-one" data-id="upload" bindtap="location">
                 <image src="../image/works.png" ></image>
-                <text class="row" wx:if="{{productionData.list.length}}">{{productionData.list.length}}</text>
             </view>  
           </view>
       </scroll-view>

+ 7 - 3
pages/transmit/transmit.js

@@ -9,7 +9,9 @@ Page({
    * 页面的初始数据
    */
   data: {
-    productionData: {}
+    productionData: {},
+    favors: '',
+    like: false
   },
   /*预览图片*/
   listenerButtonPreviewImage: function(e) {
@@ -30,7 +32,7 @@ Page({
   },
   /*点赞接口*/
   like: function () {
-    const postsId = util.getUrl().postsId;
+    const postsId = util.getUrl().postId;
     //判断分享过来的参数是否有postId查询单挑显示
     if(postsId) {
       login.getOpenidSessionKey(res => {
@@ -42,7 +44,8 @@ Page({
           console.log(res.data)
           if(res.data.success) {
             this.setData({
-              productionData: res.data.data,
+              favors: res.data.data.favors,
+              like: true
             })
           }
         })
@@ -81,6 +84,7 @@ Page({
           if(res.data.success) {
             this.setData({
               productionData: res.data.data,
+              favors:res.data.data.postsAttributeInfo.favors
             })
           }
         })

+ 3 - 2
pages/transmit/transmit.wxml

@@ -30,8 +30,9 @@
                     </view>
                     <view class="icon">
                         <view bindtap="like">
-                            <image src="../../pages/image/zan.png" class="zan"></image>
-                            <text>{{productionData.postsAttributeInfo ? productionData.postsAttributeInfo.favors : '0'}}</text>
+                            <image src="../../pages/image/zan.png" class="zan" wx:if="{{like}}"></image>
+                            <image src="../../pages/image/nozan.png" class="zan" wx:else></image>
+                            <text>{{favors ? favors : '0'}}</text>
                         </view>
                         <view>
                             <image src="../../pages/image/weatch.png" class="weatch"></image>

+ 5 - 0
utils/APIClient.js

@@ -57,5 +57,10 @@ module.exports = {
 	getLikeSchedule(header, data) {
 		let url = genAPIUrl('wx/posts/attribute');
 		return request.getInstance().url(url).header(header).data(data).method('GET').send();
+	},
+	//取消小点
+	cancelDian(header, data) {
+		let url = genAPIUrl('wx/posts/readCount');
+		return request.getInstance().url(url).header(header).data(data).method('GET').send();
 	}
 }

+ 10 - 1
utils/util.js

@@ -131,6 +131,14 @@ function topThree (arr) {
    return arr1;
 }
 
+//获取回复条数
+function replyNo (arr) {
+  let num = 0;
+  for( let item of arr) {
+    num += item.currentReplyCount
+  }
+  return num
+}
 
 module.exports = {
   formatTime: formatTime,
@@ -139,5 +147,6 @@ module.exports = {
   getUrl,
   column,
   url,
-  topThree
+  topThree,
+  replyNo
 }