Browse Source

跳转详情页

Limengbo 6 năm trước cách đây
mục cha
commit
44a2bae666

+ 2 - 1
app.json

@@ -16,7 +16,8 @@
     "pages/grade_rank/grade_rank",
     "pages/quantity_rank/quantity_rank",
     "pages/accuracy_rank/accuracy_rank",
-    "pages/set_name/set_name"
+    "pages/set_name/set_name",
+    "pages/particulars/particulars"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 9 - 0
compontents/chat/chat.js

@@ -63,12 +63,21 @@ Component({
           }
       })
     },
+    //分享
     shareImage: function(e){
       console.log(e);
       //分享查询单条的时候会用到这两个值
       const postId = e.currentTarget.dataset.postsid;
       this.share.showPopup(postId);
     },
+    //跳转详情页
+    particulars: function (e) {
+      const postId = e.currentTarget.dataset.postsid;
+      wx.navigateTo({
+        url: '../../pages/particulars/particulars?postId=' + postId
+      })
+    },
+    //查看更多
     examine: function () {
       //console.log(1)
       var myEventDetail = {} // detail对象,提供给事件监听函数

+ 31 - 29
compontents/chat/chat.wxml

@@ -8,39 +8,41 @@
     </view>
     <view wx:if="{{productionData.list}}">
         <view class="share-con" wx:for="{{productionData.list}}" wx:key="{{index}}">
-            <view class="head">
-                <view class="head-img">
-                    <image src="{{item.featureMap.headImgUrl}}"></image>
-                </view>    
-                <view class="lesson-name">
-                    <text>{{item.featureMap.wechatName}}</text>
-                    <text style="height: 100%">{{item.title}}</text>
+            <view bindtap="particulars" data-postsId="{{item.id}}">
+                <view class="head">
+                    <view class="head-img">
+                        <image src="{{item.featureMap.headImgUrl}}"></image>
+                    </view>    
+                    <view class="lesson-name">
+                        <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>
-                <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 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>
+                    </block>
                 </view>
-                <image wx:if="{{type == 1}}" class="message" src="../../pages/image/message.png"></image>
-            </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>
-                </block>
-            </view>
-            <view class="icon">
-                <view>
-                    <image src="../../pages/image/zan.png" class="zan"></image>
-                    <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.favors : '0'}}</text>
-                </view>
-                <view>
-                    <image src="../../pages/image/weatch.png" class="weatch"></image>
-                    <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.views : '0'}}</text>
-                </view>
-                <view>
-                    <image src="../../pages/image/discuss.png" class="discuss"></image>
-                    <text>{{item.replyCount}}</text>
+                <view class="icon" wx:if="{{type == 2}}">
+                    <view>
+                        <image src="../../pages/image/zan.png" class="zan"></image>
+                        <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.favors : '0'}}</text>
+                    </view>
+                    <view>
+                        <image src="../../pages/image/weatch.png" class="weatch"></image>
+                        <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.views : '0'}}</text>
+                    </view>
+                    <view>
+                        <image src="../../pages/image/discuss.png" class="discuss"></image>
+                        <text>{{item.replyCount}}</text>
+                    </view>
                 </view>
             </view>
-            <discuss discussData="{{item.replyList}}" uid="{{item.userId}}" postsId="{{item.id}}" id="discuss" type="{{type}}"/>
+            <!--分享按钮 -->
+            <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>
         </view>
         <view class="more" bindtap="examine">查看更多</view>
     </view>

+ 1 - 2
compontents/chat/chat.wxss

@@ -45,12 +45,11 @@
 .questions {
     position:relative;
     margin-top: 28rpx;
-    padding-bottom: 58rpx;
+    padding-bottom: 10rpx;
     border-bottom: 2rpx #878787 solid;
 }
 
 .share-con .head {
-    position:relative;
     padding:20rpx 0;
 }
 

+ 2 - 2
compontents/lesson_list/lessonList.js

