lian_xi.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. isOne:1,
  8. graphicReasoning:0,
  9. statusBar: app.globalData.statusBar,
  10. times: 0,
  11. level: 1,
  12. isOneShow:true,
  13. isOnePointShow:true,
  14. isOneImgShow: false,
  15. isTwoShow:true,
  16. isTwoImgShow:false,
  17. isTwoPointShow:true,
  18. yesImg: '../../image/zheng_que.png',
  19. noImg: '../../image/cuo_wu.png',
  20. lianxiList:[
  21. {
  22. idx: 1,
  23. imgTitle: '../../image/lianxi_title_one.png',
  24. header: '正式测试前先练习一下吧:',
  25. title: '请从下面所给出的小图片中找出适合大图案的一张,可以使整个图案合理与完整.',
  26. answerList: [
  27. {
  28. img: '../../image/lianxi_one_as_a.png',
  29. text: 'A',
  30. isAnswer:0,
  31. status: ''
  32. },
  33. {
  34. img: '../../image/lianxi_one_as_b.png',
  35. text: 'B',
  36. isAnswer: 0,
  37. status: ''
  38. },
  39. {
  40. img: '../../image/lianxi_one_as_c.png',
  41. text: 'C',
  42. isAnswer: 1,
  43. status: ''
  44. },
  45. {
  46. img: '../../image/lianxi_one_as_d.png',
  47. text: 'D',
  48. isAnswer: 0,
  49. status: ''
  50. },
  51. {
  52. img: '../../image/lianxi_one_as_e.png',
  53. text: 'E',
  54. isAnswer: 0,
  55. status: ''
  56. },
  57. {
  58. img: '../../image/lianxi_one_as_f.png',
  59. text: 'F',
  60. isAnswer: 0,
  61. status: ''
  62. }
  63. ]
  64. },
  65. {
  66. idx: 2,
  67. imgTitle: '../../image/lianxi_title_two.png',
  68. header:'正式测试前先练习一下吧:',
  69. title: '下面灰色图形旋转可以得到哪张黄色图形',
  70. answerList: [
  71. {
  72. img: '../../image/lianxi_two_as_a.png',
  73. text: 'A',
  74. isAnswer: 0,
  75. status: ''
  76. },
  77. {
  78. img: '../../image/lianxi_two_as_b.png',
  79. text: 'B',
  80. isAnswer: 0,
  81. status: ''
  82. },
  83. {
  84. img: '../../image/lianxi_two_as_c.png',
  85. text: 'C',
  86. isAnswer: 0,
  87. status: ''
  88. },
  89. {
  90. img: '../../image/lianxi_two_as_d.png',
  91. text: 'D',
  92. isAnswer: 1,
  93. status: ''
  94. }
  95. ]
  96. },
  97. {
  98. idx: 3,
  99. imgTitle: '../../image/lianxi_title_four.png',
  100. header: '正式测试前先练习一下吧:',
  101. title: '从左边看这个几何体,看到的形状是?',
  102. answerList: [
  103. {
  104. img: '../../image/lianxi_four_as_a.png',
  105. text: 'A',
  106. isAnswer: 1,
  107. status: ''
  108. },
  109. {
  110. img: '../../image/lianxi_four_as_b.png',
  111. text: 'B',
  112. isAnswer: 0,
  113. status: ''
  114. },
  115. {
  116. img: '../../image/lianxi_four_as_c.png',
  117. text: 'C',
  118. isAnswer: 0,
  119. status: ''
  120. },
  121. {
  122. img: '../../image/lianxi_four_as_d.png',
  123. text: 'D',
  124. isAnswer: 1,
  125. status: ''
  126. }
  127. ]
  128. },
  129. {
  130. idx: 4,
  131. imgTitle: '../../image/lianxi_title_four.png',
  132. header: '正式测试前先练习一下吧:',
  133. title: '仔细观察下列图形',
  134. titleOne:'请找出哪张图片发生了变化',
  135. titleList: [
  136. {
  137. img: '../../image/lianxi_three_as_a.png',
  138. text: 'A',
  139. isAnswer: 0,
  140. status: ''
  141. },
  142. {
  143. img: '../../image/lianxi_three_as_c.png',
  144. text: 'B',
  145. isAnswer: 0,
  146. status: ''
  147. },
  148. {
  149. img: '../../image/lianxi_three_as_d.png',
  150. text: 'C',
  151. isAnswer: 0,
  152. status: ''
  153. }
  154. ],
  155. answerList: [
  156. {
  157. img: '../../image/lianxi_three_as_b.png',
  158. text: 'A',
  159. isAnswer: 1,
  160. status: ''
  161. },
  162. {
  163. img: '../../image/lianxi_three_as_c.png',
  164. text: 'B',
  165. isAnswer: 0,
  166. status: ''
  167. },
  168. {
  169. img: '../../image/lianxi_three_as_d.png',
  170. text: 'C',
  171. isAnswer: 0,
  172. status: ''
  173. }
  174. ],
  175. },
  176. {
  177. idx: 5,
  178. imgTitle: '',
  179. header: '正式测试前先练习一下吧:',
  180. title: '仔细观察下列图形',
  181. titleOne: '请找出哪张图片发生了变化',
  182. titleList: [
  183. {
  184. img: '../../image/lianxi_five_as_a.png',
  185. text: 'A',
  186. isAnswer: 0,
  187. status: ''
  188. },
  189. {
  190. img: '../../image/lianxi_five_as_c.png',
  191. text: 'B',
  192. isAnswer: 0,
  193. status: ''
  194. },
  195. {
  196. img: '../../image/lianxi_five_as_d.png',
  197. text: 'C',
  198. isAnswer: 0,
  199. status: ''
  200. }
  201. ],
  202. answerList: [
  203. {
  204. img: '../../image/lianxi_five_as_a.png',
  205. text: 'A',
  206. isAnswer: 0,
  207. status: ''
  208. },
  209. {
  210. img: '../../image/lianxi_five_as_b.png',
  211. text: 'B',
  212. isAnswer: 1,
  213. status: ''
  214. },
  215. {
  216. img: '../../image/lianxi_five_as_d.png',
  217. text: 'C',
  218. isAnswer: 0,
  219. status: ''
  220. }
  221. ],
  222. },
  223. ]
  224. },
  225. /**
  226. * 生命周期函数--监听页面加载
  227. */
  228. onLoad: function (options) {
  229. this.setData(options)
  230. },
  231. /**
  232. * 生命周期函数--监听页面初次渲染完成
  233. */
  234. onReady: function () {
  235. },
  236. /**
  237. * 生命周期函数--监听页面显示
  238. */
  239. onShow: function () {
  240. },
  241. /**
  242. * 生命周期函数--监听页面隐藏
  243. */
  244. onHide: function () {
  245. },
  246. /**
  247. * 生命周期函数--监听页面卸载
  248. */
  249. onUnload: function () {
  250. },
  251. /**
  252. * 页面相关事件处理函数--监听用户下拉动作
  253. */
  254. onPullDownRefresh: function () {
  255. },
  256. /**
  257. * 页面上拉触底事件的处理函数
  258. */
  259. onReachBottom: function () {
  260. },
  261. /**
  262. * 用户点击右上角分享
  263. */
  264. onShareAppMessage: function () {
  265. },
  266. /**
  267. * 底部导航跳转
  268. */
  269. redirectCtl: app.redirectCtl,
  270. /**
  271. * 返回上一级页面
  272. */
  273. blockCtl: function () {
  274. this.redirectCtl({ url: 'info', method: {} }, true)
  275. },
  276. /**
  277. * 开始答题
  278. */
  279. actionAnswer:function(){
  280. const { isTxtl}=this.data;
  281. this.startSetInter();
  282. this.setData({ isTxtl:false})
  283. },
  284. /**
  285. * 选择答案
  286. */
  287. selectItems: function (e) {
  288. const { bindex,sindex } = e.currentTarget.dataset;
  289. const { lianxiList, times} = this.data;
  290. var that = this;
  291. var temp = {};
  292. for (var i in lianxiList[bindex].answerList) {
  293. temp[`lianxiList[${bindex}].answerList[${i}].status`] = '';
  294. }
  295. if (lianxiList[bindex].answerList[sindex].isAnswer == 1) {
  296. that.setData({ isYes: true })
  297. } else {
  298. that.setData({ isYes: false })
  299. }
  300. temp[`lianxiList[${bindex}].answerList[${sindex}].status`] = lianxiList[bindex].answerList[sindex].status == '' ? 'active' : ''
  301. this.setData(temp);
  302. this.setData({ isAnswer: true })
  303. setTimeout(
  304. function () {
  305. that.setData({ level: bindex + 2, isAnswer:false })
  306. if (bindex + 2 == 4) {
  307. that.hiddenShow()
  308. } else if (bindex + 2 ==5){
  309. that.hiddenTwoShow()
  310. }else if(bindex + 2 ==6){
  311. that.saveExercise()
  312. that.redirectCtl({ url: 'info', method: { isExercise:1,isShow:1} }, true)
  313. }
  314. }, 500
  315. )
  316. },
  317. /**
  318. * 第四题显示
  319. */
  320. hiddenShow:function(){
  321. const { isOneShow, isOnePointShow, isOneImgShow } = this.data;
  322. var that = this;
  323. setTimeout(function () {
  324. that.setData({ isOneImgShow:true})
  325. setTimeout(function () {
  326. that.setData({ isOneShow: false })
  327. }, 2000)
  328. }, 400)
  329. },
  330. /**
  331. * 第五题显示
  332. */
  333. hiddenTwoShow: function () {
  334. const { isTwoShow, isTwoImgShow, isTwoPointShow } = this.data;
  335. var that = this;
  336. setTimeout(function () {
  337. that.setData({ isTwoImgShow: true })
  338. setTimeout(function () {
  339. that.setData({ isTwoShow: false })
  340. }, 500)
  341. }, 400)
  342. },
  343. /**
  344. * 保存练习结果
  345. */
  346. saveExercise:function(){
  347. const postData = { fn: this.getPersonInfo, param: { ...arguments } }
  348. var that = this;
  349. app.post('/api/game/v2/saveV2', {level:0}, 0, postData).then(res => {
  350. })
  351. },
  352. })