// pages/art/art.js const app = getApp() const util = require('../../utils/util.js'); const APIClient = require('../../utils/APIClient.js'); const login = require('../../utils/loginSchedule.js'); Page({ data: { flag: false, questionsData: {}, courseData: {}, num1: 0, position: '', questionsdian: '' }, /* 区分答疑和分享 */ distinction: function(type, columnId, pageNo, pageSize, success) { login.getOpenidSessionKey(function(res) { //console.log(res.data.data.uid); APIClient.getProductionSchedule({ uid: res.data.data.uid }, { "type": type, "columnId": columnId, "pageNo": pageNo, "pageSize": pageSize }).success(success) }, function() { wx.showModal({ title: '提示', content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用', showCancel: false, success: function (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) }); }, /*加载更多点击*/ onMyEvent: function(e){ let type = e.currentTarget.dataset.type; const columnId = util.column('4').columnId; if(type == 1) { this.data.num1++ this.setData({ num1: this.data.num1 }) this.distinction(type, columnId, 1, 5*this.data.num1, res => { if(res.data.success) { console.log(res.data.data) this.setData({ questionsData: res.data.data, }) if(res.data.data) { this.setData({ questionsdian: util.replyNo(res.data.data.list) }) } } }); } }, /*点击定位*/ location: function (e) { const position = e.currentTarget.dataset.id; console.log(position) this.setData({ position: position }) }, onLoad: function (options) { }, onShow: function () { const columnId = util.column('4').columnId; /* 答疑 */ this.distinction(1, columnId, 1, 2, res => { if(res.data.success) { console.log(res.data.data) this.setData({ questionsData: res.data.data, }) if(res.data.data) { this.setData({ questionsdian: util.replyNo(res.data.data.list) }) } } }); /*科目信息*/ login.getOpenidSessionKey((res) => { //console.log(res.data.data.uid); APIClient.getEachSchedule({ uid: res.data.data.uid }, { "category": 4 }).success((res) => { //console.log('科目信息' + JSON.stringify(res)); this.setData({ courseData: res.data.data }) }) }, function() { wx.showModal({ title: '提示', content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用', showCancel: false, success: function (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) }); }, })