feedBack.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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. console.log( this.data.chooseValue,"0000");
  230. // this.data.questionList[this.data.index].checked = e.detail.value;
  231. // this.setData({
  232. // questionList: this.data.questionList
  233. // })
  234. // const items = this.data.items
  235. // for (let i = 0, len = items.length; i < len; ++i) {
  236. // items[i].checked = items[i].value === e.detail.value
  237. // }
  238. // this.setData({
  239. // items
  240. // })
  241. },
  242. checkboxChange(e) {
  243. const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
  244. const values = e.detail.value
  245. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  246. items[i].checked = false
  247. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  248. if (items[i].value === values[j]) {
  249. items[i].checked = true
  250. break
  251. }
  252. }
  253. }
  254. let json = {};
  255. let aa = e.detail.value.join("||")
  256. json.currentAnswer = aa;
  257. json.id = e.currentTarget.dataset.idx;
  258. json.questType = e.currentTarget.dataset.questtypes;
  259. this.data.chooseValue[e.currentTarget.dataset.index] = json;
  260. this.setData({
  261. questionList: this.data.questionList
  262. })
  263. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  264. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  265. },
  266. bindTextAreaBlur(e) {
  267. console.log(e, "hhhhh");
  268. console.log(e.detail.value);
  269. let json = {};
  270. json.currentAnswer = e.detail.value;
  271. json.id = e.currentTarget.dataset.idx;
  272. json.questType = e.currentTarget.dataset.questtypes;
  273. this.data.chooseValue[e.currentTarget.dataset.index] = json;
  274. this.data.questionList[e.currentTarget.dataset.index].QuestAnswer = e.detail.value;
  275. this.setData({
  276. questionList: this.data.questionList
  277. })
  278. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  279. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  280. },
  281. share() {
  282. this.setData({
  283. show: true
  284. });
  285. },
  286. onClose() {
  287. this.setData({
  288. ['postshow[' + this.data.timeIndex + ']']: false,
  289. });
  290. },
  291. onClose1() {
  292. console.log("11111111111111");
  293. this.setData({
  294. postshow1: false
  295. });
  296. },
  297. onInput(event) {
  298. console.log(event, "8888888");
  299. console.log("点击了");
  300. this.setData({
  301. currentDate: event.detail,
  302. });
  303. },
  304. onInput1(event) {
  305. console.log("000");
  306. this.setData({
  307. currentDate1: event.detail,
  308. });
  309. },
  310. formatDate(date) {
  311. date = new Date(date);
  312. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  313. },
  314. share1(e) {
  315. console.log(e);
  316. console.log(e.currentTarget.dataset.index);
  317. console.log(e.currentTarget.dataset.names, "8520852085208520");
  318. console.log(this.data.postshow[e.currentTarget.dataset.index]);
  319. this.data.postshow[e.currentTarget.dataset.index] = true;
  320. this.data.names[e.currentTarget.dataset.index] = e.currentTarget.dataset.names;
  321. this.setData({
  322. postshow: this.data.postshow,
  323. timeIndex: e.currentTarget.dataset.index
  324. })
  325. console.log(this.data.postshow, "打印下锕啊啊啊啊锕锕锕");
  326. // this.setData({
  327. // postshow: true
  328. // });
  329. },
  330. share() {
  331. this.setData({
  332. postshow1: true
  333. });
  334. },
  335. formatDate(date) {
  336. date = new Date(date);
  337. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  338. },
  339. onConfirm(event) {
  340. console.log(event, "1111111");
  341. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  342. let json = {};
  343. json.currentAnswer = timeValue;
  344. json.id = event.currentTarget.dataset.idx;
  345. json.questType = event.currentTarget.dataset.questtypes;
  346. let aa = this.data.chooseValue[event.currentTarget.dataset.index] = json;
  347. this.data.questionList[event.currentTarget.dataset.index].QuestAnswer = timeValue;
  348. this.setData({
  349. questionList: this.data.questionList,
  350. ['chooseValue[' + event.currentTarget.dataset.index + ']']: aa,
  351. ['postshow[' + this.data.timeIndex + ']']: false,
  352. ['headmasterText[' + this.data.timeIndex + ']']: '',
  353. });
  354. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  355. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  356. console.log(this.data.chooseValue, "确定后的值锕");
  357. console.log(this.data.questionList, "789789798789");
  358. },
  359. onConfirm1(event) {
  360. console.log(event, "0000");
  361. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  362. this.setData({
  363. peixunTime: timeValue,
  364. postshow1: false,
  365. peixunText: ''
  366. });
  367. },
  368. parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
  369. let that = this
  370. let this_checked = e.currentTarget.dataset.id
  371. let parameterList = this.data.parameter //获取Json数组
  372. for (let i = 0; i < parameterList.length; i++) {
  373. if (parameterList[i].id == this_checked) {
  374. parameterList[i].checked = true; //当前点击的位置为true即选中
  375. } else {
  376. parameterList[i].checked = false; //其他的位置为false
  377. }
  378. }
  379. that.setData({
  380. parameter: parameterList
  381. })
  382. },
  383. submitForm() {
  384. //let arr1 = this.data.chooseValue.filter(d => d);
  385. //console.log(arr1,"打印下提交");
  386. console.log(this.data.chooseValue, "打印下提交");
  387. wx.request({
  388. url: app.globalData.publicUrl + '/wx/paper/commit',
  389. method: "post",
  390. data: {
  391. sessionKey: this.data.sessionKey,
  392. currentAnswerTemp: this.data.chooseValue,
  393. answersId: wx.getStorageSync('answersId')
  394. },
  395. success: (res) => {
  396. console.log(res);
  397. if (res.data.msg == "请勿重复提交") {
  398. wx.showModal({
  399. showCancel: false,
  400. content: res.data.msg,
  401. success(res) {}
  402. })
  403. } else {
  404. wx.switchTab({
  405. url: '/pages/myClass/myClass',
  406. })
  407. }
  408. }
  409. })
  410. let isTrue = false;
  411. // this.data.chooseValue.forEach(item => {
  412. // console.log(item, "123123");
  413. // if (item.currentAnswer) {
  414. // isTrue = true;
  415. // } else {
  416. // wx.showModal({
  417. // showCancel: false,
  418. // content: item.QuestStem + "不能为空",
  419. // success(res) {}
  420. // })
  421. // }
  422. // })
  423. // if (isTrue) {
  424. // console.log("提交了");
  425. // wx.request({
  426. // url: app.globalData.publicUrl + '/wx/paper/commit',
  427. // method: "post",
  428. // data: {
  429. // sessionKey: this.data.sessionKey,
  430. // currentAnswerTemp: this.data.chooseValue,
  431. // answersId: wx.getStorageSync('answersId')
  432. // },
  433. // success: (res) => {
  434. // console.log(res);
  435. // if(res.data.msg == "请勿重复提交"){
  436. // wx.showModal({
  437. // showCancel: false,
  438. // content: res.data.msg,
  439. // success(res) {}
  440. // })
  441. // }else{
  442. // wx.navigateTo({
  443. // url: '/pages/myClass/myClass',
  444. // })
  445. // }
  446. // }
  447. // })
  448. // }
  449. },
  450. formSubmit(e) {
  451. console.log(e.detail.value, "000000000000000");
  452. let arr1 = this.data.zaizhiTime.filter(d => d);
  453. let arr = this.data.names.filter(d => d);
  454. var activeSubjectsArr = [];
  455. for (var i = 0; i < arr.length; i++) {
  456. var activeSubjectsObject = {};
  457. for (var j = 0; j < arr1.length; j++) {
  458. if (i == j) {
  459. activeSubjectsObject[arr[i]] = arr1[j];
  460. activeSubjectsArr.push(activeSubjectsObject);
  461. }
  462. }
  463. }
  464. console.log(activeSubjectsArr, "7777777");
  465. let count = 0;
  466. let data = {};
  467. for (let a in e.detail.value) {
  468. count += 1;
  469. if (count = 1) {
  470. data[a] = e.detail.value[a]
  471. }
  472. }
  473. activeSubjectsArr.forEach(item => {
  474. Object.assign(data, item)
  475. })
  476. console.log(data, "888888888888888888888888");
  477. // Object.keys(data).forEach(function (key) {
  478. // if (!data[key]) {
  479. // wx.showModal({
  480. // showCancel: false,
  481. // content: key + "不能为空"
  482. // })
  483. // return;
  484. // }
  485. // });
  486. // if (!e.detail.value.username) {
  487. // this.setData({
  488. // nameIsTrue: true
  489. // })
  490. // } else {
  491. // this.setData({
  492. // nameIsTrue: false
  493. // })
  494. // }
  495. // let sex = '';
  496. // if (this.data.parameter[0].checked) {
  497. // sex = this.data.parameter[0].name
  498. // this.setData({
  499. // errorIsTrue: false
  500. // })
  501. // } else if (this.data.parameter[1].checked) {
  502. // sex = this.data.parameter[1].name
  503. // this.setData({
  504. // errorIsTrue: false
  505. // })
  506. // } else {
  507. // this.setData({
  508. // errorIsTrue: true
  509. // })
  510. // }
  511. // if (!e.detail.value.work) {
  512. // this.setData({
  513. // workIsTrue: true
  514. // })
  515. // } else {
  516. // this.setData({
  517. // workIsTrue: false
  518. // })
  519. // }
  520. // if (!e.detail.value.culture) {
  521. // this.setData({
  522. // cultureIsTrue: true
  523. // })
  524. // } else {
  525. // this.setData({
  526. // cultureIsTrue: false
  527. // })
  528. // }
  529. // if (!e.detail.value.graduation) {
  530. // this.setData({
  531. // graduationIsTrue: true
  532. // })
  533. // } else {
  534. // this.setData({
  535. // graduationIsTrue: false
  536. // })
  537. // }
  538. // if (!e.detail.value.major) {
  539. // this.setData({
  540. // majorIsTrue: true
  541. // })
  542. // } else {
  543. // this.setData({
  544. // majorIsTrue: false
  545. // })
  546. // }
  547. // if (!e.detail.value.post) {
  548. // this.setData({
  549. // postIsTrue: true
  550. // })
  551. // } else {
  552. // this.setData({
  553. // postIsTrue: false
  554. // })
  555. // }
  556. // if (!e.detail.value.phone) {
  557. // this.setData({
  558. // phoneIsTrue: true
  559. // })
  560. // } else {
  561. // this.setData({
  562. // phoneIsTrue: false
  563. // })
  564. // }
  565. // if (!this.data.zaizhiTime) {
  566. // this.setData({
  567. // renzhishijianIsTrue: true
  568. // })
  569. // } else {
  570. // this.setData({
  571. // renzhishijianIsTrue: false
  572. // })
  573. // }
  574. // if (!this.data.peixunTime) {
  575. // this.setData({
  576. // peixunshijianTrue: true
  577. // })
  578. // } else {
  579. // this.setData({
  580. // peixunshijianTrue: false
  581. // })
  582. // }
  583. // console.log(this.data.zaizhiTime, "在职时间000");
  584. // console.log(this.data.peixunTime, "培训时间000");
  585. // console.log(sex, "性别的");
  586. // e.detail.value.zaizhiTime = this.data.zaizhiTime;
  587. // e.detail.value.peixunTime = this.data.peixunTime;
  588. // e.detail.value.sex = sex;
  589. // console.log(e.detail.value, "我是合并后的锕");
  590. },
  591. timeFormat(date, fmt) {
  592. let o = {
  593. "M+": date.getMonth() + 1, //月份   
  594. "d+": date.getDate(), //日
  595. "h+": date.getHours(), //小时   
  596. "m+": date.getMinutes(), //分   
  597. "s+": date.getSeconds(), //秒   
  598. "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
  599. "S": date.getMilliseconds() //毫秒   
  600. };
  601. if (/(y+)/.test(fmt))
  602. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  603. for (let k in o)
  604. if (new RegExp("(" + k + ")").test(fmt))
  605. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  606. return fmt;
  607. },
  608. onReady: function () {},
  609. async onLoad(options) {
  610. const sessionKey = await tools.checkSessionAndLogin();
  611. console.log(sessionKey, "111");
  612. //const sessionKey = 'BqQROCKCxn7R2NXdQLud9Q==';
  613. console.log("onloading.....................");
  614. // let chooceArr = this.data.questionList.map(item => {
  615. // let json = {};
  616. // json.currentAnswer = '';
  617. // json.questType = '';
  618. // json.id = item.Id;
  619. // json.QuestStem = item.QuestStem;
  620. // return json
  621. // })
  622. // console.log(chooceArr);
  623. // this.setData({
  624. // chooseValue: chooceArr
  625. // })
  626. console.log(options.answersId, "00000000000000000000000000");
  627. console.log(options, "11111");
  628. wx.setStorageSync('answersId', options.answersId);
  629. this.setData({
  630. sessionKey: sessionKey,
  631. paperId: options.paperId,
  632. answersId: options.answersId,
  633. id: options.id,
  634. })
  635. if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
  636. console.log("缓村了锕");
  637. const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
  638. this.setData({
  639. questionList: questionList,
  640. answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
  641. chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
  642. })
  643. console.log(this.data.questionList, "show 缓存的数据");
  644. } else {
  645. console.log("无缓存");
  646. this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
  647. }
  648. // if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
  649. // console.log("缓村了锕");
  650. // const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
  651. // this.setData({
  652. // questionList: questionList,
  653. // answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
  654. // chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
  655. // })
  656. // console.log(this.data.questionList, "show 缓存的数据");
  657. // } else {
  658. // console.log("无缓存");
  659. // this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
  660. // }
  661. },
  662. allShi(id, paperId, sessionKey) {
  663. wx.request({
  664. url: app.globalData.publicUrl + '/wx/paper/detail',
  665. method: "post",
  666. data: {
  667. sessionKey: sessionKey,
  668. id: id,
  669. paperId: paperId
  670. },
  671. success: (res) => {
  672. let jsonArr = JSON.parse(res.data.paperContent).map(item => {
  673. let json = {};
  674. json.QuestType = item.QuestType;
  675. json.Id = item.Id;
  676. json.QuestAnswer = item.QuestAnswer;
  677. json.QuestStem = item.QuestStem;
  678. // if (item.QuestChoice) {
  679. // let arr = item.QuestChoice.split('||');
  680. // json.QuestChoice = arr;
  681. // }
  682. if (item.QuestType == '1' || item.QuestType == '0') {
  683. let arr = item.QuestChoice.split('||');
  684. let arrJson = arr.map(item => {
  685. let json1 = {};
  686. json1.name = item;
  687. json1.value = item;
  688. json1.checked = false;
  689. return json1
  690. });
  691. json.QuestChoice = arrJson;
  692. }
  693. return json;
  694. })
  695. // for(let i = 0 ; i<jsonArr.length; i++){
  696. // let json = {};
  697. // json.currentAnswer = '';
  698. // json.questType = '';
  699. // json.id = '';
  700. // }
  701. // 答案锕
  702. let chooceArr = jsonArr.map(item => {
  703. let json = {};
  704. json.currentAnswer = '';
  705. json.questType = '';
  706. json.id = item.Id;
  707. json.QuestStem = item.QuestStem;
  708. return json
  709. })
  710. this.setData({
  711. questionList: jsonArr,
  712. chooseValue: chooceArr
  713. })
  714. console.log(this.data.questionList, "00000");
  715. wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
  716. wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
  717. }
  718. })
  719. },
  720. })