const app = getApp(); Page({ /** * 页面的初始数据 */ data: { isOne:1, graphicReasoning:0, statusBar: app.globalData.statusBar, times: 0, level: 1, isOneShow:true, isOnePointShow:true, isOneImgShow: false, isTwoShow:true, isTwoImgShow:false, isTwoPointShow:true, yesImg: '../../image/zheng_que.png', noImg: '../../image/cuo_wu.png', lianxiList:[ { idx: 1, imgTitle: '../../image/lianxi_title_one.png', header: '正式测试前先练习一下吧:', title: '请从下面所给出的小图片中找出适合大图案的一张,可以使整个图案合理与完整.', answerList: [ { img: '../../image/lianxi_one_as_a.png', text: 'A', isAnswer:0, status: '' }, { img: '../../image/lianxi_one_as_b.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_one_as_c.png', text: 'C', isAnswer: 1, status: '' }, { img: '../../image/lianxi_one_as_d.png', text: 'D', isAnswer: 0, status: '' }, { img: '../../image/lianxi_one_as_e.png', text: 'E', isAnswer: 0, status: '' }, { img: '../../image/lianxi_one_as_f.png', text: 'F', isAnswer: 0, status: '' } ] }, { idx: 2, imgTitle: '../../image/lianxi_title_two.png', header:'正式测试前先练习一下吧:', title: '下面灰色图形旋转可以得到哪张黄色图形', answerList: [ { img: '../../image/lianxi_two_as_a.png', text: 'A', isAnswer: 0, status: '' }, { img: '../../image/lianxi_two_as_b.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_two_as_c.png', text: 'C', isAnswer: 0, status: '' }, { img: '../../image/lianxi_two_as_d.png', text: 'D', isAnswer: 1, status: '' } ] }, { idx: 3, imgTitle: '../../image/lianxi_title_four.png', header: '正式测试前先练习一下吧:', title: '从左边看这个几何体,看到的形状是?', answerList: [ { img: '../../image/lianxi_four_as_a.png', text: 'A', isAnswer: 1, status: '' }, { img: '../../image/lianxi_four_as_b.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_four_as_c.png', text: 'C', isAnswer: 0, status: '' }, { img: '../../image/lianxi_four_as_d.png', text: 'D', isAnswer: 1, status: '' } ] }, { idx: 4, imgTitle: '../../image/lianxi_title_four.png', header: '正式测试前先练习一下吧:', title: '仔细观察下列图形', titleOne:'请找出哪张图片发生了变化', titleList: [ { img: '../../image/lianxi_three_as_a.png', text: 'A', isAnswer: 0, status: '' }, { img: '../../image/lianxi_three_as_c.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_three_as_d.png', text: 'C', isAnswer: 0, status: '' } ], answerList: [ { img: '../../image/lianxi_three_as_b.png', text: 'A', isAnswer: 1, status: '' }, { img: '../../image/lianxi_three_as_c.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_three_as_d.png', text: 'C', isAnswer: 0, status: '' } ], }, { idx: 5, imgTitle: '', header: '正式测试前先练习一下吧:', title: '仔细观察下列图形', titleOne: '请找出哪张图片发生了变化', titleList: [ { img: '../../image/lianxi_five_as_a.png', text: 'A', isAnswer: 0, status: '' }, { img: '../../image/lianxi_five_as_c.png', text: 'B', isAnswer: 0, status: '' }, { img: '../../image/lianxi_five_as_d.png', text: 'C', isAnswer: 0, status: '' } ], answerList: [ { img: '../../image/lianxi_five_as_a.png', text: 'A', isAnswer: 0, status: '' }, { img: '../../image/lianxi_five_as_b.png', text: 'B', isAnswer: 1, status: '' }, { img: '../../image/lianxi_five_as_d.png', text: 'C', isAnswer: 0, status: '' } ], }, ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData(options) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, /** * 底部导航跳转 */ redirectCtl: app.redirectCtl, /** * 返回上一级页面 */ blockCtl: function () { this.redirectCtl({ url: 'info', method: {} }, true) }, /** * 开始答题 */ actionAnswer:function(){ const { isTxtl}=this.data; this.startSetInter(); this.setData({ isTxtl:false}) }, /** * 选择答案 */ selectItems: function (e) { const { bindex,sindex } = e.currentTarget.dataset; const { lianxiList, times} = this.data; var that = this; var temp = {}; for (var i in lianxiList[bindex].answerList) { temp[`lianxiList[${bindex}].answerList[${i}].status`] = ''; } if (lianxiList[bindex].answerList[sindex].isAnswer == 1) { that.setData({ isYes: true }) } else { that.setData({ isYes: false }) } temp[`lianxiList[${bindex}].answerList[${sindex}].status`] = lianxiList[bindex].answerList[sindex].status == '' ? 'active' : '' this.setData(temp); this.setData({ isAnswer: true }) setTimeout( function () { that.setData({ level: bindex + 2, isAnswer:false }) if (bindex + 2 == 4) { that.hiddenShow() } else if (bindex + 2 ==5){ that.hiddenTwoShow() }else if(bindex + 2 ==6){ that.saveExercise() that.redirectCtl({ url: 'info', method: { isExercise:1,isShow:1} }, true) } }, 500 ) }, /** * 第四题显示 */ hiddenShow:function(){ const { isOneShow, isOnePointShow, isOneImgShow } = this.data; var that = this; setTimeout(function () { that.setData({ isOneImgShow:true}) setTimeout(function () { that.setData({ isOneShow: false }) }, 2000) }, 400) }, /** * 第五题显示 */ hiddenTwoShow: function () { const { isTwoShow, isTwoImgShow, isTwoPointShow } = this.data; var that = this; setTimeout(function () { that.setData({ isTwoImgShow: true }) setTimeout(function () { that.setData({ isTwoShow: false }) }, 500) }, 400) }, /** * 保存练习结果 */ saveExercise:function(){ const postData = { fn: this.getPersonInfo, param: { ...arguments } } var that = this; app.post('/api/game/v2/saveV2', {level:0}, 0, postData).then(res => { }) }, })