packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml
@@ -1,146 +1,74 @@ <!--pages/bookServices/detail/components/testResource/testResource.wxml--> <view class="test-resource"> <view class="top-btn"> <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0px" > <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0px"> <view class="card {{radioItem == 'test' ? 'card--active' : ''}}"> <t-radio value="test" icon="none" borderless style="height: 80rpx"> <view class="radio-content" slot="content"> <t-image src="{{ radioItem == 'test' ? '/static/images/bookService/detail/practice-icon.png' : '/static/images/bookService/detail/notest.png'}}" ></t-image> <text style="color: {{radioItem == 'test' ? '#fff':''}};" >练习</text > <t-image src="{{ radioItem == 'test' ? '/static/images/bookService/detail/practice-icon.png' : '/static/images/bookService/detail/notest.png'}}"></t-image> <text style="color: {{radioItem == 'test' ? '#fff':''}};">练习</text> </view> </t-radio> </view> <view class="card {{radioItem == 'mock' ? 'card--active' : ''}}"> <t-radio value="mock" icon="none" borderless> <view class="radio-content" slot="content"> <t-image src="{{ radioItem == 'mock' ? '/static/images/bookService/detail/checkpaper.png' : '/static/images/bookService/detail/zujuan.png'}}" ></t-image> <t-image src="{{ radioItem == 'mock' ? '/static/images/bookService/detail/checkpaper.png' : '/static/images/bookService/detail/zujuan.png'}}"></t-image> <text style="color: {{radioItem == 'mock' ? '#fff':''}};"> 组卷</text > 组卷</text> </view> </t-radio> </view> </t-radio-group> <!-- <t-button class=" {{selectBtn == 'test' ? 'practice-btn' : 'paper-btn'}}" theme="default" size="medium" style="width: 85px" bind:tap="changeBtn" data-type="test" > <view slot="content"> <t-image src="{{ selectBtn == 'test' ? '/static/images/bookService/detail/practice-icon.png' : '/static/images/bookService/detail/notest.png'}}" ></t-image> <text>练习</text> </view> </t-button> <t-button class=" {{selectBtn == 'mock' ? 'practice-btn' : 'paper-btn'}}" theme="default" size="medium" style="width: 85px" bind:tap="changeBtn" data-type="mock" > <view slot="content"> <t-image src="{{ selectBtn == 'mock' ? '/static/images/bookService/detail/checkpaper.png' : '/static/images/bookService/detail/zujuan.png'}}" ></t-image> 组卷 </view> </t-button> --> <t-button class="error-btn" theme="default" size="medium" style="padding: 0 12rpx" bind:tap="goMycollect" data-answerType="errorQuestion" > <t-button class="error-btn" theme="default" size="medium" style="padding: 0 12rpx" bind:tap="goMycollect" data-answerType="errorQuestion"> <view slot="content"> <t-image src="/static/images/bookService/detail/cuoti.png"></t-image> 我的错题 </view> </t-button> <t-button class="collect-btn" theme="default" size="medium" style="padding: 0 12rpx" bind:tap="goMycollect" data-answerType="collectQuestion" > <t-button class="collect-btn" theme="default" size="medium" style="padding: 0 12rpx" bind:tap="goMycollect" data-answerType="collectQuestion"> <view slot="content"> <t-image src="/static/images/bookService/detail/wodeshoucang.png" ></t-image> <t-image src="/static/images/bookService/detail/wodeshoucang.png"></t-image> 我的收藏 </view> </t-button> </view> <!-- 练习列表 --> <view class="resource-list" wx:for="{{list}}" wx:key="item.id" wx:if="{{radioItem == 'test'}}" > <view class="resource-list" wx:for="{{list}}" wx:key="item.id" wx:if="{{radioItem == 'test'}}"> <view class="list-title"> <t-image src="/static/images/bookService/detail/test-icon.png"></t-image> <text>{{item.name}}</text> </view> <view class="practice" bind:tap="goTest" data-value="{{item}}"> <t-image src="/static/images/bookService/detail/lianxi-icon.png" ></t-image> <t-image src="/static/images/bookService/detail/lianxi-icon.png"></t-image> </view> </view> </view> <!-- 组卷列表 --> <view class="mock-data" wx:if="{{radioItem == 'mock'}}"> <view class="mack-num">已组卷{{mockData.mockList.length}}次</view> <view class="mock-list"> <view class="mock-list-box" wx:for="{{mockData.mockList}}" data-item="{{item}}" bind:tap="goMackPaper" > <view class="mock-title">{{item.name}}</view> <view class="mock-message"> <view class="message-box"> <view class="mack-state"> <text wx:if="{{item.state == '3'}}" class="complete state-pad" >已完成</text > <text wx:elif="{{item.state == '2' || item.state == '1'}}" class="Incomplete state-pad" >未完成</text > <text wx:else class="Incomplete state-pad">未开始</text> <view wx:if="{{mockData.mockList.length}}"> <view class="mack-num">已组卷{{mockData.mockList.length}}次</view> <view class="mock-list"> <view class="mock-list-box" wx:for="{{mockData.mockList}}" data-item="{{item}}" bind:tap="goMackPaper"> <view class="mock-title">{{item.name}}</view> <view class="mock-message"> <view class="message-box"> <view class="mack-state"> <text wx:if="{{item.state == '3'}}" class="complete state-pad">已完成</text> <text wx:elif="{{item.state == '2' || item.state == '1'}}" class="Incomplete state-pad">未完成</text> <text wx:else class="Incomplete state-pad">未开始</text> </view> <view class="mock-time">{{item.createDate}}</view> </view> <view class="mock-time">{{item.createDate}}</view></view > <view class="mock-score" wx:if="{{item.report.userScore}}" >{{item.report.userScore}}分</view > <view class="mock-score" wx:if="{{item.report.userScore}}">{{item.report.userScore}}分</view> </view> </view> </view> </view> </view> <view wx:else class="not-mock"> <t-image src="/static/images/bookService/examination/zhuangtai-icon.png"></t-image> <view class="not-mock-message note-mock-text">组卷是收费功能,请购买后使用!</view> <view class="note-mock-price note-mock-text">价格:<text class="mock-price">¥{{mockData.price}}</text> 元/次</view> </view> </view> packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss
@@ -31,7 +31,8 @@ .top-btn { display: flex; justify-content: space-evenly; padding-left: 15rpx; padding: 0 0 20rpx 15rpx; border-bottom: 1px solid #EFF0F1; } .top-btn image { @@ -207,4 +208,34 @@ .Incomplete { background-color: #e9e9e9; color: #666; } .not-mock { display: flex; flex-direction: column; align-items: center; justify-content: center; } .not-mock image { width: 328rpx; height: 328rpx; } .note-mock-text { color: #333; font-size: 28rpx; } .not-mock-message { margin: 24rpx 0; } .note-mock-price { margin-bottom: 50rpx; } .mock-price { color: #ff6c00; font-size: 36rpx; } packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -82,11 +82,10 @@ }, // 跳转音视频播放器 goPlayer(e) { console.log(e); debugger const item = e.currentTarget.dataset.item const parent = e.currentTarget.dataset.parent let url if (item.selectType == 'video') { url = '/packageDomain/pages/resourceDetails/myVideo/index' @@ -249,5 +248,8 @@ }, oncheckbox() { console.log(111); }, logdata(e) { console.log(e); } }) packageBookService/pages/bookServices/detail/components/tree/index.wxml
@@ -11,7 +11,7 @@ <!-- // 判断 无子项 且为商品item 直接显示 --> <view class="listItems" wx:if="{{citem.childrenFolderCount <= 0 && citem.type == 'productItem'}}"> <view class="itemsInfo" wx:if="{{citem.name}}" data-item="{{citem}}" data-index="{{cindex}}"> <view class="contentBox" bind:tap="goPlayer" data-item="{{citem}}" data-parent="{{item}}"> <view class="contentBox" bind:tap="goPlayer" data-item="{{citem}}" data-parent="{{item}}" > <!-- 教学资源 云学习 图标 --> <view class="box-image" style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}"> <view class="checkBox" wx:if="{{tab == 'jsek_cloudLearning'}}"> packageBookService/pages/bookServices/detail/index.js
@@ -1,6 +1,7 @@ // pages/bookServices/detail/index.js import Message from 'tdesign-miniprogram/message/index.js'; import Toast from 'tdesign-miniprogram/toast'; import tool from '../../../../assets/js/toolClass' const app = getApp(); Page({ /** @@ -49,7 +50,8 @@ useCount: 0, // 组件已使用次数 residue: 0, // 组卷剩余次数 mockList: [] // 用户组卷提交信息 } }, flag: true }, @@ -415,20 +417,22 @@ //教学资源 云学习 if (type.refCode == 'jsek_teachingResources' || type.refCode == 'jsek_cloudLearning') { if (res.datas.cmsDatas[0].datas.length > 0) { res.datas.cmsDatas[0].datas.forEach(item => { item.checked = false }) const list = await this.getAllResource(res.datas.cmsDatas[0].datas) if (type.refCode == 'jsek_teachingResources') { res.datas.cmsDatas[0].datas.forEach(item => { item.checked = false }) const list = await this.getAllResource(res.datas.cmsDatas[0].datas) console.log(list, 'list'); this.setData({ teach: list, loading: false }) this.findChildIds(this.data.teach, this.data.openTeachids = []) } else if (type.refCode == 'jsek_cloudLearning') { const list = await this.getAllResource(res.datas.cmsDatas[0].datas) // res.datas.cmsDatas[0].datas.forEach(item => { // item.checked = false // }) // const list = await this.getAllResource(res.datas.cmsDatas[0].datas) console.log(list, 'currentlist'); this.setData({ learn: list, loading: false @@ -513,6 +517,7 @@ if (this.data.tabValue == 'jsek_teachingResources') { item.checked = false } else if (this.data.tabValue == 'jsek_cloudLearning') { item.checked = false item.isbuy = this.resourceIsBuy(item) item.isShopCar = this.isShoppingCart(item) } @@ -1115,6 +1120,88 @@ }) } }) } }, // 购买组卷 async buyMock() { let res if (!this.data.mockData.id) return wx.showToast({ icon: "error", title: '暂无组卷', mask: true }) // 构建订单查询对象 try { let query = { remarks: '组卷', requests: [ { saleMethodId: this.data.mockData.id, count: 1 } ] } if (this.data.flag) { this.setData({ flag: false }) res = await app.MG.store.initOrder(query) } if (res.orderNumber && this.data.mockData.price) { wx.navigateTo({ url: `/pages/cart/paymentPage/index?orderNumber=${res.orderNumber}`, }) } else { // 0元直接领取 // 确认订单 const confirmOrderRes = await app.MG.store.confirmOrder({ orderNum: res.orderNumber }) if (confirmOrderRes) { wx.showToast({ icon: "success", title: '领取成功', }) this.setData({ flag: true }) await this.recordBuyMock() // 记录购买时间 } } } catch (error) { console.log(error) } }, // 记录购买组卷时间 recordBuyMock() { const num = this.data.mockData.mockList.length const id = tool.uuid(8) const createDate = new Date().getTime() const mockList = this.data.mockData.mockList mockList.push({ id, createDate, name: `第${num + 1}套试卷`, state: '0' }) this.setData({ 'mockData.mockList': mockList }) // 记录购买时间,并设状态state为1,表示刚购买完成组卷 app.MG.identity.setUserKey({ setKeyRequests: [ { domain: 'mockData', key: this.data.bookDetail.id + '', value: JSON.stringify(this.data.mockData.mockList) } ] }) }, // 底部购买按钮 buyBtn() { if (this.data.tabValue == 'brief') { this.buyBook() } else if (this.data.tabValue == 'jsek_cloudLearning') { console.log('云学习'); } else if (this.data.tabValue == 'questionBank') { this.buyMock() } else { console.log(this.data.tabValue); } } }) packageBookService/pages/bookServices/detail/index.wxml
@@ -137,7 +137,7 @@ <view class="btn-text">纸质样书申请</view> </view> <view class="shopCar" bind:tap="addBookShopcCar">加入购物车</view> <view class="buy" bind:tap="buyBook">立即购买</view> <view class="buy" bind:tap="buyBtn">立即购买</view> </view> </scroll-view> <!-- 我要建议弹窗 --> packageBookService/pages/bookServices/examination/examination.js
@@ -29,6 +29,19 @@ total: 0, // 题目总数 cardList: [], // 提交项, questionDataList: [], // 显示题目列表 mockid: 0, uuid: 0, mockData: { // 组卷信息 state: '0', score: 0, // 总分 sumTime: 0, time: 0, // 答题剩余时间 datas: [], // 所有模考记录数据(题目列表,用户答题,考试报告) answer: [] }, saveTime: 20, isNight: false }, /** @@ -46,8 +59,14 @@ productLinkPath: options.productLinkPath ? options.productLinkPath : '', rootCmsItemId: options.rootCmsItemId, idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], answerType: options.answerType answerType: options.answerType, }); if (this.data.answerType == 'mock') { this.setData({ uuid: options.uuid, mockid: options.mockid }) } this.init() console.log('传参', options); }, @@ -63,7 +82,19 @@ * 生命周期函数--监听页面显示 */ onShow() { if (this.data.answerType == 'mock') { if (wx.timer) { clearInterval(wx.timer) } wx.timer = setInterval(() => { this.setData({ saveTime: this.data.saveTime - 1 }) if (this.data.saveTime == 0) { this.saveMockData() } }, 1000) } }, /** @@ -105,7 +136,12 @@ goBack() { wx.navigateBack(); }, //设置背景色 changeBGColor(e) { this.setData({ isNight: e.detail.value }) }, // 获取保存的倒计时时间 getSavedTime() { const savedTime = wx.getStorageSync('countdownTime') @@ -172,7 +208,6 @@ }, // 点击答题卡跳转题目 goQuestion(e) { console.log(e); const id = e.detail.id this.data.questionDataList.forEach((item, index) => { if (item.id == id) { @@ -191,12 +226,17 @@ questionList.forEach(item => { if (item.id == id) { item.userAnswer = radioChecked item.isUserAnswer = this.isHaveAnswer(radioChecked) } }) this.setData({ questionDataList: questionList }) console.log(this.data.questionDataList); if (this.data.answerType == 'mock') { this.setData({ saveTime: 20 }) } }, // 输入框触发 onChangeInput(e) { @@ -206,13 +246,18 @@ const questionList = this.data.questionDataList questionList.forEach(item => { if (item.id == id) { item.userAnswer[index] = inputData item.userAnswer[index] = inputData, item.isUserAnswer = this.isHaveAnswer(item.userAnswer) } }) this.setData({ questionDataList: questionList }) console.log(this.data.questionDataList); if (this.data.answerType == 'mock') { this.setData({ saveTime: 20 }) } }, // 数组转为字符串方法 arrayToString(data) { @@ -251,23 +296,61 @@ this.setData({ submitStatus: true }) const child = this.selectComponent('#question-options') if (this.data.answerType == 'option' || this.data.answerType == 'errorQuestion' || this.data.answerType == 'mock') { // 先遍历所有题目,将未批改的题目批改 const qustionList = this.data.questionDataList for (let index = 0; index < qustionList.length; index++) { const item = qustionList[index]; if (!item.isComplete) this.handleQuestion(index + 1) } } if (this.data.answerType == 'option') { this.toggleCountdown() const child = this.selectComponent('#question-options') if (this.data.answerType == 'option' || this.data.answerType == 'errorQuestion') { // 先遍历所有题目,将未批改的题目批改 const qustionList = this.data.questionDataList for (let index = 0; index < qustionList.length; index++) { const item = qustionList[index]; if (!item.isComplete) this.handleQuestion(index + 1) } } if (this.data.answerType == 'option') { this.recordAnswerData() child.openTestReportDialog() } this.recordAnswerData() child.openTestReportDialog() } else if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') { this.goBack() } else if (this.data.answerType == 'mock') { this.toggleCountdown() // 设置模考状态为已完成 const mockData = this.data.mockData mockData.datas.forEach((item) => { if (item.id == this.data.uuid) { item.state = '3' item.report = { userScore: this.data.subjectiveNum } } }) this.setData({ mockData: mockData, submitStatus: true }) this.setMockInfo(mockData.datas) // 记录用户答题数据 let saveData = [] for (let index = 0; index < this.data.questionDataList.length; index++) { const item = this.data.questionDataList[index]; saveData.push({ id: item.id, answer: item.userAnswer, isRight: item.isRight }) } app.MG.identity.setUserKey({ setKeyRequests: [ { domain: 'mockAnswerData', key: this.data.uuid, value: JSON.stringify({ time: this.data.countdownTime, answerData: saveData }) } ] }) child.openTestReportDialog() } }, @@ -296,6 +379,47 @@ // loadings.value = true await this.getErrorIdList() await this.getCollectIdList() // 获取收藏id列表 } else if (this.data.answerType == 'mock') { this.getErrorList() this.getCollectIdList() this.getMockInfo(async (res) => { let mocklist try { mocklist = JSON.parse(res[0].value) } catch (error) { mocklist = [] } if (mocklist.length && this.data.uuid) { const oldMockData = mocklist.find((mockItem) => mockItem.id == this.data.uuid) this.setData({ 'mockData.state': oldMockData.state, 'mockData.score': oldMockData.score, 'mockData.datas': mocklist, }) if (oldMockData.state == '0') { // 组卷购买了,但未进入页面 await this.getEduQuizConfig() } else if (oldMockData.state == '1' || oldMockData.state == '2' || oldMockData.state == '3') { // 组卷后进入过页面,但是未答过题 let oldQuestionList = [] oldQuestionList = await this.getMockQuestionList() const userAnswerList = await this.getMockAnswer() await this.getMockDataList(oldQuestionList, userAnswerList) this.setData({ 'mockData.sumTime': oldMockData.time, cardList: oldQuestionList }) } if (oldMockData.state == '0' || oldMockData.state == '1' || oldMockData.state == '2') { this.startCountdown() } if (oldMockData.state == '3') { this.setData({ submitStatus: true }) } } }) } }, async restart() { @@ -327,9 +451,9 @@ setKeyRequests: [ { domain: 'mockAnswerData', key: route.query.uuid, key: this.data.uuid, value: JSON.stringify({ time: countDownRef.value.countdownTime, time: this.data.countdownTime, answerData: [] }) } @@ -492,6 +616,7 @@ item.Embedded_QuestionBank_QuestionType == 'multipleChoice' ? [] : '', isUserAnswer: oldObj ? this.isHaveAnswer(oldObj.userAnswer) : false, isRight: oldObj ? oldObj.isRight : null, isComplete: oldObj ? oldObj.isComplete : false, isCollect: this.data.collectList.indexOf(item.id) > -1 ? true : false, @@ -573,7 +698,7 @@ aitem.infoList.forEach((bitem, bindex) => { questionList.push(bitem) bitem.number = bindex + 1 bitem.grade = 2 bitem.score = 2 }) }) this.setData({ @@ -635,13 +760,13 @@ if (item.questionType != 'shortAnswer') { this.setData({ subjectiveTotal: this.data.subjectiveTotal + 1, subjectiveGrade: this.data.subjectiveGrade + item.grade subjectiveGrade: this.data.subjectiveGrade + item.score }) } if (questionList[index].isRight && item.questionType != 'shortAnswer') { // 客观题回答正确 this.setData({ subjectiveNum: this.data.subjectiveNum + item.grade, subjectiveNum: this.data.subjectiveNum + item.score, correctNum: this.data.correctNum + 1 }) } @@ -675,6 +800,7 @@ console.log(res) }) } this.setData({ questionDataList: questionList }) @@ -689,7 +815,6 @@ this.setData({ cardList: cardUpdatedList }) // console.log(this.data.questionDataList, this.data.cardList); }, // 题目收藏按钮,收藏和取消同一接口,取消数组减去该项id setCollect() { @@ -841,7 +966,6 @@ } }) } // console.log('收藏', collectList.value) }) }, // 获取收藏夹 @@ -1118,6 +1242,358 @@ }) }) // loadings.value = false // console.log('错题集', topicList.value) }, // 获取组卷结果 async getEduQuizConfig() { await app.MG.edu .getEduQuizConfigResult({ idOrRefCode: this.data.mockid }) .then(async (configRes) => { // 获取 分数 时间 this.setData({ 'mockData.score': configRes.score }) try { this.setData({ 'mockData.time': JSON.parse(configRes.config).time * 1000, countdownTime: JSON.parse(configRes.config).time * 1000 }) } catch (error) { this.setData({ 'mockData.time': 3600 * 1000, countdownTime: 3600 * 1000, }) } this.setData({ 'mockData.sumTime': this.data.mockData.time }) let itemIds = [] let numberIndex = 1 // 获取抽题结果 const cardList = configRes.eduQuizConfigStageResultList.map((item) => { let questionIds = [] // 获取必含题目 let list = item.cmsItemList.map((idItem) => { itemIds.push(idItem.id + '') questionIds.push({ id: idItem.id + '', score: idItem.score }) numberIndex++ return { number: numberIndex, id: idItem.id, score: idItem.score } }) // 获取抽题题目 let extractList = [] for (let i = 0; i < item.generatorResultList.length; i++) { const extractItem = item.generatorResultList[i] let extractItemList = extractItem.cmsItemList.map((extractCmsItem) => { itemIds.push(extractCmsItem.id + '') questionIds.push({ id: extractCmsItem.id + '', score: extractCmsItem.score }) numberIndex++ return { number: numberIndex, id: extractCmsItem.id, score: extractCmsItem.score } }) extractList = extractList.concat(extractItemList) } return { path: item.id, catalogName: item.name, infoList: list.concat(extractList) } }) this.setData({ cardList: cardList }) // 更新该条组卷的数据状态,包括记录改试卷总分,更改组卷状态state为1,表示已经抽题完成,并要将抽屉数据记录下来 if (this.data.mockData.datas && this.data.mockData.datas.length) { const mockData = this.data.mockData mockData.datas.forEach((item, index) => { if (item.id == this.data.uuid) { item.state = '1' item.time = mockData.time item.score = configRes.score mockData.state = '1' } }) this.setData({ mockData: mockData }) } this.setMockInfo(this.data.mockData.datas) // 记录试卷总分 时长,修改state为 1 // 更新本地mockData this.saveMockQuestionList(this.data.cardList) // 记录题目列表 await this.getMockDataList(this.data.cardList) // 请求题目数据 }) }, // 获取组卷题目列表 async getMockDataList(questionList, oldList) { console.log(questionList, oldList); const questionDataList = this.data.questionDataList questionList.forEach(async (pathitem, pathindex) => { let itemIds = [] pathitem.infoList.forEach(item => { itemIds.push(item.id + '') }) let query = { path: '*', cmsPath: this.data.rootCmsItemId, cmsType: '*', productId: this.data.bookId, queryType: '*', itemIds, itemFields: { Embedded_QuestionBank_Stem: [], Embedded_QuestionBank_AnalysisCon: [], Embedded_QuestionBank_Answer: [], Embedded_QuestionBank_Option: [], Embedded_QuestionBank_QuestionType: [], Embedded_QuestionBank_StemStyle: [], Embedded_QuestionBank_OptionStyle: [], Embedded_QuestionBank_KnowledgePoint: [], Embedded_QuestionBank_Difficulty: [] } } await app.MG.store.getProductDetail(query).then((res) => { res.datas.cmsDatas[0].datas.forEach((item, index) => { // 循环questionList,给每题赋值分数 let oldObj if (oldList) oldObj = oldList.find((oldItem) => oldItem.id == item.id) let questionObj = { // number: pathitem.infoList.find(infoItem => infoItem.itemId == item.id).number, id: item.id, score: pathitem.infoList.find(infoItem => infoItem.id == item.id).score, stem: item.Embedded_QuestionBank_QuestionType == 'completion' ? JSON.parse(item.Embedded_QuestionBank_Stem) .stemTxt.replaceAll('<vacancy>', ',input,') .split(',') : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干 answer: item.Embedded_QuestionBank_Answer, // 答案 option: item.Embedded_QuestionBank_Option ? JSON.parse(item.Embedded_QuestionBank_Option) : '', // 选择题选项 analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析 questionType: item.Embedded_QuestionBank_QuestionType, // 题型 optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型 stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型 difficulty: item.Embedded_QuestionBank_Difficulty ? 4 - item.Embedded_QuestionBank_Difficulty : 0, // 难度等级 userAnswer: oldObj ? oldObj.answer : item.Embedded_QuestionBank_QuestionType == 'completion' || item.Embedded_QuestionBank_QuestionType == 'multipleChoice' ? [] : '', isUserAnswer: oldObj ? this.isHaveAnswer(oldObj.userAnswer) : false, isRight: oldObj ? oldObj.isRight : null, // isComplete: oldObj ? oldObj.isComplete : false, isComplete: this.data.mockData.state == '3' ? true : oldObj ? this.isHaveAnswer(oldObj.answer) : false, isCollect: this.data.collectList.indexOf(item.id) > -1 ? true : false, isUnfold: '' // 控制解析的折叠面板是否展开 } // 多选和填空答案肯为数组,要转换JSON格式 if ( questionObj.questionType == 'completion' || questionObj.questionType == 'multipleChoice' ) { try { questionObj.answer = JSON.parse(questionObj.answer) } catch (error) { questionObj.answer = item.Embedded_QuestionBank_Answer } } // 填空题改造 if (questionObj.questionType == 'completion') { let index = 0 for (let i = 0; i < questionObj.stem.length; i++) { const item = questionObj.stem[i] if (item == 'input') { questionObj.stem[i] = { num: index, data: 'input' } if (!oldObj) questionObj.userAnswer[index] = '' index++ } } } // 获取图片 if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') { questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150) } if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') { questionObj.option.forEach(optionItem => { if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150) }) } if (oldObj && oldObj.isRight) { this.setData({ correctNum: this.data.correctNum + 1 }) } if (item.questionType != 'shortAnswer' && item.isComplete) { this.setData({ subjectiveTotal: this.data.subjectiveTotal + 1 }) } // if (oldObj && isHaveAnswer(oldObj.answer)) countDownRef.value.changeAlready() // cardList赋值 let cardIndex = this.data.cardList.findIndex((item) => item.catalogName == pathitem.catalogName) let infoIndex = this.data.cardList[cardIndex].infoList.findIndex(infoItem => infoItem.id == item.id) this.setData({ [`cardList[${cardIndex}].infoList[${infoIndex}]`]: questionObj }) let questionList = [] const cardUpdatedList = this.data.cardList // if (flag == this.data.idPathList.length) { cardUpdatedList.forEach(aitem => { aitem.infoList.forEach((bitem, bindex) => { questionList.push(bitem) bitem.number = bindex + 1 }) }) this.setData({ questionDataList: questionList, cardList: cardUpdatedList }) }) }) }) this.setData({ // questionDataList: questionDataList, loading: false }) }, // 获取组卷数据 getMockInfo(callback) { app.MG.identity .getUserKey({ domain: 'mockData', keys: [this.data.bookId] }) .then((res) => { if (callback) callback(res) }) }, // 记录购买组卷时间 setMockInfo(data) { app.MG.identity.setUserKey({ setKeyRequests: [ { domain: 'mockData', key: this.data.bookId + '', value: JSON.stringify(data) } ] }) }, // 记录组卷题目列表 saveMockQuestionList(data) { app.MG.identity .setUserKey({ setKeyRequests: [ { domain: 'mockQuestionData', key: this.data.uuid, value: JSON.stringify(data) } ] }) .then((res) => { console.log('模考题目列表已记录') }) }, // 获取记录组卷题目列表 async getMockQuestionList() { let list = [] await app.MG.identity .getUserKey({ domain: 'mockQuestionData', keys: [this.data.uuid] }) .then((res) => { list = JSON.parse(res[0].value) }) return list }, // 获取模考用户答题数据 async getMockAnswer() { let data await app.MG.identity .getUserKey({ domain: 'mockAnswerData', keys: [this.data.uuid] }) .then((res) => { if (res[0]) { this.setData({ currentIndex: JSON.parse(res[0].value).currentIndex, 'mockData.time': JSON.parse(res[0].value).time, countdownTime: JSON.parse(res[0].value).time ? JSON.parse(res[0].value).time : this.data.mockData.sumTime, 'mockData.answer': JSON.parse(res[0].value).answerData }) console.log(JSON.parse(res[0].value)); data = JSON.parse(res[0].value).answerData } }) return data }, // 记录模考答题数据 saveMockData() { const data = this.data.mockData.datas.find((itme) => itme.id == this.data.uuid) if (data.state == '3') return true const saveData = this.data.mockData.answer for (let i = 0; i < this.data.questionDataList.length; i++) { const item = this.data.questionDataList[i] if (this.isHaveAnswer(item.userAnswer)) { const index = saveData.findIndex((saveitem) => saveitem.id == item.id) if (index + '' != '-1') { saveData[index].answer = item.userAnswer } else { saveData.push({ id: item.id, answer: item.userAnswer }) } } } // if (this.data.mockData.state == '1') { const datas = this.data.mockData.datas datas.forEach((item) => { if (item.id == this.data.uuid) { item.state = '2' } }) this.setMockInfo(datas) } // app.MG.identity .setUserKey({ setKeyRequests: [ { domain: 'mockAnswerData', key: this.data.uuid, value: JSON.stringify({ currentIndex: this.data.currentIndex, time: this.data.countdownTime, answerData: saveData }) } ] }) .then((res) => { this.setData({ saveTime: 20 }) console.log('模考答题数据已记录') }) } }) packageBookService/pages/bookServices/examination/examination.wxml
@@ -26,6 +26,7 @@ <question-schedule wx:if="{{!loading}}" id="countDownRef" isNight="{{isNight}}" answerType="{{answerType}}" countdownTime="{{countdownTime}}" currentIndex="{{currentIndex}}" @@ -34,6 +35,7 @@ ></question-schedule> <question-list wx:if="{{!loading}}" isNight="{{isNight}}" currentIndex="{{currentIndex}}" questionList="{{questionDataList}}" submitStatus="{{submitStatus}}" @@ -55,6 +57,7 @@ <view class="page-bottom"> <question-options id="question-options" isNight="{{isNight}}" submitStatus="{{submitStatus}}" answerType="{{answerType}}" countdownTime="{{countdownTime}}" @@ -65,9 +68,11 @@ subjectiveNum="{{subjectiveNum}}" subjectiveGrade="{{subjectiveGrade}}" correctNum="{{correctNum}}" mockSumTime="{{mock.sumTime}}" bind:setCollect="setCollect" bind:submitPaper="submitPaper" bind:restart="restart" bind:goQuestion="goQuestion" bind:changeBGColor="changeBGColor" ></question-options> </view> packageBookService/pages/bookServices/examination/examination.wxss
@@ -1,5 +1,6 @@ /* pages/examination/examination.wxss */ .nacigationBar { display: flex; align-items: center; @@ -28,4 +29,14 @@ height: 78vh; padding: 20rpx; background-color: #F2F3F8; } .daytime { background-color: #fff; color: #000; } .night { background-color: #000; color: #fff; } packageBookService/pages/bookServices/examination/questionList/index.js
@@ -15,6 +15,10 @@ currentIndex: { type: Number, value: 1 }, isNight:{ type:Boolean, value:false } }, created() { packageBookService/pages/bookServices/examination/questionList/index.wxml
@@ -1,63 +1,35 @@ <!--pages/bookServices/examination/questionList/index.wxml--> <view class="question-list"> <view class="question-list" style="background-color:{{isNight ? '#000' : '#fff'}}"> <!-- 题型title --> <view class="question-title" wx:if="{{questionList[showIndex].type}}"> <text class="title-name">{{questionList[showIndex].type}}</text ><text class="title-score">(每题{{questionList[showIndex].grade}}分)</text> <view class="question-title" wx:if="{{questionList[showIndex].type}}" style="background-color:{{isNight ? '#000' : '#fff'}}"> <text class="title-name">{{questionList[showIndex].type}}</text><text class="title-score" style="color: {{isNight ? '#fff' : '#000'}};">(每题{{questionList[showIndex].score}}分)</text> </view> <!-- 题目列表 --> <swiper class="swiper" bind:change="changeSwiper" current="{{currentIndex}}"> <swiper-item wx:for="{{questionList}}" wx:key="{{item.id}}"> <!-- 题干 --> <view class="question-stem title-score"> <view class="question-stem title-score" style="color: {{isNight ? '#fff' : '#000'}};"> <!-- 题号 --> <text>{{item.number}}.</text> <!-- 仅文字 --> <view wx:if="{{item.stemStyle == 'Txt' && item.questionType != 'completion'}}" >{{item.stem.stemTxt}}</view > <view wx:if="{{item.stemStyle == 'Txt' && item.questionType != 'completion'}}">{{item.stem.stemTxt}}</view> <!-- 仅图片 --> <view wx:elif="{{item.stemStyle == 'Image'}}"> <t-image src="{{item.stem.stemImage}}" /> </view> <!-- 图片加文字 --> <view wx:elif="{{item.stemStyle == 'TxtAndImage'}}" class="title-TxtAndImage" > <view wx:elif="{{item.stemStyle == 'TxtAndImage'}}" class="title-TxtAndImage"> <text>{{item.stem.stemTxt}}</text> <t-image src="{{item.stem.stemImage}}"></t-image> </view> <!-- 富文本 --> <view wx:elif="{{item.stemStyle == 'RichText'}} " class="title-RichText" > <view wx:elif="{{item.stemStyle == 'RichText'}} " class="title-RichText"> <rich-text nodes="{{item.stem.stemTxt}}"></rich-text> </view> <!-- 填空题 --> <view wx:if="{{item.questionType == 'completion'}}"> <view class="completion-box" wx:for="{{item.stem}}" wx:for-item="inputItem" wx:for-index="inputIndex" wx:key="inputIndex" > <t-input disabled="{{item.isComplete}}" bind:change="onChangeInput" data-value="{{item.option}}" data-id="{{item.id}}" data-index="{{inputItem.num}}" class="title-input" style="{{inputstyle}}" placeholder-style="{{placeholderstyle}}" wx:if="{{inputItem.data == 'input'}}" placeholder="请输入文字" value="{{item.userAnswer[inputItem.num]}}" ></t-input> <view class="completion-box" wx:for="{{item.stem}}" wx:for-item="inputItem" wx:for-index="inputIndex" wx:key="inputIndex"> <t-input disabled="{{item.isComplete}}" bind:change="onChangeInput" data-value="{{item.option}}" data-id="{{item.id}}" data-index="{{inputItem.num}}" class="title-input" style="{{inputstyle}}" placeholder-style="{{placeholderstyle}}" wx:if="{{inputItem.data == 'input'}}" placeholder="请输入文字" value="{{item.userAnswer[inputItem.num]}}"></t-input> <text wx:else>{{inputItem}}</text> </view> </view> @@ -65,44 +37,19 @@ <!-- 答题区域 --> <view class="question-answer"> <!-- 单选题 --> <t-radio-group wx:if="{{item.questionType == 'singleChoice' || item.questionType == 'judge'}}" defaultValue="{{item.userAnswer}}" disabled="{{item.isComplete}}" bind:change="onChangeRadio" class="radio-group" data-value="{{item.option}}" data-id="{{item.id}}" > <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex" > <t-radio value="{{contentItem.value}}" icon="none" placement="right" borderless > <view class="radio-item {{item.answer == contentItem.value && item.answer == item.userAnswer ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :''}}" > <t-radio-group wx:if="{{item.questionType == 'singleChoice' || item.questionType == 'judge'}}" defaultValue="{{item.userAnswer}}" disabled="{{item.isComplete}}" bind:change="onChangeRadio" class="radio-group" data-value="{{item.option}}" data-id="{{item.id}}"> <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex"> <t-radio value="{{contentItem.value}}" icon="none" placement="right" borderless style="color: {{isNight ? '#fff' : '#000'}}; background-color:{{isNight ? '#000' : '#fff'}}"> <view class="radio-item {{item.answer == contentItem.value && item.answer == item.userAnswer ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :''}}" style="color: {{isNight ? '#fff' : '#000'}}; background-color:{{isNight ? '#000' : '#fff'}}"> <!-- 仅文字 --> <text wx:if="{{item.optionStyle == 'Txt'}}" >{{contentItem.value}}、{{contentItem.txt}}</text > <text wx:if="{{item.optionStyle == 'Txt'}}">{{contentItem.value}}、{{contentItem.txt}}</text> <!-- 仅图片 --> <view wx:if="{{item.optionStyle == 'Image'}}" class="fl-center"> <text>{{contentItem.value}}、</text> <t-image src="{{contentItem.img}}"></t-image> </view> <!-- 文字加图片 --> <view wx:if="{{item.optionStyle == 'TxtAndImage'}}" class="fl-center" > <view wx:if="{{item.optionStyle == 'TxtAndImage'}}" class="fl-center"> <text>{{contentItem.value}}、</text> <text>{{contentItem.txt}}</text> <t-image src="{{contentItem.img}}"></t-image> @@ -112,51 +59,25 @@ <text>{{contentItem.value}}、</text> <rich-text nodes="{{contentItem.txt}}"></rich-text> </view> <text wx:if="{{item.answer == contentItem.value && item.answer == item.userAnswer}}" >对</text > <text wx:if="{{item.userAnswer == contentItem.value && item.userAnswer != item.answer}}" >错</text > <text wx:if="{{item.answer == contentItem.value && item.answer == item.userAnswer}}">对</text> <text wx:if="{{item.userAnswer == contentItem.value && item.userAnswer != item.answer}}">错</text> </view> </t-radio> </view> </t-radio-group> <!-- 多选题 --> <t-checkbox-group disabled="{{item.isComplete}}" class="checkbox-group" wx:elif="{{item.questionType == 'multipleChoice'}}" t-class="box" borderless bind:change="onChangeRadio" data-value="{{item.option}}" data-id="{{item.id}}" defaultValue="{{item.userAnswer}}" > <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex" > <t-checkbox-group disabled="{{item.isComplete}}" class="checkbox-group" wx:elif="{{item.questionType == 'multipleChoice'}}" t-class="box" borderless bind:change="onChangeRadio" data-value="{{item.option}}" data-id="{{item.id}}" defaultValue="{{item.userAnswer}}"> <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex"> <t-checkbox block="{{false}}" value="{{contentItem.value}}"> <!-- 仅文字 --> <text wx:if="{{item.optionStyle == 'Txt'}}" >{{contentItem.value}}、{{contentItem.txt}}</text > <text wx:if="{{item.optionStyle == 'Txt'}}">{{contentItem.value}}、{{contentItem.txt}}</text> <!-- 仅图片 --> <view wx:if="{{item.optionStyle == 'Image'}}" class="fl-center"> <text>{{contentItem.value}}、</text> <t-image src="{{contentItem.img}}"></t-image> </view> <!-- 文字加图片 --> <view wx:if="{{item.optionStyle == 'TxtAndImage'}}" class="fl-center" > <view wx:if="{{item.optionStyle == 'TxtAndImage'}}" class="fl-center"> <text>{{contentItem.value}}、</text> <text>{{contentItem.txt}}</text> <t-image src="{{contentItem.img}}"></t-image> @@ -170,43 +91,21 @@ </view> </t-checkbox-group> <!-- 简答 翻译 --> <t-textarea disabled="{{item.isComplete}}" value="{{item.userAnswer}}" bind:change="onChangeRadio" data-value="{{item.option}}" data-id="{{item.id}}" class="option-textarea" wx:elif="{{item.questionType == 'shortAnswer'}}" t-class="external-class" placeholder="请输入文字" bordered maxlength="500" disableDefaultPadding="{{true}}" indicator style="{{style}}" /> <t-textarea disabled="{{item.isComplete}}" value="{{item.userAnswer}}" bind:change="onChangeRadio" data-value="{{item.option}}" data-id="{{item.id}}" class="option-textarea" wx:elif="{{item.questionType == 'shortAnswer'}}" t-class="external-class" placeholder="请输入文字" bordered maxlength="500" disableDefaultPadding="{{true}}" indicator style="{{style}}" /> </view> <!-- 解析 --> <view class="analysis" wx:if="{{item.isComplete}}"> <view class="analysis-answer"> <view class="answer-correct"> <text class="analysis-title-box">正确答案:</text> <rich-text nodes="{{item.answer}}" style="font-size: 40rpx" ></rich-text> <rich-text nodes="{{item.answer}}" style="font-size: 40rpx"></rich-text> </view> <view class="answer-error"> <text class="analysis-title-box">您的答案:</text ><text class="answer-text">{{item.userAnswer}}</text> <text class="analysis-title-box">您的答案:</text><text class="answer-text">{{item.userAnswer}}</text> </view> </view> <view class="analysis-text" wx:if="{{item.analysisCon}}"> 答案解析:<rich-text nodes="{{item.analysisCon}}" class="analysis-content" ></rich-text> 答案解析:<rich-text nodes="{{item.analysisCon}}" class="analysis-content"></rich-text> </view> </view> </swiper-item> @@ -214,4 +113,4 @@ <text>没有更多了。。。</text> </swiper-item> </swiper> </view> </view> packageBookService/pages/bookServices/examination/questionOptions/index.js
@@ -44,6 +44,10 @@ submitStatus: { type: Boolean, value: false }, mockSumTime: { type: Number, value: 0, } }, @@ -57,13 +61,19 @@ setUpPopup: false, testReportState: false, sliderValue: 0, useTime: '' useTime: '', radioItem: 'daytime' }, observers: { "countdownTime": function (newValue, oldValue) { if (this.properties.answerType == 'option') { this.setData({ useTime: this.formatTime(2 * 60 * 60 * 1000 - this.properties.countdownTime) }) } else if (this.properties.answerType == 'option') { this.setData({ useTime: this.formatTime(this.properties.mockSumTime - this.properties.countdownTime) }) } if (newValue == 0 && (this.properties.answerType == 'option' || this.properties.answerType == 'mock')) { @@ -163,6 +173,14 @@ setUpPopup: e.detail.visible }) }, // 设置模式切换 onRadioChange(e) { this.setData({ radioItem: e.detail.value }) const value = e.detail.value == 'night' ? true : false this.triggerEvent('changeBGColor', { value }) }, // 重做按钮 resterBtn() { wx.showModal({ @@ -203,23 +221,27 @@ // 底部提交按钮 submitBtn() { // 我的错题和收藏 直接走提交逻辑 if (this.properties.answerType !== 'option' || this.properties.answerType !== 'option') { return this.submitPaper() } this.properties.questionDataList.forEach(item => { if (!this.isHaveAnswer(item.userAnswer)) { this.setData({ noReady: this.data.noReady + 1 }) } }) // 未做完,打开提示弹窗 if (this.data.noReady > 0) { this.confrimPromptDialog() } else { // 做完了直接执行提交事件 if (this.properties.answerType == 'collectQuestion' || this.properties.answerType == 'errorQuestion') { this.submitPaper() return wx.navigateBack() } else if (this.properties.answerType == 'option' || this.properties.answerType == 'mock') { if (this.properties.submitStatus) return wx.navigateBack() this.properties.questionDataList.forEach(item => { if (!this.isHaveAnswer(item.userAnswer)) { this.setData({ noReady: this.data.noReady + 1 }) } }) // 未做完,打开提示弹窗 if (this.data.noReady > 0) { this.confrimPromptDialog() } else { // 做完了直接执行提交事件 this.submitPaper() } } }, // 提交事件 submitPaper() { packageBookService/pages/bookServices/examination/questionOptions/index.json
@@ -6,6 +6,8 @@ "t-button": "tdesign-miniprogram/button/button", "t-dialog": "tdesign-miniprogram/dialog/dialog", "t-popup": "tdesign-miniprogram/popup/popup", "t-slider": "tdesign-miniprogram/slider/slider" "t-slider": "tdesign-miniprogram/slider/slider", "t-radio": "tdesign-miniprogram/radio/radio", "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" } } packageBookService/pages/bookServices/examination/questionOptions/index.wxml
@@ -1,48 +1,30 @@ <!--pages/bookServices/examination/questionOptions/index.wxml--> <view class="page-bottom"> <view class="li-option" bind:tap="setCollect"> <t-image src="{{ questionDataList[currentIndex].isCollect ? '/static/images/bookService/detail/collecting.png' : '/static/images/bookService/examination/collect.png'}}" > <t-image src="{{ questionDataList[currentIndex].isCollect ? '/static/images/bookService/detail/collecting.png' : '/static/images/bookService/examination/collect.png'}}"> </t-image> 收藏 </view> <view class="li-option" bind:tap="handlePopup"> <t-image src="/static/images/bookService/examination/questionCard.png" ></t-image> <t-image src="/static/images/bookService/examination/questionCard.png"></t-image> 答题卡 </view> <view class="li-option" bind:tap="setUpBtn"> <t-image src="/static/images/bookService/examination/setting.png"></t-image> 设置 </view> <view class="li-option" bind:tap="resterBtn" wx:if="{{answerType == 'option' || answerType == 'mock'}}" > <view class="li-option" bind:tap="resterBtn" wx:if="{{answerType == 'option' || answerType == 'mock'}}"> <t-image src="/static/images/bookService/examination/reset.png"></t-image> 重做 </view> <view class="bottom-submit"> <t-button theme="primary" size="large" style="{{btnStyle}}" bind:tap="submitBtn" >{{(answerType == 'option' || answerType == 'mock') ? '提交' : '退出'}}</t-button > <t-button theme="primary" size="large" style="{{btnStyle}}" bind:tap="submitBtn">{{(answerType == 'option' || answerType == 'mock') && !submitStatus ? '提交' : '退出'}}</t-button> </view> </view> <!-- 答题卡 --> <t-popup visible="{{questionCardState}}" bind:visible-change="onVisibleChange" placement="bottom" > <t-popup visible="{{questionCardState}}" bind:visible-change="onVisibleChange" placement="bottom"> <view class="popup-block"> <view class="popup-header"> <view class="popup-title">答题卡</view> @@ -65,14 +47,7 @@ <text class="title-text">{{item.catalogName}}</text> </view> <view class="question-list"> <view bind:tap="goQuestion" data-id="{{citem.id}}" wx:for="{{item.infoList}}" wx:for-item="citem" wx:for-index="cindex" class="question-box {{citem.isComplete ? 'answered' : 'un-answered'}}" > <view bind:tap="goQuestion" data-id="{{citem.id}}" wx:for="{{item.infoList}}" wx:for-item="citem" wx:for-index="cindex" class="question-box {{citem.isUserAnswer ? 'answered' : 'un-answered'}}"> {{citem.number}} </view> </view> @@ -82,34 +57,47 @@ </t-popup> <!-- 设置 --> <t-popup visible="{{setUpPopup}}" bind:visible-change="onSetUpChange" placement="bottom" > <t-popup visible="{{setUpPopup}}" bind:visible-change="onSetUpChange" placement="bottom"> <view class="popup-block set-up-popup"> <view class="popup-header"> <view class="popup-title">设置</view> </view> <!-- 亮度 --> <view> <t-slider defaultValue="{{30}}" theme="capsule" /> <view class="brightness"> <text>A-</text> <view class="brightness-slider"> <t-slider defaultValue="{{30}}" theme="capsule" /> </view> <text>A+</text> </view> <!-- 模式 --> <view> <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0px"> <view class="card {{radioItem == 'daytime' ? 'card--active' : ''}}"> <t-radio value="daytime" icon="none" borderless> <view class="radio-content" slot="content"> <t-image src="{{ radioItem == 'daytime' ? '/static/images/bookService/detail/practice-icon.png' : '/static/images/bookService/detail/notest.png'}}"></t-image> <text style="color: {{radioItem == 'daytime' ? '#fff':''}};">日间模式</text> </view> </t-radio> </view> <view class="card {{radioItem == 'night' ? 'card--active' : ''}}"> <t-radio value="night" icon="none" borderless> <view class="radio-content" slot="content"> <t-image src="{{ radioItem == 'night' ? '/static/images/bookService/detail/practice-icon.png' : '/static/images/bookService/detail/notest.png'}}"></t-image> <text style="color: {{radioItem == 'night' ? '#fff':''}};">夜间模式</text> </view> </t-radio> </view> </t-radio-group> </view> </view> </t-popup> <!-- 测试报告 --> <t-dialog class="test-report" visible="{{testReportState}}" cancel-btn="{{null}}" confirm-btn="{{null}}" close-btn="{{true}}" title="测试报告" bind:close="closeTestReportDialog" > <t-dialog class="test-report" visible="{{testReportState}}" cancel-btn="{{null}}" confirm-btn="{{null}}" close-btn="{{true}}" title="测试报告" bind:close="closeTestReportDialog"> <view slot="content" class="test-report"> <view class="report-content-top"> <view class="report-li"> @@ -122,34 +110,24 @@ </view> <view class="report-li"> <view class="report-li-left">其中客观题:</view> <view class="report-li-right" >{{subjectiveTotal}}道,分值{{subjectiveGrade}}分</view > <view class="report-li-right">{{subjectiveTotal}}道,分值{{subjectiveGrade}}分</view> </view> <view class="report-li"> <view class="report-li-left">答对:</view> <view class="report-li-right" ><text class="correct-color">{{correctNum}}</text> 道</view > <view class="report-li-right"><text class="correct-color">{{correctNum}}</text> 道</view> </view> <view class="report-li"> <view class="report-li-left">答错:</view> <view class="report-li-right" ><text class="error-color">{{subjectiveTotal - correctNum}}</text> 道</view > <view class="report-li-right"><text class="error-color">{{subjectiveTotal - correctNum}}</text> 道</view> </view> <view class="report-li"> <view class="report-li-left">客观题得分:</view> <view class="report-li-right" ><text class="score-color">{{subjectiveNum}}</text> 分</view > <view class="report-li-right"><text class="score-color">{{subjectiveNum}}</text> 分</view> </view> </view> <view class="report-content-bottom"> <t-button theme="primary" bind:tap="viewAnswer" style="width: 560rpx" >查看答案与解析</t-button > <t-button theme="primary" bind:tap="viewAnswer" style="width: 560rpx">查看答案与解析</t-button> </view> </view> </t-dialog> </t-dialog> packageBookService/pages/bookServices/examination/questionOptions/index.wxss
@@ -184,4 +184,53 @@ .score-color { color: #ff6c00; } .brightness { display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 40rpx; } .brightness-slider { width: 80%; } .test-radio { height: 80rpx; display: flex; justify-content: space-evenly; --td-radio-content-font-size: 28rpx; --td-radio-vertical-padding: 0 } .test-radio image { width: 34rpx; height: 34rpx; } .card { position: relative; border-radius: 10rpx; overflow: hidden; box-sizing: border-box; /* border: 3rpx solid #ff6c00; */ --td-radio-content-color: #0F1214; --td-radio-bg-color: #EFF0F1; } .card--active { border-color: #ff6c00; --td-radio-bg-color: #ff6c00; --td-radio-content-color: #fff; } .radio-content { display: flex; align-items: center; justify-content: center; width: 300rpx; height: 68rpx; } packageBookService/pages/bookServices/examination/questionSchedule/index.js
@@ -24,9 +24,15 @@ answerType: { type: String, value: '' }, isNight:{ type:Boolean, value:false } }, created() { created( ) { }, detached() { }, @@ -37,7 +43,8 @@ data: { showTime: '', // percentage: 0, ready: 0 ready: 0, scheduleStyle: 'back', }, observers: { 'countdownTime': function (newValue) { @@ -58,12 +65,19 @@ }) } } }, 'ready': function (newValue) { this.setData({ percentage: (this.data.ready / this.data.questionList.length) * 100 }) } }, /** * 组件的方法列表 */ methods: { // 夜间和日间模式 // 判断是否有用户答案 isHaveAnswer(data) { if (typeof data == 'string') { packageBookService/pages/bookServices/examination/questionSchedule/index.wxml
@@ -1,17 +1,12 @@ <!--pages/bookServices/examination/questionSchedule/questionSchedule.wxml--> <view class="schedule"> <view class="schedule" id="schedule" style="background-color:{{isNight ? '#000' : '#fff'}}"> <view class="schedule-top"> <view class="question-schedule" >答题进度<text class="parimary-color question-num">{{ready}}</text> <text>/{{questionList.length}}</text></view > <view class="remainder" wx:if="{{!submitStatus && (answerType == 'option' || answerType == 'mock')}}" >剩余时间 <text class="parimary-color">{{showTime}}</text></view > <view class="question-schedule" style="color: {{isNight ? '#fff' : '#000'}};">答题进度<text class="parimary-color question-num">{{ready}}</text> <text>/{{questionList.length}}</text> </view> <view class="remainder" wx:if="{{!submitStatus && (answerType == 'option' || answerType == 'mock')}}" style="color: {{isNight ? '#fff' : '#000'}};">剩余时间 <text class="parimary-color">{{showTime}}</text></view> </view> <view class="schedule-progress"> <t-progress percentage="{{percentage}}" color="#ff6c00" label="" /> </view> </view> </view> static/images/bookService/examination/rijian.png
static/images/bookService/examination/yejian.png
static/images/bookService/examination/zhuangtai-icon.png