Rorschach 6 gadi atpakaļ
vecāks
revīzija
fb9422634b
41 mainītis faili ar 541 papildinājumiem un 155 dzēšanām
  1. 4 4
      app.json
  2. 1 1
      component/group/group.js
  3. 1 0
      component/group/group.wxml
  4. 36 0
      component/share-dialog/share-dialog.js
  5. 4 0
      component/share-dialog/share-dialog.json
  6. 16 0
      component/share-dialog/share-dialog.wxml
  7. 42 0
      component/share-dialog/share-dialog.wxss
  8. 8 10
      pages/group-details/group-details.js
  9. 6 0
      pages/groupPage/collage-details/collage-details.json
  10. 77 0
      pages/groupPage/collage-details/collage-details.wxml
  11. 75 95
      pages/group-details/group-details.wxss
  12. 2 2
      pages/discount-group/discount-group.js
  13. 0 0
      pages/groupPage/discount-group/discount-group.json
  14. 0 0
      pages/groupPage/discount-group/discount-group.wxml
  15. 0 0
      pages/groupPage/discount-group/discount-group.wxss
  16. 0 0
      pages/groupPage/grade-details/grade-details.js
  17. 0 0
      pages/groupPage/grade-details/grade-details.json
  18. 3 3
      pages/grade-details/grade-details.wxml
  19. 0 0
      pages/groupPage/grade-details/grade-details.wxss
  20. 104 0
      pages/groupPage/group-details/group-details.js
  21. 0 0
      pages/groupPage/group-details/group-details.json
  22. 12 12
      pages/group-details/group-details.wxml
  23. 0 0
      pages/groupPage/group-details/group-details.wxss
  24. 17 25
      pages/index/index.js
  25. 8 2
      project.config.json
  26. BIN
      static/groupImg/Bitmap.png
  27. BIN
      static/groupImg/Bitmap1.png
  28. BIN
      static/groupImg/Combined Shape.png
  29. BIN
      static/groupImg/Group 5 Copy 7.png
  30. BIN
      static/groupImg/Invitation.png
  31. BIN
      static/groupImg/Rectangle 41.png
  32. BIN
      static/groupImg/circle.png
  33. BIN
      static/groupImg/rule1.png
  34. BIN
      static/groupImg/rule2.png
  35. BIN
      static/groupImg/share.png
  36. BIN
      static/groupImg/step.png
  37. BIN
      static/groupImg/weixin.png
  38. BIN
      static/groupImg/保存.png
  39. BIN
      static/groupImg/团长.png
  40. 24 1
      utils/APIClient.js
  41. 101 0
      utils/httpUtil.js

+ 4 - 4
app.json

@@ -8,10 +8,10 @@
     "pages/main/singleBook/singleBook",
     "pages/main/reading/reading",
     "pages/user/myEdit/myEdit",
-    "pages/discount-group/discount-group",
-    "pages/main/searchResult/searchResult",
-    "pages/group-details/group-details",
-    "pages/grade-details/grade-details"
+    "pages/groupPage/discount-group/discount-group",
+    "pages/groupPage/group-details/group-details",
+    "pages/groupPage/grade-details/grade-details",
+    "pages/groupPage/collage-details/collage-details"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 1 - 1
component/group/group.js

@@ -7,7 +7,7 @@ export const groupInit = (that) => {
   //请求数据封装
   that.more = function () {
     wx.navigateTo({
-      url: '/pages/discount-group/discount-group'
+      url: '/pages/groupPage/discount-group/discount-group'
     })
     wx.setNavigationBarTitle({
       title: '限量优惠团购'

+ 1 - 0
component/group/group.wxml

@@ -80,4 +80,5 @@
       </view>
     </view>
   </view>
+  <button open-type="getUserInfo">授权</button>
 </template>

+ 36 - 0
component/share-dialog/share-dialog.js

@@ -0,0 +1,36 @@
+// component/shar-dialog/shar-dialog.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    poster: function () {
+      const ctx = wx.createCanvasContext('myCanvas');
+      ctx.setFontSize(20)
+      ctx.fillText('喔喔', 93, 49)
+      ctx.setFillStyle('#FF4400')
+      ctx.fillText('郎朗读书声是世上最美的声音', 92, 76) 
+      ctx.save()
+      ctx.arc(48, 53, 37, 0, 2 * Math.PI, false)
+      ctx.clip();//画了圆 再剪切  原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内  
+      ctx.drawImage('../../../static/groupImg/Bitmap1.png', 10, 10, 100, 100);   //插入图片  
+      ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
+      ctx.drawImage('../../../static/groupImg/Bitmap1.png', 9, 103, 352, 145);  
+      ctx.draw()
+    }
+  }
+})

