Selaa lähdekoodia

新增排名页面

Limengbo 6 vuotta sitten
vanhempi
commit
c83b551635
48 muutettua tiedostoa jossa 1138 lisäystä ja 28 poistoa
  1. 6 1
      app.json
  2. 63 0
      compontents/rank-tarbar/rank-tarbar.js
  3. 4 0
      compontents/rank-tarbar/rank-tarbar.json
  4. 12 0
      compontents/rank-tarbar/rank-tarbar.wxml
  5. 42 0
      compontents/rank-tarbar/rank-tarbar.wxss
  6. 42 0
      compontents/ranking/ranking.js
  7. 4 0
      compontents/ranking/ranking.json
  8. 42 0
      compontents/ranking/ranking.wxml
  9. 152 0
      compontents/ranking/ranking.wxss
  10. 100 0
      pages/accuracy_rank/accuracy_rank.js
  11. 6 0
      pages/accuracy_rank/accuracy_rank.json
  12. 18 0
      pages/accuracy_rank/accuracy_rank.wxml
  13. 7 0
      pages/accuracy_rank/accuracy_rank.wxss
  14. 1 1
      pages/art/art.wxml
  15. 0 4
      pages/chinese/chinese.wxml
  16. 100 0
      pages/competition/competition.js
  17. 6 0
      pages/competition/competition.json
  18. 18 0
      pages/competition/competition.wxml
  19. 7 0
      pages/competition/competition.wxss
  20. 0 4
      pages/english/english.wxml
  21. 100 0
      pages/grade_rank/grade_rank.js
  22. 6 0
      pages/grade_rank/grade_rank.json
  23. 17 0
      pages/grade_rank/grade_rank.wxml
  24. 7 0
      pages/grade_rank/grade_rank.wxss
  25. BIN
      pages/image/add.png
  26. BIN
      pages/image/bg_1.png
  27. BIN
      pages/image/bg_2.png
  28. BIN
      pages/image/bg_3.png
  29. BIN
      pages/image/q_discuss.png
  30. BIN
      pages/image/works.png
  31. 37 2
      pages/index/index.wxml
  32. 34 2
      pages/index/index.wxss
  33. 13 3
      pages/input_content/input_content.js
  34. 0 1
      pages/input_content/input_content.json
  35. 1 1
      pages/input_content/input_content.wxml
  36. 6 0
      pages/input_content/input_content.wxss
  37. 0 4
      pages/language/language.wxml
  38. 0 4
      pages/mathematics/mathematics.wxml
  39. 100 0
      pages/medal_rank/medal_rank.js
  40. 6 0
      pages/medal_rank/medal_rank.json
  41. 18 0
      pages/medal_rank/medal_rank.wxml
  42. 7 0
      pages/medal_rank/medal_rank.wxss
  43. 100 0
      pages/quantity_rank/quantity_rank.js
  44. 6 0
      pages/quantity_rank/quantity_rank.json
  45. 18 0
      pages/quantity_rank/quantity_rank.wxml
  46. 7 0
      pages/quantity_rank/quantity_rank.wxss
  47. 5 0
      utils/APIClient.js
  48. 20 1
      utils/util.js

+ 6 - 1
app.json

@@ -10,7 +10,12 @@
     "pages/science/science",
     "pages/art/art",
     "pages/input_content/input_content",
-    "pages/transmit/transmit"
+    "pages/transmit/transmit",
+    "pages/competition/competition",
+    "pages/medal_rank/medal_rank",
+    "pages/grade_rank/grade_rank",
+    "pages/quantity_rank/quantity_rank",
+    "pages/accuracy_rank/accuracy_rank"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 63 - 0
compontents/rank-tarbar/rank-tarbar.js

