1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //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: []
- },
-
- 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)
- })
- })
- //获取排名
- 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('用户点击取消')
- }
- }
- })
- });
- },
- })
|