+ 4 - 0
component/share-dialog/share-dialog.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 16 - 0
component/share-dialog/share-dialog.wxml

@@ -0,0 +1,16 @@
+<!--component/shar-dialog/shar-dialog.wxml-->
+<view class="share">
+   <view class="btn">
+       <image class="bg" src="../../static/groupImg/share.png"></image>
+       <view class="share-btn">
+           <view class="share-friend">
+               <image  src="../../static/groupImg/weixin.png"></image>
+               <text>发送给群/好友</text>
+           </view>
+           <view class="share-circle" bindtap="poster">
+               <image  src="../../static/groupImg/circle.png"></image>
+               <text>发朋友圈</text>
+           </view>           
+       </view>
+   </view>
+</view>

+ 42 - 0
component/share-dialog/share-dialog.wxss

@@ -0,0 +1,42 @@
+/* component/shar-dialog/shar-dialog.wxss */
+.share {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, .3);
+    z-index: 99;
+}
+
+.btn {
+    position: absolute;
+    bottom: 0;
+    width: 100%;
+    height: 290rpx;
+    background: #fff;
+}
+
+.btn .bg {
+    width: 90%;
+    margin: 46rpx 5%;
+    height: 42rpx;
+}
+
+.share-btn {
+    display: flex;
+    justify-content: space-around;
+}
+
+.share-btn image {
+    width: 66rpx;
+    height: 66rpx;
+}
+
+.share-btn view {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    font-size: 32rpx;
+}

+ 8 - 10
pages/group-details/group-details.js

@@ -1,21 +1,19 @@
-// pages/group-details/group-details.js
+// pages/groupPage/collage-details/collage-details.js
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    hideFlag: true,
+    hideFlag: true
   },
