123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- // pages/problem_list/problem_list.js
- const app = getApp()
- const { formatDate, formatTime2 } = require('../../utils/util.js')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- baseImgUrl: app.globalData.baseImgUrl,
- thumbnail: app.globalData.thumbnail,
- maxCreateTime: formatTime2(new Date()),
- hiddenModel:false,
- pageNo: 1,
- pageSize: 10,
- isAll: false,
- navIndex: 0,
- list: [
- // {
- // "problemPictureId": "",
- // "chilName": "小明",
- // "childImg": "",
- // "createTime": "2019-10-23 30:00:00",
- // "problemPicturePath": "",
- // }
- ],
- subject:'语文',
- navList: [
- {
- text: '语文'
- },
- {
- text: '数学'
- },
- {
- text: '英语'
- }
- ],
- footerData: {
- actIndex: 0,
- list: [
- {
- text: '首页',
- url: '../../image/shou_ye_hui.png',
- actUrl: '../../image/shou_ye.png',
- src: 'problem_list',
- id: 'problem_list'
- },
- {
- text: '学习成长报告',
- url: '../../image/xue_qing_hui.png',
- actUrl: '../../image/xue_qing.png',
- src: 'learning_report',
- id: 'learning_report'
- },
- {
- text: '我的',
- url: '../../image/wo_de_hui.png',
- actUrl: '../../image/wo_de.png',
- src: 'me',
- id: 'me'
- }
- ],
- },
- headerData: {
- actIndex: 1,
- list: [
- {
- text: '作业',
- src: 'homework_list',
- id: 'homework_list'
- },
- {
- text: '难题',
- src: 'problem_list',
- id: 'problem_list'
- },
- // {
- // text: '辅导课',
- // src: 'one_to_one',
- // id: 'one_to_one'
- // }
-
- ],
- },
-
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- options.vipId = app.getGlobalAttributeValue(`parentVipId-${app.getGlobalAttributeValue(`userId`)}`)
- this.setData({ options })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getMyInfo()
- this.getPuzzleList();
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- // let pages = getCurrentPages();
- // console.log(pages);
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({ pageNo: 1 })
- this.getPuzzleList(res => {
- wx.stopPullDownRefresh()
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- const { isAll } = this.data;
- if (isAll) {
- return
- }
- this.getPuzzleList()
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- },
- /**
- * 底部导航跳转
- */
- redirectCtl: app.redirectCtl,
- /**
- * 路由跳转
- */
- navigateCtl: app.navigateCtl,
- //查看图片
- viewImageCtl: app.viewImageCtl,
- /**
- * 选择切换项
- */
- selectNavIndexCtl: function (e) {
- const { index } = e.currentTarget.dataset
- const { navIndex = 0, navList = [] } = this.data || {}
- if (navIndex == index) return
- const temp = {}
- temp[`navIndex`] = index
- temp[`subject`] = navList[index].text
- this.setData(temp)
- this.getPuzzleList()
- },
- /**
- * 我的信息
- */
- getMyInfo: function () {
- const userId = app.globalData.userId || wx.getStorageSync('userId');
- const postData = { fn: this.getChildInfo, param: { ...arguments } }
- app.post('/api/parents/parents/V2/getMyInfo', {}, 0, postData).then(res => {
- const { childList, phone } = res.data;
- if (!phone) {
- this.redirectCtl({ url: 'phone', method: {isFrist:1} }, true)
- }
- })
- },
- // 获取难题列表
- getPuzzleList:function(){
- const postData = { fn: this.getPuzzleList, param: { ...arguments } }
- const { vipId }= this.data.options;
- const { pageNo, maxCreateTime, pageSize, list}=this.data;
- app.post('/api/parents/parents/V2/problemReviewSimilarVersion', {
- vipId,
- maxCreateTime,
- pageNo,
- pageSize
- }, 0, postData).then(res => {
- const listTemp = res.data.list;
- let arr = []
- if (pageNo == 1) {
- arr = [...listTemp]
- } else {
- arr = [...list, ...listTemp]
- }
- console.log(pageNo, pageSize)
- this.setData({
- list: arr,
- pageNo: listTemp.length == pageSize? pageNo + 1 : pageNo,
- isAll: listTemp.length < pageSize
- })
- })
- },
-
- })
|