Pārlūkot izejas kodu

重构微信小程序

Limengbo 7 gadi atpakaļ
vecāks
revīzija
dbac0499c2
63 mainītis faili ar 3752 papildinājumiem un 494 dzēšanām
  1. 0 72
      app.js
  2. 9 1
      app.json
  3. 19 1
      app.wxss
  4. 33 9
      compontents/chat/chat.js
  5. 2 1
      compontents/chat/chat.json
  6. 21 8
      compontents/chat/chat.wxml
  7. 18 2
      compontents/chat/chat.wxss
  8. 40 14
      compontents/discuss/discuss.js
  9. 1 1
      compontents/discuss/discuss.wxml
  10. 58 0
      compontents/one/one.js
  11. 7 0
      compontents/one/one.json
  12. 40 0
      compontents/one/one.wxml
  13. 165 0
      compontents/one/one.wxss
  14. 16 2
      compontents/share/share.js
  15. 12 10
      compontents/share/share.wxml
  16. 41 4
      compontents/share/share.wxss
  17. 91 0
      compontents/tarbar/tarbar.js
  18. 4 0
      compontents/tarbar/tarbar.json
  19. 10 0
      compontents/tarbar/tarbar.wxml
  20. 40 0
      compontents/tarbar/tarbar.wxss
  21. 73 35
      pages/art/art.js
  22. 2 2
      pages/art/art.json
  23. 140 117
      pages/art/art.wxml
  24. 6 0
      pages/art/art.wxss
  25. 95 0
      pages/chinese/chinese.js
  26. 9 0
      pages/chinese/chinese.json
  27. 54 0
      pages/chinese/chinese.wxml
  28. 295 0
      pages/chinese/chinese.wxss
  29. 95 0
      pages/english/english.js
  30. 9 0
      pages/english/english.json
  31. 54 0
      pages/english/english.wxml
  32. 295 0
      pages/english/english.wxss
  33. BIN
      pages/image/message.png
  34. 45 43
      pages/index/index.js
  35. 1 0
      pages/index/index.json
  36. 13 16
      pages/index/index.wxml
  37. 1 65
      pages/index/index.wxss
  38. 41 13
      pages/input_content/input_content.js
  39. 7 5
      pages/input_content/input_content.wxml
  40. 95 0
      pages/language/language.js
  41. 9 0
      pages/language/language.json
  42. 54 0
      pages/language/language.wxml
  43. 295 0
      pages/language/language.wxss
  44. 95 0
      pages/mathematics/mathematics.js
  45. 9 0
      pages/mathematics/mathematics.json
  46. 59 0
      pages/mathematics/mathematics.wxml
  47. 295 0
      pages/mathematics/mathematics.wxss
  48. 36 24
      pages/recommend/recommend.js
  49. 1 0
      pages/recommend/recommend.json
  50. 55 44
      pages/recommend/recommend.wxml
  51. 7 0
      pages/recommend/recommend.wxss
  52. 95 0
      pages/science/science.js
  53. 9 0
      pages/science/science.json
  54. 59 0
      pages/science/science.wxml
  55. 295 0
      pages/science/science.wxss
  56. 77 0
      pages/transmit/transmit.js
  57. 8 0
      pages/transmit/transmit.json
  58. 52 0
      pages/transmit/transmit.wxml
  59. 171 0
      pages/transmit/transmit.wxss
  60. 10 2
      project.config.json
  61. 11 2
      utils/APIClient.js
  62. 77 0
      utils/loginSchedule.js
  63. 16 1
      utils/util.js

+ 0 - 72
app.js

@@ -5,77 +5,5 @@ App({
     var logs = wx.getStorageSync('logs') || []  
     logs.unshift(Date.now())  
     wx.setStorageSync('logs', logs)
-    // 登录
-    // wx.login({
-    //   success: res => {
-    //     // 发送 res.code 到后台换取 openId, sessionKey, unionId
-    //   }
-    // })
-    // // 获取用户信息
-    // wx.getSetting({
-    //   success: res => {
-    //     if (res.authSetting['scope.userInfo']zx) {
-    //       // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
-    //       wx.getUserInfo({
-    //         success: res => {
-    //           // 可以将 res 发送给后台解码出 unionId
-    //           this.globalData.userInfo = res.userInfo
-
-    //           // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-    //           // 所以此处加入 callback 以防止这种情况
-    //           if (this.userInfoReadyCallback) {
-    //             this.userInfoReadyCallback(res)
-    //           }
-    //         }
-    //       })
-    //     }
-    //   }
-    // })
   },
-  getUserInfo: function (cb) {
-    var that = this;
-    if (this.globalData.userInfo) {
-      typeof cb == "function" && cb(this.globalData.userInfo)
-    } else {
-      //调用登录接口  
-      wx.login({
-        success: function (res) {
-          if (res.code) {
-            wx.request({  
-            //获取openid接口  
-            url: 'https://weixin.ai160.com',
-            header: { 'content-type': 'application/json'	},  
-            data:{   
-              js_code: res.code,  
-              grant_type: 'authorization_code'  
-            },  
-            method:'GET',  
-            success:function(res){  
-              console.log(res)  
-            }  
-          })  
-            //发起网络请求
-            // wx.request({
-            //   url: 'https://test.com/onLogin',
-            //   data: {
-            //     code: res.code
-            //   }
-            // })
-          } else {
-            console.log('登录失败!' + res.errMsg)
-          }
-          wx.getUserInfo({
-            success: function (res) {
-              console.log(res);
-              that.globalData.userInfo = res.userInfo;
-              typeof cb == "function" && cb(that.globalData.userInfo)
-            }
-          })
-        }
-      });
-    }
-  },
-  globalData: {
-    userInfo: null
-  }
 })  

+ 9 - 1
app.json

@@ -2,7 +2,15 @@
   "pages": [
     "pages/index/index",
     "pages/logs/logs",
-    "pages/input_content/input_content"
+    "pages/recommend/recommend",
+    "pages/language/language",
+    "pages/mathematics/mathematics",
+    "pages/chinese/chinese",
+    "pages/english/english",
+    "pages/science/science",
+    "pages/art/art",
+    "pages/input_content/input_content",
+    "pages/transmit/transmit"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 19 - 1
app.wxss

@@ -4,5 +4,23 @@ page {
 }
 
 .container {
+  width: 100%;
+  height: 100%;
+  background: #FAF8FB;
+  padding-top:72rpx;
   box-sizing: border-box;
-} 
+}
+
+.content {
+  height:100%;
+}
+
+.content scroll-view{
+  height: 100%;
+}
+
+::-webkit-scrollbar{
+  width: 0;
+  height: 0;
+  color: transparent;
+}

+ 33 - 9
compontents/chat/chat.js

@@ -1,18 +1,20 @@
 // compontents/chat/chat.js
