Rorschach 6 yıl önce
ebeveyn
işleme
8eae076775

+ 1 - 0
app.json

@@ -2,6 +2,7 @@
   "pages": [
     "pages/index/index",
     "pages/social/works/works",
+    "pages/social/insideMessage/insideMessage",
     "pages/social/replyDetail/replyDetail",
     "pages/main/class/class",
     "pages/main/books/books",

+ 13 - 1
component/group/group.js

@@ -13,7 +13,8 @@ export const groupInit = (that) => {
       listLength: '',
       baseIndex: 0,
       isIOS: app.globalData.isIOS,
-      alertFlag: false
+      alertFlag: false,
+      myGroupGoing: 0
     },
     groupIndex: 1
   })
@@ -45,11 +46,22 @@ export const groupInit = (that) => {
         listLength: res.data.data.totalNo,
         [listLengthStr]: res.data.data.totalNo
       })
+      that.getMyGroupGoing()
     }).fail((error) => {
       console.log('错误', error)
     })
   }
 
+  // 获取我的正在进行中的团
+  that.getMyGroupGoing = function(){
+    httpRequestApi.getMyGroupGoing().success(res=>{
+      console.log(res)
+      const str = 'groupData.myGroupGoing';
+      that.setData({
+        [str]: res.data.count
+      })
+    })
+  },
   //请求数据封装
   that.getGroupList = function () {
     httpRequestApi.getAllBooks(1, 10).success((res) => {

+ 12 - 1
component/group/group.wxml

@@ -25,7 +25,18 @@
             </view>
           </view>
         </block>
-        <view class="change" bindtap="change" wx:if="{{groupData.listLength > 1}}">换一换</view>
+        <view class="btn-area">
+            <view class="btn-item" bindtap='toMyCollage' wx:if="{{groupData.myGroupGoing > 0}}">我的{{groupData.isIOS ? '助力' : '拼团'}}<text class="red-text">({{groupData.myGroupGoing}})</text>
+          <image src="../../static/image/little_firends.png" />
+        </view>
+         <view class="btn-item"  wx:if="{{groupData.myGroupGoing <= 0}}" bindtap="more" data-type="course">
+           开个团试试
+          <image src="../../static/image/little_firends.png" />
+        </view>
+        <view class="btn-item" bindtap="change">换一批看看
+          <image src="../../static/image/refresh.png" />
+        </view>
+        </view>
       </view>
       <view class="title">
         <text class="title-regular left">全部课程</text>

+ 23 - 12
component/group/group.wxss

@@ -107,18 +107,29 @@ scroll-view {
     background: #C6C6C6
 }
 
-.change {
-    width: 146rpx;
-    height: 48rpx;
-    background: #5BB7FD;
-    border-radius: 48rpx;
-    margin: 20rpx auto;
-    text-align: center;
-    line-height: 48rpx;
-    color: #fff;
-    font-size: 28rpx;
+.btn-area {
+    width: 100%;
+    color: #12c962;
+    font-size: 30rpx;
+    font-weight: 800;
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    padding: 27rpx 60rpx;
+    box-sizing: border-box;
+}
+
+.btn-item {
+    /* width: 235rpx; */
+    display: flex;
+    align-items: center;
 }
 
+.btn-item image {
+    width: 30rpx;
+    height: 30rpx;
+    margin-left: 5rpx;
+}
 
 .whole-group {
     width: 100%;
@@ -187,7 +198,7 @@ scroll-view {
     position: relative;
     display: flex;
     margin-right: 35rpx;
-
+    margin-bottom:30px;
     flex-direction: column;
 }
 
@@ -218,7 +229,7 @@ scroll-view {
     text-align: center;
     font-size: 30rpx;
     font-weight: 800;
-    
+
 
 }
 

+ 3 - 2
component/hot/hot.js

@@ -138,10 +138,11 @@ export const hotInit = (that) => {
       const hotStr = 'hotData.hotWorks'
       const myCourseStr = 'hotData.myCourse'
       const unReadMessageNum = 'hotData.unReadMessageNum'
+      console.log(recommendRes)
       that.setData({
         [hotStr]: that.data.hotData.hotWorks,
         [myCourseStr]: recommendRes.myCourse,
-        [unReadMessageNum]: recommendRes.unReadMessageNum
+        [unReadMessageNum]: recommendRes.unreadCount
       })
     })
   }
@@ -175,5 +176,5 @@ export const hotInit = (that) => {
   that.getIndex();
   that.getHotRecommend(that.uid, 1, 3);
   // 获取全部课本
-  that.getBookList();
+  // that.getBookList();
 }

+ 1 - 1
component/hot/hot.wxml

@@ -1,5 +1,5 @@
 <template name="hot">
-    <view class="messageSection" wx:if="{{hotData.unReadMessageNum > 0}}">
+    <view class="messageSection" wx:if="{{hotData.unReadMessageNum > 0}}" bindtap="goToMessage">
         <image class="messageIcon" src="../../static/image/message_icon.png"  />
         <text class="messageText">您有<text class="red-text">{{hotData.unReadMessageNum}}</text>条未读消息【立即查看】</text>
     </view>

+ 1 - 12
component/my/my.js

@@ -50,18 +50,7 @@ export const myInit = (that) => {
         url: `../user/mycollection/mycollection?title=${title}`
       });
     },
-    that.toMyCollage = e => {
-      if(app.globalData.isIOS){
-        wx.navigateTo({
-          url: `../../pages/groupPage/my-group/my-group?title=我的助力`
-        });
-      }else {
-        wx.navigateTo({
-          url: `../../pages/groupPage/my-group/my-group?title=我的拼团`
-        });
-      }
-      
-    },
+
     that.getFollowWorks = (pageNo, pageSize) => {
       APIClient.getFollowWorks(pageNo, pageSize).success(res => {
         console.log(res)

+ 19 - 19
component/share/share.js

@@ -80,12 +80,12 @@ Component({
                   wx.canvasToTempFilePath({
                     x: 0,
                     y: 0,
-                    width: 375,
-                    height: 667,
+                    width: 300,
+                    height: 525,
                     // destWidth: 370,
-                    destWidth: 1500,
+                    destWidth: 1200,
                     // destHeight: 507,
-                    destHeight: 2668,
+                    destHeight: 2100,
                     canvasId: 'myCanvas',
                     success: (res) => {
                       console.log(res.tempFilePath)
@@ -264,9 +264,9 @@ Component({
           mask: true
         })
         if (this.data.shareType === 'works') {
-          ctx.drawImage('../../../static/image/works_poster.jpg', 0, 0, 1500, 2668, 0, 0, 750, 1334); //插入图片  
+          ctx.drawImage('../../../static/image/works_poster.jpg', 0, 0, 1200, 2100, 0, 0, 600, 1050); //插入图片  
         } else {
-          ctx.drawImage('../../../static/image/group_poster.jpg', 0, 0, 1500, 2668, 0, 0, 750, 1334); //插入图片  
+          ctx.drawImage('../../../static/image/group_poster.jpg', 0, 0, 1200, 2100, 0, 0, 600, 1050); //插入图片  
         }
         ctx.save()
         ctx.beginPath()
@@ -286,14 +286,14 @@ Component({
           ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
           ctx.setFontSize(18)
           ctx.setFillStyle('#444444')
-          ctx.fillText(this.data.author, (375 - ctx.measureText(this.data.author).width) / 2, 232)
+          ctx.fillText(this.data.author, (300 - ctx.measureText(this.data.author).width) / 2, 232)
           ctx.setFontSize(16)
           ctx.setFillStyle('#ff9209')
-          ctx.fillText('播音主持特长生', (375 - ctx.measureText('播音主持特长生').width) / 2, 253)
+          ctx.fillText('播音主持特长生', (300 - ctx.measureText('播音主持特长生').width) / 2, 253)
         } else {
           ctx.arc(52, 58, 36, 0, 2 * Math.PI, false)
           ctx.clip(); //剪切头像区域
-          ctx.fill('red')
+          ctx.fill('ff6f42')
           ctx.drawImage(this.data.avatar, 16, 22, 72, 72); //插入图片  
           ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
           ctx.setFontSize(20)
@@ -313,16 +313,16 @@ Component({
         console.log('开始画内容')
         ctx.setFillStyle('#fff')
         ctx.setFontSize(18)
-        ctx.fillText('小学语文 最新全国统一教材', (375 - ctx.measureText('小学语文 最新全国统一教材').width) / 2, 55);
+        ctx.fillText('小学语文 最新全国统一教材', (300 - ctx.measureText('小学语文 最新全国统一教材').width) / 2, 55);
         ctx.setFontSize(30)
-        ctx.fillText('课文朗读 从未如此有趣', (375 - ctx.measureText('课文朗读 从未如此有趣').width) / 2, 103);
+        ctx.fillText('课文朗读 从未如此有趣', (300 - ctx.measureText('课文朗读 从未如此有趣').width) / 2, 103);
         ctx.setFontSize(16)
         ctx.setFillStyle('#444')
-        ctx.fillText('使出洪荒之力,声情并茂地朗诵了', (375 - ctx.measureText('使出洪荒之力,声情并茂地朗诵了').width) / 2, 297)
+        ctx.fillText('使出洪荒之力,声情并茂地朗诵了', (300 - ctx.measureText('使出洪荒之力,声情并茂地朗诵了').width) / 2, 297)
         // ctx.fillText(`配了一段惊世之作`,  90, 240)
         // ctx.setFontSize(16)
         // ctx.setFillStyle('red')
-        ctx.fillText(`《${this.data.title}》`, (375 - ctx.measureText(`《${this.data.title}》`).width) / 2, 322)
+        ctx.fillText(`《${this.data.title}》`, (300 - ctx.measureText(`《${this.data.title}》`).width) / 2, 322)
 
         ctx.setFontSize(16)
         ctx.setFillStyle('#000')
@@ -330,10 +330,10 @@ Component({
         ctx.setFontSize(16)
         // ctx.setFillStyle('#c90000')
         ctx.setFillStyle('#ff9209')
-        ctx.fillText('为TA疯狂打CALL 快去听听', (375 - ctx.measureText('为TA疯狂打CALL 快去听听').width) / 2, 401)
+        ctx.fillText('为TA疯狂打CALL 快去听听', (300 - ctx.measureText('为TA疯狂打CALL 快去听听').width) / 2, 401)
         ctx.setFontSize(12)
         ctx.setFillStyle('#666666')
-        ctx.fillText('长按识别二维码', (375 - ctx.measureText('长按识别二维码').width) / 2, 574)
+        ctx.fillText('长按识别二维码', (300 - ctx.measureText('长按识别二维码').width) / 2, 574)
         // })
         resolve();
       })
@@ -345,10 +345,10 @@ Component({
       let group = new Promise((resolve, reject) => {
         ctx.setFontSize(28)
         ctx.setFillStyle('#ff670d')
-        ctx.fillText('小学语文 朗读配音', (375 - ctx.measureText('小学语文 朗读配音').width) / 2, 152)
+        ctx.fillText('小学语文 朗读配音', (300 - ctx.measureText('小学语文 朗读配音').width) / 2, 152)
         ctx.setFontSize(16)
         ctx.setFillStyle('#444')
-        ctx.fillText('朗朗读书声,是世上最美的声音', (375 - ctx.measureText('朗朗读书声,是世上最美的声音').width) / 2, 351)
+        ctx.fillText('朗朗读书声,是世上最美的声音', (300 - ctx.measureText('朗朗读书声,是世上最美的声音').width) / 2, 351)
         // if (this.data.groupPurchaseInfo.productId === 1) {
           ctx.drawImage(this.data.iconImg, 12, 176, 351, 145);
         // }
@@ -362,7 +362,7 @@ Component({
         console.log(this.data.groupType)
         if(this.data.groupType === 'IOS'){
           ctx.setFillStyle('#ff670d')
-          ctx.fillText(`助力成功,您还可以获得本课程7天VIP`, (375 - ctx.measureText('助力成功,您还可以获得本课程7天VIP').width) / 2, 412)
+          ctx.fillText(`助力成功,您还可以获得本课程7天VIP`, (300 - ctx.measureText('助力成功,您还可以获得本课程7天VIP').width) / 2, 412)
 
           
         } else {
@@ -379,7 +379,7 @@ Component({
       
         ctx.setFontSize(12)
         ctx.setFillStyle('#666666')
-        ctx.fillText('长按识别二维码', (375 - ctx.measureText('长按识别二维码').width) / 2, 574)
+        ctx.fillText('长按识别二维码', (300 - ctx.measureText('长按识别二维码').width) / 2, 574)
         //})
         resolve();
       })

+ 1 - 1
pages/groupPage/collage-details/collage-details.wxml

@@ -120,7 +120,7 @@
         </view>
     </view>
 </view>
-<canvas canvas-id="myCanvas" style="width:375px; height: 668px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
+<canvas canvas-id="myCanvas" style="width:600rpx; height: 1050rpx; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
 <shareDialog id="share-dialog" shareType='group' shareId="{{orderId}}" />
 <popup typeOf="sendSuccess" title="报告团长" headTextTwo='您发起的团购已经成立,订单号:{{orderId}}' content="{{content}}"></popup>
 <goBackHome id="goBackHome" shareType="{{goBackHome}}" wx:if="{{goBackHome}}" />

+ 24 - 4
pages/groupPage/group-details/group-details.js

@@ -60,7 +60,7 @@ Page({
     knowFlag: true,
     menuFlag: false,
     ifGroupSuccessed: false,
-    groupOSType:'IOS',
+    groupOSType: 'IOS',
     hideBottomBtn: true
   },
   //tab切换
@@ -188,11 +188,31 @@ Page({
   getGroupInfo: function (orderId) {
     httpRequestApi.getMygroupInfo(orderId).success(res => {
       const groupOrder = res.data.data.groupPurchaseOrder;
+      // 团员进入collage页面
+      const myUid = wx.getStorageSync('uid');
+      if (myUid === groupOrder.organizer) {
+        wx.redirectTo({
+          url: `../collage-details/collage-details?orderId=${orderId}&goBackHome=${this.data.goBackHome}`
+        })
+        return;
+      }
+      res.data.data.joinUserList.forEach(item => {
+        if (item.uid === myUid) {
+          wx.redirectTo({
+            url: `../collage-details/collage-details?orderId=${groupId}&goBackHome=${this.data.goBackHome}`
+          })
+          return;
+        }
+      })
+
+
+
       const surplusNum = groupOrder.headcount - groupOrder.joinCount;
       this.setData({
         organizerUid: groupOrder.organizer,
         ifGroupSuccessed: groupOrder.status === 'SUCCESSED' ? true : false
       })
+
       for (var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }
@@ -315,14 +335,14 @@ Page({
     });
   },
   // 页面滚动
-  pageScroll: function(e){
+  pageScroll: function (e) {
     console.log(e.target.offsetTop)
-    if(e.target.offsetTop < 600){
+    if (e.target.offsetTop < 600) {
       this.setData({
         hideBottomBtn: true
       })
     }
-    if(e.target.offsetTop > 600){
+    if (e.target.offsetTop > 600) {
       this.setData({
         hideBottomBtn: false
       })

+ 33 - 12
pages/index/index.js

@@ -218,18 +218,39 @@ Page({
     },1500);
   },
   // 获取全部课本
-  getBookList: function () {
-    httpRequestApi.getAllBooks(1, 10).success((res) => {
-      this.data.bookList = res.data.data.list;
-      res.data.data.list.forEach(element => {
-        this.data.selectFlag.push(true);
-      });
-      this.setData({
-        bookList: this.data.bookList
-      })
-    }).fail((error) => {
-      console.log('错误', error)
+  // getBookList: function () {
+  //   httpRequestApi.getAllBooks(1, 10).success((res) => {
+  //     this.data.bookList = res.data.data.list;
+  //     res.data.data.list.forEach(element => {
+  //       this.data.selectFlag.push(true);
+  //     });
+  //     this.setData({
+  //       bookList: this.data.bookList
+  //     })
+  //   }).fail((error) => {
+  //     console.log('错误', error)
+  //   })
+  // },
+  goToMessage: function(){
+    wx.navigateTo({
+      url: `../../pages/social/insideMessage/insideMessage`
+    });
+    const str = 'hotData.unReadMessageNum';
+    this.setData({
+      [str]: 0
     })
-  }
+  },
+  toMyCollage: function(e){
+    if(app.globalData.isIOS){
+      wx.navigateTo({
+        url: `../../pages/groupPage/my-group/my-group?title=我的助力`
+      });
+    }else {
+      wx.navigateTo({
+        url: `../../pages/groupPage/my-group/my-group?title=我的拼团`
+      });
+    }
+    
+  },
 
 })

+ 4 - 1
pages/main/books/books.wxss

@@ -1,7 +1,8 @@
 .allBooks {
-    margin-top: 44rpx;
+    /* margin-top: 44rpx; */
     display: flex;
     flex-direction: row;
+    flex-wrap: wrap;
 }
 .book{
     width: 214rpx;
@@ -9,6 +10,8 @@
     text-align: center;
     flex-direction: column;
     margin-left: 28rpx;
+    margin-top:44rpx;
+
 }
 .book image{
     display: block;

+ 28 - 0
pages/social/insideMessage/insideMessage.js

@@ -0,0 +1,28 @@
+import httpRequestApi from '../../../utils/APIClient';
+import {
+    formatDate
+} from '../../../utils/util';
+Page({
+    data: {
+        messageList: []
+    },
+    onLoad: function (options) {
+        wx.setNavigationBarTitle({
+            title: '消息列表'
+        })
+        httpRequestApi.getMessageList(1, 10).success((res) => {
+            res.data.data.list.forEach( item => {
+                item.gmtCreated = formatDate(item.gmtCreated,1)
+            })
+            this.setData({
+                messageList: res.data.data.list
+            })
+            httpRequestApi.refreshMessageStatus().success((res)=>{
+                console.log(res)
+            })
+        });
+    },
+    // onHide: function(){
+        
+    // }
+})

+ 3 - 0
pages/social/insideMessage/insideMessage.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 6 - 0
pages/social/insideMessage/insideMessage.wxml

@@ -0,0 +1,6 @@
+<view class="message-view">
+    <view class="message-box" wx:for="{{messageList}}" wx:key="{{index}}">
+        <view class="message-time">{{item.gmtCreated}}</view>
+        <view class="message-text">{{item.content}}</view>
+    </view>
+</view>

+ 35 - 0
pages/social/insideMessage/insideMessage.wxss

@@ -0,0 +1,35 @@
+.message-view{
+    width: 100%;
+    min-height: 100%;
+    background: #f0eff2;
+    padding-top: 19rpx;
+}
+
+.message-box{
+    width: 100%;
+    margin-bottom: 19rpx;
+}
+.message-time{
+    color: #fff;
+    font-size: 24rpx;
+    background: #cccbce;
+    width: 310rpx;
+    height: 36rpx;
+    line-height: 36rpx;
+    margin: 0 auto;
+    text-align: center;
+    border-radius: 18rpx;
+    
+}
+.message-text{
+    color: #464646;
+    font-weight: 800;
+    font-size: 24rpx;
+    width: 704rpx;
+    min-height: 80rpx;
+    margin: 20rpx auto;
+    background: #fff;
+    border-radius: 20rpx;
+    padding: 20rpx;
+    box-sizing: border-box;
+}

BIN
static/image/group_poster.jpg


BIN
static/image/little_firends.png


BIN
static/image/refresh.png


+ 24 - 0
utils/APIClient.js

@@ -395,4 +395,28 @@ module.exports = {
       pageSize: pageSize
     }).url(url).send();
   },
+  // 获取站内消息列表
+  getMessageList(pageNo, pageSize) {
+    let url = getBaseUrl('wx/message');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).url(url).send();
+  },
+  // 更新消息状态
+  refreshMessageStatus(){
+    let url = getBaseUrl('wx/message');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).method('PUT').send();
+  },
+  // 获取正在进行中的团数量
+  getMyGroupGoing(){
+    let url = getBaseUrl('wx/groupPurchase/underway');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  }
 }