feedBack.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. //index.js
  2. //获取应用实例
  3. const app = require('../../utils/util.js');
  4. const tools = require('../../utils/tools.js');
  5. Page({
  6. data: {
  7. nameIsTrue: false, //名字是否填写
  8. cultureIsTrue: false, //文化是否填写
  9. graduationIsTrue: false, //毕业学校
  10. majorIsTrue: false, //所有专业
  11. postIsTrue: false, //现任职务
  12. renzhishijianIsTrue: false,
  13. phoneIsTrue: false, //电话
  14. peixunshijianTrue: false, // 培训时间
  15. nameMessage: '',
  16. zaizhiTime: [], //在线时间
  17. peixunTime: '', //培训时间
  18. headmasterText: [], //
  19. names: [],
  20. timeIndex: '',
  21. chooseValue: [], // 选择的答案序列
  22. radio: '1',
  23. renzhiDate: '',
  24. postshow: [],
  25. postshow1: false,
  26. errorIsTrue: false,
  27. currentDate: new Date().getTime(),
  28. currentDate1: new Date().getTime(),
  29. minDate: new Date().getTime,
  30. formatter(type, value) {
  31. if (type === 'year') {
  32. return `${value}年`;
  33. } else if (type === 'month') {
  34. return `${value}月`;
  35. }
  36. return value;
  37. },
  38. questionList: [
  39. // {
  40. // "QuestType": "6",
  41. // "Id": 11,
  42. // name: 'ccccc',
  43. // QuestStem: '时间选择',
  44. // QuestAnswer: ''
  45. // },
  46. // {
  47. // "QuestType": "5",
  48. // "Id": 11,
  49. // name: 'dddd',
  50. // QuestStem: '姓名输入',
  51. // QuestAnswer: ''
  52. // },
  53. // {
  54. // "QuestType": "6",
  55. // "Id": 11,
  56. // name: 'username111',
  57. // QuestStem: '时间2',
  58. // QuestAnswer: ''
  59. // },
  60. // {
  61. // "QuestType": "5",
  62. // "Id": 11,
  63. // name: 'address',
  64. // QuestStem: '姓名输入',
  65. // QuestAnswer: ''
  66. // },
  67. // {
  68. // "QuestType": "0",
  69. // "QuestChoice": [{
  70. // value: 'USA',
  71. // name: '美国'
  72. // },
  73. // {
  74. // value: 'CHN',
  75. // name: '中国',
  76. // checked: 'true'
  77. // },
  78. // {
  79. // value: 'BRA',
  80. // name: '巴西'
  81. // },
  82. // {
  83. // value: 'JPN',
  84. // name: '日本'
  85. // },
  86. // {
  87. // value: 'ENG',
  88. // name: '英国'
  89. // },
  90. // {
  91. // value: 'FRA',
  92. // name: '法国'
  93. // },
  94. // ],
  95. // "Id": 36,
  96. // name: 'sex',
  97. // QuestStem: '性别单选'
  98. // },
  99. // {
  100. // "QuestType": "0",
  101. // "QuestChoice": [{
  102. // value: '男',
  103. // name: '男',
  104. // checked: false,
  105. // },
  106. // {
  107. // value: '女',
  108. // name: '女',
  109. // checked: false,
  110. // },
  111. // ],
  112. // "Id": 36,
  113. // name: 'sex111',
  114. // QuestStem: '性别单选2222'
  115. // },
  116. // {
  117. // "QuestType": "1",
  118. // "QuestAnswer": "equals ()||\nhashCode()||",
  119. // "QuestChoice": [{
  120. // value: 'USA',
  121. // name: '美国'
  122. // },
  123. // {
  124. // value: 'CHN',
  125. // name: '中国',
  126. // checked: false
  127. // },
  128. // {
  129. // value: 'FRA',
  130. // name: '法国'
  131. // }
  132. // ],
  133. // "Id": 38,
  134. // name: 'alls',
  135. // QuestStem: '多选'
  136. // },
  137. // {
  138. // "QuestType": "2",
  139. // "QuestStem": "1+1=2",
  140. // "QuestAnswer": "是",
  141. // "QuestChoice": [{
  142. // value: 'USA',
  143. // name: '是'
  144. // },
  145. // {
  146. // value: 'CHN',
  147. // name: '中国',
  148. // checked: false
  149. // },
  150. // ],
  151. // "Id": 42,
  152. // name: 'lllll',
  153. // QuestStem: '判断1'
  154. // },
  155. // {
  156. // "QuestType": "2",
  157. // "QuestStem": "1+1=2",
  158. // "QuestAnswer": "是",
  159. // "QuestChoice": [{
  160. // value: 'USA',
  161. // name: '是'
  162. // },
  163. // {
  164. // value: 'CHN',
  165. // name: '中国',
  166. // checked: false
  167. // },
  168. // ],
  169. // "Id": 42,
  170. // name: 'lllll',
  171. // QuestStem: '判断2'
  172. // },
  173. // {
  174. // "QuestType": "2",
  175. // "QuestStem": "1+1=2",
  176. // "QuestAnswer": "是",
  177. // "QuestChoice": [{
  178. // value: 'USA',
  179. // name: '是'
  180. // },
  181. // {
  182. // value: 'CHN',
  183. // name: '中国',
  184. // checked: false
  185. // },
  186. // ],
  187. // "Id": 42,
  188. // name: 'lllll',
  189. // QuestStem: '判断3'
  190. // },
  191. // {
  192. // "QuestType": "3",
  193. // "QuestStem": "世纪大厦的萨科技的哈市(解答)",
  194. // "QuestAnswer": "",
  195. // "QuestChoice": "",
  196. // "Id": 39,
  197. // name: 'textarea',
  198. // },
  199. ],
  200. answersId: '', // 提交答案用到
  201. sessionKey: '',
  202. paperId: '',
  203. answersId: '',
  204. id: '',
  205. status: ''
  206. },
  207. onChange(event) {
  208. this.setData({
  209. radio: event.detail,
  210. });
  211. },
  212. radioChange(e) {
  213. console.log(e);
  214. const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
  215. for (let i = 0, len = items.length; i < len; ++i) {
  216. items[i].checked = items[i].value === e.detail.value
  217. }
  218. let json = {};
  219. json.currentAnswer = e.detail.value;
  220. json.id = e.currentTarget.dataset.idx;
  221. json.questType = e.currentTarget.dataset.questtypes;
  222. this.data.chooseValue[e.currentTarget.dataset.index] = json;
  223. this.setData({
  224. questionList: this.data.questionList
  225. })
  226. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  227. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  228. console.log(this.data.questionList);
  229. // this.data.questionList[this.data.index].checked = e.detail.value;
  230. // this.setData({
  231. // questionList: this.data.questionList
  232. // })
  233. // const items = this.data.items
  234. // for (let i = 0, len = items.length; i < len; ++i) {
  235. // items[i].checked = items[i].value === e.detail.value
  236. // }
  237. // this.setData({
  238. // items
  239. // })
  240. },
  241. checkboxChange(e) {
  242. const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
  243. const values = e.detail.value
  244. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  245. items[i].checked = false
  246. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  247. if (items[i].value === values[j]) {
  248. items[i].checked = true
  249. break
  250. }
  251. }
  252. }
  253. let json = {};
  254. let aa = e.detail.value.join("||")
  255. json.currentAnswer = aa;
  256. json.id = e.currentTarget.dataset.idx;
  257. json.questType = e.currentTarget.dataset.questtypes;
  258. this.data.chooseValue[e.currentTarget.dataset.index] = json;
  259. this.setData({
  260. questionList: this.data.questionList
  261. })
  262. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  263. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  264. },
  265. bindTextAreaBlur(e) {
  266. console.log(e, "hhhhh");
  267. console.log(e.detail.value);
  268. let json = {};
  269. json.currentAnswer = e.detail.value;
  270. json.id = e.currentTarget.dataset.idx;
  271. json.questType = e.currentTarget.dataset.questtypes;
  272. this.data.chooseValue[e.currentTarget.dataset.index] = json;
  273. this.data.questionList[e.currentTarget.dataset.index].QuestAnswer = e.detail.value;
  274. this.setData({
  275. questionList: this.data.questionList
  276. })
  277. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  278. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  279. },
  280. share() {
  281. this.setData({
  282. show: true
  283. });
  284. },
  285. onClose() {
  286. this.setData({
  287. ['postshow[' + this.data.timeIndex + ']']: false,
  288. });
  289. },
  290. onClose1() {
  291. console.log("11111111111111");
  292. this.setData({
  293. postshow1: false
  294. });
  295. },
  296. onInput(event) {
  297. console.log(event, "8888888");
  298. console.log("点击了");
  299. this.setData({
  300. currentDate: event.detail,
  301. });
  302. },
  303. onInput1(event) {
  304. console.log("000");
  305. this.setData({
  306. currentDate1: event.detail,
  307. });
  308. },
  309. formatDate(date) {
  310. date = new Date(date);
  311. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  312. },
  313. share1(e) {
  314. console.log(e);
  315. console.log(e.currentTarget.dataset.index);
  316. console.log(e.currentTarget.dataset.names, "8520852085208520");
  317. console.log(this.data.postshow[e.currentTarget.dataset.index]);
  318. this.data.postshow[e.currentTarget.dataset.index] = true;
  319. this.data.names[e.currentTarget.dataset.index] = e.currentTarget.dataset.names;
  320. this.setData({
  321. postshow: this.data.postshow,
  322. timeIndex: e.currentTarget.dataset.index
  323. })
  324. console.log(this.data.postshow, "打印下锕啊啊啊啊锕锕锕");
  325. // this.setData({
  326. // postshow: true
  327. // });
  328. },
  329. share() {
  330. this.setData({
  331. postshow1: true
  332. });
  333. },
  334. formatDate(date) {
  335. date = new Date(date);
  336. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  337. },
  338. onConfirm(event) {
  339. console.log(event, "1111111");
  340. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  341. let json = {};
  342. json.currentAnswer = timeValue;
  343. json.id = event.currentTarget.dataset.idx;
  344. json.questType = event.currentTarget.dataset.questtypes;
  345. let aa = this.data.chooseValue[event.currentTarget.dataset.index] = json;
  346. this.data.questionList[event.currentTarget.dataset.index].QuestAnswer = timeValue;
  347. this.setData({
  348. questionList: this.data.questionList,
  349. ['chooseValue[' + event.currentTarget.dataset.index + ']']: aa,
  350. ['postshow[' + this.data.timeIndex + ']']: false,
  351. ['headmasterText[' + this.data.timeIndex + ']']: '',
  352. });
  353. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  354. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  355. console.log(this.data.chooseValue, "确定后的值锕");
  356. console.log(this.data.questionList, "789789798789");
  357. },
  358. onConfirm1(event) {
  359. console.log(event, "0000");
  360. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  361. this.setData({
  362. peixunTime: timeValue,
  363. postshow1: false,
  364. peixunText: ''
  365. });
  366. },
  367. parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
  368. let that = this
  369. let this_checked = e.currentTarget.dataset.id
  370. let parameterList = this.data.parameter //获取Json数组
  371. for (let i = 0; i < parameterList.length; i++) {
  372. if (parameterList[i].id == this_checked) {
  373. parameterList[i].checked = true; //当前点击的位置为true即选中
  374. } else {
  375. parameterList[i].checked = false; //其他的位置为false
  376. }
  377. }
  378. that.setData({
  379. parameter: parameterList
  380. })
  381. },
  382. submitForm() {
  383. //let arr1 = this.data.chooseValue.filter(d => d);
  384. //console.log(arr1,"打印下提交");
  385. console.log(this.data.chooseValue, "打印下提交");
  386. wx.request({
  387. url: app.globalData.publicUrl + '/wx/paper/commit',
  388. method: "post",
  389. data: {
  390. sessionKey: this.data.sessionKey,
  391. currentAnswerTemp: this.data.chooseValue,
  392. answersId: wx.getStorageSync('answersId')
  393. },
  394. success: (res) => {
  395. console.log(res);
  396. if (res.data.msg == "请勿重复提交") {
  397. wx.showModal({
  398. showCancel: false,
  399. content: res.data.msg,
  400. success(res) {}
  401. })
  402. } else {
  403. wx.switchTab({
  404. url: '/pages/myClass/myClass',
  405. })
  406. }
  407. }
  408. })
  409. let isTrue = false;
  410. // this.data.chooseValue.forEach(item => {
  411. // console.log(item, "123123");
  412. // if (item.currentAnswer) {
  413. // isTrue = true;
  414. // } else {
  415. // wx.showModal({
  416. // showCancel: false,
  417. // content: item.QuestStem + "不能为空",
  418. // success(res) {}
  419. // })
  420. // }
  421. // })
  422. // if (isTrue) {
  423. // console.log("提交了");
  424. // wx.request({
  425. // url: app.globalData.publicUrl + '/wx/paper/commit',
  426. // method: "post",
  427. // data: {
  428. // sessionKey: this.data.sessionKey,
  429. // currentAnswerTemp: this.data.chooseValue,
  430. // answersId: wx.getStorageSync('answersId')
  431. // },
  432. // success: (res) => {
  433. // console.log(res);
  434. // if(res.data.msg == "请勿重复提交"){
  435. // wx.showModal({
  436. // showCancel: false,
  437. // content: res.data.msg,
  438. // success(res) {}
  439. // })
  440. // }else{
  441. // wx.navigateTo({
  442. // url: '/pages/myClass/myClass',
  443. // })
  444. // }
  445. // }
  446. // })
  447. // }
  448. },
  449. formSubmit(e) {
  450. console.log(e.detail.value, "000000000000000");
  451. let arr1 = this.data.zaizhiTime.filter(d => d);
  452. let arr = this.data.names.filter(d => d);
  453. var activeSubjectsArr = [];
  454. for (var i = 0; i < arr.length; i++) {
  455. var activeSubjectsObject = {};
  456. for (var j = 0; j < arr1.length; j++) {
  457. if (i == j) {
  458. activeSubjectsObject[arr[i]] = arr1[j];
  459. activeSubjectsArr.push(activeSubjectsObject);
  460. }
  461. }
  462. }
  463. console.log(activeSubjectsArr, "7777777");
  464. let count = 0;
  465. let data = {};
  466. for (let a in e.detail.value) {
  467. count += 1;
  468. if (count = 1) {
  469. data[a] = e.detail.value[a]
  470. }
  471. }
  472. activeSubjectsArr.forEach(item => {
  473. Object.assign(data, item)
  474. })
  475. console.log(data, "888888888888888888888888");
  476. // Object.keys(data).forEach(function (key) {
  477. // if (!data[key]) {
  478. // wx.showModal({
  479. // showCancel: false,
  480. // content: key + "不能为空"
  481. // })
  482. // return;
  483. // }
  484. // });
  485. // if (!e.detail.value.username) {
  486. // this.setData({
  487. // nameIsTrue: true
  488. // })
  489. // } else {
  490. // this.setData({
  491. // nameIsTrue: false
  492. // })
  493. // }
  494. // let sex = '';
  495. // if (this.data.parameter[0].checked) {
  496. // sex = this.data.parameter[0].name
  497. // this.setData({
  498. // errorIsTrue: false
  499. // })
  500. // } else if (this.data.parameter[1].checked) {
  501. // sex = this.data.parameter[1].name
  502. // this.setData({
  503. // errorIsTrue: false
  504. // })
  505. // } else {
  506. // this.setData({
  507. // errorIsTrue: true
  508. // })
  509. // }
  510. // if (!e.detail.value.work) {
  511. // this.setData({
  512. // workIsTrue: true
  513. // })
  514. // } else {
  515. // this.setData({
  516. // workIsTrue: false
  517. // })
  518. // }
  519. // if (!e.detail.value.culture) {
  520. // this.setData({
  521. // cultureIsTrue: true
  522. // })
  523. // } else {
  524. // this.setData({
  525. // cultureIsTrue: false
  526. // })
  527. // }
  528. // if (!e.detail.value.graduation) {
  529. // this.setData({
  530. // graduationIsTrue: true
  531. // })
  532. // } else {
  533. // this.setData({
  534. // graduationIsTrue: false
  535. // })
  536. // }
  537. // if (!e.detail.value.major) {
  538. // this.setData({
  539. // majorIsTrue: true
  540. // })
  541. // } else {
  542. // this.setData({
  543. // majorIsTrue: false
  544. // })
  545. // }
  546. // if (!e.detail.value.post) {
  547. // this.setData({
  548. // postIsTrue: true
  549. // })
  550. // } else {
  551. // this.setData({
  552. // postIsTrue: false
  553. // })
  554. // }
  555. // if (!e.detail.value.phone) {
  556. // this.setData({
  557. // phoneIsTrue: true
  558. // })
  559. // } else {
  560. // this.setData({
  561. // phoneIsTrue: false
  562. // })
  563. // }
  564. // if (!this.data.zaizhiTime) {
  565. // this.setData({
  566. // renzhishijianIsTrue: true
  567. // })
  568. // } else {
  569. // this.setData({
  570. // renzhishijianIsTrue: false
  571. // })
  572. // }
  573. // if (!this.data.peixunTime) {
  574. // this.setData({
  575. // peixunshijianTrue: true
  576. // })
  577. // } else {
  578. // this.setData({
  579. // peixunshijianTrue: false
  580. // })
  581. // }
  582. // console.log(this.data.zaizhiTime, "在职时间000");
  583. // console.log(this.data.peixunTime, "培训时间000");
  584. // console.log(sex, "性别的");
  585. // e.detail.value.zaizhiTime = this.data.zaizhiTime;
  586. // e.detail.value.peixunTime = this.data.peixunTime;
  587. // e.detail.value.sex = sex;
  588. // console.log(e.detail.value, "我是合并后的锕");
  589. },
  590. timeFormat(date, fmt) {
  591. let o = {
  592. "M+": date.getMonth() + 1, //月份   
  593. "d+": date.getDate(), //日
  594. "h+": date.getHours(), //小时   
  595. "m+": date.getMinutes(), //分   
  596. "s+": date.getSeconds(), //秒   
  597. "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
  598. "S": date.getMilliseconds() //毫秒   
  599. };
  600. if (/(y+)/.test(fmt))
  601. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  602. for (let k in o)
  603. if (new RegExp("(" + k + ")").test(fmt))
  604. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  605. return fmt;
  606. },
  607. onReady: function () {},
  608. async onLoad(options) {
  609. const sessionKey = await tools.checkSessionAndLogin();
  610. console.log(sessionKey, "111");
  611. //const sessionKey = 'BqQROCKCxn7R2NXdQLud9Q==';
  612. console.log("onloading.....................");
  613. // let chooceArr = this.data.questionList.map(item => {
  614. // let json = {};
  615. // json.currentAnswer = '';
  616. // json.questType = '';
  617. // json.id = item.Id;
  618. // json.QuestStem = item.QuestStem;
  619. // return json
  620. // })
  621. // console.log(chooceArr);
  622. // this.setData({
  623. // chooseValue: chooceArr
  624. // })
  625. console.log(options.answersId, "00000000000000000000000000");
  626. console.log(options, "11111");
  627. wx.setStorageSync('answersId', options.answersId);
  628. this.setData({
  629. sessionKey: sessionKey,
  630. paperId: options.paperId,
  631. answersId: options.answersId,
  632. id: options.id,
  633. })
  634. if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
  635. console.log("缓村了锕");
  636. const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
  637. this.setData({
  638. questionList: questionList,
  639. answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
  640. chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
  641. })
  642. console.log(this.data.questionList, "show 缓存的数据");
  643. } else {
  644. console.log("无缓存");
  645. this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
  646. }
  647. // if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
  648. // console.log("缓村了锕");
  649. // const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
  650. // this.setData({
  651. // questionList: questionList,
  652. // answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
  653. // chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
  654. // })
  655. // console.log(this.data.questionList, "show 缓存的数据");
  656. // } else {
  657. // console.log("无缓存");
  658. // this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
  659. // }
  660. },
  661. allShi(id, paperId, sessionKey) {
  662. wx.request({
  663. url: app.globalData.publicUrl + '/wx/paper/detail',
  664. method: "post",
  665. data: {
  666. sessionKey: sessionKey,
  667. id: id,
  668. paperId: paperId
  669. },
  670. success: (res) => {
  671. let jsonArr = JSON.parse(res.data.paperContent).map(item => {
  672. let json = {};
  673. json.QuestType = item.QuestType;
  674. json.Id = item.Id;
  675. json.QuestAnswer = item.QuestAnswer;
  676. json.QuestStem = item.QuestStem;
  677. // if (item.QuestChoice) {
  678. // let arr = item.QuestChoice.split('||');
  679. // json.QuestChoice = arr;
  680. // }
  681. if (item.QuestType == '1' || item.QuestType == '0') {
  682. let arr = item.QuestChoice.split('||');
  683. let arrJson = arr.map(item => {
  684. let json1 = {};
  685. json1.name = item;
  686. json1.value = item;
  687. json1.checked = false;
  688. return json1
  689. });
  690. json.QuestChoice = arrJson;
  691. }
  692. return json;
  693. })
  694. // for(let i = 0 ; i<jsonArr.length; i++){
  695. // let json = {};
  696. // json.currentAnswer = '';
  697. // json.questType = '';
  698. // json.id = '';
  699. // }
  700. // 答案锕
  701. let chooceArr = jsonArr.map(item => {
  702. let json = {};
  703. json.currentAnswer = '';
  704. json.questType = '';
  705. json.id = item.Id;
  706. json.QuestStem = item.QuestStem;
  707. return json
  708. })
  709. this.setData({
  710. questionList: jsonArr,
  711. chooseValue: chooceArr
  712. })
  713. console.log(this.data.questionList, "00000");
  714. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  715. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  716. }
  717. })
  718. },
  719. })