-const APIClient = require('../../utils/APIClient.js');
 
 Component({
   relations: {
-    '../discuss/custom-li': {
+    '../discuss/discuss': {
       type: 'child', // 关联的目标节点应为子节点
       linked: function(target) {
         // 每次有custom-li被插入时执行,target是该节点实例对象,触发在该节点attached生命周期之后
+        console.log(target)
       },
       linkChanged: function(target) {
         // 每次有custom-li被移动后执行,target是该节点实例对象,触发在该节点moved生命周期之后
+        console.log(target)
       },
       unlinked: function(target) {
         // 每次有custom-li被移除时执行,target是该节点实例对象,触发在该节点detached生命周期之后
+        console.log(target)
       }
     }
   },
@@ -24,16 +26,27 @@ Component({
       type: Object,
       value: {}
     },
+    title: {
+      type: String,
+      value: ''      
+    },
+    query: {
+      type: String,
+      value: ''          
+    },
+    type: {
+      type: String,
+      value: '' 
+    },
   },
 
   /**
    * 组件的初始数据
    */
   data: {
-    flag: false,
     text: '',
     chatDatas: [],
-    animationData: {}
+    animationData: {},
   },
 
   /**
@@ -41,8 +54,9 @@ Component({
    */
   methods: {
     uploadImage (e) {
+      const type = this.properties.type;
       wx.navigateTo({
-        url: '../input_content/input_content'
+        url: '../input_content/input_content?type=' + type
       })
     },
     listenerButtonPreviewImage: function(e) {
@@ -60,11 +74,21 @@ Component({
               //console.log('fail')
           }
       })
+    },
+    shareImage: function(e){
+      console.log(e);
+      //分享查询单条的时候会用到这两个值
+      const postId = e.currentTarget.dataset.postsid;
+      this.share.showPopup(postId);
+    },
+    _getAllLi: function(){
+      // 使用getRelationNodes可以获得nodes数组,包含所有已关联的custom-li,且是有序的
+      var nodes = this.getRelationNodes('../discuss/discuss');
+      console.log(nodes);
     }
   },
-  ready () {
-    console.log(this.getRelationNodes('discuss/discuss/custom-li'))
-    // this.discuss = this.selectComponent("#discuss");
-    // console.log(this.discuss);
+  ready: function(){
+    this._getAllLi()
+    this.share = this.selectComponent("#share");
   }
 })

+ 2 - 1
compontents/chat/chat.json

@@ -1,6 +1,7 @@
 {
   "component": true,
   "usingComponents": {
-    "discuss": "../discuss/discuss"
+    "discuss": "../discuss/discuss",
+    "share": "../share/share"
   }
 }

+ 21 - 8
compontents/chat/chat.wxml

@@ -2,11 +2,11 @@
 <view class="works">
     <view class="title">
         <image src="../../pages/image/xing.png" class="xing"></image>
-        <text class="">作品分享</text>
+        <text class="">{{title}}</text>
         <image src="../../pages/image/xing.png" class="xing"></image>
-        <text class="uploading" bindtap="uploadImage">分享作品</text>
+        <text class="uploading" bindtap="uploadImage" wx:if="{{productionData.list}}">{{query}}</text>
     </view>
-    <view >
+    <view wx:if="{{productionData.list}}">
         <view class="share-con" wx:for="{{productionData.list}}" wx:key="{{index}}">
             <view class="head">
                 <view class="head-img">
@@ -16,9 +16,12 @@
                     <text>{{item.featureMap.wechatName}}</text>
                     <text style="height: 100%">{{item.title}}</text>
                 </view>
-                <image class="share_up" src="../../pages/image/share_up.png" data-flag="{{flag}}" bindtap="shareImage"></image>
+                <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>
+                <image wx:if="{{type == 1}}" class="message" src="../../pages/image/message.png"></image>
             </view>
-            <view class="picture">
+            <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>
@@ -37,17 +40,27 @@
                     <text>{{item.replyCount}}</text>
                 </view>
             </view>
-            <discuss discussData="{{item.replyList}}" uid="{{item.userId}}" id="discuss"/>
+            <discuss discussData="{{item.replyList}}" uid="{{item.userId}}" postsId="{{item.id}}" id="discuss" type="{{type}}"/>
         </view>
         <view class="more">查看更多</view>
     </view>
-    <view class="no-con" style="display: none;">
+    <view class="no-con" wx:if="{{!productionData.list && type == 2}}">
         <view class="state">你还没有上传作品</view>
-        <view class="upload-works">
+        <view class="upload-works" bindtap="uploadImage">
             <image src="../../pages/image/work_box.png" class="work-box"></image>
             <image src="../../pages/image/uploading_works.png" class="uploading-works"></image>
             <text>上传作品</text>
         </view>
     </view>
+    <view class="no-con" wx:if="{{!productionData.list && type == 1}}">
+        <view class="state">你还没有提问过问题</view>
+        <view class="upload-works" bindtap="uploadImage">
+            <image src="../../pages/image/work_box.png" class="work-box"></image>
+            <image src="../../pages/image/questions.png" class="uploading-works"></image>
+            <text>提问问题</text>
+        </view>
+    </view>
 </view>
 
+<share wx:if="{{type == 2}}" id="share"/>
+

+ 18 - 2
compontents/chat/chat.wxss

@@ -102,14 +102,30 @@
     margin-left: 8rpx;
 }
 
+.share-up-box {
+    position: absolute;
+    right: -30rpx;
+    top: -30rpx;
+    height: 100rpx;
+    width: 100rpx;
+}
+
 .share_up {
     position: absolute;
-    right: 0;
-    top: 20rpx;
+    right: 30rpx;
+    top: 50rpx;
     height: 19rpx;
     width: 19rpx;
 }
 