@@ -0,0 +1,63 @@
+// compontents/tarbar/tarbar.js
+const util = require('../../utils/util.js');
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    motto: ['好友数','勋章数','等级','答题量','准确率'],
+    navBtnSelectIdx: 0,
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    navItemTap: function (e) {
+      //更改navBtnSelectIdx加class   
+      let index = e.target.dataset.index;
+      if (index != this.navBtnSelectIdx) {
+        this.setData({ navBtnSelectIdx: index});
+      }
+      if(index == 0) {
+        wx.redirectTo({
+          url: '../competition/competition?ind=0'
+        })
+      }
+      if(index == 1) {
+        wx.redirectTo({
+          url: '../medal_rank/medal_rank?ind=1'
+        })
+      }
+      if(index == 2) {
+        wx.redirectTo({
+          url: '../grade_rank/grade_rank?ind=2'
+        })
+      }
+      if(index == 3) {
+        wx.redirectTo({
+          url: '../quantity_rank/quantity_rank?ind=3'
+        })
+      }
+      if(index == 4) {
+        wx.redirectTo({
+          url: '../accuracy_rank/accuracy_rank?ind=4'
+        })
+      }
+    }
+  },
+  ready() {
+    let options = util.getUrl();
+    console.log(options)
+    if(options.ind) {
+      this.setData({ navBtnSelectIdx: options.ind});
+    }
+  }
+})

+ 4 - 0
compontents/rank-tarbar/rank-tarbar.json

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

+ 12 - 0
compontents/rank-tarbar/rank-tarbar.wxml

@@ -0,0 +1,12 @@
+<view class="menu">
+    <scroll-view scroll-x="true" class="top-nav">
+      <view class="nav">
+        <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>
+      </view>
+    </scroll-view>
+</view>

+ 42 - 0
compontents/rank-tarbar/rank-tarbar.wxss

@@ -0,0 +1,42 @@
+/* compontents/tarbar/tarbar.wxss */
+/*菜单*/
+.menu{
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  z-index: 99;
+  background: #FAF8FB;
+}
+
+.nav{
+    display: flex;
+    padding: 16rpx 0;
+}
+
+.top-btn{
+    flex: 1;
+    padding-bottom: 9rpx;
+    text-align: center;
+    position: relative;
+    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;
+}

+ 42 - 0
compontents/ranking/ranking.js

