Explorar o código

解决所提出的各个问题

Limengbo %!s(int64=6) %!d(string=hai) anos
pai
achega
f7634db3e6

+ 26 - 6
compontents/ranking/ranking.js

@@ -23,6 +23,10 @@ Component({
     title: {
       type: String,
       value: ''
+    },
+    num: {
+      type: Number,
+      value: 0
     }
   },
 
@@ -30,17 +34,33 @@ Component({
    * 组件的初始数据
    */
   data: {
-
+    animationData: {},
   },
 
   /**
    * 组件的方法列表
    */
   methods: {
-    more () {
-      var myEventDetail = {} // detail对象,提供给事件监听函数
-      var myEventOption = {} // 触发事件的选项
-      this.triggerEvent('lookMore', myEventDetail, myEventOption)
-    }
+    more (e) {
+     let height = this.properties.friendsData.length * 80;
+     this.util(height+'rpx')
+    },
+    /* 创建动画并执行 */
+    util (height) {
+      // 创建动画实例   
+      var animation = wx.createAnimation({  
+        duration: 200,  //动画时长  
+        timingFunction: "linear", //线性  
+        delay: 0  //0则不延迟  
+      });
+      
+      this.animation = animation;
+
+      animation.height(height).step();
+
+      this.setData({  
+        animationData: animation.export()  
+      })  
+    },
   }
 })

+ 4 - 4
compontents/ranking/ranking.wxml

@@ -18,10 +18,10 @@
             </view>
         </block>
     </view>
-    <view class="rank-list">
+    <view class="rank-list" animation="{{animationData}}">
         <view class="rank-friend" wx:for="{{friendsData}}" wx:key="{{index}}">
             <view class="rank-head">
-                <text>{{item.rank}}</text>
+                <text class="rank-text">{{item.rank}}</text>
                 <image src="{{item.users.headImgUrl}}" class="head-img"></image>
                 <text>{{item.users.wechatName}}</text>
             </view>
@@ -31,14 +31,14 @@
     </view>
     <view class="my-rank-list">
         <view class="rank-head">
-            <text>{{myData.rank}}</text>
+            <text class="rank-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" bindtap="more">
+    <view class="particular" bindtap="more" data-flag="{{flag}}">
         查看更多
     </view>
 </view>

+ 8 - 1
compontents/ranking/ranking.wxss

@@ -117,7 +117,9 @@
 
 /* 勋章列表*/
 .rank-list {
-    margin-top: 20rpx;
+    height: 560rpx;
+    overflow: hidden;
+    margin-top: 20rpx;  
 }
 
 .rank-friend {
@@ -141,6 +143,11 @@
     margin: 0 22rpx 0 38rpx;
 }
 
+.rank-text {
+    width: 50rpx;
+    text-align: center;
+}
+
 .rank-head text {
     font-size: 28rpx;
 }

+ 1 - 4
pages/competition/competition.js

@@ -14,10 +14,7 @@ Page({
     friendsThreeData: {},
     myData: {}
   },
-  /*点击查看更多*/
-  lookMore: function () {
-    console.log('排名查看更多')
-  },
+
 
   /**
    * 生命周期函数--监听页面加载

+ 1 - 1
pages/competition/competition.wxml

@@ -12,7 +12,7 @@
             myData="{{myData}}"
             str="位好友"
             title="好友数排名"
-            bind:lookMore="lookMore"/>
+            num="0"/>
         </view>
       </scroll-view>
   </view>

+ 2 - 0
pages/recommend/recommend.js

@@ -7,6 +7,7 @@ const login = require('../../utils/loginSchedule.js');
 Page({
   data: {
     recommendData: {},
+    metalsStrategy: [],
     downUp: '展开'    
   },
 
@@ -22,6 +23,7 @@ Page({
         console.log(res.data)
         this.setData({
           recommendData: res.data.data,
+          metalsStrategy:util.strategy(res.data.data.weekPageThemeConfig.metalsStrategy)
         })
       })
     }, function() {

+ 5 - 7
pages/recommend/recommend.wxml

@@ -29,17 +29,15 @@
                         </view>
                     </view>
                 </view>
+                <!--
                 <view class="get-gem">
-                    <text>{{recommendData.weekPageThemeConfig.metalsStrategy}}</text>
+                   
                 </view>
-                <!--
+                -->
                 <view class="get-medal">
-                    <text>勋章获取方法</text>
-                    
-                    <text>2,学习完每门课程,获取宝石</text>
-                    <text>3,学习完每门课程,获取宝石</text>
+                    <text wx:for="{{metalsStrategy}}" wx:key="{{index}}">{{item}}</text>
                 </view>
-                -->
+                
             </view>
             <!--
             <view class="recommend-strategy">

+ 6 - 0
utils/util.js

@@ -81,6 +81,11 @@ function studyPageTime (arr) {
   return studyLog;
 }
 
+//本周推荐勋章攻略 取消<br>
+function strategy (str) {
+  return str.split('<br>')
+}
+
 //获取当前页面传的的值
 
 function getUrl() {
@@ -184,6 +189,7 @@ module.exports = {
   formatTime: formatTime,
   studyTime,
   studyPageTime,
+  strategy,
   gradeUpper,
   day,
   getUrl,