+.message {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    width: 68rpx;
+    height: 56rpx;    
+}
+
 .icon {
     display: flex;
     align-items: center;

+ 40 - 14
compontents/discuss/discuss.js

@@ -1,18 +1,22 @@
 // compontents/discuss/discuss.js
 const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
 Component({
   relations: {
-    './custom-ul': {
+    '../chat/chat': {
       type: 'parent', // 关联的目标节点应为父节点
       linked: function(target) {
         // 每次被插入到custom-ul时执行,target是custom-ul节点实例对象,触发在attached生命周期之后
+        console.log(target)
       },
       linkChanged: function(target) {
         // 每次被移动后执行,target是custom-ul节点实例对象,触发在moved生命周期之后
+        console.log(target)        
       },
       unlinked: function(target) {
         // 每次被移除时执行,target是custom-ul节点实例对象,触发在detached生命周期之后
+        console.log(target)
       }
     }
   },
@@ -27,6 +31,14 @@ Component({
     uid: {
       type: String,
       value: ''
+    },
+    type: {
+      type: String,
+      value: ''
+    },
+    postsId: {
+      type: String,
+      value: ''
     }
   },
 
@@ -84,9 +96,6 @@ Component({
       let text = this.data.text.trim();
       let postsId = this.properties.postsId;
       let _this = this;
-      let header = {
-        uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
-      }
       if(text == ''){
         wx.showModal({
           title: '提示',
@@ -103,19 +112,36 @@ Component({
       }
       this.data.text = "";
       let data = {
-        "userId": header.uid,
         "postsId": postsId,
         "content": text
       };
-      APIClient.getDiscussSchedule(header, data).success(function (res) {
-        console.log(res.data)
-        if(res.data.success) {
-          _this.properties.discussData.push(res.data.data);
-          _this.setData({
-            discussDatas: _this.properties.discussData,
-            messageLength: _this.properties.discussData.length
-          });
-        };
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getDiscussSchedule({
+          uid: res.data.data.uid
+        }, data).success(function (res) {
+          console.log(res.data)
+          if(res.data.success) {
+            _this.properties.discussData.push(res.data.data);
+            _this.setData({
+              discussDatas: _this.properties.discussData,
+              messageLength: _this.properties.discussData.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: ''

+ 1 - 1
compontents/discuss/discuss.wxml

@@ -4,7 +4,7 @@
         <text style="color: {{uid == item.userId ? '#000' : '#f7085e'}}">{{item.featureMap.wechatName}}:</text>
         <text>{{item.content}}</text>
     </view>  
-    <view class="text">
+    <view class="text" wx:if="{{type == 2}}">
         <input placeholder="输入评论内容" value="{{text}}" bindinput="bindKeyInput" type="text" />
         <text bindtap="sendText">发送</text>
     </view>

+ 58 - 0
compontents/one/one.js

@@ -0,0 +1,58 @@
+// compontents/chat/chat.js
+
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    productionData: {
+      type: Object,
+      value: {}
+    },
+    title: {
+      type: String,
+      value: ''      
+    },
+    type: {
+      type: String,
+      value: '' 
+    },
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    text: '',
+    chatDatas: [],
+    animationData: {},
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    uploadImage (e) {
+      const type = this.properties.type;
+      wx.navigateTo({
+        url: '../input_content/input_content?type=' + type
+      })
+    },
+    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')
+          }
+      })
+    }
+  }
+})

+ 7 - 0
compontents/one/one.json

@@ -0,0 +1,7 @@
+{
+  "component": true,
+  "usingComponents": {
+    "discuss": "../discuss/discuss",
+    "share": "../share/share"
+  }
+}

+ 40 - 0
compontents/one/one.wxml

@@ -0,0 +1,40 @@
+<!--compontents/chat/chat.wxml-->
+<view class="works">
+    <view class="title">
+        <image src="../../pages/image/xing.png" class="xing"></image>
+        <text class="">{{title}}</text>
+        <image src="../../pages/image/xing.png" class="xing"></image>
+    </view>
+    <view class="share-con" wx:key="{{index}}">
+        <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" 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>
+                <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>
+        <discuss discussData="{{productionData.replyList}}" uid="{{productionData.userId}}" postsId="{{productionData.id}}" id="discuss" type="{{type}}"/>
+    </view>
+</view>
+

+ 165 - 0
compontents/one/one.wxss

@@ -0,0 +1,165 @@
+/* compontents/chat/chat.wxss */
+.works {
+    width: 100%;
+    margin: 20rpx 0;
+    border-radius: 25rpx;
+    padding: 20rpx 0;
+    box-sizing: border-box;
+    background: #fff;
+    position: relative;
+}
+
+/* 分享评论 */
+.works {
+    padding: 16rpx 25rpx;
+}
+
+.works .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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;
+}

+ 16 - 2
compontents/share/share.js

@@ -11,13 +11,27 @@ Component({
    * 组件的初始数据
    */
   data: {
-
+    flag: true,
+    postId: '',
   },
 
   /**
    * 组件的方法列表
    */
   methods: {
-
+    //隐藏分享框
+    hidePopup: function () {
+      this.setData({
+        flag: !this.data.flag
+      })
+    },
+    //展示分享框
+    showPopup (postId) {
+      this.setData({
+        flag: !this.data.flag,
+        postId
+      })
+    },
   }
+
 })

+ 12 - 10
compontents/share/share.wxml

@@ -1,14 +1,16 @@
 <!--compontents/share/share.wxml-->
-<view class="share">
-    <view class="title">分享</view>
-    <view class="share-img">
-        <view class="download">
-            <image src="../../pages/image/download.png"></image>
-            <text>生成海报分享</text>
+<view class="container" bindtap="hidePopup" hidden="{{flag}}">
+    <view class="share">
+        <view class="title">分享</view>
+        <view class="share-img">
+            <view class="download">
+                <image src="../../pages/image/download.png"></image>
+                <text>生成海报分享</text>
+            </view>
+            <button class='transmit' open-type="share" id="transmit" data-userId="{{userId}}" data-postId="{{postId}}">
+                <image src="../../pages/image/transmit.png"></image>
+                <text>转发给好友</text>
+            </button>      
         </view>
-        <view class="transmit">
-            <image src="../../pages/image/transmit.png"></image>
-            <text>转发给好友</text>
-        </view>        
     </view>
 </view>

+ 41 - 4
compontents/share/share.wxss

@@ -1,13 +1,35 @@
 /* compontents/share/share.wxss */
-.share {
-    position: absolute;
+.container {
+    position:fixed;
+    left: 0;
+    bottom: 0;   
+    width: 100%;
+    height: 100%;
+    z-index: 98;
+}
+
+.container:after {
+    content:'';
+    position:absolute;
     left: 0;
-    bottom: -342rpx;
-    width:100%;
+    bottom: 0;   
+    width: 100%;
+    height: 100%;
+    background: rgba(255,255,255,.8);
+    filter: blur(15px);
+    z-index: 99;
+}
+
+.share {
+    position:fixed;
+    left: 15rpx;
+    bottom: 0;
+    width: calc(100% - 30rpx);
     border-radius:25rpx;
     padding:32rpx 24rpx;
     box-sizing:border-box;
     background:#fff;
+    z-index: 100;
 }
 
 .share .title {
@@ -46,6 +68,21 @@
     height: 86rpx;
 }
 
+.transmit {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    background: #fff;
+    margin:0;
+    padding:0;
+    line-height: normal;
+}
+
+.transmit:after {
+    content: '';
+    border: none;
+}
+
 .transmit image {
     width: 102rpx;
     height: 82rpx;    

+ 91 - 0
compontents/tarbar/tarbar.js

@@ -0,0 +1,91 @@
+// compontents/tarbar/tarbar.js
+const util = require('../../utils/util.js');
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    motto: ['我的','本周推荐','语文','数学','中文','英语','科学','艺术'],
+    navBtnSelectIdx: 0,
+    left: 0
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    navItemTap: function (e) {
+      //更改navBtnSelectIdx加class   
+      let index = e.target.dataset.index;
+      if (index != this.navBtnSelectIdx) {
+        this.setData({ navBtnSelectIdx: index});
+      }
+      //移动nav
+      if (index <= 2) {
+        this.setData({ left: 0 });
+      }
+      if(index > 2){
+        this.setData({left: 200 });
+      }
+      if(index == 0) {
+        wx.redirectTo({
+          url: '../index/index?ind=0'
+        })
+      }
+      if(index == 1) {
+        wx.redirectTo({
+          url: '../recommend/recommend?ind=1'
+        })
+      }
+      if(index == 2) {
+        wx.redirectTo({
+          url: '../language/language?ind=2'
+        })
+      }
+      if(index == 3) {
+        wx.redirectTo({
+          url: '../mathematics/mathematics?ind=3'
+        })
+      }
+      if(index == 4) {
+        wx.redirectTo({
+          url: '../chinese/chinese?ind=4'
+        })
+      }
+      if(index == 5) {
+        wx.redirectTo({
+          url: '../english/english?ind=5'
+        })
+      }
+      if(index == 6) {
+        wx.redirectTo({
+          url: '../science/science?ind=6'
+        })
+      }                        
+      if(index == 7) {
+        wx.redirectTo({
+          url: '../art/art?ind=7'
+        })
+      }
+    }
+  },
+  ready() {
+    let options = util.getUrl();
+    if(options.ind) {
+      this.setData({ navBtnSelectIdx: options.ind});
+    }
+    if (options.ind <= 2) {
+      this.setData({ left: 0 });
+    }
+    if(options.ind > 2){
+      this.setData({left: 200 });
+    }
+  }
+})

+ 4 - 0
compontents/tarbar/tarbar.json

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

+ 10 - 0
compontents/tarbar/tarbar.wxml

@@ -0,0 +1,10 @@
+<view class="menu">
+    <scroll-view scroll-x="true" class="top-nav" scroll-with-animation="true" scroll-left="{{left}}" >
+        <block wx:for="{{motto}}" wx:for-item="item" wx:key="index" wx:for-index="itemIdx">
+          <view bindtap="navItemTap" class="top-btn {{navBtnSelectIdx == itemIdx ? 'top-hoverd-btn' : ''}}" data-index="{{itemIdx}}">
+            {{item}}              
+            <view class="striping {{navBtnSelectIdx == itemIdx ? 'top-hoverd-striping' : ''}}"></view>
+          </view>
+        </block>
+    </scroll-view>
+</view>

+ 40 - 0
compontents/tarbar/tarbar.wxss

@@ -0,0 +1,40 @@
+/* compontents/tarbar/tarbar.wxss */
+/*菜单*/
+.menu{
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  z-index: 99;
+  background: #FAF8FB;
+}
+
+.top-nav{
+    white-space: nowrap;
+}
+
+.top-btn{
+    position: relative;
+    display: inline-block;
+    padding: 12rpx 20rpx;
+    font-size: 36rpx;
+    color: #878787;
+}
+
+.top-hoverd-btn {
+  color: #000;
+}
+
+.striping {
+    position: absolute;
+    left: 50%;
+    bottom: 0;
+    transform: translateX(-50%);
+    width: 26rpx;
+    border-bottom: #000 solid 6rpx;
+    display: none;
+}
+
+.top-hoverd-striping {
+  display: block;
+}

+ 73 - 35
pages/art/art.js

@@ -1,57 +1,95 @@
 // pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
 const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
-Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    
-  },
-
-  /**
-   * 组件的初始数据
-   */
+Page({
   data: {
     flag: false,
     productionData: {},
-    questionsData: {}
+    questionsData: {},
   },
 
-  /**
-   * 组件的方法列表
-   */
   methods: {
     shareImage: function(e) {
       console.log(e.target.dataset.flag)
     }
   },
-  ready () {
-     /* 区分答疑和分享 */
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
     let distinction = (type, success) => {
-      APIClient.getProductionSchedule({
-        uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
-      }, {
-        "userId": "e7e0d43a-36b1-4e71-a3a3-61469c90d0a2",
-        "type": type,
-        "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
-        "pageNo": 1,
-        "pageSize": 2
-      }).success(success)
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
     };
     /* 分享 */
     distinction(2, res => {
-      console.log(res.data.data)
-      this.setData({
-        productionData: res.data.data,
-      })
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
     });
     /* 答疑 */
     distinction(1, res => {
-      console.log(res.data)
-      this.setData({
-        questionsData: res.data.data,
-      })
-    })
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
   },
 })

+ 2 - 2
pages/art/art.json

@@ -1,9 +1,9 @@
 {
   "component": true,
   "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "chat": "/compontents/chat/chat",
-    "lessonList": "/compontents/lesson_list/lessonList",
-    "share": "/compontents/share/share"
+    "lessonList": "/compontents/lesson_list/lessonList"
   }
 }

+ 140 - 117
pages/art/art.wxml

@@ -1,133 +1,156 @@
 <!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
 
-<target/>
+            <lessonList/>
 
-<lessonList/>
-
-<view class="material">
-    <view class="this-week">
-        <image src="../image/study.png"></image>
-        <view class="lesson-name">
-            <text>学习资料</text>
-            <text>本周和历史学习资料</text>
-        </view>
-    </view>
-    <view class="material-con">
-        <view class="art-img">
-            <text>钻石戒指</text>
-            <text>点击预览</text>
-        </view>
-        <view class="art-img">
-            <text>钻石戒指</text>
-            <text>点击预览</text>
-        </view>
-    </view>
-</view>
-
-<!--<view class="works">
-    <view class="title">
-        <image src="../image/xing.png" class="xing"></image>
-        <text class="">作品分享</text>
-        <image src="../image/xing.png" class="xing"></image>
-        <text class="uploading" bindtap="uploadImage">分享作品</text>
-    </view>
-    <view >
-        <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>
-                <image class="share_up" src="../image/share_up.png" data-flag="{{flag}}" bindtap="shareImage"></image>
-            </view>
-            <view class="picture">
-                <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="../image/zan.png" class="zan"></image>
-                    <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.favors : '0'}}</text>
-                </view>
-                <view>
-                    <image src="../image/weatch.png" class="weatch"></image>
-                    <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.views : '0'}}</text>
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
                 </view>
-                <view>
-                    <image src="../image/discuss.png" class="discuss"></image>
-                    <text>{{item.replyCount}}</text>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
                 </view>
             </view>
-             <chat chatData="{{item.replyList}}" uid="{{item.userId}}" postsId="{{item.id}}"/> 
-        </view>
-        <view class="more">查看更多</view>
-    </view>
-    <view class="no-con" style="display: none;">
-        <view class="state">你还没有上传作品</view>
-        <view class="upload-works">
-            <image src="../image/work_box.png" class="work-box"></image>
-            <image src="../image/uploading_works.png" class="uploading-works"></image>
-            <text>上传作品</text>
-        </view>
-    </view>
-</view>-->
-<chat productionData="{{productionData}}" />
 
-<view class="share">
-    <view class="title">
-        <image src="../image/xing.png" class="xing"></image>
-        <text class="">答疑讨论</text>
-        <image src="../image/xing.png" class="xing"></image>
-    </view>
-    <view >
-        <view class="questions">
-            <view class="head">
-                <view class="head-img">
-                    <image src="../image/medal.png"></image>
+            <!--<view class="works">
+                <view class="title">
+                    <image src="../image/xing.png" class="xing"></image>
+                    <text class="">作品分享</text>
+                    <image src="../image/xing.png" class="xing"></image>
+                    <text class="uploading" bindtap="uploadImage">分享作品</text>
                 </view>
-                <view class="lesson-name">
-                    <text>李佳怡</text>
-                    <text style="height: 100%">第一次发作品,请大家多多关注第一次发作品,请大家多多关注,第一次发作品,请大家多多关注,第一次发作品,请大家多多关注</text>
+                <view >
+                    <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>
+                            <view class="share-up-box" bindtap="shareImage">
+                                <image class="share_up" src="../image/share_up.png"></image>
+                            </view>
+                        </view>
+                        <view class="picture">
+                            <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="../image/zan.png" class="zan"></image>
+                                <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.favors : '0'}}</text>
+                            </view>
+                            <view>
+                                <image src="../image/weatch.png" class="weatch"></image>
+                                <text>{{item.postsAttributeInfo ? item.postsAttributeInfo.views : '0'}}</text>
+                            </view>
+                            <view>
+                                <image src="../image/discuss.png" class="discuss"></image>
+                                <text>{{item.replyCount}}</text>
+                            </view>
+                        </view>
+                        <chat chatData="{{item.replyList}}" uid="{{item.userId}}" postsId="{{item.id}}"/> 
+                    </view>
+                    <view class="more">查看更多</view>
                 </view>
-                <view class="dian"></view>
-            </view>
-            <view class="icon">
-                <view>
-                    <image src="../image/zan.png" class="zan"></image>
-                    <text>534</text>
+                <view class="no-con" style="display: none;">
+                    <view class="state">你还没有上传作品</view>
+                    <view class="upload-works">
+                        <image src="../image/work_box.png" class="work-box"></image>
+                        <image src="../image/uploading_works.png" class="uploading-works"></image>
+                        <text>上传作品</text>
+                    </view>
                 </view>
-                <view>
-                    <image src="../image/weatch.png" class="weatch"></image>
-                    <text>1534</text>
+            </view>-->
+            <chat 
+                productionData="{{productionData}}" 
+                title="作品分享"
+                query="分享作品"
+                type="2"/>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+            
+            <!-- <view class="share">
+                <view class="title">
+                    <image src="../image/xing.png" class="xing"></image>
+                    <text class="">答疑讨论</text>
+                    <image src="../image/xing.png" class="xing"></image>
                 </view>
-                <view>
-                    <image src="../image/discuss.png" class="discuss"></image>
-                    <text>534</text>
+                <view >
+                    <view class="questions">
+                        <view class="head">
+                            <view class="head-img">
+                                <image src="../image/medal.png"></image>
+                            </view>
+                            <view class="lesson-name">
+                                <text>李佳怡</text>
+                                <text style="height: 100%">第一次发作品,请大家多多关注第一次发作品,请大家多多关注,第一次发作品,请大家多多关注,第一次发作品,请大家多多关注</text>
+                            </view>
+                            <view class="dian"></view>
+                        </view>
+                        <view class="icon">
+                            <view>
+                                <image src="../image/zan.png" class="zan"></image>
+                                <text>534</text>
+                            </view>
+                            <view>
+                                <image src="../image/weatch.png" class="weatch"></image>
+                                <text>1534</text>
+                            </view>
+                            <view>
+                                <image src="../image/discuss.png" class="discuss"></image>
+                                <text>534</text>
+                            </view>
+                        </view>
+                    </view>
+                    <view class="more">查看更多</view>
                 </view>
-            </view>
-        </view>
-        <view class="more">查看更多</view>
-    </view>
-    <view class="no-con" style="display: none;">
-        <view class="state">你还没有提问过问题</view>
-        <view class="upload-works">
-            <image src="../image/work_box.png" class="work-box"></image>
-            <image src="../image/questions.png" class="uploading-works"></image>
-            <text>提问问题</text>
-        </view>
-    </view>
-</view>
+                <view class="no-con" style="display: none;">
+                    <view class="state">你还没有提问过问题</view>
+                    <view class="upload-works">
+                        <image src="../image/work_box.png" class="work-box"></image>
+                        <image src="../image/questions.png" class="uploading-works"></image>
+                        <text>提问问题</text>
+                    </view>
+                </view>
+            </view> -->
+
 
-<share/>
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
 
-<view class="questions-one">
-    <image src="../image/q_discuss.png" ></image>
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
 </view>
 
- <view class="upload-one">
-   <image src="../image/works.png" ></image>
-</view> 

+ 6 - 0
pages/art/art.wxss

@@ -1,5 +1,11 @@
 /* pages/art/art.wxss */
 
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
 .material,
 .works,
 .share {

+ 95 - 0
pages/chinese/chinese.js

@@ -0,0 +1,95 @@
+// pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+  data: {
+    flag: false,
+    productionData: {},
+    questionsData: {},
+  },
+
+  methods: {
+    shareImage: function(e) {
+      console.log(e.target.dataset.flag)
+    }
+  },
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
+    let distinction = (type, success) => {
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
+    };
+    /* 分享 */
+    distinction(2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
+    });
+    /* 答疑 */
+    distinction(1, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
+  },
+})