@@ -25,9 +25,9 @@ Component({
   methods: {
     onTap (e) {
       let flage = e.target.dataset.flag;
-      const height = this.properties.lessonData.length * 60;
+      const height = this.properties.lessonData.length * 65;
       if(flage){
-        this.util(flage, '260rpx');
+        this.util(flage, '270rpx');
         this.setData({
           'flag': false,
           'downUp': '展开'

+ 1 - 1
compontents/lesson_list/lessonList.wxss

@@ -41,7 +41,7 @@
 
 /* 时间轴 */
 .timer-shaft {
-    height: 260rpx;
+    height: 270rpx;
     overflow: hidden;
     margin: 0 0 68rpx 10rpx;
     padding: 0 25rpx;

+ 2 - 2
compontents/preview/preview.js

@@ -25,9 +25,9 @@ Component({
   methods: {
     onTap (e) {
       let flage = e.target.dataset.flag;
-      const height = this.properties.materialData.length * 60;
+      const height = this.properties.materialData.length * 65;
       if(flage){
-        this.util(flage, '260rpx');
+        this.util(flage, '270rpx');
         this.setData({
           'flag': false,
           'downUp': '展开'

+ 1 - 1
compontents/preview/preview.wxss

@@ -41,7 +41,7 @@
 
 /* 预览图片 */
 .material-con {
-    height: 260rpx;
+    height: 270rpx;
     margin: 0 0 68rpx 10rpx;
     padding: 0 25rpx;
     overflow: hidden;

+ 113 - 0
pages/particulars/particulars.js

@@ -0,0 +1,113 @@
+// pages/particulars/particulars.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    productionData: {}
+  },
+  /*预览图片*/
+  listenerButtonPreviewImage: function(e) {
+    let imgUrl = [];
+    imgUrl.push(e.target.dataset.img);
+    wx.previewImage({
+        current: '', // 当前显示图片的http链接
+        urls: imgUrl, // 需要预览的图片http链接列表
+        //这根本就不走
+        success: function(res) {
+            //console.log(res);
+        },
+        //也根本不走
+        fail: function() {
+            //console.log('fail')
+        }
+    })
+  },
+  /*点赞接口*/
+  like: function () {
+    const postsId = util.getUrl().postsId;
+    //判断分享过来的参数是否有postId查询单挑显示
+    if(postsId) {
+      login.getOpenidSessionKey(res => {
+        APIClient.getLikeSchedule({
+          uid: res.data.data.uid
+        }, {
+          postsId, 
+        }).success(res => {
+          console.log(res.data)
+          if(res.data.success) {
+            this.setData({
+              productionData: res.data.data,
+            })
+          }
+        })
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });      
+    };
+  },
+
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '作品分享'
+    })
+    const postsId = options.postId || '';
+    //判断分享过来的参数是否有postId查询单挑显示
+    if(postsId) {
+      login.getOpenidSessionKey(res => {
+        APIClient.getOneSchedule({
+          uid: res.data.data.uid
+        }, {
+          postsId, 
+        }).success(res => {
+          console.log(res.data)
+          if(res.data.success) {
+            this.setData({
+              productionData: res.data.data,
+            })
+          }
+        })
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });      
+    };
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+      
+  },
+})

+ 1 - 0
pages/particulars/particulars.json

@@ -0,0 +1 @@
+{}

+ 41 - 0
pages/particulars/particulars.wxml

@@ -0,0 +1,41 @@
+<!--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">
+        <!-- 科学艺术 -->
+        <view class="art">
+        <view class="works">
+            <view class="share-con">
+                <view class="head">
+                    <view class="head-img">
+                        <image src="{{productionData.featureMap.headImgUrl}}"></image>
+                    </view>    
+                    <view class="lesson-name">
+                        <text>{{productionData.featureMap.wechatName}}</text>
+                        <text style="height: 100%">{{productionData.title}}</text>
+                    </view>
+                </view>
+                <view class="picture">
+                    <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 bindtap="like">
+                        <image src="../../pages/image/zan.png" class="zan"></image>
+                        <text>{{productionData.postsAttributeInfo ? productionData.postsAttributeInfo.favors : '0'}}</text>
+                    </view>
+                    <view>
+                        <image src="../../pages/image/weatch.png" class="weatch"></image>
+                        <text>{{productionData.postsAttributeInfo ? productionData.postsAttributeInfo.views : '0'}}</text>
+                    </view>
+                    <view>
+                        <image src="../../pages/image/discuss.png" class="discuss"></image>
+                        <text>{{productionData.replyCount}}</text>
+                    </view>
+                </view>
+            </view>
+        </view>            
+        </view>
+    </scroll-view>
+</view>
+

+ 147 - 0
pages/particulars/particulars.wxss

@@ -0,0 +1,147 @@
+/* pages/particulars/particulars.wxss */
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.works {
+    width: 100%;
+    margin: 20rpx 0;
+    border-radius: 25rpx;
+    padding: 20rpx 0;
+    box-sizing: border-box;
+    background: #fff;
+    position: relative;
+}
+
+/* 分享评论 */
+.works {
+    padding: 16rpx 25rpx;
+}
+
+.share-con,
+.questions {
+    position:relative;
+    margin-top: 28rpx;
+    padding-bottom: 58rpx;
+    border-bottom: 2rpx #878787 solid;
+}
+
+.share-con .head {
+    position:relative;
+    padding:20rpx 0;
+}
+
+.head-img {
+    width: 86rpx;
+    height: 86rpx;
+    float: left;  
+    margin-right: 18rpx; 
+}
+
+.head-img image {
+    width: 100%;
+    height: 100%;
+    border-radius: 50%;
+}
+
+.lesson-name {
+    display: flex;
+    flex-direction: column;
+    margin: 8rpx  16rpx;
+}
+
+.lesson-name text:nth-child(1) {
+    height: 38rpx;
+    font-size: 32rpx;
+    font-weight: 600;
+}
+
+.lesson-name text:nth-child(2) {
+    height: 30rpx;
+    margin-top: 10rpx;
+    font-size: 24rpx;
+    color: #C3C3C3;
+}
+
+.picture {
+    display: flex;
+    justify-content: center;    
+    margin: 24rpx 112rpx 17rpx 103rpx;
+
+}
+.picture image {
+     width: 236rpx;
+     height: 176rpx;
+     border-radius: 15rpx;
+ }
+
+.picture image:nth-child(2) {
+    margin-left: 8rpx;
+}
+
+.share-up-box {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 100rpx;
+    width: 100rpx;
+}
+
+.share_up {
+    position: absolute;
+    right: 0;
+    top: 0rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.message {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    width: 68rpx;
+    height: 56rpx;    
+}
+
+.icon {
+    display: flex;
+    align-items: center;
+    margin: 0 112rpx 17rpx 103rpx;
+}
+
+.icon view {
+    display: flex;
+    align-items: center;
+    margin-right: 60rpx;
+}
+
+.icon .zan {
+    width: 26rpx;
+    height: 23rpx;
+}
+
+.icon .weatch {
+    width: 30rpx;
+    height: 23rpx;
+}
+
+.icon .discuss {
+    width: 32rpx;
+    height: 29rpx;  
+}
+
+.icon view text {
+    font-size: 24rpx;
+    color: #878787;
+    margin-left: 14rpx;
+}
+
+
+.more {
+    margin-top: 18rpx;
+    font-size: 28rpx;
+    text-align: center;
+    color: #787878;
+}

+ 1 - 2
pages/transmit/transmit.wxml

@@ -13,7 +13,7 @@
                     <text class="">分享作品</text>
                     <image src="../../pages/image/xing.png" class="xing"></image>
                 </view>
-                <view class="share-con" wx:key="{{index}}">
+                <view class="share-con">
                     <view class="head">
                         <view class="head-img">
                             <image src="{{productionData.featureMap.headImgUrl}}"></image>
@@ -42,7 +42,6 @@
                             <text>{{productionData.replyCount}}</text>
                         </view>
                     </view>
-                    <discuss discussData="{{productionData.replyList}}" uid="{{productionData.userId}}" postsId="{{productionData.id}}" id="discuss" type="{{2}}"/>
                 </view>
             </view>            
           </view>