qa-education-exam-weapp/pages/mine/survey/survey.js

70 lines
1.4 KiB
JavaScript

// pages/exam/online/online.js
import Dialog from '@vant/weapp/dialog/dialog';
import Toast from '@vant/weapp/toast/toast';
import {
getUserSurveyListPage
} from "../../../api/index";
Page({
/**
* 页面的初始数据
*/
data: {
showCount: 10,
timesOfexamination: 0,
currentPage: 1,
totalPage: 0,
varList: [],
},
goExam(item) {
let info = item.currentTarget.dataset.item
console.log(item.currentTarget.dataset.item);
wx.navigateTo({
url: '/pages/mine/survey/question?SURVEY_ID='+info.SURVEY_ID
+'&CLASS_ID='+info.CLASS_ID
+'&CORPINFO_ID='+info.CORPINFO_ID
,
})
},
async getData() {
let resData = await getUserSurveyListPage({
showCount: this.data.showCount,
currentPage: this.data.currentPage
})
this.setData({
varList: [...this.data.varList, ...resData.varList],
totalPage: resData.page.totalPage
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({
showCount: 10,
currentPage: 1,
totalPage: 0,
varList: [],
})
this.getData()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
this.setData({
currentPage: ++this.data.currentPage
})
if (this.data.totalPage >= this.data.currentPage) {
this.getData()
}
},
})