+ 9 - 0
pages/chinese/chinese.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
+    "target": "/compontents/target/target",
+    "chat": "/compontents/chat/chat",
+    "lessonList": "/compontents/lesson_list/lessonList"
+  }
+}

+ 54 - 0
pages/chinese/chinese.wxml

@@ -0,0 +1,54 @@
+<!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
+
+            <lessonList/>
+
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
+                </view>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                </view>
+            </view>
+            
+            <view>语文</view>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+
+
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
+
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 295 - 0
pages/chinese/chinese.wxss

@@ -0,0 +1,295 @@
+/* pages/art/art.wxss */
+
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.material,
+.works,
+.share {
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 20rpx 0;
+  box-sizing: border-box;
+  background: #fff;
+  position: relative;
+}
+
+.this-week {
+    display: flex;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+}
+
+.this-week image {
+  width: 86rpx;
+  height: 86rpx;
+}
+
+.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;
+}
+
+
+/* 预览图片 */
+.material-con {
+    margin-left: 10rpx;
+    padding: 0 25rpx;
+}
+
+.art-img {
+    display: flex;
+    justify-content: space-between;
+    margin-left: 53rpx;
+    font-size: 28rpx;
+    color: #444;
+    margin-top: 30rpx;
+}
+
+/* 分享评论 */
+.works,
+.share {
+    padding: 16rpx 25rpx;
+}
+
+.works .title,
+.share .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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%;
+}
+
+
+.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 {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.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;
+}
+
+.no-con {
+    margin: 50rpx 0 ;
+}
+
+.state {
+    text-align: center;
+    font-size: 24rpx;
+    color: #C0C0C0;
+}
+
+.upload-works {
+    position: relative;
+    width: 212rpx;
+    height: 212rpx;
+    margin: 0 auto;
+}
+
+.work-box {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 212rpx;
+    height: 212rpx;
+}
+
+.uploading-works {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    z-index: 1;
+    width: 67rpx;
+    height: 51rpx;
+    transform: translate(-50%, -50%);
+}
+
+.upload-works text {
+    position: absolute;
+    left: 50%;
+    top: 70%;
+    z-index: 1;
+    font-size: 24rpx;
+    color: #C0C0C0;
+    transform: translate(-50%);
+}
+
+
+
+
+
+ 
+ /* 答疑讨论 */
+ .questions {
+    padding-bottom: 28rpx;
+}
+
+ .questions .head {
+    padding:20rpx 0;
+    position: relative;
+ }
+
+
+.dian {
+     position: absolute;
+     right: 45rpx;
+     top: 40rpx;
+     width: 20rpx;
+     height: 20rpx;
+     border-radius: 50%;
+     background: #FD025F;
+ }
+
+ /* 标题定位到顶部 */
+ .adsorb {
+  position: fixed;
+  left: 0;
+  top: 72rpx;
+}
+
+/* 定位图片 */
+.questions-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 30rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;
+}
+
+.questions-one image {
+    width: 100%;
+    height: 100%;
+}
+
+.upload-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 150rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;   
+}
+
+.upload-one image {
+    width: 100%;
+    height: 100%;
+}

+ 95 - 0
pages/english/english.js

@@ -0,0 +1,95 @@
+// pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+  data: {
+    flag: false,
+    productionData: {},
+    questionsData: {},
+  },
+
+  methods: {
+    shareImage: function(e) {
+      console.log(e.target.dataset.flag)
+    }
+  },
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
+    let distinction = (type, success) => {
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
+    };
+    /* 分享 */
+    distinction(2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
+    });
+    /* 答疑 */
+    distinction(1, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
+  },
+})

+ 9 - 0
pages/english/english.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
+    "target": "/compontents/target/target",
+    "chat": "/compontents/chat/chat",
+    "lessonList": "/compontents/lesson_list/lessonList"
+  }
+}

+ 54 - 0
pages/english/english.wxml

@@ -0,0 +1,54 @@
+<!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
+
+            <lessonList/>
+
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
+                </view>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                </view>
+            </view>
+
+            <view>英语</view>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+
+
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
+
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 295 - 0
pages/english/english.wxss