@@ -0,0 +1,42 @@
+// compontents/ranking/ranking.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    friendsData: {
+      type: Array,
+      value: []
+    },
+    friendsThreeData: {
+      type: Array,
+      value: []      
+    },
+    myData: {
+      type: Object,
+      value: {}  
+    },
+    str: {
+      type: String,
+      value: ''
+    },
+    title: {
+      type: String,
+      value: ''
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 4 - 0
compontents/ranking/ranking.json

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

+ 42 - 0
compontents/ranking/ranking.wxml

@@ -0,0 +1,42 @@
+<!--compontents/ranking/ranking.wxml-->
+<view class="ranking">
+    <view class="title">
+        <text>{{title}}</text>
+    </view>
+    <view class="my-rank">
+        <view class="head-rank" wx:for="{{friendsThreeData}}" wx:key="{{index}}">
+            <image src="{{item.users.headImgUrl}}" class="big-head-img"></image>
+            <view class="head">
+                <image src="../../pages/image/bg_{{item.rank}}.png" class="bg"></image>
+            </view>
+            <view class="txt">
+                <text class="name">{{item.users.wechatName}}</text>
+                <text wx:if="{{myData.exp >= 0}}" class="medal-num">LV{{item.number}}({{item.exp}})</text>
+                <text wx:else class="medal-num">{{item.number}}{{str}}</text>     
+            </view>      
+        </view>
+    </view>
+    <view class="rank-list">
+        <view class="rank-friend" wx:for="{{friendsData}}" wx:key="{{index}}">
+            <view class="rank-head">
+                <text>{{item.rank}}</text>
+                <image src="{{item.users.headImgUrl}}" class="head-img"></image>
+                <text>{{item.users.wechatName}}</text>
+            </view>
+            <text wx:if="{{myData.exp >= 0}}" class="medal-num">LV{{item.number}}({{item.exp}})</text>
+            <text wx:else class="medal-num">{{item.number}}{{str}}</text>
+        </view> 
+    </view>
+    <view class="my-rank-list">
+        <view class="rank-head">
+            <text>{{myData.rank}}</text>
+            <image src="{{myData.users.headImgUrl}}" class="head-img"></image>
+            <text>{{myData.users.wechatName}}</text>
+        </view>
+        <text wx:if="{{myData.exp >= 0}}" class="medal-num" style="color: #5b82fa">LV{{myData.number}}({{myData.exp}})</text>
+        <text wx:else class="medal-num" style="color: #5b82fa">{{myData.number}}{{str}}</text>
+    </view> 
+    <view class="particular">
+        查看更多
+    </view>
+</view>

+ 152 - 0
compontents/ranking/ranking.wxss

@@ -0,0 +1,152 @@
+/* compontents/ranking/ranking.wxss */
+.ranking {
+  position: relative;
+  width: 100%;
+  margin: 20rpx 0;
+  border-radius: 25rpx;
+  padding: 28rpx 28rpx 80rpx 28rpx;
+  box-sizing: border-box;
+  background: #fff;
+}
+
+.ranking .title text{
+  font-size: 36rpx;
+  font-weight: 600;
+}
+
+.my-rank {
+    position: relative;
+    height: 266rpx;
+}
+
+.head-rank {
+    text-align: center;
+}
+
+.my-rank .head-rank:nth-child(1) {
+    position: absolute;
+    left: 120rpx;
+    top: 0rpx;
+    width: 116rpx;
+}
+
+.my-rank .head-rank:nth-child(2) {
+    position: absolute;
+    left: 295rpx;
+    top: 0rpx;
+    width: 136rpx;
+}
+
+.my-rank .head-rank:nth-child(3) {
+    position: absolute;
+    left: 485rpx;
+    top: 0rpx;
+    width: 116rpx;
+}
+
+.my-rank .head-rank:nth-child(even) .head{
+    position: absolute;
+    left: 0;
+    top: 0;
+    z-index: 9;
+    width: 136rpx;
+    height: 200rpx;
+}
+
+.my-rank .head-rank:nth-child(odd) .head{
+    position: absolute;
+    left: 0;
+    top: 30rpx;
+    z-index: 9;
+    width: 116rpx;
+    height: 172rpx;
+}
+
+.bg {
+    width: 100%;
+    height: 100%;
+}
+
+
+.my-rank .head-rank:nth-child(even) .big-head-img{
+    position: absolute;
+    left: 5rpx;
+    top: 55rpx;
+    border-radius: 50%;
+    width: 130rpx;
+    height: 130rpx;
+}
+
+.my-rank .head-rank:nth-child(odd) .big-head-img{
+    position: absolute;
+    left: 2rpx;
+    top: 75rpx;
+    border-radius: 50%;
+    width: 112rpx;
+    height: 112rpx;
+}
+
+.txt {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-top: 200rpx;
+}
+
+.name {
+    font-size: 24rpx;
+}
+
+.medal-num {
+    font-size: 24rpx;
+    color: #aaa;
+}
+
+/* 勋章列表*/
+.rank-list {
+    margin-top: 20rpx;
+}
+
+.rank-friend {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    height: 78rpx;
+    padding: 0 20rpx;
+    border-top: 2rpx solid #ccc;
+}
+
+.rank-head {
+    display: flex;
+    align-items: center;  
+}
+
+.head-img {
+    width: 60rpx;
+    height: 60rpx;
+    border-radius: 50%;
+    margin: 0 22rpx 0 38rpx;
+}
+
+.rank-head text {
+    font-size: 28rpx;
+}
+
+/* 我自己排名 */
+.my-rank-list {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    height: 78rpx;
+    padding: 0 20rpx;
+    background: #E1E9FE;
+}
+
+/*查看更多*/
+.particular {
+  position: absolute;
+  right: 30rpx;
+  bottom: 30rpx;
+  color: #5E86F8;
+  font-size: 28rpx;
+}

+ 100 - 0
pages/accuracy_rank/accuracy_rank.js

@@ -0,0 +1,100 @@
+// pages/competition/competition.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    friendsData: {},
+    friendsThreeData: {},
+    myData: {}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '好友比一比'
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getFriendSchedule('wx/friendsRank/questionCorrect', {
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
+          friendsThreeData: util.topThree(res.data.data.rankVoList),
+          friendsData: res.data.data.rankVoList.slice(3,),
+          myData: res.data.data
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/accuracy_rank/accuracy_rank.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "rank-tarbar": "/compontents/rank-tarbar/rank-tarbar",
+        "ranking": "/compontents/ranking/ranking"
+       }
+}

+ 18 - 0
pages/accuracy_rank/accuracy_rank.wxml

@@ -0,0 +1,18 @@
+<!--pages/competition/competition.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <rank-tarbar/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="my-friend-rank">
+            <ranking
+            friendsData="{{friendsData}}"
+            friendsThreeData="{{friendsThreeData}}"
+            myData="{{myData}}"
+            str="%"
+            title="准确率"/>
+        </view>
+      </scroll-view>
+  </view>
+</view>

+ 7 - 0
pages/accuracy_rank/accuracy_rank.wxss

@@ -0,0 +1,7 @@
+/* pages/competition/competition.wxss */
+
+.my-friend-rank {
+    width:100%;
+    padding:0 15rpx;
+    box-sizing:border-box;
+}

+ 1 - 1
pages/art/art.wxml

@@ -38,7 +38,7 @@
             </view>
 
             <view class="upload-one">
-            <image src="../image/works.png" ></image>
+                <image src="../image/works.png" ></image>
             </view> 
           </view>
       </scroll-view>

+ 0 - 4
pages/chinese/chinese.wxml

@@ -24,10 +24,6 @@
             <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>

+ 100 - 0
pages/competition/competition.js

@@ -0,0 +1,100 @@
+// pages/competition/competition.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    friendsData: {},
+    friendsThreeData: {},
+    myData: {}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '好友比一比'
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getFriendSchedule('wx/friendsRank/friends', {
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
+          friendsThreeData: util.topThree(res.data.data.friendsRankVoList),
+          friendsData: res.data.data.friendsRankVoList.slice(3,),
+          myData: res.data.data
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/competition/competition.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "rank-tarbar": "/compontents/rank-tarbar/rank-tarbar",
+        "ranking": "/compontents/ranking/ranking"
+       }
+}

+ 18 - 0
pages/competition/competition.wxml

@@ -0,0 +1,18 @@
+<!--pages/competition/competition.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <rank-tarbar/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="my-friend-rank">
+            <ranking
+            friendsData="{{friendsData}}"
+            friendsThreeData="{{friendsThreeData}}"
+            myData="{{myData}}"
+            str="位好友"
+            title="好友数排名"/>
+        </view>
+      </scroll-view>
+  </view>
+</view>

+ 7 - 0
pages/competition/competition.wxss

@@ -0,0 +1,7 @@
+/* pages/competition/competition.wxss */
+
+.my-friend-rank {
+    width:100%;
+    padding:0 15rpx;
+    box-sizing:border-box;
+}

+ 0 - 4
pages/english/english.wxml

@@ -24,10 +24,6 @@
             <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>

+ 100 - 0
pages/grade_rank/grade_rank.js

@@ -0,0 +1,100 @@
+// pages/competition/competition.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    friendsData: {},
+    friendsThreeData: {},
+    myData: {}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '好友比一比'
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getFriendSchedule('wx/friendsRank/exp', {
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
+          friendsThreeData: util.topThree(res.data.data.expRankVoList),
+          friendsData: res.data.data.expRankVoList.slice(3,),
+          myData: res.data.data
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/grade_rank/grade_rank.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "rank-tarbar": "/compontents/rank-tarbar/rank-tarbar",
+        "ranking": "/compontents/ranking/ranking"
+       }
+}

+ 17 - 0
pages/grade_rank/grade_rank.wxml

@@ -0,0 +1,17 @@
+<!--pages/competition/competition.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <rank-tarbar/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="my-friend-rank">
+            <ranking
+            friendsData="{{friendsData}}"
+            friendsThreeData="{{friendsThreeData}}"
+            myData="{{myData}}"
+            title="等级排名"/>
+        </view>
+      </scroll-view>
+  </view>
+</view>

+ 7 - 0
pages/grade_rank/grade_rank.wxss

@@ -0,0 +1,7 @@
+/* pages/competition/competition.wxss */
+
+.my-friend-rank {
+    width:100%;
+    padding:0 15rpx;
+    box-sizing:border-box;
+}

BIN
pages/image/add.png


BIN
pages/image/bg_1.png


BIN
pages/image/bg_2.png


BIN
pages/image/bg_3.png


BIN
pages/image/q_discuss.png


BIN
pages/image/works.png


+ 37 - 2
pages/index/index.wxml

@@ -15,7 +15,7 @@
                   <view class='left'>
                     <view class="name">
                       {{data.users.wechatName}}
-                      <text class='LV'>LV.{{data.level}}</text>
+                      <text class='LV'>{{grade}}</text>
                     </view>
                     <view class="student">
                       学号:
@@ -23,7 +23,7 @@
                     </view>
                   </view>
                 </view>
-                <view class='grade'>{{grade}}</view>
+                <view class='grade'>更改昵称</view>
               </view>
               <view class='personal'>
                 <view class="particulars">
@@ -44,6 +44,41 @@
                 </view>
               </view>  
             </view>
+            <!-- 答题 -->
+            <view class="ranking">
+              <view class="title">
+                <text>我的排名</text>
+              </view>
+              <view class="ranking-con">
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+                <view class="rank">
+                  <text>好友数</text>
+                  <text>第九名</text>
+                </view>
+              </view>
+              <view class="particular">
+                <navigator url="../competition/competition" >查看详细排行</navigator>
+              </view>
+            </view>
             <!-- 勋章 -->
             <view class="medal">
               <view class="title">

+ 34 - 2
pages/index/index.wxss

@@ -11,7 +11,9 @@
   box-sizing: border-box;
 }
 
