138 lines
2.8 KiB
JavaScript
138 lines
2.8 KiB
JavaScript
var WxParse = require('../../wxParse/wxParse.js');
|
|
const app = getApp();
|
|
const baseUrl = getApp();
|
|
const api = require('../../config/api.js');
|
|
const util = require('../../config/util.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
active: 0,
|
|
totaldata:4,
|
|
openactive:2,
|
|
show:true,
|
|
title:'动态修改',
|
|
now: 1, //当前页码
|
|
all: 15, //总页码
|
|
index:1,
|
|
grouppaper_id:1,//组卷ID
|
|
listdata:[], //数据
|
|
currentdata:[] //当前数据
|
|
},
|
|
onChange:function(event){
|
|
|
|
console.log(event.detail.index);
|
|
this.setData({
|
|
active:event.detail.index
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
console.log(options);
|
|
wx.setNavigationBarTitle({
|
|
title: this.data.title
|
|
})
|
|
this.setData({
|
|
grouppaper_id:options.grouppaper_id
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getexammaterial(this.data.grouppaper_id);
|
|
this.selectComponent('#tabs').resize();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
openactiveclick:function(event){
|
|
console.log(event);
|
|
this.setData({
|
|
openactive:event.currentTarget.id
|
|
})
|
|
},
|
|
getexammaterial:function(params) {
|
|
//得到练习题目
|
|
const that = this;
|
|
let url = baseUrl.globalData.baseUrl + '/exam/exammaterial';
|
|
var param = {
|
|
grouppaper_id: params
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.post(url, param).then((res) => {
|
|
console.log(res.data[0]);
|
|
that.setData({
|
|
itemdataall: res.data,
|
|
listdata:res.data[0].itemanswerdata,
|
|
all:res.data[0].answercount,
|
|
currentdata:res.data[0]
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
},
|
|
clickanswer:function(params) {
|
|
console.log(params.currentTarget.id);
|
|
let grouppaper_id=params.currentTarget.id;
|
|
wx.navigateTo({
|
|
url: '/pages/examproblem/examproblem?grouppaper_id='+grouppaper_id
|
|
})
|
|
|
|
|
|
},
|
|
clickm:function(params) {
|
|
console.log(params.currentTarget.id);
|
|
let grouppaper_id=params.currentTarget.id;
|
|
wx.navigateTo({
|
|
url: '/pages/exammakings/exammakings?grouppaper_id='+grouppaper_id
|
|
})
|
|
}
|
|
}) |