123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- // 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: '',
- list: [],
- lessonListHeight: '',
- previewHeight: '',
- questionsMore: '',
- wxObjectives: [],
- flag: true,
- materialData: [],
- loginType: 1,
- timeList: [],
- userKey: ''
- },
- /* 区分答疑和分享 */
- 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,
- "category": columnId,
- "pageNo": pageNo,
- "pageSize": pageSize
- }).success(success)
- }, function() {
- });
- },
- /*加载更多点击*/
- onMyEvent: function(e){
- let type = e.currentTarget.dataset.type;
- const columnId = util.column('2').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) {
- res.data.data.list.forEach(item => {
- this.data.timeList.push(util.formatDate(item.gmtCreated,4));
- });
- this.setData({
- timeList: this.data.timeList,
- questionsdian: util.replyNo(res.data.data.list)
- })
- if(5*this.data.num1 > res.data.data.totalSize) {
- this.setData({
- questionsMore: ''
- })
- }
- }
- }
- });
- }
- },
- onLoad: function (options) {
- if(options.type == "noTv") {
- this.setData({
- loginType: ""
- })
- }
- let scene = decodeURIComponent(options.scene);
- if (scene && scene !== 'undefined') {
- let idParam = scene.split('&')[0];
- let showIdParam = scene.split('&')[1];
-
- let idKey = idParam.split('=')[0];
- let idvalue = idParam.split('=')[1];
- this.setData({
- userKey: idvalue
- })
- }
- if(wx.getStorageSync('user')) {
- this.setData({
- teacher: wx.getStorageSync('user').data.data.isTeacher
- })
- }
- },
- /*点击定位*/
- location: function (e) {
- const position = e.currentTarget.dataset.id;
- console.log(position)
- this.setData({
- position: position
- })
- },
- onShow: function () {
- const columnId = util.column('2').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) {
- res.data.data.list.forEach(item => {
- this.data.timeList.push(util.formatDate(item.gmtCreated,4));
- });
- this.setData({
- timeList: this.data.timeList,
- questionsdian: util.replyNo(res.data.data.list)
- })
- if(res.data.data.totalSize > 2) {
- this.setData({
- questionsMore: true
- })
- }
- }
- }
- });
- /*科目信息*/
- login.getOpenidSessionKey((res) => {
- //console.log(res.data.data.uid);
- APIClient.getEachSchedule({
- uid: res.data.data.uid
- }, {
- "category": 2
- }).success((res) => {
- //console.log('科目信息' + JSON.stringify(res));
- const lessonListLength = util.studyPageTime(res.data.data.lessonPage.list).length;
- const previewLength = util.filter(res.data.data.lessonPage.list).length;
- console.log(res)
- if(lessonListLength > 4) {
- this.setData({
- lessonListHeight: 144
- })
- }
- if(previewLength > 4){
- this.setData({
- previewHeight: 144
- })
- }
- this.setData({
- courseData: res.data.data,
- materialData: util.filter(res.data.data.lessonPage.list),
- list: util.studyPageTime(res.data.data.lessonPage.list),
- wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
- })
- })
- }, () => {
- this.setData({
- flag: !this.data.flag
- })
- }, this.data.loginType, this.data.userKey);
- },
- /*获取个人信息弹框*/
- jurisdiction: function () {
- this.setData({
- flag: !this.data.flag
- })
- this.onShow();
- }
- })
|