@@ -0,0 +1,295 @@
+/* pages/art/art.wxss */
+
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.material,
+.works,
+.share {
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 20rpx 0;
+  box-sizing: border-box;
+  background: #fff;
+  position: relative;
+}
+
+.this-week {
+    display: flex;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+}
+
+.this-week image {
+  width: 86rpx;
+  height: 86rpx;
+}
+
+.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;
+}
+
+
+/* 预览图片 */
+.material-con {
+    margin-left: 10rpx;
+    padding: 0 25rpx;
+}
+
+.art-img {
+    display: flex;
+    justify-content: space-between;
+    margin-left: 53rpx;
+    font-size: 28rpx;
+    color: #444;
+    margin-top: 30rpx;
+}
+
+/* 分享评论 */
+.works,
+.share {
+    padding: 16rpx 25rpx;
+}
+
+.works .title,
+.share .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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%;
+}
+
+
+.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 {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.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;
+}
+
+.no-con {
+    margin: 50rpx 0 ;
+}
+
+.state {
+    text-align: center;
+    font-size: 24rpx;
+    color: #C0C0C0;
+}
+
+.upload-works {
+    position: relative;
+    width: 212rpx;
+    height: 212rpx;
+    margin: 0 auto;
+}
+
+.work-box {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 212rpx;
+    height: 212rpx;
+}
+
+.uploading-works {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    z-index: 1;
+    width: 67rpx;
+    height: 51rpx;
+    transform: translate(-50%, -50%);
+}
+
+.upload-works text {
+    position: absolute;
+    left: 50%;
+    top: 70%;
+    z-index: 1;
+    font-size: 24rpx;
+    color: #C0C0C0;
+    transform: translate(-50%);
+}
+
+
+
+
+
+ 
+ /* 答疑讨论 */
+ .questions {
+    padding-bottom: 28rpx;
+}
+
+ .questions .head {
+    padding:20rpx 0;
+    position: relative;
+ }
+
+
+.dian {
+     position: absolute;
+     right: 45rpx;
+     top: 40rpx;
+     width: 20rpx;
+     height: 20rpx;
+     border-radius: 50%;
+     background: #FD025F;
+ }
+
+ /* 标题定位到顶部 */
+ .adsorb {
+  position: fixed;
+  left: 0;
+  top: 72rpx;
+}
+
+/* 定位图片 */
+.questions-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 30rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;
+}
+
+.questions-one image {
+    width: 100%;
+    height: 100%;
+}
+
+.upload-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 150rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;   
+}
+
+.upload-one image {
+    width: 100%;
+    height: 100%;
+}

BIN
pages/image/message.png


+ 45 - 43
pages/index/index.js