-.message,.medal {
+.message,
+.medal,
+.ranking {
   width: 100%;
   margin: 20rpx 0;
   border-radius: 25rpx;
@@ -63,7 +65,7 @@
 }
 
 .grade {
-  width: 128rpx;
+  width: 146rpx;
   height: 46rpx;
   font-size: 28rpx;
   font-weight: bolder;
@@ -85,6 +87,36 @@
   flex-direction: column;
   text-align: center;
 }
+
+/*排名*/
+.ranking {
+  position: relative;
+}
+
+.ranking .title text{
+  font-size: 36rpx;
+  font-weight: 600;
+}
+
+.ranking-con {
+  margin-bottom: 70rpx;
+}
+
+.rank {
+  display: flex;
+  justify-content: space-between;
+  font-size: 28rpx;
+  margin-top: 30rpx;
+}
+
+.particular {
+  position: absolute;
+  right: 30rpx;
+  bottom: 30rpx;
+  color: #5E86F8;
+  font-size: 28rpx;
+}
+
 /*勋章*/
 .medal {
   padding: 28rpx;

+ 13 - 3
pages/input_content/input_content.js

@@ -178,9 +178,19 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // this.setData({
-    //   type: options.type
-    // })
+    if(options.type == 2) {
+      wx.setNavigationBarTitle({
+        title: '作品分享'
+      })
+    }
+    if(options.type == 1) {
+      wx.setNavigationBarTitle({
+        title: '答疑讨论'
+      })
+    }
+    this.setData({
+      type: options.type
+    })
   },
 
   /**

+ 0 - 1
pages/input_content/input_content.json

@@ -1,3 +1,2 @@
 {
-    "navigationBarTitleText": "作品分享"
   }

+ 1 - 1
pages/input_content/input_content.wxml

@@ -7,7 +7,7 @@
     <view class="write">
         <input placeholder="写点什么..." bindinput="bindKeyInput" type="text" />
         <view wx:if="{{type == 2}}">
-            <text bindtap="uploading">上传图片</text>
+            <image src="../image/add.png" class="add" bindtap="uploading"/>
             <block wx:for="{{tempFilePath}}" wx:key="{{index}}">
                 <image src="{{item }}" bindtap="listenerButtonPreviewImage" data-index="{{index}}" style="width: 100%;"/>
             </block>

+ 6 - 0
pages/input_content/input_content.wxss

@@ -31,3 +31,9 @@
 .write input {
     font-size: 32rpx;
 }
+
+.write .add {
+    width: 126rpx;
+    height: 126rpx;
+    margin-top: 30rpx;
+}

+ 0 - 4
pages/language/language.wxml

@@ -24,10 +24,6 @@
             <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>

+ 0 - 4
pages/mathematics/mathematics.wxml

@@ -24,10 +24,6 @@
             <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>

+ 100 - 0
pages/medal_rank/medal_rank.js

@@ -0,0 +1,100 @@
+// pages/competition/competition.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    friendsData: {},
+    friendsThreeData: {},
+    myData: {}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '好友比一比'
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getFriendSchedule('wx/friendsRank/metals', {
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
+          friendsThreeData: util.topThree(res.data.data.userMetalRankVoList),
+          friendsData: res.data.data.userMetalRankVoList.slice(3,),
+          myData: res.data.data
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/medal_rank/medal_rank.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "rank-tarbar": "/compontents/rank-tarbar/rank-tarbar",
+        "ranking": "/compontents/ranking/ranking"
+       }
+}

+ 18 - 0
pages/medal_rank/medal_rank.wxml

@@ -0,0 +1,18 @@
+<!--pages/competition/competition.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <rank-tarbar/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="my-friend-rank">
+            <ranking
+            friendsData="{{friendsData}}"
+            friendsThreeData="{{friendsThreeData}}"
+            myData="{{myData}}"
+            str="个勋章"
+            title="勋章数排名"/>
+        </view>
+      </scroll-view>
+  </view>
+</view>

+ 7 - 0
pages/medal_rank/medal_rank.wxss

@@ -0,0 +1,7 @@
+/* pages/competition/competition.wxss */
+
+.my-friend-rank {
+    width:100%;
+    padding:0 15rpx;
+    box-sizing:border-box;
+}

+ 100 - 0
pages/quantity_rank/quantity_rank.js

@@ -0,0 +1,100 @@
+// pages/competition/competition.js
+const app = getApp()
+const util = require('../../utils/util.js');
+const APIClient = require('../../utils/APIClient.js');
+const login = require('../../utils/loginSchedule.js');
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    friendsData: {},
+    friendsThreeData: {},
+    myData: {}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: '好友比一比'
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    //登录页信息
+    login.getOpenidSessionKey(res => {
+      APIClient.getFriendSchedule('wx/friendsRank/question', {
+        uid: res.data.data.uid
+      }).success(res => {
+        console.log(res)
+        this.setData({
+          friendsThreeData: util.topThree(res.data.data.rankVoList),
+          friendsData: res.data.data.rankVoList.slice(3,),
+          myData: res.data.data
+        })
+      })
+    }, function() {
+      wx.showModal({
+        title: '提示',
+        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            console.log('用户点击确定')
+          } else if (res.cancel) {
+            console.log('用户点击取消')
+          }
+        }
+      })
+    });  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 6 - 0
pages/quantity_rank/quantity_rank.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "rank-tarbar": "/compontents/rank-tarbar/rank-tarbar",
+        "ranking": "/compontents/ranking/ranking"
+       }
+}