-  //跳转到年级
-  gradeDetails: function () {
-    wx.navigateTo({
-      url: '/pages/grade-details/grade-details'
+
+  //规则页显示和隐藏
+  hide: function () {
+    this.setData({
+      hideFlag: !this.data.hideFlag
     })
-    // wx.setNavigationBarTitle({
-    //   title: '限量优惠团购'
-    // })
-  
   },
   /**
    * 生命周期函数--监听页面加载

+ 6 - 0
pages/groupPage/collage-details/collage-details.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "sharDialog": "/component/share-dialog/share-dialog"
+    }
+  }

+ 77 - 0
pages/groupPage/collage-details/collage-details.wxml

@@ -0,0 +1,77 @@
+<!--pages/groupPage/collage-details/collage-details.wxml-->
+<view class="collage-details">
+    <view class="step">
+        <image src="../../../static/groupImg/step.png"></image>
+        <view class="txt">
+            <text>1.支付成功</text>
+            <text>2.邀请朋友参加</text>
+            <text>3.去朗读</text>
+        </view>
+    </view>
+    <view class="details-head">
+        <view class="headImg">
+            <view class="headImg-item">
+                
+            </view>
+            <view class="headImg-item">
+ 
+            </view>
+            <view class="headImg-item">
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
+            </view>
+            <view class="headImg-item">
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
+            </view>  
+            <view class="headImg-item">
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
+            </view>
+            <view class="headImg-item">
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
+            </view>                      
+        </view>
+        <view class="shengyu">
+            <view class="shengyu-num">仅剩<text>3</text>个名额就拼团成功了</view>
+            <view class="shengyu-time">
+                剩余时间:
+                <view class="time">
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <text>1</text>
+                </view>
+                天
+                <view class="time">
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <text>1</text>
+                </view>
+                <view class="time">
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <text>1</text>
+                </view> 
+                时             
+                <view class="time">
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <text>1</text>
+                </view>
+                <view class="time">
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <text>1</text>
+                </view>                
+                分             
+            </view>
+        </view>
+        <view class="invitation-btn" bindtap="hideFlag">
+            <image src="../../../static/groupImg/Invitation.png"></image>
+            <text>邀请朋友参加</text>
+        </view>
+    </view>  
+    <view class="rule" style="{{hideFlag ? 'right' : 'left'}}: 0" bindtap="hide">
+        <image src="../../../static/groupImg/rule{{hideFlag ? '1' : '2'}}.png"></image>
+        <text>拼团规则</text>        
+    </view>  
+    <view class="explain" hidden="{{hideFlag}}">
+        <text>拼团规则</text>
+        * 转发给自己的朋友们,分享好课, 追随您一起学习进步。您的魅力不是吹的! * 在限定时间内内成功拼团,您将得到xx元的奖励金哦。 * 如果拼团失败,您预付的课程费将在48小时内退回您的账户。
+    </view>
+</view> 
+<canvas canvas-id="myCanvas" style="width:100%; height: 100%;"></canvas>
+<sharDialog/>
+

+ 75 - 95
pages/group-details/group-details.wxss

@@ -1,12 +1,38 @@
-/* pages/group-details/group-details.wxss */
-.group-details {
+/* pages/groupPage/collage-details/collage-details.wxss */
+.collage-details {
     height: 100%;
     width: 100%;
     background:rgba(240,241,245,1);    
 }
 
+.step {
+    width: 100%;
+    height: 250rpx;
+    background: #fff;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+}
+
+.step image {
+    height: 60rpx;
+    width: 70%;
+    margin: 0 auto;
+}
+
+.txt {
+    display: flex;
+    justify-content: space-around;
+    color: #535353;
+    font-size: 32rpx;
+    padding: 0 46rpx;
+    margin-top: 20rpx;
+}
+
 .details-head {
     width: 100%;
+    height: 78%;
+    margin-top: 12rpx;
     background: #fff;
 }
 
@@ -75,119 +101,73 @@
     font-size: 28rpx;
 }
 
-scroll-view {
-    height: 59%;
-    width: 100%;
-}
-
-.grade-details {
-    margin: 12rpx 0;
-    background: #fff;
-    display: flex;
-    flex-direction: column;
-    padding: 24rpx;
-}
-
-.grade-details image{
-    width: 100%;
-    height: 290rpx;
-    border-radius: 20rpx;
-}
-
-.grade-details text {
-    font-size: 32rpx;
-}
-
-.grade-details text:nth-child(2) {
-    margin: 12rpx 0;
-}
-
-.catalog {
-    width: 100%;
-    height: 62rpx;
-    background: #fff;
-    position: relative;
+.invitation-btn {
+    position: absolute;
+    left: 50%;
+    top: 65%;
+    transform: translate(-50%);
+    width: 434rpx;
+    height: 80rpx;
 }
 
-.catalog image {
+.invitation-btn image{
     position: absolute;
-    left: 24rpx;
-    top: 10rpx;
-    width: 208rpx;
-    height: 42rpx;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
 }
 
-.catalog text {
+.invitation-btn text{
     position: absolute;
-    left: 34rpx;
-    top: 7rpx;
+    width: 100%;
+    height: 100%;
+    display: inline-block;
+    text-align: center;
+    line-height: 80rpx;
     z-index: 2;
     color: #fff;
-    font-size: 36rpx;
-}
-
-.catalog-list {
-    width: 100%;
-    padding: 18rpx;
-    box-sizing: border-box;
 }
 
-.catalog-item {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    width: 100%;
+.rule {
+    position: fixed;
+    right: 0;
+    top: 82%;
+    width: 84rpx;
     height: 88rpx;
-    background: #fff;
-    padding: 0 20rpx;
-    box-sizing: border-box;
-    margin-bottom: 12rpx;
-    border-radius: 10rpx;
-}
-
-.catalog-item .left {
-    color: #656565;
-    font-size: 36rpx;
+    z-index:2;    
 }
 
-.catalog-item .right {
-    color: #939393;
-    font-size: 28rpx;
-}
-
-.group-details-btn {
+.rule image {
     position: absolute;
-    bottom: 0;
-    display: flex;
+    left: 0;
+    top: 0;
     width: 100%;
-    height: 102rpx;
-}
-
-.left-btn {
-    width: 35%;
     height: 100%;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    background: #F0F1F5;
 }
 
-.right-btn {
-    width: 65%;
-}
-
-.right-btn image{
+.rule text {
     position: absolute;
-    right: 0;
-    top: 0;
-    width: 65%;
-    height: 100%;
+    left: 30rpx;
+    top: 10rpx;
+    font-size: 24rpx;
+    color: #fff;
+    z-index: 2;
 }
 
-.right-btn text{
+.explain {
     position: absolute;
-    width: 65%;
-    color: #fff;
-    text-align: center;
-    line-height: 102rpx;
+    top: 73%;
+    left: 11%;
+    background: #61CA54;
+    padding: 20rpx;
+    color: #000;
+    font-size: 32rpx;
+    width: 668rpx;
+    box-sizing: border-box;
+} 
+
+.explain text {
+    display: block;
+    font-size: 36rpx;
 }

+ 2 - 2
pages/discount-group/discount-group.js

@@ -1,4 +1,4 @@
-// pages/discount-group/discount-group.js
+// pages/groupPage//discount-group/discount-group.js
 Page({
 
   /**
@@ -11,7 +11,7 @@ Page({
 //点击跳转到团购详情
 groupDetails:function () {
   wx.navigateTo({
-    url: '/pages/group-details/group-details'
+    url: '/pages/groupPage/group-details/group-details'
   })
   wx.setNavigationBarTitle({
     title: '拼团详情'

pages/discount-group/discount-group.json → pages/groupPage/discount-group/discount-group.json


pages/discount-group/discount-group.wxml → pages/groupPage/discount-group/discount-group.wxml


pages/discount-group/discount-group.wxss → pages/groupPage/discount-group/discount-group.wxss


pages/grade-details/grade-details.js → pages/groupPage/grade-details/grade-details.js


pages/grade-details/grade-details.json → pages/groupPage/grade-details/grade-details.json


+ 3 - 3
pages/grade-details/grade-details.wxml

@@ -7,7 +7,7 @@
             <text>《语文一年级上册》为人教社2016年修订的教材,包括“我上学了识字汉语拼音课文口语交际语文园地”和“快乐读吧供一年级上学期使用。</text>
         </view>
         <view class="catalog">
-            <image src="../../static/groupImg/Rectangle 34@2x.png"></image>
+            <image src="../../../static/groupImg/Rectangle 34@2x.png"></image>
             <text>语文目录</text>
         </view>
         <view class="catalog-list">
@@ -26,8 +26,8 @@
         </view>
     </scroll-view>
     <view class="group-btn">
-        <image class="bg1" src="../../static/groupImg/Rectangle 9.png"></image>
-        <image class="bg2" src="../../static/groupImg/Rectangle 9.png"></image>
+        <image class="bg1" src="../../../static/groupImg/Rectangle 9.png"></image>
+        <image class="bg2" src="../../../static/groupImg/Rectangle 9.png"></image>
         <view class="Price">
             <text>¥99</text>
             <text>单人团</text>

pages/grade-details/grade-details.wxss → pages/groupPage/grade-details/grade-details.wxss


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

@@ -0,0 +1,104 @@
+// pages/group-details/group-details.js
+import httpRequestApi from '../../../utils/APIClient';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+  //跳转到年级
+  gradeDetails: function () {
+    wx.navigateTo({
+      url: '/pages/groupPage/grade-details/grade-details'
+    })
+    // wx.setNavigationBarTitle({
+    //   title: '限量优惠团购'
+    // })
+  
+  },
+  //跳转到拼团详情
+  collage: function () {
+    wx.navigateTo({
+      url: '/pages/groupPage/collage-details/collage-details'
+    })
+    wx.setNavigationBarTitle({
+      title: '拼团详情'
+    })
+  
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    httpRequestApi.getGroupPurchaseInfo(1).success( (res) =>{
+      console.log(res);
+    }).fail( (error) => {
+
+    })
+    httpRequestApi.SendGroupPurchas({
+      "productId": "1",
+      "groupId": "1"
+    }).success( (res) =>{
+
+    }).fail( (error) => {
+      
+    })
+    httpRequestApi.JoinGroupPurchas('1541386476732288').success( (res) =>{
+
+    }).fail( (error) => {
+      
+    })
+    
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

pages/group-details/group-details.json → pages/groupPage/group-details/group-details.json


+ 12 - 12
pages/group-details/group-details.wxml

@@ -1,6 +1,6 @@
 <!--pages/group-details/group-details.wxml-->
 <view class="group-details">
-    <view class="details-head">
+    <view class="details-head" bindtap="collage">
         <view class="headImg">
             <view class="headImg-item">
                 
@@ -9,16 +9,16 @@
  
             </view>
             <view class="headImg-item">
-                <image src="../../static/groupImg/Mask Copy@2x.png"></image>
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
             </view>
             <view class="headImg-item">
-                <image src="../../static/groupImg/Mask Copy@2x.png"></image>
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
             </view>  
             <view class="headImg-item">
-                <image src="../../static/groupImg/Mask Copy@2x.png"></image>
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
             </view>
             <view class="headImg-item">
-                <image src="../../static/groupImg/Mask Copy@2x.png"></image>
+                <image src="../../../static/groupImg/Mask Copy@2x.png"></image>
             </view>                      
         </view>
         <view class="shengyu">
@@ -26,25 +26,25 @@
             <view class="shengyu-time">
                 剩余时间:
                 <view class="time">
-                    <image src="../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
                     <text>1</text>
                 </view>
                 <view class="time">
-                    <image src="../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
                     <text>1</text>
                 </view>
                 <view class="time">
-                    <image src="../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
                     <text>1</text>
                 </view> 
                 <view class="time">
-                    <image src="../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
                     <text>1</text>
                 </view>
                 <view class="time">
-                    <image src="../../static/groupImg/Rectangle 31@2x.png"></image>
+                    <image src="../../../static/groupImg/Rectangle 31@2x.png"></image>
                     <text>1</text>
                 </view>                
@@ -58,7 +58,7 @@
             <text>《语文一年级上册》为人教社2016年修订的教材,包括“我上学了识字汉语拼音课文口语交际语文园地”和“快乐读吧供一年级上学期使用。</text>
         </view>
         <view class="catalog">
-            <image src="../../static/groupImg/Rectangle 34@2x.png"></image>
+            <image src="../../../static/groupImg/Rectangle 34@2x.png"></image>
             <text>语文目录</text>
         </view>
         <view class="catalog-list">
@@ -81,7 +81,7 @@
             开团
         </view>
         <view class="right-btn">
-            <image src="../../static/groupImg/Rectangle 8 Copy@2x.png"></image>
+            <image src="../../../static/groupImg/Rectangle 8 Copy@2x.png"></image>
             <text>参团</text>
         </view>
     </view>

pages/group-details/group-details.wxss → pages/groupPage/group-details/group-details.wxss


+ 17 - 25
pages/index/index.js

@@ -6,21 +6,13 @@ import {
 } from '../../utils/httpUtill';
 const app = getApp()
 
-import {
-  hotInit
-} from '../../component/hot/hot';
-import {
-  groupInit
-} from '../../component/group/group';
-import {
-  myInit
-} from '../../component/my/my';
-import {
-  followInit
-} from '../../component/follow/follow';
+import {  hotInit } from '../../component/hot/hot';
+import {  groupInit} from '../../component/group/group';
+import { myInit } from '../../component/my/my';
+import { followInit} from '../../component/follow/follow';
 // import '../../utils/hls';
 // import httpRequestApi from '../../utils/APIRequest';
-// import httputil from '../../utils/httputil';
+import httputil from '../../utils/httpUtil';
 Page({
   data: {
     tab: [{
@@ -91,17 +83,17 @@ Page({
   },
   //初始化数据
   init: function () {
-    // httputil.getOpenidSessionKey((res) => {
-    //   console.log('微信的用户信息', res);
-    //   this.setData({
-    //     jurisdictionFlag: true
-    //   })
-    //   lookInit(this);
-    // },(error) => {
-    //   console.log(error);
-    //   this.setData({
-    //     jurisdictionFlag: false
-    //   })
-    // });
+    httputil.getOpenidSessionKey((res) => {
+      console.log('微信的用户信息', res);
+      // this.setData({
+      //   jurisdictionFlag: true
+      // })
+      // lookInit(this);
+    }, (error) => {
+      // console.log(error);
+      // this.setData({
+      //   jurisdictionFlag: false
+      // })
+    });
   }
 })

+ 8 - 2
project.config.json

@@ -36,7 +36,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 3,
+			"current": 4,
 			"list": [
 				{
 					"id": 0,
@@ -59,7 +59,13 @@
 				{
 					"id": -1,
 					"name": "课程详情",
-					"pathName": "pages/grade-details/grade-details"
+					"pathName": "pages/grade-details/grade-details",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "团购",
+					"pathName": "pages/groupPage/collage-details/collage-details"
 				}
 			]
 		}

BIN
static/groupImg/Bitmap.png


BIN
static/groupImg/Bitmap1.png


BIN
static/groupImg/Combined Shape.png


BIN
static/groupImg/Group 5 Copy 7.png


BIN
static/groupImg/Invitation.png


BIN
static/groupImg/Rectangle 41.png


BIN
static/groupImg/circle.png


BIN
static/groupImg/rule1.png


BIN
static/groupImg/rule2.png


BIN
static/groupImg/share.png


BIN
static/groupImg/step.png


BIN
static/groupImg/weixin.png


BIN
static/groupImg/保存.png


BIN
static/groupImg/团长.png


+ 24 - 1
utils/APIClient.js

@@ -2,7 +2,7 @@ var constant = require('const.js');
 const HOST_PRODUCT = constant.productApi;
 const HOST_BASE = constant.baseApi;
 let request = require('WXHttpRequest.js');
-const httputil = require('httpUtill.js');
+const httputil = require('httpUtil.js');
 
 function getProductUrl(action) {
 	return HOST_PRODUCT + action;
@@ -135,4 +135,27 @@ module.exports = {
 			uid
 		}).url(url).data(data).method('POST').send();
 	},
+	// 获取课程团购信息
+	getGroupPurchaseInfo (productId) {
+		let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
+		return request.getInstance().header({
+			uid: 1
+		}).url(url).send();
+	},
+	// 发起团购
+	SendGroupPurchas (data) {
+		let url = getBaseUrl(`wx/groupPurchase/create`);
+		return request.getInstance().header({
+			uid: 1
+		}).url(url).data(data).method('POST').send();
+	},
+	// 参加团购
+	JoinGroupPurchas (orderId) {
+		let url = getBaseUrl(`wx/groupPurchase/join`);
+		return request.getInstance().header({
+			uid: 1
+		}).url(url).data({
+			orderId
+		}).method('POST').send();
+	}
 }

+ 101 - 0
utils/httpUtil.js

@@ -0,0 +1,101 @@
+const request = require('./WXHttpRequest.js');
+const url = require('./const.js');
+const util = require('./util.js');
+
+const HOST = url.baseApi;
+
+
+function genAPIUrl(action) {
+	return HOST + action;
+}
+
+// 登录
+function wxLogin(successcallback, failcallback) {
+    wx.showToast({
+        title: '登录中...',
+        icon: 'loading',
+        duration: 1500
+    })
+    wx.login({  
+        success: function(res) {
+            if (res.code) {
+                // 获取openid
+                 let url = genAPIUrl('wx/openId')
+                 let data = { code: res.code }
+                 return request.getInstance().url(url).data(data).send().success(successcallback).fail(failcallback);
+            } else {
+                console.log('获取用户登录态失败!' + res.errMsg)
+            }
+        }
+    })
+}
+
+// 获取原来的 openid 和 session_key
+function getOpenidSessionKey(successcallback, failcallback) {
+    if (wx.getStorageSync('user')) {
+      successcallback(
+        wx.getStorageSync('user'),
+        //分享小程序按钮
+        wx.showShareMenu({
+          withShareTicket: true
+        })
+      );
+      return;
+    }
+    wxLogin(function(res) {
+      if(res.data.code == 200){
+          console.log(res);
+        // let sessionKey = res.data.data.session_key;
+        // let openId = res.data.data.openid;
+        // getLoginSchedule(sessionKey, openId, successcallback, failcallback);
+      }
+
+    },function(res) {
+        failcallback(res);
+    })    
+}
+
+
+//获取用户信息和登录
+function getLoginSchedule(sessionKey, successcallback, failcallback) {
+    wx.getSetting({
+        success: function(res) {
+            // 已经授权,可以直接调用 getUserInfo 获取头像昵称
+            wx.getUserInfo({
+                withCredentials: true,
+                success: function (res) {
+                  let url = genAPIUrl('wx/user');
+                  const userData = {
+                      encryptedData: res.encryptedData,
+                      sessionKey: sessionKey,
+                      iv: res.iv,
+                      code: wx.getStorageSync('uid') ? wx.getStorageSync('uid') : ''
+                  }          
+                  request.getInstance().header({
+                    'content-type': 'application/x-www-form-urlencoded'
+                  }).url(url).data(userData).method('POST').send().success(res => {
+                      wx.hideToast()
+                      wx.showToast({
+                          title: '登录成功',
+                          icon: 'success',
+                          duration: 1500
+                      })
+                      wx.setStorageSync('uid', res.data.data.id)
+                      wx.setStorageSync('user', res)
+                      successcallback(res)
+                  });
+                },
+                fail: function(res) {
+                    failcallback(res)
+                }
+            })
+          } 
+      })
+    
+}
+
+//登录
+
+module.exports = {
+    getOpenidSessionKey
+}