@@ -3,6 +3,7 @@
 const app = getApp()
 const util = require('../../utils/util.js');
 const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
 Page({
   data: {
@@ -14,36 +15,10 @@ Page({
     data: {},
     grade: "",
     time: "",
-    recommendData: {}
-  },
-  navItemTap: function (e) {
-    //更改navBtnSelectIdx加class
-    let index = e.target.dataset.index;
-    if (index != this.navBtnSelectIdx) {
-      this.setData({ navBtnSelectIdx: index});
-    }
-
-    //点击第几个请求数据
-    let header = {
-      uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
-    }
-    if(index == 1){
-      APIClient.getRecommendSchedule(header).success(res => {
-        console.log(res.data)
-        this.setData({
-          recommendData: res.data.data,
-        })
-      })
-    }
-
-    //移动nav
-    if (index <= 2) {
-      this.setData({ left: 0 });
-    }
-    if(index > 2){
-      this.setData({left: 200 });
-    }
+    oneData: {},
+    share: false,
   },
+  
   lower: function (e) {
     //console.log(e);
     //console.log(e.detail.scrollTop)
@@ -59,24 +34,51 @@ Page({
     // }
   },
 
-  onLoad: function () {
-    //调用应用实例的方法获取全局数据  
-    // app.getUserInfo( userInfo => {
-    //   console.log(userInfo)
-    //   //更新数据  
-    //   this.setData({
-    //     userInfo: userInfo
-    //   })
-    // })
-    let header = {
-      uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
+  onLoad: function (options) {
+    //获取分享过来的值跳转页面
+    const ind  = options.ind;
+    const postsId = options.postId || '';
+    //判断ind的值移动到到艺术
+    if(ind) {
+      this.setData({
+        navBtnSelectIdx: ind
+      })
+      //移动nav
+      if (ind <= 2) {
+        this.setData({ left: 0 });
+      }
+      if(ind > 2){
+        this.setData({left: 200 });
+      }  
     }
-    APIClient.getMySchedule(header).success(res => {
-          this.setData({
+  },
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getMySchedule({
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
           data: res.data.data,
           grade: util.gradeUpper(res.data.data.users.grade),
           time: util.day(res.data.data.timeSpend)
         })
-    })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
   },
+
 })

+ 1 - 0
pages/index/index.json

@@ -1,6 +1,7 @@
 
 {
     "usingComponents": {
+     "tarbar": "/compontents/tarbar/tarbar",
      "curriculum": "/compontents/curriculum/curriculum",
      "recommend": "../recommend/recommend",
      "art": "../art/art"

+ 13 - 16
pages/index/index.wxml

@@ -1,19 +1,10 @@
 <!--index.wxml-->
 <view class="container">
   <!-- 标题 -->
-  <view class="menu">
-    <scroll-view scroll-x="true" class="top-nav" scroll-with-animation="true" scroll-left="{{left}}" >
-        <block wx:for="{{motto}}" wx:for-item="item" wx:key="index" wx:for-index="itemIdx">
-          <view bindtap="navItemTap" class="top-btn {{navBtnSelectIdx == itemIdx ? 'top-hoverd-btn' : ''}}" data-index="{{itemIdx}}">
-            {{item}}              
-            <view class="striping {{navBtnSelectIdx == itemIdx ? 'top-hoverd-striping' : ''}}"></view>
-          </view>
-        </block>
-    </scroll-view>
-  </view>
+  <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true" bindscroll="lower"  scroll-with-animation="true" enable-back-to-top="true">
+      <scroll-view scroll-y="true" bindscroll="lower" scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
           <!-- 我的 -->
           <view class="my {{navBtnSelectIdx == 0 ? '' : 'none'}}">
             <!-- 个人信息 -->
@@ -83,13 +74,19 @@
             </view> -->
           </view>
           <!-- 本周推荐 -->
-          <view class="recommend {{navBtnSelectIdx == 1 ? '' : 'none'}}">
+          <!-- <view class="recommend {{navBtnSelectIdx == 1 ? '' : 'none'}}">
             <recommend recommendData="{{recommendData}}"/>
-          </view>
+          </view> -->
           <!-- 科学艺术 -->
-          <view class="art {{navBtnSelectIdx == 7 ? '' : 'none'}}">
-            <art />
-          </view>
+          <!-- <view class="art {{navBtnSelectIdx == 7 ? '' : 'none'}}">
+            <one wx:if="{{share}}"
+            productionData="{{oneData}}" 
+            title="作品分享"
+            type="2"/>
+            <art wx:else 
+            productionData="{{productionData}}"
+            questionsData="{{questionsData}}"/>
+          </view> -->
       </scroll-view>
   </view>
 </view>

+ 1 - 65
pages/index/index.wxss

@@ -1,78 +1,14 @@
 /**index.wxss**/
-.container {
-  width: 100%;
-  height: 100%;
-  background: #FAF8FB;
-  padding-top:72rpx;
-}
-/*菜单*/
-.menu{
-  position: fixed;
-  top: 0;
-  left: 0;
-  width: 100%;
-  z-index: 99;
-  background: #FAF8FB;
-}
-
-.top-nav{
-    white-space: nowrap;
-}
-
-.top-btn{
-    position: relative;
-    display: inline-block;
-    padding: 12rpx 20rpx;
-    font-size: 36rpx;
-    color: #878787;
-}
-
-.top-hoverd-btn {
-  color: #000;
-}
-
-.striping {
-    position: absolute;
-    left: 50%;
-    bottom: 0;
-    transform: translateX(-50%);
-    width: 26rpx;
-    border-bottom: #000 solid 6rpx;
-    display: none;
-}
-
-.top-hoverd-striping {
-  display: block;
-}
 
 /* 隐藏内容 */
 .none {
   display: none;
 } 
 
-/*个人一些信息*/
-.content {
-  height:100%;
-}
-
-.content scroll-view{
-  height: 100%;
-}
-
-::-webkit-scrollbar{
-  width: 0;
-  height: 0;
-  color: transparent;
-}
-
-.my, 
-.recommend,
-.art {
-  position: relative;
+.my {
   width: 100%;
   padding: 0 15rpx;
   box-sizing: border-box;
-  overflow: hidden;
 }
 
 .message,.medal {

+ 41 - 13
pages/input_content/input_content.js

@@ -3,6 +3,7 @@
 const app = getApp();
 const url = require('../../utils/const.js');
 const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
 const HOST = url.apiUrl;
 
@@ -14,7 +15,8 @@ Page({
   data: {
     tempFilePath: [],
     imgId: [],
-    textValue: ''
+    textValue: '',
+    type: ''
   },
 
   /**
@@ -90,10 +92,7 @@ Page({
   },
   //点击发送
   send: function() {
-    let header = {
-      uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
-    }
-    if(this.data.imgId.length == 0){
+    if(this.data.imgId.length == 0 && this.data.type == 2){
       wx.showModal({
         title: '提示',
         content: '请上传分享的作品',
@@ -106,21 +105,48 @@ Page({
         }
       })
       return false;
-    }
+    } 
     let data = {
       "title": this.data.textValue,
-      "userId": "e7e0d43a-36b1-4e71-a3a3-61469c90d0a2",
-      "type": "1",
+      "type": this.data.type,
       "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
       "columnType": "6",
       "columnNames": "艺术",
-      "imagesStrList": this.data.imgId
     };
-    APIClient.getSendSchedule(header, data).success(res => {
-      console.log(res);
-    })
+    if(this.data.type == 2){
+      data.imagesStrList = this.data.imgId
+    }
+    login.getOpenidSessionKey(function(res) {
+      //console.log(res.data.data.uid);
+      APIClient.getSendSchedule({
+        uid: res.data.data.uid
+      }, data).success(res => {
+        console.log(res)
+        if(res.data.success) {
+          wx.redirectTo({
+            url: '../art/art?ind=7'
+          })
+        }
+      })      
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });
     
   },
+  cancel: function() {
+    wx.navigateBack({ changed: true });
+  },
   /**
    * 图片预览
    */
@@ -145,7 +171,9 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-  
+    this.setData({
+      type: options.type
+    })
   },
 
   /**

+ 7 - 5
pages/input_content/input_content.wxml

@@ -1,14 +1,16 @@
 <!--pages/Input_content/input_content.wxml-->
 <view class="input-content">
     <view class="head">
-        <text>取消</text>
+        <text bindtap="cancel">取消</text>
         <text bindtap="send">发送</text>
     </view>
     <view class="write">
         <input placeholder="写点什么..." bindinput="bindKeyInput" type="text" />
-        <text bindtap="uploading">上传图片</text>
-        <block wx:for="{{tempFilePath}}" wx:key="{{index}}">
-            <image src="{{item }}" bindtap="listenerButtonPreviewImage" data-index="{{index}}" style="width: 100%;"/>
-        </block>
+        <view wx:if="{{type == 2}}">
+            <text bindtap="uploading">上传图片</text>
+            <block wx:for="{{tempFilePath}}" wx:key="{{index}}">
+                <image src="{{item }}" bindtap="listenerButtonPreviewImage" data-index="{{index}}" style="width: 100%;"/>
+            </block>
+        </view>
     </view>
 </view>

+ 95 - 0
pages/language/language.js

@@ -0,0 +1,95 @@
+// pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+  data: {
+    flag: false,
+    productionData: {},
+    questionsData: {},
+  },
+
+  methods: {
+    shareImage: function(e) {
+      console.log(e.target.dataset.flag)
+    }
+  },
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
+    let distinction = (type, success) => {
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
+    };
+    /* 分享 */
+    distinction(2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
+    });
+    /* 答疑 */
+    distinction(1, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
+  },
+})

+ 9 - 0
pages/language/language.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
+    "target": "/compontents/target/target",
+    "chat": "/compontents/chat/chat",
+    "lessonList": "/compontents/lesson_list/lessonList"
+  }
+}

+ 54 - 0
pages/language/language.wxml

@@ -0,0 +1,54 @@
+<!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
+
+            <lessonList/>
+
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
+                </view>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                </view>
+            </view>
+
+            <view>中文</view>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+
+
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
+
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 295 - 0
pages/language/language.wxss

@@ -0,0 +1,295 @@
+/* pages/art/art.wxss */
+
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.material,
+.works,
+.share {
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 20rpx 0;
+  box-sizing: border-box;
+  background: #fff;
+  position: relative;
+}
+
+.this-week {
+    display: flex;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+}
+
+.this-week image {
+  width: 86rpx;
+  height: 86rpx;
+}
+
+.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;
+}
+
+
+/* 预览图片 */
+.material-con {
+    margin-left: 10rpx;
+    padding: 0 25rpx;
+}
+
+.art-img {
+    display: flex;
+    justify-content: space-between;
+    margin-left: 53rpx;
+    font-size: 28rpx;
+    color: #444;
+    margin-top: 30rpx;
+}
+
+/* 分享评论 */
+.works,
+.share {
+    padding: 16rpx 25rpx;
+}
+
+.works .title,
+.share .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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%;
+}
+
+
+.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 {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.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;
+}
+
+.no-con {
+    margin: 50rpx 0 ;
+}
+
+.state {
+    text-align: center;
+    font-size: 24rpx;
+    color: #C0C0C0;
+}
+
+.upload-works {
+    position: relative;
+    width: 212rpx;
+    height: 212rpx;
+    margin: 0 auto;
+}
+
+.work-box {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 212rpx;
+    height: 212rpx;
+}
+
+.uploading-works {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    z-index: 1;
+    width: 67rpx;
+    height: 51rpx;
+    transform: translate(-50%, -50%);
+}
+
+.upload-works text {
+    position: absolute;
+    left: 50%;
+    top: 70%;
+    z-index: 1;
+    font-size: 24rpx;
+    color: #C0C0C0;
+    transform: translate(-50%);
+}
+
+
+
+
+
+ 
+ /* 答疑讨论 */
+ .questions {
+    padding-bottom: 28rpx;
+}
+
+ .questions .head {
+    padding:20rpx 0;
+    position: relative;
+ }
+
+
+.dian {
+     position: absolute;
+     right: 45rpx;
+     top: 40rpx;
+     width: 20rpx;
+     height: 20rpx;
+     border-radius: 50%;
+     background: #FD025F;
+ }
+
+ /* 标题定位到顶部 */
+ .adsorb {
+  position: fixed;
+  left: 0;
+  top: 72rpx;
+}
+
+/* 定位图片 */
+.questions-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 30rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;
+}
+
+.questions-one image {
+    width: 100%;
+    height: 100%;
+}
+
+.upload-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 150rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;   
+}
+
+.upload-one image {
+    width: 100%;
+    height: 100%;
+}

+ 95 - 0
pages/mathematics/mathematics.js

@@ -0,0 +1,95 @@
+// pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+  data: {
+    flag: false,
+    productionData: {},
+    questionsData: {},
+  },
+
+  methods: {
+    shareImage: function(e) {
+      console.log(e.target.dataset.flag)
+    }
+  },
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
+    let distinction = (type, success) => {
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
+    };
+    /* 分享 */
+    distinction(2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
+    });
+    /* 答疑 */
+    distinction(1, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
+  },
+})

+ 9 - 0
pages/mathematics/mathematics.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
+    "target": "/compontents/target/target",
+    "chat": "/compontents/chat/chat",
+    "lessonList": "/compontents/lesson_list/lessonList"
+  }
+}

+ 59 - 0
pages/mathematics/mathematics.wxml

@@ -0,0 +1,59 @@
+<!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
+
+            <lessonList/>
+
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
+                </view>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                </view>
+            </view>
+
+            <view>数学</view>
+            <chat 
+                productionData="{{productionData}}" 
+                title="作品分享"
+                query="分享作品"
+                type="2"/>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+
+
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
+
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 295 - 0
pages/mathematics/mathematics.wxss

@@ -0,0 +1,295 @@
+/* pages/art/art.wxss */
+
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.material,
+.works,
+.share {
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 20rpx 0;
+  box-sizing: border-box;
+  background: #fff;
+  position: relative;
+}
+
+.this-week {
+    display: flex;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+}
+
+.this-week image {
+  width: 86rpx;
+  height: 86rpx;
+}
+
+.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;
+}
+
+
+/* 预览图片 */
+.material-con {
+    margin-left: 10rpx;
+    padding: 0 25rpx;
+}
+
+.art-img {
+    display: flex;
+    justify-content: space-between;
+    margin-left: 53rpx;
+    font-size: 28rpx;
+    color: #444;
+    margin-top: 30rpx;
+}
+
+/* 分享评论 */
+.works,
+.share {
+    padding: 16rpx 25rpx;
+}
+
+.works .title,
+.share .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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%;
+}
+
+
+.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 {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.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;
+}
+
+.no-con {
+    margin: 50rpx 0 ;
+}
+
+.state {
+    text-align: center;
+    font-size: 24rpx;
+    color: #C0C0C0;
+}
+
+.upload-works {
+    position: relative;
+    width: 212rpx;
+    height: 212rpx;
+    margin: 0 auto;
+}
+
+.work-box {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 212rpx;
+    height: 212rpx;
+}
+
+.uploading-works {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    z-index: 1;
+    width: 67rpx;
+    height: 51rpx;
+    transform: translate(-50%, -50%);
+}
+
+.upload-works text {
+    position: absolute;
+    left: 50%;
+    top: 70%;
+    z-index: 1;
+    font-size: 24rpx;
+    color: #C0C0C0;
+    transform: translate(-50%);
+}
+
+
+
+
+
+ 
+ /* 答疑讨论 */
+ .questions {
+    padding-bottom: 28rpx;
+}
+
+ .questions .head {
+    padding:20rpx 0;
+    position: relative;
+ }
+
+
+.dian {
+     position: absolute;
+     right: 45rpx;
+     top: 40rpx;
+     width: 20rpx;
+     height: 20rpx;
+     border-radius: 50%;
+     background: #FD025F;
+ }
+
+ /* 标题定位到顶部 */
+ .adsorb {
+  position: fixed;
+  left: 0;
+  top: 72rpx;
+}
+
+/* 定位图片 */
+.questions-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 30rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;
+}
+
+.questions-one image {
+    width: 100%;
+    height: 100%;
+}
+
+.upload-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 150rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;   
+}
+
+.upload-one image {
+    width: 100%;
+    height: 100%;
+}