+ 18 - 0
pages/quantity_rank/quantity_rank.wxml

@@ -0,0 +1,18 @@
+<!--pages/competition/competition.wxml-->
+<view class="container">
+  <!-- 标题 -->
+  <rank-tarbar/>
+  <!-- 内容 -->
+  <view class="content">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true">
+        <view class="my-friend-rank">
+            <ranking
+            friendsData="{{friendsData}}"
+            friendsThreeData="{{friendsThreeData}}"
+            myData="{{myData}}"
+            str="题"
+            title="答题量排名"/>
+        </view>
+      </scroll-view>
+  </view>
+</view>

+ 7 - 0
pages/quantity_rank/quantity_rank.wxss

@@ -0,0 +1,7 @@
+/* pages/competition/competition.wxss */
+
+.my-friend-rank {
+    width:100%;
+    padding:0 15rpx;
+    box-sizing:border-box;
+}

+ 5 - 0
utils/APIClient.js

@@ -42,5 +42,10 @@ module.exports = {
 	getEachSchedule(header, data) {
 		let url = genAPIUrl('wx/course');
 		return request.getInstance().url(url).header(header).data(data).method('GET').send();
+	},
+	//各个排名
+	getFriendSchedule(urls, header) {
+		let url = genAPIUrl(urls);
+		return request.getInstance().url(url).header(header).method('GET').send();
 	}
 }

+ 20 - 1
utils/util.js

@@ -114,11 +114,30 @@ function url(columnNum) {
   return url;
 }
 
+//过滤返回回来的数组找出前三名重新排序
+function topThree (arr) {
+  var arr1 = [];
+  for(var item of arr.slice(0,3)){
+      if(item.rank == 2){
+          arr1.unshift(item)
+      }
+      if(item.rank == 1) {
+          arr1.push(item)
+      }
+      if(item.rank == 3) {
+          arr1.push(item)
+      }
+   }
+   return arr1;
+}
+
+
 module.exports = {
   formatTime: formatTime,
   gradeUpper,
   day,
   getUrl,
   column,
-  url
+  url,
+  topThree
 }