123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- // compontents/ranking/ranking.js
- const util = require('../../utils/util.js');
- const APIClient = require('../../utils/APIClient.js');
- const login = require('../../utils/loginSchedule.js');
- Component({
- /**
- * 组件的属性列表
- * friendsData除了前三名的数据
- * friendsThreeData前三名的数据
- * myData总的数据
- * str 传过来的排名
- * title 头部标题
- * height是否显示展开
- */
- properties: {
- friendsData: {
- type: Array,
- value: []
- },
- friendsThreeData: {
- type: Array,
- value: []
- },
- myData: {
- type: Object,
- value: {}
- },
- str: {
- type: String,
- value: ''
- },
- title: {
- type: String,
- value: ''
- },
- height: {
- type: String,
- value: ''
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- animationData: {},
- rankData: {},
- indexs: 0,
- flag: true
- },
- /**
- * 组件的方法列表
- */
- methods: {
- /*展开更多*/
- more (e) {
- let height = this.properties.friendsData.length * 79.9;
- this.util(height+'rpx')
- this.setData({
- flag: false
- })
- },
- /* 创建动画并执行 */
- 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()
- })
- },
-
- },
- ready: function () {
- let options = util.getUrl();
- console.log(options)
- this.setData({
- indexs: options.ind
- })
- //获取排名
- login.getOpenidSessionKey(res => {
- //获取排名
- APIClient.getFriendSchedule('wx/friendsRank/user', {
- uid: res.data.data.uid
- }).success(res => {
- console.log(res)
- this.setData({
- rankData: res.data.data,
- })
- })
- }, () => {
- });
- }
- })
|