+ 36 - 24
pages/recommend/recommend.js

@@ -1,30 +1,42 @@
-// pages/recommend/recommend.js
-Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    recommendData: {
-      type: Object,
-      value: {}
-    }
-  },
+//获取应用实例
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
 
-  /**
-   * 组件的初始数据
-   */
+Page({
   data: {
-    imgUrls: [
-      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
-      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
-      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
-    ]
+    recommendData: {},
   },
 
-  /**
-   * 组件的方法列表
-   */
-  methods: {
+  onLoad: function (options) {
     
-  }
+  },
+
+  onShow: function () {
+    login.getOpenidSessionKey(res => {
+      APIClient.getRecommendSchedule({
+        uid: res.data.data.uid
+      }).success(res => {
+        //console.log(res.data)
+        this.setData({
+          recommendData: res.data.data,
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });
+  },
+  
 })

+ 1 - 0
pages/recommend/recommend.json

@@ -1,6 +1,7 @@
 {
   "component": true,
   "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",    
     "target": "/compontents/target/target"
   }
 }

+ 55 - 44
pages/recommend/recommend.wxml

@@ -1,49 +1,60 @@
 <!--pages/recommend/recommend.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar" />
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="recommend">
+            <!-- 本周推荐 -->
+            <target wxObjectives="{{recommendData.weekPageThemeConfig.wxObjectives}}"/>
 
-<target wxObjectives="{{recommendData.weekPageThemeConfig.wxObjectives}}"/>
-
-<view class="recommend-exchange">
-    <view class="auto-img">
-        <swiper indicator-dots="{{indicatorDots}}"
-        autoplay="true"  duration="1000" circular="true" indicator-dots="true">
-        <block wx:for="{{recommendData.weekStory.autoImageVOList}}" wx:key="{{index}}">
-            <swiper-item>
-            <image src="{{item.img}}"/>
-            </swiper-item>
-        </block>
-        </swiper>
-    </view>
-    <view class="exchange-medal">
-        <view class="this-week">
-            <image src="{{recommendData.weekMetals.img}}"></image>
-            <view class="medal-name">
-                <text>本周勋章“{{recommendData.weekMetals.name}}”</text>
-                <text class="{{recommendData.userDiamond >= 7 ? 'none' : ''}}">还差{{7 - recommendData.userDiamond}}个宝石即可兑换</text>
+            <view class="recommend-exchange">
+                <view class="auto-img">
+                    <swiper indicator-dots="{{indicatorDots}}"
+                    autoplay="true"  duration="1000" circular="true" indicator-dots="true">
+                    <block wx:for="{{recommendData.weekStory.autoImageVOList}}" wx:key="{{index}}">
+                        <swiper-item>
+                        <image src="{{item.img}}"/>
+                        </swiper-item>
+                    </block>
+                    </swiper>
+                </view>
+                <view class="exchange-medal">
+                    <view class="this-week">
+                        <image src="{{recommendData.weekMetals.img}}"></image>
+                        <view class="medal-name">
+                            <text>本周勋章“{{recommendData.weekMetals.name}}”</text>
+                            <text class="{{recommendData.userDiamond >= 7 ? 'none' : ''}}">还差{{7 - recommendData.userDiamond}}个宝石即可兑换</text>
+                        </view>
+                    </view>
+                </view>
+                <view class="get-gem">
+                    <text>本宝石获取方法</text>
+                    <text>学习完每门课程,并与XXXPK成功获取</text>
+                </view>
+                <view class="get-medal">
+                    <text>勋章获取方法</text>
+                    <text>1,{{recommendData.weekPageThemeConfig.metalsStrategy}}</text>
+                    <text>2,学习完每门课程,获取宝石</text>
+                    <text>3,学习完每门课程,获取宝石</text>
+                </view>
             </view>
-        </view>
-    </view>
-    <view class="get-gem">
-        <text>本宝石获取方法</text>
-        <text>学习完每门课程,并与XXXPK成功获取</text>
-    </view>
-    <view class="get-medal">
-        <text>勋章获取方法</text>
-        <text>1,{{recommendData.weekPageThemeConfig.metalsStrategy}}</text>
-        <text>2,学习完每门课程,获取宝石</text>
-        <text>3,学习完每门课程,获取宝石</text>
-    </view>
-</view>
 
-<view class="recommend-strategy">
-    <view class="this-week">
-        <image src="../image/strategy.png"></image>
-        <view class="medal-name">
-            <text>春季攻略</text>
-            <text>春季剧情即将开始</text>
-        </view>
-    </view>
-    <view class="strategy-con">
-        <view>春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽</view>
-        <text class="unfold">展开</text>
-    </view>
+            <view class="recommend-strategy">
+                <view class="this-week">
+                    <image src="../image/strategy.png"></image>
+                    <view class="medal-name">
+                        <text>春季攻略</text>
+                        <text>春季剧情即将开始</text>
+                    </view>
+                </view>
+                <view class="strategy-con">
+                    <view>春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽春季攻略,怎样打败怪兽</view>
+                    <text class="unfold">展开</text>
+                </view>
+            </view>
+        </view> 
+      </scroll-view>
+  </view>
 </view>

+ 7 - 0
pages/recommend/recommend.wxss

@@ -1,5 +1,12 @@
 /* pages/recommend/recommend.wxss */
 
+
+.recommend {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
 .unfold {
     position: absolute;
     right: 28rpx;

+ 95 - 0
pages/science/science.js

@@ -0,0 +1,95 @@
+// pages/art/art.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+  data: {
+    flag: false,
+    productionData: {},
+    questionsData: {},
+  },
+
+  methods: {
+    shareImage: function(e) {
+      console.log(e.target.dataset.flag)
+    }
+  },
+
+  onLoad: function (options) {
+    //分享按钮
+    wx.showShareMenu({
+      withShareTicket: true
+    })
+  },
+
+  onShow: function () {
+    /* 区分答疑和分享 */
+    let distinction = (type, success) => {
+      login.getOpenidSessionKey(function(res) {
+        //console.log(res.data.data.uid);
+        APIClient.getProductionSchedule({
+          uid: res.data.data.uid
+        }, {
+          "type": type,
+          "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
+          "pageNo": 1,
+          "pageSize": 6
+        }).success(success)
+      }, function() {
+        wx.showModal({
+          title: '提示',
+          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+          showCancel: false,
+          success: function (res) {
+            if (res.confirm) {
+              console.log('用户点击确定')
+            } else if (res.cancel) {
+              console.log('用户点击取消')
+            }
+          }
+        })
+      });
+    };
+    /* 分享 */
+    distinction(2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data,
+        })
+      }
+      
+    });
+    /* 答疑 */
+    distinction(1, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          questionsData: res.data.data,
+        })
+      }
+    });
+  },
+  /* 转发*/
+  onShareAppMessage: function (ops) {
+    if (ops.from === 'button') {
+      // 来自页面内转发按钮
+      console.log(ops.target)
+    }
+    const postId = ops.target.dataset.postid;
+    return {
+      title: '小学王者班',
+      path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      success: function (res) {
+        // 转发成功
+        console.log("转发成功:" + JSON.stringify(res));
+      },
+      fail: function (res) {
+        // 转发失败
+        console.log("转发失败:" + JSON.stringify(res));
+      }
+    }
+  },
+})

+ 9 - 0
pages/science/science.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "tarbar": "/compontents/tarbar/tarbar",  
+    "target": "/compontents/target/target",
+    "chat": "/compontents/chat/chat",
+    "lessonList": "/compontents/lesson_list/lessonList"
+  }
+}

+ 59 - 0
pages/science/science.wxml

@@ -0,0 +1,59 @@
+<!--pages/art/art.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+          <!-- 科学艺术 -->
+          <view class="art">
+            <target/>
+
+            <lessonList/>
+
+            <view class="material">
+                <view class="this-week">
+                    <image src="../image/study.png"></image>
+                    <view class="lesson-name">
+                        <text>学习资料</text>
+                        <text>本周和历史学习资料</text>
+                    </view>
+                </view>
+                <view class="material-con">
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                    <view class="art-img">
+                        <text>钻石戒指</text>
+                        <text>点击预览</text>
+                    </view>
+                </view>
+            </view>
+
+            <view>科学</view>
+            <chat 
+                productionData="{{productionData}}" 
+                title="作品分享"
+                query="分享作品"
+                type="2"/>
+
+            <chat 
+                productionData="{{questionsData}}" 
+                title="答疑讨论"
+                query="我有疑问"
+                type="1"/>
+
+
+            <view class="questions-one">
+                <image src="../image/q_discuss.png" ></image>
+            </view>
+
+            <view class="upload-one">
+            <image src="../image/works.png" ></image>
+            </view> 
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 295 - 0
pages/science/science.wxss

