123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //index.js
- //获取应用实例
- const app = getApp()
- const util = require('../../utils/util.js');
- const APIClient = require('../../utils/APIClient.js');
- const login = require('../../utils/loginSchedule.js');
- Page({
- data: {
- motto: ['我的','本周推荐','语文','数学','中文','英语','科学','艺术'],
- navBtnSelectIdx: 0,
- left: 0,
- //questionsPreviewing: false,
- //questionsShare: false,
- data: {},
- grade: "",
- time: "",
- rankData: {},
- share: false,
- studyLog: [],
- height: ''
- },
-
- lower: function (e) {
- //console.log(e);
- //console.log(e.detail.scrollTop)
- // if (320 <= e.detail.scrollTop && e.detail.scrollTop <= 1000){
- // this.setData({ questionsPreviewing: true, questionsShare: false});
- // }else {
- // this.setData({ questionsPreviewing: false });
- // }
- // if (1090 <= e.detail.scrollTop) {
- // this.setData({ questionsPreviewing: false, questionsShare: true});
- // } else {
- // this.setData({ questionsShare: false });
- // }
- },
- 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 });
- }
- }
- },
- 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),
- studyLog: util.studyTime(res.data.data.studyLog)
- })
- if(res.data.data.studyLog.length > 10) {
- this.setData({
- height: '700'
- })
- }
- })
- //获取排名
- APIClient.getFriendSchedule('wx/friendsRank/user', {
- uid: res.data.data.uid
- }).success(res => {
- console.log(res)
- this.setData({
- rankData: res.data.data,
- })
- })
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除勋章战士后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- },
- })
|