From 81b30e7fb0763bce403431f0c1f64d5a9e36dfb2 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期三, 20 三月 2024 15:42:13 +0800 Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master --- packageBookService/pages/bookServices/examination/questionList/index.js | 4 packageBookService/pages/bookServices/examination/questionList/index.wxml | 153 +------ packageBookService/pages/bookServices/examination/questionSchedule/index.js | 18 packageBookService/pages/bookServices/detail/index.wxml | 2 packageBookService/pages/bookServices/examination/questionOptions/index.js | 54 + packageBookService/pages/bookServices/examination/questionOptions/index.json | 4 packageBookService/pages/bookServices/examination/examination.wxml | 5 packageBookService/pages/bookServices/examination/questionOptions/index.wxss | 49 ++ packageBookService/pages/bookServices/examination/questionOptions/index.wxml | 108 ++--- packageBookService/pages/bookServices/examination/examination.wxss | 11 static/images/bookService/examination/rijian.png | 0 static/images/bookService/examination/zhuangtai-icon.png | 0 packageBookService/pages/bookServices/detail/components/tree/index.wxml | 2 packageBookService/pages/bookServices/examination/examination.js | 532 ++++++++++++++++++++++++- packageBookService/pages/bookServices/examination/questionSchedule/index.wxml | 17 packageBookService/pages/bookServices/detail/components/tree/index.js | 8 packageBookService/pages/bookServices/detail/index.js | 105 ++++ static/images/bookService/examination/yejian.png | 0 packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss | 33 + packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml | 134 +---- 20 files changed, 871 insertions(+), 368 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml b/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml index 079fe6e..4d44c62 100644 --- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml +++ b/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> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss b/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss index 10592fc..ed954c7 100644 --- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss +++ b/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; } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index 414cc08..33cc8d7 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/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); } }) \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.wxml b/packageBookService/pages/bookServices/detail/components/tree/index.wxml index 9d3efdd..346bd9a 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.wxml +++ b/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'}}"> diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 0bc5d6c..77bf47c 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/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 + }) + // 璁板綍璐拱鏃堕棿锛屽苟璁剧姸鎬乻tate涓�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); + } + } }) diff --git a/packageBookService/pages/bookServices/detail/index.wxml b/packageBookService/pages/bookServices/detail/index.wxml index e26b9f5..abfcb94 100644 --- a/packageBookService/pages/bookServices/detail/index.wxml +++ b/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> <!-- 鎴戣寤鸿寮圭獥 --> diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index a880c26..d948903 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/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); }, // 棰樼洰鏀惰棌鎸夐挳,鏀惰棌鍜屽彇娑堝悓涓�鎺ュ彛锛屽彇娑堟暟缁勫噺鍘昏椤筰d 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 + }) + // 鏇存柊璇ユ潯缁勫嵎鐨勬暟鎹姸鎬侊紝鍖呮嫭璁板綍鏀硅瘯鍗锋�诲垎锛屾洿鏀圭粍鍗风姸鎬乻tate涓�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) // 璁板綍璇曞嵎鎬诲垎 鏃堕暱锛屼慨鏀箂tate涓� 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, // 瑙f瀽 + 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: '' // 鎺у埗瑙f瀽鐨勬姌鍙犻潰鏉挎槸鍚﹀睍寮� + } + // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲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('妯¤�冪瓟棰樻暟鎹凡璁板綍') + }) } }) \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/examination.wxml b/packageBookService/pages/bookServices/examination/examination.wxml index 4c597a9..7e55aa7 100644 --- a/packageBookService/pages/bookServices/examination/examination.wxml +++ b/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> diff --git a/packageBookService/pages/bookServices/examination/examination.wxss b/packageBookService/pages/bookServices/examination/examination.wxss index d5798cf..d8a4efb 100644 --- a/packageBookService/pages/bookServices/examination/examination.wxss +++ b/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; } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/questionList/index.js b/packageBookService/pages/bookServices/examination/questionList/index.js index 49a40ba..dfb3b6e 100644 --- a/packageBookService/pages/bookServices/examination/questionList/index.js +++ b/packageBookService/pages/bookServices/examination/questionList/index.js @@ -15,6 +15,10 @@ currentIndex: { type: Number, value: 1 + }, + isNight:{ + type:Boolean, + value:false } }, created() { diff --git a/packageBookService/pages/bookServices/examination/questionList/index.wxml b/packageBookService/pages/bookServices/examination/questionList/index.wxml index 2314bd1..d776c40 100644 --- a/packageBookService/pages/bookServices/examination/questionList/index.wxml +++ b/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> <!-- 瑙f瀽 --> <view class="analysis" wx:if="{{item.isComplete}}"> <view class="analysis-answer"> <view class="answer-correct"> <text class="analysis-title-box">姝g‘绛旀锛�</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}}"> - 绛旀瑙f瀽锛�<rich-text - nodes="{{item.analysisCon}}" - class="analysis-content" - ></rich-text> + 绛旀瑙f瀽锛�<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> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.js b/packageBookService/pages/bookServices/examination/questionOptions/index.js index 54aed63..49b4ac6 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.js +++ b/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() { diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.json b/packageBookService/pages/bookServices/examination/questionOptions/index.json index 99a169b..8ed1f7c 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.json +++ b/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" } } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml b/packageBookService/pages/bookServices/examination/questionOptions/index.wxml index 1130cc8..ee23b79 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml +++ b/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> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.wxss b/packageBookService/pages/bookServices/examination/questionOptions/index.wxss index d1c5f70..50a6e03 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.wxss +++ b/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; } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/questionSchedule/index.js b/packageBookService/pages/bookServices/examination/questionSchedule/index.js index 311ed8a..458b052 100644 --- a/packageBookService/pages/bookServices/examination/questionSchedule/index.js +++ b/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') { diff --git a/packageBookService/pages/bookServices/examination/questionSchedule/index.wxml b/packageBookService/pages/bookServices/examination/questionSchedule/index.wxml index c7cad08..ac5ebbf 100644 --- a/packageBookService/pages/bookServices/examination/questionSchedule/index.wxml +++ b/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> \ No newline at end of file diff --git a/static/images/bookService/examination/rijian.png b/static/images/bookService/examination/rijian.png new file mode 100644 index 0000000..3080ac1 --- /dev/null +++ b/static/images/bookService/examination/rijian.png Binary files differ diff --git a/static/images/bookService/examination/yejian.png b/static/images/bookService/examination/yejian.png new file mode 100644 index 0000000..86a0c05 --- /dev/null +++ b/static/images/bookService/examination/yejian.png Binary files differ diff --git a/static/images/bookService/examination/zhuangtai-icon.png b/static/images/bookService/examination/zhuangtai-icon.png new file mode 100644 index 0000000..7e1c926 --- /dev/null +++ b/static/images/bookService/examination/zhuangtai-icon.png Binary files differ -- Gitblit v1.9.1