| | |
| | | import { |
| | | getPublicImage |
| | | } from "../../../../assets/js/middleGround/tool"; |
| | | import { |
| | | loginInfo |
| | | } from '../../../../assets/js/login'; |
| | | const app = getApp(); |
| | | Page({ |
| | | /** |
| | |
| | | isCountdownRunning: true, // 是否倒计时 |
| | | countdownTime: 0, // 倒计时时间 |
| | | storeInfo: '', |
| | | jslx: '', |
| | | bookId: "", |
| | | productLinkPath: "", |
| | | rootCmsItemId: "", |
| | |
| | | idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], |
| | | answerType: options.answerType, |
| | | storeInfo: options.storeInfo, |
| | | jslx: options.jslx, |
| | | }); |
| | | wx.setNavigationBarTitle({ |
| | | title: options.answerTitle, |
| | |
| | | mockid: options.mockid, |
| | | }); |
| | | } |
| | | this.init(); |
| | | |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | this.init(); |
| | | } else { |
| | | this.init(); |
| | | } |
| | | }) |
| | | } else { |
| | | this.init() |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | const inputData = e.detail.value.detail.value; |
| | | const id = e.detail.value.currentTarget.dataset.id; |
| | | const index = Number(e.detail.value.currentTarget.dataset.index); |
| | | console.log(index); |
| | | const questionList = this.data.questionDataList; |
| | | questionList.forEach((item) => { |
| | | if (item.id == id) { |
| | |
| | | let query = { |
| | | path: "*", |
| | | queryType: "*", |
| | | storeInfo: this.data.storeInfo, |
| | | |
| | | productId: this.data.bookId, |
| | | cmsPath: pathitem.productLinkPath, |
| | | itemFields: { |
| | |
| | | size: 999, |
| | | }, |
| | | }; |
| | | if (this.data.storeInfo) { |
| | | query.storeInfo = this.data.storeInfo |
| | | } |
| | | await app.MG.store.getProductDetail(query).then((res) => { |
| | | this.setData({ |
| | | total: res.datas.cmsDatas[0].datas.length, |
| | |
| | | }); |
| | | } |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | if (this.data.storeInfo) { |
| | | if (this.data.storeInfo || this.data.jslx) { |
| | | if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | pathitem.name = "单选题" |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | |
| | | questionDataList: questionList, |
| | | cardList: cardUpdatedList, |
| | | }); |
| | | console.log( |
| | | '题目', this.data.questionDataList |
| | | ); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | for (let qindex = 0; qindex < this.data.collectList.length; qindex++) { |
| | | const qitem = this.data.collectList[qindex]; |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | Embedded_QuestionBank_Difficulty: [], |
| | | }, |
| | | }; |
| | | if (this.data.storeInfo) { |
| | | query.storeInfo = this.data.storeInfo |
| | | } |
| | | await app.MG.store.getProductDetail(query).then((res) => { |
| | | let questionArr = []; |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | |
| | | let multipleChoiceArr = []; // 多选 |
| | | let completionArr = []; // 填空 |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | Embedded_QuestionBank_Difficulty: [], |
| | | }, |
| | | }; |
| | | if (this.data.storeInfo) { |
| | | query.storeInfo = this.data.storeInfo |
| | | } |
| | | await app.MG.store.getProductDetail(query).then((res) => { |
| | | let questionArr = []; |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | |
| | | itemIds.push(item.id + ""); |
| | | }); |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | Embedded_QuestionBank_Difficulty: [], |
| | | }, |
| | | }; |
| | | if (this.data.storeInfo) { |
| | | query.storeInfo = this.data.storeInfo |
| | | } |
| | | await app.MG.store.getProductDetail(query).then((res) => { |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | // 循环questionList,给每题赋值分数 |