Ver código fonte

分享朋友圈样式和位置

孙志雷 6 anos atrás
pai
commit
ca1929bc67

+ 6 - 2
component/group/group.wxss

@@ -23,6 +23,7 @@ scroll-view {
 .less-group,
 .whole-group {
     width: 100%;
+    min-height: 60%;
     background: #fff;
 }
 
@@ -65,14 +66,17 @@ scroll-view {
 
 .group-box {
     display: flex;
-    width: 100%;
+    width: 105%;
     flex-wrap: wrap;
-    justify-content: space-between;
+    flex-direction: row;
+    /* justify-content: space-between; */
 }
 
 .group-item {
     position: relative;
     display: flex;
+    margin-right:35rpx;
+
     flex-direction: column;
 }
 

+ 1 - 1
component/hot/hot.js

@@ -15,7 +15,7 @@ export const hotInit = (that) => {
         circular: true,
         hotWareCardFirst: 'hotWareCardFirst',
         hotWareCard: 'hotWareCard',
-        hotSearch: '鹅鹅鹅',
+        hotSearch: '',
         banner: [],
         recommend: [],
         hotWorks: [],

+ 1 - 2
component/hot/hot.wxss

@@ -165,11 +165,10 @@ swiper {
 }
 
 .hotWareCard .wareCardTip {
-
     width: 178rpx;
     height: 40rpx;
     display: block;
-    text-align: center;
+    text-align: left;
     color: #414141;
     font-size: 24rpx;
 }

+ 0 - 5
component/my/my.js

@@ -61,11 +61,6 @@ export const myInit = (that) => {
       wx.navigateTo({
         url: `../../pages/groupPage/my-group/my-group?title=${title}`
       });
-      debugger
-      APIClient.myWallet().success(res => {
-        debugger
-        console.log(res.data.data.data);
-      });
     }
     
 }

+ 3 - 5
component/share/share.js

@@ -61,8 +61,6 @@ Component({
           }
         })
         .then(() => {
-          debugger;
-          console.log(this.data.QRCodeImagePath);
           wx.getImageInfo({
             src: this.data.QRCodeImagePath,//服务器返回的图片地址
             success: function (res) {
@@ -119,7 +117,6 @@ Component({
 
     },
     share: function (data) {
-      debugger;
       if (this.data.shareType === 'works') {
 
         this.setData({
@@ -167,7 +164,6 @@ Component({
       let download = new Promise((resolve, reject) => {
         let QRCode = () => {
           // 生成二维码并下载
-          debugger;
           httpRequestApi.createQRCode(this.data.QRData).success(res => {
             // let base64 = wx.arrayBufferToBase64(res.data);
             // console.log(a)
@@ -332,7 +328,9 @@ Component({
       wx.saveImageToPhotosAlbum({
         filePath: this.data.imgUrls,
         success(res) {
-          console.log('保存成功')
+          this.setData({
+            imgUrls: false
+          })
         }
       })
     },

+ 0 - 1
pages/groupPage/collage-details/collage-details.js

@@ -58,7 +58,6 @@ Page({
    */
   onLoad: function (options) {
     options.scene = 'QR1541862338777268';
-    debugger;
     wx.setNavigationBarTitle({
       title: '拼团详情'
     })

+ 2 - 1
pages/groupPage/collage-details/collage-details.wxss

@@ -3,6 +3,7 @@
     height: 100%;
     width: 100%;
     background:rgba(240,241,245,1);    
+    overflow: hidden;
 }
 
 .step {
@@ -31,7 +32,7 @@
 
 .details-head {
     width: 100%;
-    height: 78%;
+    height: 82%;
     margin-top: 12rpx;
     background: #fff;
 }

+ 7 - 3
pages/groupPage/grade-details/grade-details.js

@@ -135,9 +135,10 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    wx.setNavigationBarTitle({
-      title: options.title
-    })
+    console.log(options)
+    // wx.setNavigationBarTitle({
+    //   title: options.title
+    // })
     const productId = options.productId;
     if (productId) {
       this.setData({
@@ -149,6 +150,9 @@ Page({
       console.log('课本详情', res.data.data);
       const bookInfo = res.data.data.product;
       const lessonList = res.data.data.lessonList;
+      wx.setNavigationBarTitle({
+        title: bookInfo.title
+      })
       this.setData({
         titleIcon: bookInfo.bgImg,
         title: bookInfo.title,

+ 0 - 1
pages/groupPage/group-details/group-details.js

@@ -143,7 +143,6 @@ Page({
   },
   //拼团详情
   jionSuccess: function (orderId, type) {
-    debugger;
     httpRequestApi.getMygroupInfo(orderId).success(res => {
       console.log('拼团详情', res.data.data);
       const surplusNum = res.data.data.groupPurchaseOrder.headcount - res.data.data.groupPurchaseOrder.joinCount;

+ 1 - 1
pages/groupPage/group-details/group-details.wxss

@@ -76,7 +76,7 @@
 }
 
 scroll-view {
-    height: 64%;
+    height: 80%;
     width: 100%;
 }
 

+ 9 - 20
pages/index/index.js

@@ -78,12 +78,19 @@ Page({
       templates
     });
     if (myIndex == 0) {
+      
       groupInit(this);
     }
     if (myIndex == 1) {
+      this.setData({
+        recommendPageNo: 1
+      })
       hotInit(this);
     }
     if (myIndex == 2) {
+      this.setData({
+        followPageNo: 1
+      })
       followInit(this);
     }
     if (myIndex == 3) {
@@ -97,24 +104,6 @@ Page({
       // });
     }
   },
-  aa: function () {
-    let a = new Promise((resolve, reject) => {
-      resolve(console.log('aa'))
-    });
-    return a;
-  },
-  bb: function () {
-    let b = new Promise((resolve, reject) => {
-      resolve(console.log('bb'))
-    });
-    return b
-  },
-  cc: function () {
-    let c = new Promise((resolve, reject) => {
-      console.log('cc')
-    });
-    return c
-  },
   onLoad: function (options) {
     console.log(options)
     this.uid = wx.getStorageSync('uid');
@@ -173,10 +162,10 @@ Page({
   },
   // 触底加载
   onReachBottom: function () {
-    console.log(this.data.recommendPageNo)
-    console.log('bottom')
+    
     // 当前在推荐页面 加载推荐
     if (this.data.myIndex === 1) {
+      console.log(this.data.recommendPageNo)
       this.setData({
         recommendPageNo: this.data.recommendPageNo + 1
       })

+ 29 - 6
pages/main/class/class.js

@@ -54,11 +54,34 @@ Page({
     })
   },
   goToReading: function () {
-    let id = this.data.id;
-    let title = this.data.title;
-    wx.navigateTo({
-      url: `../../main/reading/reading?id=${id}`
-    })
+    
+    let classId = this.data.id;
+    httpRequestApi.checkLesson(classId).success(res=>{
+      const productId = res.data.data[0];
+      httpRequestApi.areYouSuper(res.data.data).success(res => {
+        if(res.data.success){
+          wx.navigateTo({
+            url: `../../main/reading/reading?id=${classId}`
+          })
+        } else {
+          wx.showModal({
+            title: '您未购买过本书,不能朗读',
+            content: '超值团购进行中,快去看看',
+            success (res) {
+              if (res.confirm) {
+                console.log('用户点击确定')
+                wx.navigateTo({
+                  url: `../../groupPage/grade-details/grade-details?productId=${productId}`
+                })
+              } else if (res.cancel) {
+                console.log('用户点击取消')
+              }
+            }
+          })
+        }
+      })
+    });
+    
   },
   openShare: function (e) {
     // this.setData({
@@ -114,7 +137,7 @@ Page({
     const data = {
       lessonId: this.data.id,
       pageNo: this.data.pageNo,
-      pageSize: 1
+      pageSize: 10
     };
     httpRequestApi.getClassRead(this.uid, data).success(res => {
       const readInfo = res.data.data.list;

+ 8 - 3
pages/main/class/class.wxml

@@ -27,10 +27,15 @@
             <image class="microphone" src="../../../static/image/microphone.png" />
             <text>我要朗读</text>
         </view>
-        <view class="shareBtn footerBtn" bindtap="openShare">
-            <image src="../../../static/image/share.png" />
-            <text>分享</text>
+        <view class="shareBtn footerBtn">
+            <!-- <image src="../../../static/image/share.png" />
+            <text>分享</text> -->
+            <button open-type="share" plain="true" hover-class="none">
+                <image src="../../../static/image/share.png" />
+                <text>分享</text>
+            </button>
         </view>
+        
     </view>
     <canvas canvas-id="myCanvas" style="width:370px;z-index=99999; height: 507px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
     <shareDialog id="share-dialog" shareType='class' />

+ 51 - 14
pages/main/class/class.wxss

@@ -2,9 +2,12 @@
     width: 750rpx;
     height: 428rpx;
 }
-.classPage{
+
+.classPage {
     background: #e8e8e8;
+    height: 100%;
 }
+
 /**底部按钮区域**/
 .footSection {
     width: 750rpx;
@@ -40,53 +43,87 @@
     flex-direction: column;
     margin-top: 60rpx;
 }
-.collectBtn{
+
+.collectBtn {
     margin-left: 80rpx
 }
-.shareBtn{
-    margin-right: 80rpx
+
+.shareBtn button {
+    display: flex;
+    flex-direction: column;
+    outline: none;
+    border: 0;
+    padding: 0;
+    margin: 0;
+    border-radius: 0;
+    /* line-height: 0; */
+    background: #f7f7f7;
+}
+
+button::after {
+    width: 0;
+    height: 0;
+    top: 0;
+    left: 0
+}
+
+.shareBtn {
+    margin-right: 80rpx;
+    padding: 0;
+    /* background: #fff; */
 }
+
 .footerBtn image {
     width: 50rpx;
     height: 48rpx;
-    display:block;
-    margin: 0 auto 18rpx; 
+    display: block;
+    margin: 0 auto 18rpx;
 }
+
 .footerBtn text {
     width: 112rpx;
     height: 40rpx;
+    line-height:40rpx;
     font-size: 28rpx;
     color: #414141;
     text-align: center;
 }
+
 .footSection .microphone {
     display: block;
     margin: -6rpx auto 0;
     width: 108rpx;
     height: 106rpx;
 }
-.footSection .readingBtn text{
+
+.footSection .readingBtn text {
     margin-top: -10rpx;
 }
+
 .readWorksSection {
     width: 100%;
-    height: 100%;
+    /* height: 100%; */
     background: #e8e8e8;
-    margin-bottom: 150rpx;
+    padding-bottom:75px;
+    /* margin-bottom: 150rpx; */
+    /* min-height: 710rpx; */
+
 }
 
-.readWorksSection  .peopleNum{
+.readWorksSection .peopleNum {
     display: flex;
     align-items: center;
     margin: 10rpx 0 10rpx 24rpx;
 
 }
-.peopleNum .peoplesIcon{
+
+.peopleNum .peoplesIcon {
     width: 28rpx;
     height: 28rpx;
     margin-right: 10rpx;
 }
-.peopleNum .title{
+
+.peopleNum .title {
     font-size: 24rpx;
     color: #5d5d5d;
     height: 24rpx;
@@ -95,8 +132,8 @@
 
 .readWorksSection .workCard {
     width: 716rpx;
-    /* height: 132rpx; */
-    height: 700rpx;
+    height: 132rpx;
+    /* height: 700rpx; */
     display: flex;
     align-items: center;
     flex-direction: row;

+ 1 - 1
pages/main/week/week.wxml

@@ -1,6 +1,6 @@
 <view class="hotSection">
         <view class="hotWares" style="flex-direction:row;">
-            <view wx:for="{{recommend}}" wx:key="{{index}}" class="hotWareCard" data-classId="{{item.classId}}" data-title="{{item.title}}">
+            <view wx:for="{{recommend}}" bindtap="openClass" wx:key="{{index}}" class="hotWareCard" data-classId="{{item.classId}}" data-title="{{item.title}}">
                 <image class="wareCardImg" src="{{item.img}}" />
                 <text class="wareCardTitle">{{item.title}}</text>
                 <view class="bottomData">

+ 8 - 0
pages/main/week/week.wxss

@@ -51,3 +51,11 @@
     justify-content: space-between;
     align-items: center;
 }
+.hotWareCard .wareCardTip {
+    width: 178rpx;
+    height: 40rpx;
+    display: block;
+    text-align: left;
+    color: #414141;
+    font-size: 24rpx;
+}

+ 0 - 1
pages/social/replyDetail/replyDetail.js

@@ -25,7 +25,6 @@ Page({
     getReplyDetail: function () {
         // 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;

+ 38 - 13
pages/social/works/works.js

@@ -27,7 +27,6 @@ Page({
     },
     onLoad: function (option) {
         console.log(option)
-        debugger;
         let id = option.id ? option.id : option.scene.replace('QR', '')
 
         wx.setNavigationBarTitle({
@@ -41,13 +40,13 @@ Page({
         this.uid = wx.getStorageSync('uid');
         this.getWorks(this.uid, id);
     },
-    onHide: function(){
-        if(this.innerAudioContext){
+    onHide: function () {
+        if (this.innerAudioContext) {
             this.innerAudioContext.stop();
         }
     },
-    onUnload: function(){
-        if(this.innerAudioContext){
+    onUnload: function () {
+        if (this.innerAudioContext) {
             this.innerAudioContext.stop();
         }
     },
@@ -60,7 +59,7 @@ Page({
             const works = res.data.data.userRead;
             const othersTemp = [];
             others.forEach((item) => {
-              const temp = {};
+                const temp = {};
                 temp.uid = item.userRead.id;
                 temp.title = item.userRead.title;
                 temp.image = item.user.avatar;
@@ -68,7 +67,7 @@ Page({
                 othersTemp.push(temp);
             });
             this.setData({
-                user: othersTemp, 
+                user: othersTemp,
                 totalRead: res.data.data.totalRead,
                 author: author.wechatName,
                 authorAvatar: author.avatar,
@@ -141,11 +140,37 @@ Page({
         this.innerAudioContext.pause();
     },
     goToReading: function () {
-        let id = this.data.id;
-        let title = this.data.title;
-        wx.navigateTo({
-            url: `../../main/reading/reading?id=${this.data.classId}`
-        })
+
+        // wx.navigateTo({
+        //     url: `../../main/reading/reading?id=${this.data.classId}`
+        // })
+
+        const classId = this.data.classId;
+        httpRequestApi.checkLesson(classId).success(res => {
+            const productId = res.data.data[0];
+            httpRequestApi.areYouSuper(res.data.data).success(res => {
+                if (res.data.success) {
+                    wx.navigateTo({
+                        url: `../../main/reading/reading?id=${classId}`
+                    })
+                } else {
+                    wx.showModal({
+                        title: '您未购买过本书,不能朗读',
+                        content: '超值团购进行中,快去看看',
+                        success(res) {
+                            if (res.confirm) {
+                                console.log('用户点击确定')
+                                wx.navigateTo({
+                                    url: `../../groupPage/grade-details/grade-details?productId=${productId}`
+                                })
+                            } else if (res.cancel) {
+                                console.log('用户点击取消')
+                            }
+                        }
+                    })
+                }
+            })
+        });
     },
     onShareAppMessage: function (res) {
         if (res.from === 'button') {
@@ -204,7 +229,7 @@ Page({
     // 去其他用户的作品页
     goToOthers: function (e) {
         wx.navigateTo({
-          url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}`
+            url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}`
         })
     },
     // 查询回复

+ 2 - 2
pages/social/works/works.wxss

@@ -21,7 +21,7 @@
 
 .readAuthorSection .nickName {
     margin-left: 20rpx;
-    width: 160rpx;
+    width: 250rpx;
     height: 46rpx;
     font-size: 32rpx;
     color: #101010;
@@ -32,7 +32,7 @@
     display: flex;
     align-items: center;
     justify-content: center;
-    margin-left: 90rpx;
+    /* margin-left: 90rpx; */
     width: 160rpx;
     height: 60rpx;
     border: 2rpx solid rgba(255, 152, 0, 1);

+ 1 - 1
pages/user/myEdit/myEdit.js

@@ -44,7 +44,7 @@ Page({
     const data = {
       wechatName: e.detail.value.nickname || '',
       mobile: '',
-      gender: 1,
+      gender: e.detail.value.radioGroup1,
       schoolProvince: '',
       schoolCity: '',
       schoolName: e.detail.value.address || '',

+ 1 - 1
pages/user/myWallet/myWallet.js

@@ -33,7 +33,7 @@ Page({
     APIClient.myWallet().success(res => {
       console.log(res.data.data);
       this.setData({
-        totalMoney:res.data.data.income
+        totalMoney:res.data.data.income / 100
       });
     }).fail(err => {
       console.log(err);

+ 0 - 1
pages/user/mycourse/mycourse.js

@@ -37,7 +37,6 @@ Page({
   toCourse: function(e) {
     let productId = e.currentTarget.dataset.productid;
     let productTitle = e.currentTarget.dataset.producttitle;
-    debugger
     wx.navigateTo({
       url: `../../groupPage/grade-details/grade-details?productId=${productId}&title=${productTitle}`
     });

+ 0 - 1
pages/user/myread/myread.js

@@ -104,7 +104,6 @@ Page({
     }
     APIClient.myRead().success(res => {
       console.log(res.data.data.list);
-      debugger;
       this.setData({
         wareCards: res.data.data.list
       });

+ 14 - 0
utils/APIClient.js

@@ -322,4 +322,18 @@ module.exports = {
       uid: wx.getStorageSync('uid')
     }).url(url).send();
   },
+  // 产品鉴权
+  areYouSuper(productArr){
+    let url = getBaseUrl(`wx/groupPurchase/auth`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data(productArr).method('POST').send();
+  },
+  // 找到课程对应的课本
+ checkLesson(lessonId){
+    let url = getProductUrl(`wx/lesson/product/${lessonId}`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  }
 }