@@ -0,0 +1,295 @@
+/* pages/art/art.wxss */
+
+.art {
+  width: 100%;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+}
+
+.material,
+.works,
+.share {
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 20rpx 0;
+  box-sizing: border-box;
+  background: #fff;
+  position: relative;
+}
+
+.this-week {
+    display: flex;
+    padding: 0 25rpx;
+    box-sizing: border-box;
+}
+
+.this-week image {
+  width: 86rpx;
+  height: 86rpx;
+}
+
+.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;
+}
+
+
+/* 预览图片 */
+.material-con {
+    margin-left: 10rpx;
+    padding: 0 25rpx;
+}
+
+.art-img {
+    display: flex;
+    justify-content: space-between;
+    margin-left: 53rpx;
+    font-size: 28rpx;
+    color: #444;
+    margin-top: 30rpx;
+}
+
+/* 分享评论 */
+.works,
+.share {
+    padding: 16rpx 25rpx;
+}
+
+.works .title,
+.share .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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%;
+}
+
+
+.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 {
+    position: absolute;
+    right: 0;
+    top: 20rpx;
+    height: 19rpx;
+    width: 19rpx;
+}
+
+.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;
+}
+
+.no-con {
+    margin: 50rpx 0 ;
+}
+
+.state {
+    text-align: center;
+    font-size: 24rpx;
+    color: #C0C0C0;
+}
+
+.upload-works {
+    position: relative;
+    width: 212rpx;
+    height: 212rpx;
+    margin: 0 auto;
+}
+
+.work-box {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 212rpx;
+    height: 212rpx;
+}
+
+.uploading-works {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    z-index: 1;
+    width: 67rpx;
+    height: 51rpx;
+    transform: translate(-50%, -50%);
+}
+
+.upload-works text {
+    position: absolute;
+    left: 50%;
+    top: 70%;
+    z-index: 1;
+    font-size: 24rpx;
+    color: #C0C0C0;
+    transform: translate(-50%);
+}
+
+
+
+
+
+ 
+ /* 答疑讨论 */
+ .questions {
+    padding-bottom: 28rpx;
+}
+
+ .questions .head {
+    padding:20rpx 0;
+    position: relative;
+ }
+
+
+.dian {
+     position: absolute;
+     right: 45rpx;
+     top: 40rpx;
+     width: 20rpx;
+     height: 20rpx;
+     border-radius: 50%;
+     background: #FD025F;
+ }
+
+ /* 标题定位到顶部 */
+ .adsorb {
+  position: fixed;
+  left: 0;
+  top: 72rpx;
+}
+
+/* 定位图片 */
+.questions-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 30rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;
+}
+
+.questions-one image {
+    width: 100%;
+    height: 100%;
+}
+
+.upload-one {
+    position: fixed;
+    right: 20rpx;
+    bottom: 150rpx;
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50%;   
+}
+
+.upload-one image {
+    width: 100%;
+    height: 100%;
+}

+ 77 - 0
pages/transmit/transmit.js

@@ -0,0 +1,77 @@
+// pages/transmit/transmit.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: {}
+  },
+
+  methods: {
+    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')
+          }
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    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 () {
+      
+  },
+})

+ 8 - 0
pages/transmit/transmit.json

@@ -0,0 +1,8 @@
+{
+    "component": true,
+    "usingComponents": {
+      "discuss": "/compontents/discuss/discuss",
+      "share": "/compontents/share/share",
+      "tarbar": "/compontents/tarbar/tarbar"
+    }
+  }

+ 52 - 0
pages/transmit/transmit.wxml

@@ -0,0 +1,52 @@
+<!--pages/transmit/transmit.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <tarbar id="tarbar"/>
+  <!-- 内容 -->
+  <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="title">
+                    <image src="../../pages/image/xing.png" class="xing"></image>
+                    <text class="">分享作品</text>
+                    <image src="../../pages/image/xing.png" class="xing"></image>
+                </view>
+                <view class="share-con" wx:key="{{index}}">
+                    <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>
+                            <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>
+                    <discuss discussData="{{productionData.replyList}}" uid="{{productionData.userId}}" postsId="{{productionData.id}}" id="discuss" type="{{2}}"/>
+                </view>
+            </view>            
+          </view>
+      </scroll-view>
+  </view>
+</view>
+

+ 171 - 0
pages/transmit/transmit.wxss

@@ -0,0 +1,171 @@
+/* pages/transmit/transmit.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;
+}
+
+.works .title {
+    position:relative;
+    width: 100%;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    border-bottom: 2rpx #878787 solid;
+    padding-bottom: 16rpx;
+    background: #fff;
+}
+
+.xing {
+    width: 20rpx;
+    height: 20rpx;
+    margin: 0 10rpx;
+}
+
+.uploading {
+    position: absolute;
+    right: 0;
+    top: 10rpx;
+    font-size: 24rpx;
+}
+
+.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;
+}

+ 10 - 2
project.config.json

@@ -10,7 +10,7 @@
 	"compileType": "miniprogram",
 	"libVersion": "1.6.6",
 	"appid": "wx7b5ea6422847ea64",
-	"projectname": "%E5%B0%8F%E5%AD%A6%E7%8E%8B%E8%80%85%E7%8F%AD",
+	"projectname": "%E5%B0%8F%E5%AD%A6%E7%8E%8B%E8%80%85%E7%8F%AD(2)",
 	"condition": {
 		"search": {
 			"current": -1,
@@ -22,7 +22,15 @@
 		},
 		"miniprogram": {
 			"current": -1,
-			"list": []
+			"list": [
+				{
+					"id": -1,
+					"name": "分享",
+					"pathName": "pages/index/index",
+					"query": "postId=\"293092b5-9a08-42e8-aaec-059403c9d0d6\"",
+					"scene": "1001"
+				}
+			]
 		}
 	}
 }

+ 11 - 2
utils/APIClient.js

@@ -7,7 +7,6 @@ function genAPIUrl(action) {
 	return HOST + action;
 }
 
-
 module.exports = {
     // 获取我的data
 	getMySchedule(header) {
@@ -26,7 +25,7 @@ module.exports = {
 	},
 	//获取分享作品list
 	getProductionSchedule(header, data) {
-		let url = genAPIUrl('wx/posts/findPostsReplyList');
+		let url = genAPIUrl('wx/posts/reply');
 		return request.getInstance().url(url).header(header).data(data).method('GET').send();
 	},
 	//保存评论
@@ -34,4 +33,14 @@ module.exports = {
 		let url = genAPIUrl('wx/reply');
 		return request.getInstance().url(url).header(header).data(data).method('POST').send();
 	},
+	//分享查询单条
+	getOneSchedule(header, data) {
+		let url = genAPIUrl('wx/posts/one');
+		return request.getInstance().url(url).header(header).data(data).method('GET').send();
+	},
+	//各个科目信息
+	getEachSchedule(header, data) {
+		let url = genAPIUrl('wx/course');
+		return request.getInstance().url(url).header(header).data(data).method('GET').send();
+	}
 }

+ 77 - 0
utils/loginSchedule.js

@@ -0,0 +1,77 @@
+const request = require('./WXHttpRequest.js');
+const url = require('./const.js');
+
+const HOST = url.apiUrl;
+
+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/ucenter/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) {
+    wxLogin(function(res) {
+        //console.log('获取sessionKey等内容'+JSON.stringify(res.data));
+        let sessionKey = res.data.session_key;
+        //登录
+        getLoginSchedule(sessionKey, successcallback, failcallback);
+    },function(res) {
+        failcallback(res);
+    })    
+}
+
+//登录
+function getLoginSchedule(sessionKey, successcallback, failcallback) {
+    //获取个人信息
+    wx.getUserInfo({
+        success: function (res) {
+            let userInfo = res.userInfo
+            let url = genAPIUrl('wx/ucenter/user/loginRegist');
+            const userData = {
+                encryptedData: res.encryptedData,
+                sessionKey: sessionKey,
+                iv: res.iv,
+                dist: '1133',
+                headimgurl: userInfo.avatarUrl
+            }          
+            request.getInstance().url(url).data(userData).method('GET').send().success(res => {
+                wx.hideToast()
+                wx.showToast({
+                    title: '登录成功',
+                    icon: 'success',
+                    duration: 1500
+                })
+                wx.setStorageSync('uid', res.data.data.uid)
+                successcallback(res)
+            });
+        },
+        fail: function(res) {
+            failcallback(res)
+        }
+    })
+    
+}
+
+module.exports = {
+    getOpenidSessionKey
+}

+ 16 - 1
utils/util.js

@@ -41,8 +41,23 @@ const day = msd => {
   return time;          
 }
 
+//获取当前页面传的的值
+
+function getUrl() {
+  var pages = getCurrentPages()    //获取加载的页面
+  
+  var currentPage = pages[pages.length-1]    //获取当前页面的对象
+  
+  var url = currentPage.route    //当前页面url
+  
+  var options = currentPage.options    //如果要获取url中所带的参数可以查看options
+
+  return options
+}
+
 module.exports = {
   formatTime: formatTime,
   gradeUpper,
-  day
+  day,
+  getUrl
 }