xin_li_xuan_zhuan.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. // pages/tu_xing_tui_li/tu_xing_tui_li.js
  2. const { throttle } = require('../../utils/util.js')
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isXlxz: true,
  10. statusBar: app.globalData.statusBar,
  11. mentalRotation:0,
  12. graphicReasoning:0,
  13. spaceImagination:0,
  14. executionFunctionality:0,
  15. visualSearch:0,
  16. workingMemory:0,
  17. isAnswer: false,
  18. times: 0,
  19. level:0,
  20. isWhite:false,
  21. allList:[
  22. [
  23. {
  24. idx: 0,
  25. imgTitle: '../../image/lianxi_title_two.png',
  26. header:'正式测试前先练习一下吧:',
  27. title: '下面灰色图形旋转可以得到哪张黄色图形',
  28. answerList: [
  29. [
  30. {
  31. img: '../../image/lianxi_two_as_a.png',
  32. text: 'A',
  33. isAnswer: 0,
  34. status: ''
  35. },
  36. {
  37. img: '../../image/lianxi_two_as_b.png',
  38. text: 'B',
  39. isAnswer: 0,
  40. status: ''
  41. },
  42. {
  43. img: '../../image/lianxi_two_as_c.png',
  44. text: 'C',
  45. isAnswer: 0,
  46. status: ''
  47. },
  48. {
  49. img: '../../image/lianxi_two_as_d.png',
  50. text: 'D',
  51. isAnswer: 1,
  52. status: ''
  53. }
  54. ],
  55. [
  56. {
  57. img: '../../image/lianxi_two_as_d.png',
  58. text: 'A',
  59. isAnswer: 1,
  60. status: ''
  61. },
  62. {
  63. img: '../../image/lianxi_two_as_c.png',
  64. text: 'B',
  65. isAnswer: 0,
  66. status: ''
  67. },
  68. {
  69. img: '../../image/lianxi_two_as_b.png',
  70. text: 'C',
  71. isAnswer: 0,
  72. status: ''
  73. },
  74. {
  75. img: '../../image/lianxi_two_as_a.png',
  76. text: 'D',
  77. isAnswer: 0,
  78. status: ''
  79. }
  80. ],
  81. ]
  82. }
  83. ],
  84. [
  85. {
  86. id: 0,
  87. imgTitle: '../../image/the_first_pass_two_tittle.png',
  88. title: '认真观察下图,此图旋转后可以得到哪张图?',
  89. answerList: [
  90. [
  91. {
  92. img: '../../image/the_first_pass_two_as_a.png',
  93. text: 'A',
  94. isAnswer: 1,
  95. status: ''
  96. },
  97. {
  98. img: '../../image/the_first_pass_two_as_b.png',
  99. text: 'B',
  100. isAnswer: 0,
  101. status: ''
  102. },
  103. {
  104. img: '../../image/the_first_pass_two_as_c.png',
  105. text: 'C',
  106. isAnswer: 0,
  107. status: ''
  108. },
  109. {
  110. img: '../../image/the_first_pass_two_as_d.png',
  111. text: 'D',
  112. isAnswer: 0,
  113. status: ''
  114. }
  115. ],
  116. [
  117. {
  118. img: '../../image/the_first_pass_two_as_d.png',
  119. text: 'A',
  120. isAnswer: 0,
  121. status: ''
  122. },
  123. {
  124. img: '../../image/the_first_pass_two_as_b.png',
  125. text: 'B',
  126. isAnswer: 0,
  127. status: ''
  128. },
  129. {
  130. img: '../../image/the_first_pass_two_as_a.png',
  131. text: 'C',
  132. isAnswer: 1,
  133. status: ''
  134. },
  135. {
  136. img: '../../image/the_first_pass_two_as_c.png',
  137. text: 'D',
  138. isAnswer: 0,
  139. status: ''
  140. }
  141. ]
  142. ]
  143. },
  144. {
  145. id: 1,
  146. imgTitle: '../../image/the_first_pass_two_tittle1.png',
  147. title: '认真观察下图,此图旋转后可以得到哪张图?',
  148. answerList: [
  149. [
  150. {
  151. img: '../../image/the_first_pass_two1_as_a.png',
  152. text: 'A',
  153. isAnswer: 0,
  154. status: ''
  155. },
  156. {
  157. img: '../../image/the_first_pass_two1_as_b.png',
  158. text: 'B',
  159. isAnswer: 0,
  160. status: ''
  161. },
  162. {
  163. img: '../../image/the_first_pass_two1_as_c.png',
  164. text: 'C',
  165. isAnswer: 1,
  166. status: ''
  167. },
  168. {
  169. img: '../../image/the_first_pass_two1_as_d.png',
  170. text: 'D',
  171. isAnswer: 0,
  172. status: ''
  173. }
  174. ],
  175. [
  176. {
  177. img: '../../image/the_first_pass_two1_as_c.png',
  178. text: 'A',
  179. isAnswer: 1,
  180. status: ''
  181. },
  182. {
  183. img: '../../image/the_first_pass_two1_as_b.png',
  184. text: 'B',
  185. isAnswer: 0,
  186. status: ''
  187. },
  188. {
  189. img: '../../image/the_first_pass_two1_as_d.png',
  190. text: 'C',
  191. isAnswer: 0,
  192. status: ''
  193. },
  194. {
  195. img: '../../image/the_first_pass_two1_as_a.png',
  196. text: 'D',
  197. isAnswer: 0,
  198. status: ''
  199. }
  200. ],
  201. ]
  202. },
  203. ],
  204. [
  205. {
  206. id: 0,
  207. imgTitle: '../../image/the_second_pass_two_tittle.png',
  208. title: '认真观察下图,此图旋转后可以得到哪张图?',
  209. answerList: [
  210. [
  211. {
  212. img: '../../image/the_second_pass_two_as_a.png',
  213. text: 'A',
  214. isAnswer: 0,
  215. status: ''
  216. },
  217. {
  218. img: '../../image/the_second_pass_two_as_b.png',
  219. text: 'B',
  220. isAnswer: 0,
  221. status: ''
  222. },
  223. {
  224. img: '../../image/the_second_pass_two_as_c.png',
  225. text: 'C',
  226. isAnswer: 0,
  227. status: ''
  228. },
  229. {
  230. img: '../../image/the_second_pass_two_as_d.png',
  231. text: 'D',
  232. isAnswer: 1,
  233. status: ''
  234. }
  235. ],
  236. [
  237. {
  238. img: '../../image/the_second_pass_two_as_d.png',
  239. text: 'A',
  240. isAnswer: 1,
  241. status: ''
  242. },
  243. {
  244. img: '../../image/the_second_pass_two_as_c.png',
  245. text: 'B',
  246. isAnswer: 0,
  247. status: ''
  248. },
  249. {
  250. img: '../../image/the_second_pass_two_as_b.png',
  251. text: 'C',
  252. isAnswer: 0,
  253. status: ''
  254. },
  255. {
  256. img: '../../image/the_second_pass_two_as_a.png',
  257. text: 'D',
  258. isAnswer: 0,
  259. status: ''
  260. }
  261. ]
  262. ]
  263. },
  264. {
  265. id: 1,
  266. imgTitle: '../../image/the_second_pass_two_tittle1.png',
  267. title: '认真观察下图,此图旋转后可以得到哪张图?',
  268. answerList: [
  269. [
  270. {
  271. img: '../../image/the_second_pass_two1_as_a.png',
  272. text: 'A',
  273. isAnswer: 0,
  274. status: ''
  275. },
  276. {
  277. img: '../../image/the_second_pass_two1_as_b.png',
  278. text: 'B',
  279. isAnswer: 0,
  280. status: ''
  281. },
  282. {
  283. img: '../../image/the_second_pass_two1_as_c.png',
  284. text: 'C',
  285. isAnswer: 0,
  286. status: ''
  287. },
  288. {
  289. img: '../../image/the_second_pass_two1_as_d.png',
  290. text: 'D',
  291. isAnswer: 1,
  292. status: ''
  293. }
  294. ],
  295. [
  296. {
  297. img: '../../image/the_second_pass_two1_as_b.png',
  298. text: 'A',
  299. isAnswer: 0,
  300. status: ''
  301. },
  302. {
  303. img: '../../image/the_second_pass_two1_as_a.png',
  304. text: 'B',
  305. isAnswer: 0,
  306. status: ''
  307. },
  308. {
  309. img: '../../image/the_second_pass_two1_as_d.png',
  310. text: 'C',
  311. isAnswer: 1,
  312. status: ''
  313. },
  314. {
  315. img: '../../image/the_second_pass_two1_as_a.png',
  316. text: 'D',
  317. isAnswer: 0,
  318. status: ''
  319. }
  320. ],
  321. ]
  322. },
  323. ],
  324. [
  325. {
  326. id: 0,
  327. imgTitle: '../../image/the_third_pass_two_tittle.png',
  328. title: '认真观察下图,此图旋转后可以得到哪张图?',
  329. answerList: [
  330. [
  331. {
  332. img: '../../image/the_third_pass_two_as_a.png',
  333. text: 'A',
  334. isAnswer: 0,
  335. status: ''
  336. },
  337. {
  338. img: '../../image/the_third_pass_two_as_b.png',
  339. text: 'B',
  340. isAnswer: 1,
  341. status: ''
  342. },
  343. {
  344. img: '../../image/the_third_pass_two_as_c.png',
  345. text: 'C',
  346. isAnswer: 0,
  347. status: ''
  348. },
  349. {
  350. img: '../../image/the_third_pass_two_as_d.png',
  351. text: 'D',
  352. isAnswer: 0,
  353. status: ''
  354. }
  355. ],
  356. [
  357. {
  358. img: '../../image/the_third_pass_two_as_b.png',
  359. text: 'A',
  360. isAnswer: 1,
  361. status: ''
  362. },
  363. {
  364. img: '../../image/the_third_pass_two_as_a.png',
  365. text: 'B',
  366. isAnswer: 0,
  367. status: ''
  368. },
  369. {
  370. img: '../../image/the_third_pass_two_as_d.png',
  371. text: 'C',
  372. isAnswer: 0,
  373. status: ''
  374. },
  375. {
  376. img: '../../image/the_third_pass_two_as_c.png',
  377. text: 'D',
  378. isAnswer: 0,
  379. status: ''
  380. }
  381. ],
  382. ]
  383. },
  384. {
  385. id: 1,
  386. imgTitle: '../../image/the_third_pass_two_tittle1.png',
  387. title: '认真观察下图,此图旋转后可以得到哪张图?',
  388. answerList: [
  389. [
  390. {
  391. img: '../../image/the_third_pass_two1_as_a.png',
  392. text: 'A',
  393. isAnswer: 0,
  394. status: ''
  395. },
  396. {
  397. img: '../../image/the_third_pass_two1_as_b.png',
  398. text: 'B',
  399. isAnswer: 0,
  400. status: ''
  401. },
  402. {
  403. img: '../../image/the_third_pass_two1_as_c.png',
  404. text: 'C',
  405. isAnswer:1,
  406. status: ''
  407. },
  408. {
  409. img: '../../image/the_third_pass_two1_as_d.png',
  410. text: 'D',
  411. isAnswer: 0,
  412. status: ''
  413. }
  414. ],
  415. [
  416. {
  417. img: '../../image/the_third_pass_two1_as_c.png',
  418. text: 'A',
  419. isAnswer: 1,
  420. status: ''
  421. },
  422. {
  423. img: '../../image/the_third_pass_two1_as_b.png',
  424. text: 'B',
  425. isAnswer: 0,
  426. status: ''
  427. },
  428. {
  429. img: '../../image/the_third_pass_two1_as_a.png',
  430. text: 'C',
  431. isAnswer:0,
  432. status: ''
  433. },
  434. {
  435. img: '../../image/the_third_pass_two1_as_d.png',
  436. text: 'D',
  437. isAnswer: 0,
  438. status: ''
  439. }
  440. ],
  441. ]
  442. },
  443. ],
  444. [
  445. {
  446. id: 0,
  447. imgTitle: '../../image/the_fourth_pass_two_tittle.png',
  448. title: '认真观察下图,此图旋转后可以得到哪张图?',
  449. answerList: [
  450. [
  451. {
  452. img: '../../image/the_fourth_pass_two_as_a.png',
  453. text: 'A',
  454. isAnswer: 0,
  455. status: ''
  456. },
  457. {
  458. img: '../../image/the_fourth_pass_two_as_b.png',
  459. text: 'B',
  460. isAnswer: 0,
  461. status: ''
  462. },
  463. {
  464. img: '../../image/the_fourth_pass_two_as_c.png',
  465. text: 'C',
  466. isAnswer: 1,
  467. status: ''
  468. },
  469. {
  470. img: '../../image/the_fourth_pass_two_as_d.png',
  471. text: 'D',
  472. isAnswer: 0,
  473. status: ''
  474. }
  475. ],
  476. [
  477. {
  478. img: '../../image/the_fourth_pass_two_as_d.png',
  479. text: 'A',
  480. isAnswer: 0,
  481. status: ''
  482. },
  483. {
  484. img: '../../image/the_fourth_pass_two_as_a.png',
  485. text: 'B',
  486. isAnswer: 0,
  487. status: ''
  488. },
  489. {
  490. img: '../../image/the_fourth_pass_two_as_b.png',
  491. text: 'C',
  492. isAnswer: 0,
  493. status: ''
  494. },
  495. {
  496. img: '../../image/the_fourth_pass_two_as_c.png',
  497. text: 'D',
  498. isAnswer: 1,
  499. status: ''
  500. }
  501. ],
  502. ]
  503. },
  504. {
  505. id:1,
  506. imgTitle: '../../image/the_fourth_pass_two_tittle1.png',
  507. title: '认真观察下图,此图旋转后可以得到哪张图?',
  508. answerList: [
  509. [
  510. {
  511. img: '../../image/the_fourth_pass_two1_as_a.png',
  512. text: 'A',
  513. isAnswer: 0,
  514. status: ''
  515. },
  516. {
  517. img: '../../image/the_fourth_pass_two1_as_b.png',
  518. text: 'B',
  519. isAnswer: 1,
  520. status: ''
  521. },
  522. {
  523. img: '../../image/the_fourth_pass_two1_as_c.png',
  524. text: 'C',
  525. isAnswer: 0,
  526. status: ''
  527. },
  528. {
  529. img: '../../image/the_fourth_pass_two1_as_d.png',
  530. text: 'D',
  531. isAnswer: 0,
  532. status: ''
  533. }
  534. ],
  535. [
  536. {
  537. img: '../../image/the_fourth_pass_two1_as_a.png',
  538. text: 'A',
  539. isAnswer: 0,
  540. status: ''
  541. },
  542. {
  543. img: '../../image/the_fourth_pass_two1_as_d.png',
  544. text: 'B',
  545. isAnswer: 0,
  546. status: ''
  547. },
  548. {
  549. img: '../../image/the_fourth_pass_two1_as_c.png',
  550. text: 'C',
  551. isAnswer: 0,
  552. status: ''
  553. },
  554. {
  555. img: '../../image/the_fourth_pass_two1_as_b.png',
  556. text: 'D',
  557. isAnswer: 1,
  558. status: ''
  559. }
  560. ],
  561. ]
  562. },
  563. ],
  564. [
  565. {
  566. id: 0,
  567. imgTitle: '../../image/the_fifth_pass_two_tittle.png',
  568. title: '认真观察下图,此图旋转后可以得到哪张图?',
  569. answerList: [
  570. [
  571. {
  572. img: '../../image/the_fifth_pass_two_as_a.png',
  573. text: 'A',
  574. isAnswer:0,
  575. status: ''
  576. },
  577. {
  578. img: '../../image/the_fifth_pass_two_as_b.png',
  579. text: 'B',
  580. isAnswer: 1,
  581. status: ''
  582. },
  583. {
  584. img: '../../image/the_fifth_pass_two_as_c.png',
  585. text: 'C',
  586. isAnswer: 0,
  587. status: ''
  588. },
  589. {
  590. img: '../../image/the_fifth_pass_two_as_d.png',
  591. text: 'D',
  592. isAnswer: 0,
  593. status: ''
  594. }
  595. ],
  596. [
  597. {
  598. img: '../../image/the_fifth_pass_two_as_c.png',
  599. text: 'A',
  600. isAnswer:0,
  601. status: ''
  602. },
  603. {
  604. img: '../../image/the_fifth_pass_two_as_a.png',
  605. text: 'B',
  606. isAnswer: 0,
  607. status: ''
  608. },
  609. {
  610. img: '../../image/the_fifth_pass_two_as_d.png',
  611. text: 'C',
  612. isAnswer: 0,
  613. status: ''
  614. },
  615. {
  616. img: '../../image/the_fifth_pass_two_as_b.png',
  617. text: 'D',
  618. isAnswer: 1,
  619. status: ''
  620. }
  621. ],
  622. ]
  623. },
  624. {
  625. id: 1,
  626. imgTitle: '../../image/the_fifth_pass_two_tittle1.png',
  627. title: '认真观察下图,此图旋转后可以得到哪张图?',
  628. answerList: [
  629. [
  630. {
  631. img: '../../image/the_fifth_pass_two1_as_a.png',
  632. text: 'A',
  633. isAnswer: 1,
  634. status: ''
  635. },
  636. {
  637. img: '../../image/the_fifth_pass_two1_as_b.png',
  638. text: 'B',
  639. isAnswer: 0,
  640. status: ''
  641. },
  642. {
  643. img: '../../image/the_fifth_pass_two1_as_c.png',
  644. text: 'C',
  645. isAnswer: 0,
  646. status: ''
  647. },
  648. {
  649. img: '../../image/the_fifth_pass_two1_as_d.png',
  650. text: 'D',
  651. isAnswer: 0,
  652. status: ''
  653. }
  654. ],
  655. [
  656. {
  657. img: '../../image/the_fifth_pass_two1_as_c.png',
  658. text: 'A',
  659. isAnswer: 0,
  660. status: ''
  661. },
  662. {
  663. img: '../../image/the_fifth_pass_two1_as_b.png',
  664. text: 'B',
  665. isAnswer: 0,
  666. status: ''
  667. },
  668. {
  669. img: '../../image/the_fifth_pass_two1_as_a.png',
  670. text: 'C',
  671. isAnswer: 1,
  672. status: ''
  673. },
  674. {
  675. img: '../../image/the_fifth_pass_two1_as_d.png',
  676. text: 'D',
  677. isAnswer: 0,
  678. status: ''
  679. }
  680. ],
  681. ]
  682. },
  683. ],
  684. ]
  685. },
  686. /**
  687. * 生命周期函数--监听页面加载
  688. */
  689. onLoad: function (options) {
  690. this.setData(options)
  691. console.log(options)
  692. this.setData({
  693. isOne: Math.round(Math.random()),
  694. isRandom:Math.round(Math.random())
  695. })
  696. },
  697. /**
  698. * 生命周期函数--监听页面初次渲染完成
  699. */
  700. onReady: function () {
  701. },
  702. /**
  703. * 生命周期函数--监听页面显示
  704. */
  705. onShow: function () {
  706. },
  707. /**
  708. * 生命周期函数--监听页面隐藏
  709. */
  710. onHide: function () {
  711. },
  712. /**
  713. * 生命周期函数--监听页面卸载
  714. */
  715. onUnload: function () {
  716. },
  717. /**
  718. * 页面相关事件处理函数--监听用户下拉动作
  719. */
  720. onPullDownRefresh: function () {
  721. },
  722. /**
  723. * 页面上拉触底事件的处理函数
  724. */
  725. onReachBottom: function () {
  726. },
  727. /**
  728. * 用户点击右上角分享
  729. */
  730. onShareAppMessage: function () {
  731. },
  732. /**
  733. * 底部导航跳转
  734. */
  735. redirectCtl: app.redirectCtl,
  736. /**
  737. * 返回上一级页面
  738. */
  739. blockCtl: function () {
  740. this.redirectCtl({ url: 'me', method: {} }, true)
  741. this.endSetInter();
  742. },
  743. /**
  744. * 开始答题
  745. */
  746. actionAnswer: function () {
  747. const { isXlxz } = this.data;
  748. this.startSetInter();
  749. this.setData({ isXlxz: false })
  750. },
  751. /**
  752. * 选择答案
  753. */
  754. selectItems:throttle(function(e){
  755. const {lindex, mindex,sindex } = e.currentTarget.dataset;
  756. const { allList, times, graphicReasoning, ageGroup,isRandom} = this.data;
  757. // console.log(lindex, mindex,sindex)
  758. var that = this;
  759. var temp = {};
  760. for (var i in allList[lindex][mindex].answerList[isRandom]) {
  761. temp[`allList[${lindex}][${mindex}].answerList[${isRandom}][${i}].status`] = '';
  762. }
  763. temp[`allList[${lindex}][${mindex}].answerList[${isRandom}][${sindex}].status`]='active';
  764. this.setData(temp);
  765. if (allList[lindex][mindex].answerList[isRandom][sindex].isAnswer == 1) {
  766. that.setData({ isYes: true,isAnswer: true})
  767. if(lindex!=0){
  768. that.integraeRule(1)
  769. }
  770. that.endSetInter();
  771. that.startSetInter()
  772. } else {
  773. that.setData({ isYes: false,isAnswer: true })
  774. if(lindex!=0){
  775. that.integraeRule(0)
  776. }
  777. that.endSetInter();
  778. that.startSetInter()
  779. }
  780. setTimeout(
  781. function () {
  782. if(lindex+1==6){
  783. that.endSetInter();
  784. that.tenEndTimes()
  785. }else{
  786. that.setData({ level:lindex+1,isAnswer:false,times: 0,isOne: Math.round(Math.random()),isWhite:true,isRandom:Math.round(Math.random())})
  787. that.hiddenShow()
  788. }
  789. }, 300)
  790. },800),
  791. /**
  792. * 过渡页显示
  793. */
  794. hiddenShow:function(){
  795. const {isWhite} = this.data;
  796. var that = this;
  797. setTimeout(function () {
  798. that.setData({ isWhite:false})
  799. }, 500)
  800. },
  801. /**
  802. * 积分规则处理
  803. */
  804. integraeRule:function(str){
  805. const { ageGroup, times,mentalRotation}=this.data;
  806. var that = this;
  807. that.saveCase(str)
  808. // console.log(ageGroup, times,mentalRotation)
  809. if(str==1){
  810. if (0<ageGroup&&ageGroup <= 5) {
  811. if (0 < times && times <= 720) {
  812. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  813. } else if (720 < times ) {
  814. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  815. }
  816. } else if (6<=ageGroup&&ageGroup <= 8){
  817. if (0 < times && times <= 600) {
  818. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  819. } else if (600 < times ) {
  820. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  821. }
  822. } else if (9<=ageGroup&&ageGroup <= 12){
  823. if (0 < times && times <= 480) {
  824. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  825. } else if (480 < times ) {
  826. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  827. }
  828. } else if (13<=ageGroup&&ageGroup <= 15){
  829. if (0 < times && times <= 300) {
  830. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  831. } else if (300 < times ) {
  832. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  833. }
  834. } else if (16<=ageGroup&&ageGroup <= 35){
  835. if (0 < times && times <= 120) {
  836. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  837. } else if (120 < times ) {
  838. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  839. }
  840. } else if (36<=ageGroup&&ageGroup <= 49){
  841. if (0 < times && times <= 300) {
  842. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  843. } else if (300 < times ) {
  844. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  845. }
  846. } else if (50<=ageGroup&&ageGroup <=60){
  847. if (0 < times && times <= 480) {
  848. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  849. } else if (480 < times ) {
  850. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  851. }
  852. } else if (60<ageGroup){
  853. if (0 < times && times <= 600) {
  854. that.setData({ mentalRotation: Number(mentalRotation)+20 });
  855. } else if (600 < times ) {
  856. that.setData({ mentalRotation: Number(mentalRotation)+18 });
  857. }
  858. }
  859. }else{
  860. that.setData({ mentalRotation: Number(mentalRotation)+0 });
  861. }
  862. },
  863. /**
  864. * 开始计时
  865. */
  866. startSetInter: function () {
  867. var that = this;
  868. const { graphicReasoning } = that.data;
  869. //将计时器赋值给setInter
  870. that.data.setInter = setInterval(
  871. function () {
  872. var numVal = that.data.times + 0.1;
  873. that.setData({ times: numVal });
  874. }
  875. , 100);
  876. },
  877. /**
  878. * 结束计时
  879. */
  880. endSetInter: function () {
  881. var that = this;
  882. clearInterval(that.data.setInter)
  883. },
  884. /**
  885. * 页面跳转定时器
  886. */
  887. tenEndTimes: function () {
  888. var that = this;
  889. const { graphicReasoning, level, ageGroup,spaceImagination,executionFunctionality,visualSearch,workingMemory,mentalRotation,gameRespondentId} = that.data;
  890. setTimeout(
  891. function () {
  892. that.redirectCtl({ url: 'kong_jian_xiang_xiang', method: { mentalRotation,graphicReasoning, level:0, ageGroup,spaceImagination,executionFunctionality,visualSearch,workingMemory,gameRespondentId} }, true)
  893. }, 500
  894. )
  895. },
  896. /**
  897. * 答题情况保存
  898. */
  899. saveCase:function(str){
  900. const postData = { fn: this.getPersonInfo, param: { ...arguments } }
  901. const {level,times,gameRespondentId}=this.data
  902. app.post('/api/game/v2/answerInfoSave', {gameRespondentId,moduleCode:1,questionCode:level,usedTime:Math.round(times*1000),answerResult:str+1}, 0, postData).then(res => {
  903. })
  904. },
  905. })