From cd98c69ff835643f518337ee9ab532885c647efb Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 15 三月 2024 18:48:39 +0800 Subject: [PATCH] 合并代码 --- pages/bookServices/examination/questionList/index.wxml | 214 ++++ pages/bookServices/examination/questionList/index.wxss | 125 ++ pages/bookServices/examination/questionOptions/index.json | 5 pages/bookServices/examination/questionSchedule/index.js | 186 ++- pages/bookServices/detail/components/testResource/testResource.js | 53 + static/images/bookService/detail/checkpaper.png | 0 pages/bookServices/examination/questionList/index.js | 73 + pages/bookServices/detail/index.js | 111 ++ static/images/bookService/detail/notest.png | 0 pages/bookServices/webpage/index.json | 3 pages/bookServices/detail/components/testResource/testResource.json | 4 pages/bookServices/detail/index.wxml | 4 pages/bookServices/examination/examination.json | 3 pages/bookServices/examination/questionSchedule/index.wxml | 16 pages/bookServices/examination/questionOptions/index.js | 242 +++++ pages/bookServices/examination/examination.js | 896 ++++++++++++++++++- app.json | 3 pages/bookServices/examination/examination.wxss | 8 pages/bookServices/detail/components/testResource/testResource.wxss | 164 +++ pages/bookServices/examination/examination.wxml | 55 + pages/bookServices/webpage/index.js | 69 + pages/bookServices/examination/questionList/index.json | 9 pages/bookServices/examination/questionOptions/index.wxss | 156 +++ pages/bookServices/examination/questionOptions/index.wxml | 143 +++ pages/bookServices/detail/components/testResource/testResource.wxml | 133 ++ pages/bookServices/webpage/index.wxss | 1 pages/bookServices/webpage/index.wxml | 2 27 files changed, 2,485 insertions(+), 193 deletions(-) diff --git a/app.json b/app.json index 188d4a6..d440e7c 100644 --- a/app.json +++ b/app.json @@ -57,7 +57,8 @@ "pages/personalCenter/downloads/index", "pages/personalCenter/activateProduct/index", "pages/testLogin/index", - "pages/bookServices/examination/examination" + "pages/bookServices/examination/examination", + "pages/bookServices/webpage/index" ], "tabBar": { "custom": true, diff --git a/pages/bookServices/detail/components/testResource/testResource.js b/pages/bookServices/detail/components/testResource/testResource.js index 10282d4..e365632 100644 --- a/pages/bookServices/detail/components/testResource/testResource.js +++ b/pages/bookServices/detail/components/testResource/testResource.js @@ -12,6 +12,10 @@ bookInfo: { type: Object, value: "", + }, + mockData: { + type: Object, + value: {} } }, @@ -19,7 +23,8 @@ * 缁勪欢鐨勫垵濮嬫暟鎹� */ data: { - + selectBtn: 'test', // test mock + radioItem: 'test', }, /** @@ -56,7 +61,6 @@ }) } else { const res = await app.MG.store.getProductDetail(query) - debugger res.datas.cmsDatas[0].datas.forEach((item) => { idPathList.push({ id: item.id, @@ -79,6 +83,51 @@ wx.navigateTo({ url: `/pages/bookServices/examination/examination?bookId=${this.properties.bookInfo.id}&productLinkPath=${value.productLinkPath}&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&idPathList=${JSON.stringify(idPathList)}&answerTitle=${value.name}&answerType=${'option'}`, }) + }, + goMycollect(e) { + const answertype = e.currentTarget.dataset.answertype + const token = wx.getStorageSync('jsek-token') + if (!token) { + return wx.getUserProfile({ + desc: '鐢ㄦ埛鐧诲綍', + success: (res) => { + console.log(res); + } + }) + } + wx.navigateTo({ + url: `/pages/bookServices/examination/examination?bookId=${this.properties.bookInfo.id}&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&answerTitle=${'鎴戠殑鏀惰棌'}&answerType=${answertype}`, + }) + }, + // 缁冧範 缁勪欢鍒囨崲 + onRadioChange(e) { + this.setData({ + radioItem: e.detail.value + }) + }, + async getMockId() { + let id + let query = { + start: 0, + size: 99, + productId: this.properties.bookInfo.id + } + await app.MG.edu.getQuizConfigListByProduct(query).then((res) => { + id = res.datas[0].id + }) + return id + }, + // 缁勫嵎璺宠浆绛旈鐣岄潰 + async goMackPaper(e) { + // const token = localStorage.getItem('jsek-token') + // if (!token) { + // return logIn() + // } + const mockid = await this.getMockId() + const item = e.currentTarget.dataset.item + wx.navigateTo({ + url: `/pages/bookServices/examination/examination?bookId=${this.properties.bookInfo.id}&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&answerTitle=${item.name}&answerType=${'mock'}&uuid=${item.id}&mockid=${mockid}`, + }) } } }) diff --git a/pages/bookServices/detail/components/testResource/testResource.json b/pages/bookServices/detail/components/testResource/testResource.json index d3520d1..e0cdc61 100644 --- a/pages/bookServices/detail/components/testResource/testResource.json +++ b/pages/bookServices/detail/components/testResource/testResource.json @@ -2,6 +2,8 @@ "component": true, "usingComponents": { "t-button": "tdesign-miniprogram/button/button", - "t-image": "tdesign-miniprogram/image/image" + "t-image": "tdesign-miniprogram/image/image", + "t-radio": "tdesign-miniprogram/radio/radio", + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" } } \ No newline at end of file diff --git a/pages/bookServices/detail/components/testResource/testResource.wxml b/pages/bookServices/detail/components/testResource/testResource.wxml index 522eef5..079fe6e 100644 --- a/pages/bookServices/detail/components/testResource/testResource.wxml +++ b/pages/bookServices/detail/components/testResource/testResource.wxml @@ -1,39 +1,146 @@ <!--pages/bookServices/detail/components/testResource/testResource.wxml--> <view class="test-resource"> <view class="top-btn"> - <t-button class="practice-btn" theme="primary" size="medium" style="width: 85px;"> + <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 + > + </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> + <text style="color: {{radioItem == 'mock' ? '#fff':''}};"> + 缁勫嵎</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="/static/images/bookService/detail/practice-icon.png"></t-image> - 缁冧範 + <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="paper-btn" theme="default" size="medium" style="width: 85px;"> + <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="/static/images/bookService/detail/zujuan.png"></t-image> + <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;"> + </t-button> --> + <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;"> + <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"> + <!-- 缁冧範鍒楄〃 --> + <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> \ No newline at end of file +</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> + <view class="mock-time">{{item.createDate}}</view></view + > + <view class="mock-score" wx:if="{{item.report.userScore}}" + >{{item.report.userScore}}鍒�</view + > + </view> + </view> + </view> +</view> diff --git a/pages/bookServices/detail/components/testResource/testResource.wxss b/pages/bookServices/detail/components/testResource/testResource.wxss index 4342f7d..10592fc 100644 --- a/pages/bookServices/detail/components/testResource/testResource.wxss +++ b/pages/bookServices/detail/components/testResource/testResource.wxss @@ -31,6 +31,7 @@ .top-btn { display: flex; justify-content: space-evenly; + padding-left: 15rpx; } .top-btn image { @@ -40,17 +41,170 @@ } .practice-btn { - --td-button-primary-bg-color: #ff6c00; - --td-button-primary-border-color: #ff6c00; - --td-button-primary-active-bg-color: #ff984d; - --td-button-primary-active-border-color: #ff984d; + --td-button-default-bg-color: #ff6c00; + --td-button-default-border-color: #ff6c00; + --td-button-default-active-bg-color: #ff984d; + --td-button-default-active-border-color: #ff984d; +} + +.practice-btn image { + margin-top: 25rpx; + margin-right: 10rpx; + width: 26rpx; + height: 30rpx; +} + +.practice-btn text { + font-size: 28rpx; } .paper-btn, .error-btn, .collect-btn { --td-button-default-bg-color: #fff; - --td-button-default-color: #ff6c00; + --td-button-default-color: #0F1214; --td-button-default-active-bg-color: #fff0e6; --td-button-medium-font-size: 28rpx +} + + + +.card { + position: relative; + margin: 32rpx; + border-radius: 12rpx; + overflow: hidden; + box-sizing: border-box; + border: 3rpx solid #ff6c00; + --td-radio-content-color: #0F1214; +} + +.card--active { + border-color: #ff6c00; + --td-radio-bg-color: #ff6c00; + --td-radio-content-color: #fff; +} + +/* .card--active::after { + content: ''; + display: block; + position: absolute; + left: 0; + top: 0; + width: 0; + border: 14px solid #0052d9; + border-bottom-color: transparent; + border-right-color: transparent; +} */ + +.card__icon { + color: #fff; + position: absolute; + left: 1.5px; + top: 1.5px; + z-index: 1; +} + +/* 妯悜甯冨眬 */ +.horizontal-box { + width: 350rpx; + display: flex; + align-items: center; + margin: 32rpx; +} + +.horizontal-box .card { + flex: 1; + margin: 0; +} + +.horizontal-box .card+.card { + margin-left: 24rpx; +} + +.test-radio { + --td-radio-content-font-size: 28rpx; + --td-radio-vertical-padding: 0 +} + +.radio-content { + padding: 0 8rpx; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 68rpx; +} + +.radio-content image { + margin: 0 10rpx 10rpx 0; +} + +.mock-data { + padding: 0 32rpx; +} + +.mack-num { + width: 100%; + height: 100rpx; + display: flex; + align-items: center; + color: #333; + font-size: 28rpx; +} + +.mock-list-box { + padding: 32rpx; + background-color: #F9F9F9; + margin-bottom: 30rpx; +} + +.mock-title { + color: #333; + font-size: 32rpx; + font-weight: 600; +} + +.mock-message { + margin-top: 10rpx; + display: flex; + justify-content: space-between; +} + +.message-box { + height: 60rpx; + display: flex; + align-items: center; +} + +.mack-state { + width: 94rpx; + height: 42rpx; +} + +.mock-score { + font-size: 28rpx; + color: #ff6c00; +} + +.mock-time { + color: #333; + margin-left: 20rpx; +} + +.state-pad { + width: 80rpx; + border-radius: 10rpx; + display: inline-block; + padding: 10rpx; +} + +.complete { + background-color: #d8f0d8; + color: #1FBC1F; +} + +.Incomplete { + background-color: #e9e9e9; + color: #666; } \ No newline at end of file diff --git a/pages/bookServices/detail/index.js b/pages/bookServices/detail/index.js index 6e744f6..0a17a1e 100644 --- a/pages/bookServices/detail/index.js +++ b/pages/bookServices/detail/index.js @@ -42,7 +42,14 @@ loading: false, isShowTeachDownload: false, // 鎻愮ずPC涓嬭浇寮圭獥鐘舵�� confirmBtn: { content: '鎴戠煡閬撲簡', variant: 'base' }, - + mockData: { + id: 0, // 閿�鍞甶d + price: 0, // 鍞环 + count: 0, // 缁勫嵎宸茶喘涔版鏁� + useCount: 0, // 缁勪欢宸蹭娇鐢ㄦ鏁� + residue: 0, // 缁勫嵎鍓╀綑娆℃暟 + mockList: [] // 鐢ㄦ埛缁勫嵎鎻愪氦淇℃伅 + } }, resetTree: function (e) { @@ -71,10 +78,11 @@ }); this.getBookInfo(options.id); this.getResourceClass() // 鑾峰彇璧勬簮鎵�灞炲垎绫� - this.getApplyInfo(options.id) const token = wx.getStorageSync('jsek-token') if (token) { this.getShoppingCartProductGet() + this.getApplyInfo(options.id) + this.getMockData() } }, @@ -179,6 +187,11 @@ }, // 鑾峰彇鍥句功璇︽儏 getBookInfo(id) { + this.setData({ + "mockData'.id": 0, + "mockData.price": 0, + "mockData.count": 0 + }) const query = { path: '*', queryType: '*', @@ -214,7 +227,7 @@ }, }; app.MG.store.getProductDetail(query).then(async (res) => { - + console.log(res.datas); this.setData({ bookDetail: res.datas, cmsDatas: res.datas.cmsDatas[0].datas, @@ -224,6 +237,29 @@ const iconType = JSON.parse(res.datas.bookClassification)[0][0]; const classType = JSON.parse(res.datas.bookClassification)[0][1]; const className = await this.getBookClass(iconType, classType) + // 鑾峰彇缁勫嵎閿�鍞甶d + if (res.datas.saleMethod && res.datas.saleMethod.length) { + res.datas.saleMethod.forEach((item) => { + if (item.SaleType == 'combinationTestPaper') { + this.setData({ + 'mockData.id': item.Id, + 'mockData.price': item.Price + }) + } + }) + } + // 鑾峰彇缁勫嵎宸茶喘涔版鏁� + if (res.datas.purchasedSaleMethodIdList && res.datas.purchasedSaleMethodIdList.length) { + if (this.data.mockData.id) { + let count = res.datas.purchasedSaleMethodIdList.filter( + (item) => item == this.data.mockData.id + ).length + this.setData({ + 'mockData.count': count + }) + } + } + console.log('缁勫嵎淇℃伅', this.data.mockData); this.setData({ 'bookDetail.publicationDate': this.formatDate(this.data.bookDetail.publicationDate), 'bookDetail.class': className, @@ -232,6 +268,7 @@ 'bookDetail.paperPrice': this.numFormat(this.data.bookDetail.paperPrice), }); }); + }, // 鑾峰彇鍥句功鍒嗙被 async getBookClass(iconType, classType) { @@ -298,8 +335,8 @@ goShop(e) { const { link } = e.currentTarget.dataset; wx.navigateTo({ - url: link, - }); + url: `/pages/bookServices/webpage/index?url=${link}`, + }) }, onTabsChange(e) { this.setData({ @@ -1014,5 +1051,69 @@ handleTrue() { // findAndUpdateItemsByIds(this.date.) }, + // 缁勫嵎鏍煎紡鍖栨棩鏈熸樉绀� + DateFormat(date, fmt) { + if (date && fmt) { + let _date = new Date(date) + var o = { + 'M+': _date.getMonth() + 1, //鏈堜唤 + 'd+': _date.getDate(), //鏃� + 'h+': _date.getHours(), //灏忔椂 + 'm+': _date.getMinutes(), //鍒� + 's+': _date.getSeconds(), //绉� + 'q+': Math.floor((_date.getMonth() + 3) / 3), //瀛e害 + S: _date.getMilliseconds() //姣 + } + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (_date.getFullYear() + '').substr(4 - RegExp.$1.length)) + } + for (var k in o) { + if (new RegExp('(' + k + ')').test(fmt)) { + fmt = fmt.replace( + RegExp.$1, + RegExp.$1.length == 1 + ? (o)[k] + : ('00' + (o)[k]).substr(('' + (o)[k]).length) + ) + } + } + return fmt + } else { + return '' + } + }, + // 鑾峰彇缁勫嵎绛旈鏁版嵁 + getMockData() { + this.setData({ + 'mockData.useCount': 0, + 'mockData.mockList': [] + }) + app.MG.identity + .getUserKey({ + domain: 'mockData', + keys: [this.data.bookId] + }) + .then((res) => { + console.log(JSON.parse(res[0].value)); + if (res && res.length) { + const mock = JSON.parse(res[0].value) + mock.forEach(item => { + item.createDate = this.DateFormat(item.createDate, 'yyyy-MM-dd') + }) + this.setData({ + 'mockData.mockList': mock + }) + // 缁勫嵎宸蹭娇鐢ㄦ鏁� + res.forEach((item) => { + // 宸茬粡鏈夌瓟棰樺垎鏁扮瓑鏁版嵁锛岃瘉鏄庣粍鍗峰凡缁忎娇鐢ㄥ畬姣� + if (item.resultData) { + this.setData({ + 'mockData.useCount': this.data.mockData.useCount + 1 + }) + } + }) + } + }) + } }) diff --git a/pages/bookServices/detail/index.wxml b/pages/bookServices/detail/index.wxml index cef98ff..e26b9f5 100644 --- a/pages/bookServices/detail/index.wxml +++ b/pages/bookServices/detail/index.wxml @@ -84,7 +84,7 @@ </view> <!-- 缃戝簵 --> <view class="book-web"> - <t-image src="/static/images/bookService/detail/jd.png" wx:if="{{bookDetail.JDLink}}" bind:tap="goShop" data-link="{{bookDetail.tmallLink}}" data-type="jd"></t-image> + <t-image src="/static/images/bookService/detail/jd.png" wx:if="{{bookDetail.JDLink}}" bind:tap="goShop" data-link="{{bookDetail.JDLink}}" data-type="jd"></t-image> <t-image src="/static/images/bookService/detail/tmall.png" width="32" height="22" bind:tap="goShop" data-link="{{bookDetail.tmallLink}}" wx:if="{{bookDetail.tmallLink}}"></t-image> <t-image src="/static/images/bookService/detail/dangdang.png" bind:tap="goShop" data-link="{{bookDetail.dangdangLink}}" wx:if="{{bookDetail.dangdangLink}}"></t-image> <t-image src="/static/images/bookService/detail/jd.png" bind:tap="goShop" data-link="{{bookDetail.weidianLink}}" wx:if="{{bookDetail.weidianLink}}"></t-image> @@ -114,7 +114,7 @@ </t-tab-panel> <t-tab-panel label="浜戞祴璇�" value="questionBank" style="{{tabPanelstyle}}"> <view wx:if="{{!loading && test.length}}"> - <test-resource list="{{test}}" bookInfo="{{bookDetail}}"></test-resource> + <test-resource list="{{test}}" bookInfo="{{bookDetail}}" mockData="{{mockData}}"></test-resource> </view> </t-tab-panel> <t-tab-panel label="浜戠瑪璁�" value="jesk_note" style="{{tabPanelstyle}}"> diff --git a/pages/bookServices/examination/examination.js b/pages/bookServices/examination/examination.js index a8bc3ce..cfad42b 100644 --- a/pages/bookServices/examination/examination.js +++ b/pages/bookServices/examination/examination.js @@ -1,3 +1,4 @@ +import { getPublicImage } from '../../../assets/js/middleGround/tool' const app = getApp() Page({ @@ -9,20 +10,25 @@ navBarHeight: "", loading: false, answerTitle: "", // 瀵艰埅鏍忔爣棰� + countdownInterval: null, // 璁℃椂鍣� + isCountdownRunning: true, // 鏄惁鍊掕鏃� + countdownTime: 0, // 鍊掕鏃舵椂闂� bookId: "", productLinkPath: "", rootCmsItemId: "", idPathList: [], // 棰樼洰鍒楄〃 - answerType: "", // 绛旈绫诲瀷 + answerType: "", // 绛旈妯″紡 submitStatus: false, // 鎻愪氦鐘舵�� - currentIndex: 0, // 褰撳墠绛旈鏁� + currentIndex: 0, // 褰撳墠鏄剧ず鐨勯鍙� collectList: [], // 鏀惰棌棰樼洰鍒楄〃 - subjectiveNum: 0, // 涓昏棰樺緱鍒� - subjectiveGrade: 0, // 涓昏棰樻�诲垎 - total: 0, // 棰樼洰鎬绘暟 + errorList: [], // 閿欓鍒楄〃 + subjectiveTotal: 0, // 瀹㈣棰樻�绘暟 + subjectiveNum: 0, // 瀹㈣棰樺緱鍒� + subjectiveGrade: 0, // 瀹㈣棰樻�诲垎 correctNum: 0, // 姝g‘棰樼洰鏁伴噺 + total: 0, // 棰樼洰鎬绘暟 cardList: [], // 鎻愪氦椤�, - questionDataList: [] + questionDataList: [], // 鏄剧ず棰樼洰鍒楄〃 }, /** @@ -37,12 +43,13 @@ navBarHeight: navBarHeight, answerTitle: options.answerTitle, bookId: options.bookId, - productLinkPath: options.productLinkPath, + productLinkPath: options.productLinkPath ? options.productLinkPath : '', rootCmsItemId: options.rootCmsItemId, - idPathList: JSON.parse(options.idPathList), + idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], answerType: options.answerType }); this.init() + console.log('浼犲弬', options); }, /** @@ -70,7 +77,9 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { - + if (this.data.countdownInterval !== null) { + clearInterval(this.data.countdownInterval) + } }, /** @@ -96,12 +105,243 @@ goBack() { wx.navigateBack(); }, + + // 鑾峰彇淇濆瓨鐨勫�掕鏃舵椂闂� + getSavedTime() { + const savedTime = wx.getStorageSync('countdownTime') + return savedTime ? parseInt(savedTime) : null + }, + // 淇濆瓨鍊掕鏃舵椂闂村埌鏈湴瀛樺偍 + saveTime() { + wx.setStorageSync('countdownTime', this.data.countdownTime.toString()) + }, + clearTime() { + this.setData({ + countdownTime: 2 * 60 * 60 * 1000 + }) + }, + // 鏆傚仠鎴栫户缁�掕鏃� + toggleCountdown() { + if (this.data.countdownInterval) { + clearInterval(this.data.countdownInterval) + this.setData({ + countdownInterval: null, + isCountdownRunning: false + }) + } else { + this.startCountdown() + this.setData({ + isCountdownRunning: true + }) + } + }, + // 寮�濮嬪�掕鏃� + startCountdown() { + // 濡傛灉璁℃椂鍣ㄥ凡缁忓瓨鍦紝鍏堟竻闄や箣鍓嶇殑璁℃椂鍣� + if (this.data.countdownInterval) { + clearInterval(this.data.countdownInterval) + this.setData({ + countdownInterval: null + }) + } + this.setData({ + countdownInterval: setInterval(() => { + this.setData({ + countdownTime: this.data.countdownTime - 1000 + }) + if (this.data.countdownTime <= 0) { + clearInterval(this.data.countdownInterval) + this.setData({ + countdownTime: 0, + isCountdownRunning: false + }) + } + this.saveTime() + }, 1000) + }) + }, + // 鍒囨崲棰樼洰 + changeSwiper(e) { + this.setData({ + currentIndex: e.detail.index + }) + let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0 + let flag = this.isHaveAnswer(this.data.questionDataList[index].userAnswer) + if (flag) this.handleQuestion(e.detail.index) + + }, + // 鐐瑰嚮绛旈鍗¤烦杞鐩� + goQuestion(e) { + console.log(e); + const id = e.detail.id + this.data.questionDataList.forEach((item, index) => { + if (item.id == id) { + this.setData({ + currentIndex: index + }) + } + }) + }, + // 鍗曢�� 澶氶�� 瑙﹀彂 + onChangeRadio(e) { + const radioData = e.detail.value.currentTarget.dataset.value + const id = e.detail.value.currentTarget.dataset.id + const radioChecked = e.detail.value.detail.value + const questionList = this.data.questionDataList + questionList.forEach(item => { + if (item.id == id) { + item.userAnswer = radioChecked + } + }) + this.setData({ + questionDataList: questionList + }) + console.log(this.data.questionDataList); + }, + // 杈撳叆妗嗚Е鍙� + onChangeInput(e) { + const inputData = e.detail.value.detail.value + const id = e.detail.value.currentTarget.dataset.id + const index = e.detail.value.currentTarget.dataset.index + const questionList = this.data.questionDataList + questionList.forEach(item => { + if (item.id == id) { + item.userAnswer[index] = inputData + } + }) + this.setData({ + questionDataList: questionList + }) + console.log(this.data.questionDataList); + }, + // 鏁扮粍杞负瀛楃涓叉柟娉� + arrayToString(data) { + // 妫�鏌ユ槸鍚︿负鏁扮粍 + if (Array.isArray(data)) { + // 浣跨敤 join 鏂规硶灏嗘暟缁勮浆鎹负瀛楃涓诧紝榛樿浣跨敤閫楀彿鍒嗛殧 + return data.join(',').replace(/<[^>]*>/g, '') + } else { + // 濡傛灉涓嶆槸鏁扮粍锛岀洿鎺ヨ繑鍥炲師濮嬪�� + return data.replace(/<[^>]*>/g, '') + } + }, + // 鍒ゆ柇鏄惁鏈夌敤鎴风瓟妗� + isHaveAnswer(data) { + if (typeof data == 'string') { + data = data + .replace(/<[^>]*>/g, '') + .replace(/ /g, '') + .trim() + if (data.length) { + return true + } else { + return false + } + } else { + const answer = data.find((item) => item.length > 0) + if (answer) { + return true + } else { + return false + } + } + }, + // 鎻愪氦閫昏緫 + submitPaper() { + this.setData({ + submitStatus: true + }) + 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() + } + } else if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') { + this.goBack() + } + + }, // 鍒濆鍖栧嚱鏁� async init() { + this.setData({ + loading: true, + subjectiveTotal: 0, + subjectiveNum: 0, + subjectiveGrade: 0 + }) if (this.data.answerType == 'option') { + if (this.data) + this.startCountdown() + this.setData({ + countdownTime: 2 * 60 * 60 * 1000 + }) // 娴嬭瘯绛旈 await this.getCollectIdList() // 鑾峰彇鏀惰棌id鍒楄〃 - // await getErrorList() // 鑾峰彇閿欓id鍒楄〃 + await this.getErrorList() // 鑾峰彇閿欓id鍒楄〃 + } else if (this.data.answerType == 'collectQuestion') { + // 鎴戠殑鏀惰棌 + await this.getcollectId() // 鑾峰彇鏀惰棌棰樼洰 + } else if (this.data.answerType == 'errorQuestion') { + // 鎴戠殑閿欓 + // loadings.value = true + await this.getErrorIdList() + await this.getCollectIdList() // 鑾峰彇鏀惰棌id鍒楄〃 + } + }, + async restart() { + const countDownRef = this.selectComponent('#countDownRef') + this.setData({ + loading: true, + total: 0, + subjectiveGrade: 0, + subjectiveTotal: 0, + subjectiveNum: 0, + currentIndex: 0, + submitStatus: false + }) + if (this.data.answerType == 'option') { + this.setData({ + countdownTime: 2 * 60 * 60 * 1000 + }) + this.delAnswerInfo(() => { + this.getQuestionList() + this.clearTime() + }) + if (!this.data.submitStatus) { + this.startCountdown() + } + } else if (this.data.answerType == 'mock') { + // 缁勫嵎妯″紡 + // 娓呯┖绛旈璁板綍 + await app.MG.identity.setUserKey({ + setKeyRequests: [ + { + domain: 'mockAnswerData', + key: route.query.uuid, + value: JSON.stringify({ + time: countDownRef.value.countdownTime, + answerData: [] + }) + } + ] + }) + this.init() + } else { + this.init() + this.clearTime() + if (submitStatus.value) { + this.startCountdown() + } } }, // 鑾峰彇鏀惰棌棰樼洰鍒楄〃id @@ -111,7 +351,7 @@ domain: 'collectData', keys: [this.data.rootCmsItemId] }) - .then(async (res) => { + .then((res) => { try { this.setData({ collectList: JSON.parse(res[0].value) @@ -120,16 +360,18 @@ } if (this.data.answerType == 'option') { // 鍏堣幏鍙栫敤鎴风瓟棰樿褰� - await this.getAnswerInfo((res) => { + this.getAnswerInfo(async (res) => { if (res.length) { // 鏈夎褰曪紝涓嶈兘绛旈锛岀姸鎬佽涓哄凡鎻愪氦 this.setData({ submitStatus: true }) let value = JSON.parse(res[0].value) - // console.log('绛旈璁板綍', JSON.parse(res[0].value)) // 鏈夌瓟棰樿褰曪紝寰楀垎璧嬪�� if (value) { + this.setData({ + submitStatus: true + }) value.dataList.forEach((item) => { if (item.name == '瀹㈣棰樺緱鍒�' && item.path == this.data.productLinkPath) this.setData({ @@ -141,11 +383,28 @@ currentIndex: value.currentIndex }) // 鎼哄甫绛旈璁板綍 鑾峰彇棰樼洰 - this.getQuestionList(value.dataList) + await this.getQuestionList(value.dataList) } else { - this.getQuestionList() // 鑾峰彇棰樺簱棰樼洰 + await this.getQuestionList() // 鑾峰彇棰樺簱棰樼洰 } }) + } + }) + }, + // 鑾峰彇閿欓id鍒楄〃 + getErrorList() { + app.MG.identity + .getUserKey({ + domain: 'errorData', + keys: [this.data.rootCmsItemId] + }) + .then((res) => { + try { + this.setData({ + errorList: JSON.parse(res[0].value) + }) + } catch (error) { + } }) }, @@ -153,22 +412,21 @@ getQuestionList(oldData) { // 娓呯┖姝g‘棰樻暟璁板綍 this.setData({ - correctNum: 0 + cardList: [], + correctNum: 0, }) let flag = 0 this.data.idPathList.forEach((pathitem) => { const pathList = this.data.cardList pathList.push({ - name: pathitem.name, path: pathitem.productLinkPath, - catalogName: pathitem.type, + catalogName: pathitem.name, infoList: [] }) this.setData({ cardList: pathList }) // 鑾峰彇棰樼洰 - let questionArr = [] let query = { path: '*', queryType: '*', @@ -210,6 +468,7 @@ let questionObj = { // num: index, // 棰樺彿 id: item.id, + type: pathitem.name, stem: item.Embedded_QuestionBank_QuestionType == 'completion' ? JSON.parse(item.Embedded_QuestionBank_Stem) @@ -249,6 +508,8 @@ questionObj.answer = item.Embedded_QuestionBank_Answer } } + // questionObj.userAnswer = this.arrayToString(questionObj.userAnswer) + // questionObj.isHaveAnswer = this.isHaveAnswer(questionObj.userAnswer) // 濉┖棰樻敼閫� if (questionObj.questionType == 'completion') { let index = 0 @@ -264,7 +525,20 @@ } } } - questionArr.push(questionObj) + // 鑾峰彇鍥剧墖 + 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 (questionObj.optionStyle == 'RichText') { + // questionObj.option.forEach(optionItem => { + // optionItem.txt.replace(/<img>/g, "<img class='imgClass'>") + // }) + // } // 鏃ф暟鎹噷 棰樼洰宸茬粡浣滅瓟锛屼慨鏀瑰凡绛旈鐩暟閲� // if (oldObj && oldObj.userAnswer.length > 0) countDownRef.value.changeAlready() // 鏃ф暟鎹噷 棰樼洰姝g‘ 璁板綍姝g‘鏁伴噺 @@ -273,57 +547,240 @@ correctNum: this.data.correctNum + 1 }) } - // if (pathitem.name == '鍒ゆ柇棰�') { - // topicList.value.judge.data = questionArr - // topicList.value.judge.path = pathitem.productLinkPath - // if (oldData) subjectiveTotal.value += 1 // 鏈夋棫鏁版嵁锛岃绠椾富瑙傞鏁� - // } else if (pathitem.name == '濉┖棰�') { - // topicList.value.gap.data = questionArr - // topicList.value.gap.path = pathitem.productLinkPath - // if (oldData) subjectiveTotal.value += 1 - // } else if (pathitem.name == '澶氶�夐') { - // topicList.value.check.data = questionArr - // topicList.value.check.path = pathitem.productLinkPath - // if (oldData) subjectiveTotal.value += 1 - // } else if (pathitem.name == '鍗曢�夐') { - // topicList.value.radio.data = questionArr - // topicList.value.radio.path = pathitem.productLinkPath - // if (oldData) subjectiveTotal.value += 1 - // } else if (pathitem.name == '绠�绛旈') { - // topicList.value.short.data = questionArr - // topicList.value.short.path = pathitem.productLinkPath - // } else if (pathitem.name == '缈昏瘧棰�') { - // topicList.value.translate.data = questionArr - // topicList.value.translate.path = pathitem.productLinkPath - // } else if (pathitem.name == '鍚姏棰�') { - // topicList.value.listen.data = questionArr - // topicList.value.listen.path = pathitem.productLinkPath - // if (oldData) subjectiveTotal.value += 1 - // } - let infoList = - this.data.cardList[this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)] - .infoList + if (pathitem.name == '鍒ゆ柇棰�' || pathitem.name == '濉┖棰�' || pathitem.name == '澶氶�夐' || pathitem.name == '鍗曢�夐' || pathitem.name == '鍚姏棰�') { + if (oldObj) { + this.setData({ + subjectiveTotal: this.data.subjectiveTotal + 1 + }) + } + + } + // cardList璧嬪�� + let cardIndex = this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath) + let infoList = this.data.cardList[cardIndex].infoList infoList.push(questionObj) + this.setData({ + [`cardList[${cardIndex}].infoList`]: infoList + }) + // this.data.cardList[this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)] + // .infoList + // infoList.push(questionObj) flag++; let questionList = [] + const cardUpdatedList = this.data.cardList // if (flag == this.data.idPathList.length) { - this.data.cardList.forEach(aitem => { - aitem.infoList.forEach(bitem => { + cardUpdatedList.forEach(aitem => { + aitem.infoList.forEach((bitem, bindex) => { questionList.push(bitem) - bitem.number = questionList.length + bitem.number = bindex + 1 + bitem.grade = 2 }) }) this.setData({ - questionDataList: questionList + questionDataList: questionList, + cardList: cardUpdatedList }) - // } }) }) }) this.setData({ loading: false, }) - console.log('棰樼洰鍒楄〃', this.data.questionDataList, this.data.cardList); + }, + // 鎵规敼棰樼洰 锛堢粌涔狅紝鎴戠殑閿欓锛屾垜鐨勬敹钘忥級 + handleQuestion(num) { + const questionList = this.data.questionDataList + const index = num - 1 >= 0 ? num - 1 : 0 + if (questionList[index].isComplete) { + // 棰樼洰宸插畬鎴愶紝璺宠繃 + return true + } + questionList[index].isComplete = true + const item = questionList[index] + // 鎵规敼棰樼洰 + if (item.questionType == 'multipleChoice') { + // 澶氶�夐 + // subjectiveGrade.value += item.score + if (item.answer.length == item.userAnswer.length) { + const sortedArr1 = item.answer.slice().sort() + const sortedArr2 = item.userAnswer.slice().sort() + questionList[index].isRight = sortedArr1.every( + (value, valueIndex) => value === sortedArr2[valueIndex] + ) + } else { + questionList[index].isRight = false + } + } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') { + // 鍗曢�� 鍒ゆ柇 + // subjectiveGrade.value += item.score + questionList[index].isRight = item.answer == item.userAnswer + } else if (item.questionType == 'shortAnswer') { + // 绠�绛� 缈昏瘧 + questionList[index].isRight = null + } else if (item.questionType == 'completion') { + // 濉┖ + // subjectiveGrade.value += item.score + if (typeof item.answer == 'string') { + questionList[index].isRight = item.answer == item.userAnswer[0] + } else { + if (item.answer.length != item.userAnswer.length) { + questionList[index].isRight = false + } else { + questionList[index].isRight = item.answer.every( + (value, valueIndex) => value === item.userAnswer[valueIndex] + ) + } + } + } + if (item.questionType != 'shortAnswer') { + this.setData({ + subjectiveTotal: this.data.subjectiveTotal + 1, + subjectiveGrade: this.data.subjectiveGrade + item.grade + }) + } + if (questionList[index].isRight && item.questionType != 'shortAnswer') { + // 瀹㈣棰樺洖绛旀纭� + this.setData({ + subjectiveNum: this.data.subjectiveNum + item.grade, + correctNum: this.data.correctNum + 1 + }) + } + if (!questionList[index].isRight && item.questionType != 'shortAnswer') { + // 瀹㈣棰樺洖绛旈敊璇� 璁板綍閿欓 + if (this.data.errorList.findIndex((errorItem) => errorItem == item.id) == -1) { + this.data.errorList.push(item.id) + } + } else { + if (this.data.answerType == 'errorQuestion' || this.data.answerType == 'option') { + // 浠庨敊棰橀泦涓Щ闄� + let errorIndex = this.data.errorList.findIndex((erroritem) => erroritem == item.id) + if (errorIndex > -1) { + this.data.errorList.splice(errorIndex, 1) + } + } + } + if (this.data.answerType != 'collectQuestion') { + // 璁板綍閿欓 + app.MG.identity + .setUserKey({ + setKeyRequests: [ + { + domain: 'errorData', + key: this.data.rootCmsItemId, + value: JSON.stringify(this.data.errorList) + } + ] + }) + .then((res) => { + console.log(res) + }) + } + this.setData({ + questionDataList: questionList + }) + const cardUpdatedList = this.data.cardList + cardUpdatedList.forEach((item) => { + item.infoList.forEach((citem) => { + if (citem.id == questionList[index].id) { + citem = questionList[index]; + } + }); + }); + this.setData({ + cardList: cardUpdatedList + }) + // console.log(this.data.questionDataList, this.data.cardList); + }, + // 棰樼洰鏀惰棌鎸夐挳,鏀惰棌鍜屽彇娑堝悓涓�鎺ュ彛锛屽彇娑堟暟缁勫噺鍘昏椤筰d + setCollect() { + const citem = this.data.questionDataList[this.data.currentIndex] + const questionList = this.data.questionDataList + for (let index = 0; index < questionList.length; index++) { + const item = questionList[index]; + if (item.id == citem.id) { + item.isCollect = !item.isCollect + } + } + this.setData({ + questionDataList: questionList + }) + if (this.data.collectList.length == 0) { + this.setData({ + collectList: [citem.id] + }) + } else { + const collectItme = this.data.collectList.filter((item) => item == citem.id) + if (collectItme.length) { + const arr = this.data.collectList.filter((item) => item != citem.id) + this.setData({ + collectList: arr + }) + } else { + const collectArr = this.data.collectList + collectArr.push(citem.id) + this.setData({ + collectList: collectArr + }) + } + } + app.MG.identity + .setUserKey({ + setKeyRequests: [ + { + domain: 'collectData', + key: this.data.rootCmsItemId, + value: JSON.stringify(this.data.collectList) + } + ] + }) + .then((res) => { }) + }, + // 澶勭悊绛旈鏁版嵁 + recordAnswerData() { + this.data.cardList.push( + { + name: '瀹㈣棰樺緱鍒�', + score: this.data.subjectiveNum, + path: this.data.productLinkPath, + // infoList: [], + // catalogName: '' + } + ) + let setInfoData = { + currentIndex: this.data.currentIndex, + dataList: JSON.parse(JSON.stringify(this.data.cardList)) + } + for (let i = 0; i < setInfoData.dataList.length; i++) { + const item = setInfoData.dataList[i] + if (!item.name && !item.name == '瀹㈣棰樺緱鍒�') { + for (let j = 0; j < item.infoList.length; j++) { + let obj = { + id: item.infoList[j].id, + userAnswer: item.infoList[j].userAnswer, + isComplete: item.infoList[j].isComplete, + isRight: item.infoList[j].isRight, + isCollect: item.infoList[j].isCollect + } + item.infoList[j] = obj + } + } + } + + this.setAnswerInfo(setInfoData) + }, + // 鎻愪氦绛旈鏁版嵁 + setAnswerInfo(data) { + app.MG.identity + .setUserKey({ + setKeyRequests: [ + { + domain: 'answerData', + key: this.data.productLinkPath, + value: JSON.stringify(data) + } + ] + }) + .then((res) => { }) }, // 鑾峰彇绛旈鏁版嵁 getAnswerInfo(callback) { @@ -335,5 +792,332 @@ .then((res) => { if (callback) callback(res) }) + }, + // 鍒犻櫎绛旈鏁版嵁 + delAnswerInfo(callback) { + app.MG.identity + .delUserKey({ + domain: 'answerData', + keys: [this.data.productLinkPath] + }) + .then((res) => { + if (callback) callback() + }) + }, + // 鎴戠殑鏀惰棌妯″紡涓嬭幏鍙栨敹钘忛鐩甶d + async getcollectId() { + app.MG.identity + .getUserKey({ + domain: 'collectData', + keys: [this.data.rootCmsItemId] + }) + .then(async (res) => { + try { + this.setData({ + collectList: JSON.parse(res[0].value) + }) + // total.value = collectList.value.length + } catch (error) { + } + if (this.data.collectList && this.data.collectList.length) { + await this.getCollectDataList() + } else { + this.setData({ + loading: false + }) + wx.showModal({ + title: '鎻愮ず', + content: '鏀惰棌澶规殏鏃犳暟鎹�',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + showCancel: false, + success: (res) => { + if (res.confirm) { + this.setData({ + submitStatus: true + }) + this.goBack() + } + + } + }) + } + // console.log('鏀惰棌', collectList.value) + }) + }, + // 鑾峰彇鏀惰棌澶� + async getCollectDataList() { + let questionArr = [] + this.setData({ + cardList: [ + { + catalogName: '鏀惰棌澶�', + infoList: [] + } + ] + }) + let query = { + path: '*', + cmsPath: this.data.rootCmsItemId, + cmsType: '*', + productId: this.data.bookId, + queryType: '*', + itemIds: this.data.collectList.map((item) => item + ''), + 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: [] + } + } + app.MG.store.getProductDetail(query).then((res) => { + let questionArr = [] + res.datas.cmsDatas[0].datas.forEach((item, index) => { + const questionObj = { + number: index + 1, // 棰樺彿 + id: item.id, + 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: + item.Embedded_QuestionBank_QuestionType == 'completion' || + item.Embedded_QuestionBank_QuestionType == 'multipleChoice' + ? [] + : '', + isSubmit: false, // 鏌ョ湅瑙f瀽 + isRight: null, // 鏄惁姝g‘ + isComplete: false, + isCollect: true + } + // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲JSON鏍煎紡 + if ( + questionObj.questionType == 'completion' || + questionObj.questionType == 'multipleChoice' + ) { + try { + questionObj.answer = JSON.parse(questionObj.answer) + } catch (error) { + // + } + } + // 濉┖棰樻敼閫� + 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' + } + 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 (item.Embedded_QuestionBank_QuestionType == 'judge') { + // topicList.value.judge.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { + // topicList.value.radio.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { + // topicList.value.check.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { + // topicList.value.gap.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { + // topicList.value.short.data.push(questionObj) + // } + questionArr.push(questionObj) + // cardList.value[0].infoList.push(questionObj) + }) + // loadings.value = false + this.setData({ + questionDataList: questionArr, + ['cardList[0].infoList']: questionArr, + loading: false, + }) + }) + }, + // 鎴戠殑閿欓妯″紡涓嬭幏鍙栭敊棰榠d鍒楄〃 + async getErrorIdList() { + await app.MG.identity + .getUserKey({ + domain: 'errorData', + keys: [this.data.rootCmsItemId] + }) + .then((res) => { + try { + this.setData({ + errorList: JSON.parse(res[0].value) + }) + } catch (error) { + } + if (this.data.errorList && this.data.errorList.length) { + this.getErrorDataList() + } else { + this.setData({ + loading: true + }) + wx.showModal({ + title: '鎻愮ず', + content: '閿欓闆嗘殏鏃犳暟鎹�',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + showCancel: false, + success: (res) => { + if (res.confirm) { + this.setData({ + submitStatus: true + }) + this.goBack() + } + } + }) + } + }) + }, + // 鑾峰彇閿欓闆� + async getErrorDataList() { + this.setData({ + cardList: [ + { + catalogName: '閿欓闆�', + infoList: [] + } + ] + }) + let query = { + path: '*', + cmsPath: this.data.rootCmsItemId, + cmsType: '*', + productId: this.data.bookId, + queryType: '*', + itemIds: this.data.errorList.map((item) => item + ''), + 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) => { + let questionArr = [] + res.datas.cmsDatas[0].datas.forEach((item, index) => { + const questionObj = { + number: index + 1, // 棰樺彿 + id: item.id, + 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: + item.Embedded_QuestionBank_QuestionType == 'completion' || + item.Embedded_QuestionBank_QuestionType == 'multipleChoice' + ? [] + : '', + isSubmit: false, // 鏌ョ湅瑙f瀽 + isRight: null, // 鏄惁姝g‘ + isComplete: false, + isCollect: this.data.collectList.some((collectItem) => collectItem == item.id) + } + // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲JSON鏍煎紡 + if ( + questionObj.questionType == 'completion' || + questionObj.questionType == 'multipleChoice' + ) { + try { + questionObj.answer = JSON.parse(questionObj.answer) + } catch (error) { + // + } + } + // 濉┖棰樻敼閫� + 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' + } + 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 (item.Embedded_QuestionBank_QuestionType == 'judge') { + // topicList.value.judge.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { + // topicList.value.radio.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') { + // topicList.value.check.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'completion') { + // topicList.value.gap.data.push(questionObj) + // } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { + // topicList.value.short.data.push(questionObj) + // } + questionArr.push(questionObj) + }) + this.setData({ + questionDataList: questionArr, + ['cardList[0].infoList']: questionArr, + loading: false + }) + }) + // loadings.value = false + // console.log('閿欓闆�', topicList.value) } }) \ No newline at end of file diff --git a/pages/bookServices/examination/examination.json b/pages/bookServices/examination/examination.json index 2365a43..7b82bc1 100644 --- a/pages/bookServices/examination/examination.json +++ b/pages/bookServices/examination/examination.json @@ -5,7 +5,8 @@ "question-list": "/pages/bookServices/examination/questionList/index", "t-icon": "tdesign-miniprogram/icon/icon", "t-image": "tdesign-miniprogram/image/image", - "t-button": "tdesign-miniprogram/button/button" + "t-button": "tdesign-miniprogram/button/button", + "t-loading": "tdesign-miniprogram/loading/loading" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/bookServices/examination/examination.wxml b/pages/bookServices/examination/examination.wxml index 25d54f3..4c597a9 100644 --- a/pages/bookServices/examination/examination.wxml +++ b/pages/bookServices/examination/examination.wxml @@ -12,13 +12,62 @@ </view> <view class="navbar-title">{{answerTitle}}</view> </view> +<!-- +<view class="lodaing-box" wx:if="{{loaidng}}"> + <t-loading + theme="circular" + size="80rpx" + class="wrapper" + loading="{{loading}}" + /> +</view> --> + <view class="page-content"> - <question-schedule></question-schedule> - <question-list questionList="{{questionDataList}}"></question-list> + <question-schedule + wx:if="{{!loading}}" + id="countDownRef" + answerType="{{answerType}}" + countdownTime="{{countdownTime}}" + currentIndex="{{currentIndex}}" + questionList="{{questionDataList}}" + submitStatus="{{submitStatus}}" + ></question-schedule> + <question-list + wx:if="{{!loading}}" + currentIndex="{{currentIndex}}" + questionList="{{questionDataList}}" + submitStatus="{{submitStatus}}" + bind:onChangeRadio="onChangeRadio" + bind:onChangeInput="onChangeInput" + bind:changeSwiper="changeSwiper" + ></question-list> + <view class="lodaing-box"> + <t-loading + theme="circular" + size="80rpx" + class="wrapper" + loading="{{loading}}" + /></view> </view> <!-- 搴曢儴鍖哄煙--> <view class="page-bottom"> - <question-options></question-options> + <question-options + id="question-options" + submitStatus="{{submitStatus}}" + answerType="{{answerType}}" + countdownTime="{{countdownTime}}" + currentIndex="{{currentIndex}}" + questionDataList="{{questionDataList}}" + cardList="{{cardList}}" + subjectiveTotal="{{subjectiveTotal}}" + subjectiveNum="{{subjectiveNum}}" + subjectiveGrade="{{subjectiveGrade}}" + correctNum="{{correctNum}}" + bind:setCollect="setCollect" + bind:submitPaper="submitPaper" + bind:restart="restart" + bind:goQuestion="goQuestion" + ></question-options> </view> diff --git a/pages/bookServices/examination/examination.wxss b/pages/bookServices/examination/examination.wxss index 82abb98..d5798cf 100644 --- a/pages/bookServices/examination/examination.wxss +++ b/pages/bookServices/examination/examination.wxss @@ -14,6 +14,14 @@ font-weight: 600; } +.lodaing-box { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + --td-loading-color: #ff6c00; +} + .page-content { box-sizing: border-box; width: 100%; diff --git a/pages/bookServices/examination/questionList/index.js b/pages/bookServices/examination/questionList/index.js index 75b694a..49a40ba 100644 --- a/pages/bookServices/examination/questionList/index.js +++ b/pages/bookServices/examination/questionList/index.js @@ -1,14 +1,4 @@ // pages/bookServices/examination/questionList/index.js - -const imageCdn = 'https://tdesign.gtimg.com/mobile/demos'; -const swiperList = [ - `${imageCdn}/swiper1.png`, - `${imageCdn}/swiper2.png`, - `${imageCdn}/swiper1.png`, - `${imageCdn}/swiper2.png`, - `${imageCdn}/swiper1.png`, -]; - Component({ /** * 缁勪欢鐨勫睘鎬у垪琛� @@ -17,28 +7,85 @@ questionList: { type: Array, value: [] + }, + submitStatus: { + type: Boolean, + value: false + }, + currentIndex: { + type: Number, + value: 1 } }, created() { - console.log('缁勪欢浼犲弬', this.properties); + // console.log('缁勪欢浼犲弬', this.properties); }, /** * 缁勪欢鐨勫垵濮嬫暟鎹� */ data: { + inputstyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;', + placeholderstyle: "font-size:28rpx", current: 2, autoplay: true, duration: 500, interval: 5000, paginationPosition: 'bottom-right', - swiperList, navigation: { type: 'fraction' }, + showIndex: 0, }, /** * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { - + // 鍒囨崲棰樼洰 + changeSwiper(e) { + console.log(e); + this.setData({ + showIndex: e.detail.current + }) + var myEventDetail = { + index: e.detail.current + } // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true, + } // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent('changeSwiper', myEventDetail, myEventOption) + }, + // 鍗曢�� 瀵屾枃鏈杈撳叆 瑙﹀彂 + onChangeRadio(e) { + var myEventDetail = { + value: e + } // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true, + } // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent('onChangeRadio', myEventDetail, myEventOption) + }, + // 澶氶�夎Е鍙� + onChangeCheck(e) { + var myEventDetail = { + value: e + } // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true, + } // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent('onChangeRadio', myEventDetail, myEventOption) + }, + // 杈撳叆妗嗚Е鍙� + onChangeInput(e) { + var myEventDetail = { + value: e + } // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true, + } // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent('onChangeInput', myEventDetail, myEventOption) + }, } }) diff --git a/pages/bookServices/examination/questionList/index.json b/pages/bookServices/examination/questionList/index.json index e44c80e..6ffa0d2 100644 --- a/pages/bookServices/examination/questionList/index.json +++ b/pages/bookServices/examination/questionList/index.json @@ -2,6 +2,13 @@ "component": true, "usingComponents": { "t-swiper": "tdesign-miniprogram/swiper/swiper", - "t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav" + "t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav", + "t-image": "tdesign-miniprogram/image/image", + "t-input": "tdesign-miniprogram/input/input", + "t-radio": "tdesign-miniprogram/radio/radio", + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group", + "t-textarea": "tdesign-miniprogram/textarea/textarea" } } \ No newline at end of file diff --git a/pages/bookServices/examination/questionList/index.wxml b/pages/bookServices/examination/questionList/index.wxml index 91ed472..2314bd1 100644 --- a/pages/bookServices/examination/questionList/index.wxml +++ b/pages/bookServices/examination/questionList/index.wxml @@ -1,13 +1,217 @@ <!--pages/bookServices/examination/questionList/index.wxml--> <view class="question-list"> <!-- 棰樺瀷title --> - <view class="question-title"> - <text class="title-name">鍗曢�夐</text><text class="title-score">(姣忛2鍒�)</text> + <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> <!-- 棰樼洰鍒楄〃 --> - <swiper> - <swiper-item wx:for="{{questionList}}"> - <text>{{item.stem.stemTxt}}</text> + <swiper class="swiper" bind:change="changeSwiper" current="{{currentIndex}}"> + <swiper-item wx:for="{{questionList}}" wx:key="{{item.id}}"> + <!-- 棰樺共 --> + <view class="question-stem title-score"> + <!-- 棰樺彿 --> + <text>{{item.number}}.</text> + <!-- 浠呮枃瀛� --> + <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" + > + <text>{{item.stem.stemTxt}}</text> + <t-image src="{{item.stem.stemImage}}"></t-image> + </view> + <!-- 瀵屾枃鏈� --> + <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> + <text wx:else>{{inputItem}}</text> + </view> + </view> + </view> + <!-- 绛旈鍖哄煙 --> + <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' :''}}" + > + <!-- 浠呮枃瀛� --> + <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" + > + <text>{{contentItem.value}}銆�</text> + <text>{{contentItem.txt}}</text> + <t-image src="{{contentItem.img}}"></t-image> + </view> + <!-- 瀵屾枃鏈� --> + <view wx:if="{{item.optionStyle == 'RichText'}}"> + <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 + > + </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 block="{{false}}" value="{{contentItem.value}}"> + <!-- 浠呮枃瀛� --> + <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" + > + <text>{{contentItem.value}}銆�</text> + <text>{{contentItem.txt}}</text> + <t-image src="{{contentItem.img}}"></t-image> + </view> + <!-- 瀵屾枃鏈� --> + <view wx:if="{{item.optionStyle == 'RichText'}}"> + <text>{{contentItem.value}}銆�</text> + <rich-text nodes="{{contentItem.txt}}"></rich-text> + </view> + </t-checkbox> + </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}}" + /> + </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> + </view> + <view class="answer-error"> + <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> + </view> + </view> + </swiper-item> + <swiper-item> + <text>娌℃湁鏇村浜嗐�傘�傘��</text> </swiper-item> </swiper> </view> diff --git a/pages/bookServices/examination/questionList/index.wxss b/pages/bookServices/examination/questionList/index.wxss index 691bc42..03185dd 100644 --- a/pages/bookServices/examination/questionList/index.wxss +++ b/pages/bookServices/examination/questionList/index.wxss @@ -22,4 +22,129 @@ .title-score { color: #000; +} + +.question-stem { + font-size: 32rpx; + font-weight: bold; + display: flex; + margin-bottom: 20rpx; +} + +.swiper { + min-height: 900rpx; + +} + +/* 鍗曢�夐 */ +.radio-group { + margin-top: 20rpx; + --td-radio-vertical-padding: 12rpx +} + +.radio-item { + padding: 0 32rpx; + min-height: 98rpx; + display: flex; + align-items: center; + justify-content: space-between; + background-color: #F9F9F9; +} + +.radio-correct { + background-color: #EAF7EE; +} + +.radio-error { + background-color: #FFEBEB; +} + +.question-stem image { + margin-left: 20rpx; + width: 300rpx; + object-fit: contain; + height: 200rpx; +} + +.title-RichText img { + width: 300rpx; + height: 200rpx; +} + + +.question-answer image { + margin: 10rpx 0 10rpx 10rpx; + width: 180rpx; + height: 120rpx; +} + +.fl-center { + display: flex; + align-items: center; +} + +.checkbox-group { + --td-checkbox-icon-checked-color: #ff6c00; +} + +.t-checkbox { + display: flex; + align-items: center; +} + +.completion-box { + display: inline-block; +} + +.title-input { + /* display: inline-block; */ + height: 40rpx; + --td-input-vertical-padding: 16rpx +} + +.option-textarea { + width: 97%; +} + +/* 瑙f瀽 */ +.analysis { + margin-top: 40rpx; +} + +.analysis-answer { + display: flex; + justify-content: space-between; +} + +.answer-correct { + color: #1FBC1F; +} + +.answer-error { + color: #EE1818; +} + +.answer-text { + font-size: 40rpx; +} + +.answer-correct { + display: flex; +} + +.analysis-title-box { + display: inline-block; + width: 160rpx; + height: 52rpx; + white-space: nowrap; +} + +.analysis-content { + display: inline-block +} + +.analysis-text { + color: #333333; + font-size: 28rpx; + margin-top: 20rpx; } \ No newline at end of file diff --git a/pages/bookServices/examination/questionOptions/index.js b/pages/bookServices/examination/questionOptions/index.js index d4fb8ec..54aed63 100644 --- a/pages/bookServices/examination/questionOptions/index.js +++ b/pages/bookServices/examination/questionOptions/index.js @@ -1,10 +1,50 @@ + // pages/bookServices/examination/questionOptions/index.js Component({ /** * 缁勪欢鐨勫睘鎬у垪琛� */ properties: { - + currentIndex: { + type: Number, + value: 0, + }, + questionDataList: { + type: Array, + value: [] + }, + cardList: { + type: Array, + value: [] + }, + subjectiveTotal: { + type: Number, + value: 0 + }, + countdownTime: { + type: Number, + value: 0, + }, + answerType: { + type: String, + value: '' + }, + subjectiveNum: { + type: Number, + value: 0 + }, + subjectiveGrade: { + type: Number, + value: 0 + }, + correctNum: { + type: Number, + value: 0 + }, + submitStatus: { + type: Boolean, + value: false + } }, /** @@ -12,12 +52,212 @@ */ data: { btnStyle: "width:320rpx;border-radius:60rpx", + noReady: 0, + questionCardState: false, + setUpPopup: false, + testReportState: false, + sliderValue: 0, + useTime: '' + }, + observers: { + "countdownTime": function (newValue, oldValue) { + if (this.properties.answerType == 'option') { + this.setData({ + useTime: this.formatTime(2 * 60 * 60 * 1000 - this.properties.countdownTime) + }) + } + if (newValue == 0 && (this.properties.answerType == 'option' || this.properties.answerType == 'mock')) { + this.timeout() + } + }, + }, + created() { }, /** * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { + // // 鏍煎紡鍖栨椂闂� + formatTime(ms) { + const hours = Math.floor((ms / (1000 * 60 * 60)) % 24) + .toString() + .padStart(2, '0') + const minutes = Math.floor((ms / (1000 * 60)) % 60) + .toString() + .padStart(2, '0') + const seconds = Math.floor((ms / 1000) % 60) + .toString() + .padStart(2, '0') + return `${hours}:${minutes}:${seconds}` + }, + // 鍒ゆ柇鏄惁杈撳叆绛旀 + isHaveAnswer(data) { + if (typeof data == 'string') { + data = data + .replace(/<[^>]*>/g, '') + .replace(/ /g, '') + .trim() + if (data.length) { + return true + } else { + return false + } + } else { + const answer = data.find((item) => item.length > 0) + if (answer) { + return true + } else { + return false + } + } + }, + setCollect() { + var myEventDetail = { + } + var myEventOption = { + bubbles: true, + composed: true, + } + this.triggerEvent('setCollect', myEventDetail, myEventOption) + }, + // 绛旈鍗℃寜閽� + handlePopup() { + this.setData({ + questionCardState: true + }) + }, + // 绛旈鍗¤烦杞鐩� + goQuestion(e) { + var myEventDetail = { + id: e.currentTarget.dataset.id + } + var myEventOption = { + bubbles: true, + composed: true, + } + this.triggerEvent('goQuestion', myEventDetail, myEventOption) + }, + // 绛旈鍗¢伄缃╁眰鐐瑰嚮 + onVisibleChange(e) { + this.setData({ + questionCardState: e.detail.visible, + }); + }, + // 璁剧疆鎸夐挳 + setUpBtn() { + this.setData({ + setUpPopup: true + }) + }, + // 婊戝潡鍙樺寲 + onChangeSlider(e) { + console.log(e); + this.setData({ + sliderValue: e.detail.value + }) + }, + // 璁剧疆閬僵灞傜偣鍑� + onSetUpChange(e) { + this.setData({ + setUpPopup: e.detail.visible + }) + }, + // 閲嶅仛鎸夐挳 + resterBtn() { + wx.showModal({ + title: '鎻愮ず', + content: '鏄惁閲嶆柊寮�濮嬬瓟棰橈紵',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + success: (res) => { + if (res.confirm) { + this.restart() + } + } + }) + }, + // 閲嶅仛浜嬩欢 + restart() { + var myEventDetail = { + } + var myEventOption = { + bubbles: true, + composed: true, + } + this.triggerEvent('restart', myEventDetail, myEventOption) + }, + // 杩樻湁N閬撻鏈仛寮圭獥 + confrimPromptDialog() { + wx.showModal({ + title: '鎻愮ず', + content: `鎮ㄨ繕鏈� ${this.data.noReady}閬撻鏈瓟锛屾槸鍚︽彁浜わ紵`,//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + success: (res) => { + if (res.confirm) { + this.submitPaper() + } + } + }) + }, + // 搴曢儴鎻愪氦鎸夐挳 + 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 { + // 鍋氬畬浜嗙洿鎺ユ墽琛屾彁浜や簨浠� + this.submitPaper() + } + }, + // 鎻愪氦浜嬩欢 + submitPaper() { + var myEventDetail = { + } + var myEventOption = { + bubbles: true, + composed: true, + } + this.triggerEvent('submitPaper', myEventDetail, myEventOption) + }, + // 鎵撳紑娴嬭瘯鎶ュ憡寮圭獥 + openTestReportDialog() { + this.setData({ + testReportState: true + }) + }, + // 鍏抽棴娴嬭瘯鎶ュ憡寮圭獥 + closeTestReportDialog(e) { + this.setData({ + testReportState: false + }) + }, + // 娴嬭瘯鎶ュ憡寮圭獥鏌ョ湅绛旀瑙f瀽鎸夐挳 + viewAnswer() { + this.closeTestReportDialog() + }, + // 绛旈鏃堕棿鍒� + timeout() { + wx.showModal({ + title: '鎻愮ず', + content: '绛旈鏃堕棿宸插埌',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + showCancel: false, + success: (res) => { + } + }) + this.submitPaper() + } } }) diff --git a/pages/bookServices/examination/questionOptions/index.json b/pages/bookServices/examination/questionOptions/index.json index 5a5e332..99a169b 100644 --- a/pages/bookServices/examination/questionOptions/index.json +++ b/pages/bookServices/examination/questionOptions/index.json @@ -3,6 +3,9 @@ "usingComponents": { "t-icon": "tdesign-miniprogram/icon/icon", "t-image": "tdesign-miniprogram/image/image", - "t-button": "tdesign-miniprogram/button/button" + "t-button": "tdesign-miniprogram/button/button", + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-popup": "tdesign-miniprogram/popup/popup", + "t-slider": "tdesign-miniprogram/slider/slider" } } \ No newline at end of file diff --git a/pages/bookServices/examination/questionOptions/index.wxml b/pages/bookServices/examination/questionOptions/index.wxml index 10464c9..1130cc8 100644 --- a/pages/bookServices/examination/questionOptions/index.wxml +++ b/pages/bookServices/examination/questionOptions/index.wxml @@ -1,24 +1,155 @@ <!--pages/bookServices/examination/questionOptions/index.wxml--> <view class="page-bottom"> - <view class="li-option"> - <t-image src="/static/images/bookService/examination/collect.png"></t-image> + <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> 鏀惰棌 </view> - <view class="li-option"> + <view class="li-option" bind:tap="handlePopup"> <t-image src="/static/images/bookService/examination/questionCard.png" ></t-image> 绛旈鍗� </view> - <view class="li-option"> + <view class="li-option" bind:tap="setUpBtn"> <t-image src="/static/images/bookService/examination/setting.png"></t-image> 璁剧疆 </view> - <view class="li-option"> + <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}}">鎻愪氦</t-button> + <t-button + theme="primary" + size="large" + style="{{btnStyle}}" + bind:tap="submitBtn" + >{{(answerType == 'option' || answerType == 'mock') ? '鎻愪氦' : + '閫�鍑�'}}</t-button + > </view> </view> + +<!-- 绛旈鍗� --> +<t-popup + visible="{{questionCardState}}" + bind:visible-change="onVisibleChange" + placement="bottom" +> + <view class="popup-block"> + <view class="popup-header"> + <view class="popup-title">绛旈鍗�</view> + </view> + <view class="question-explain"> + <view class="explain-answered"> + <text class="answered explain-color-box"></text> + <text>宸茬瓟</text> + </view> + <view class="explain-un-answered"> + <text class="un-answered explain-color-box"></text> + <text>鏈瓟</text> + </view> + </view> + <view class="question-card-list"> + <view wx:for="{{cardList}}" class="card-box"> + <!-- 棰樺瀷 --> + <view class="question-title"> + <text class="color-box"></text> + <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'}}" + > + {{citem.number}} + </view> + </view> + </view> + </view> + </view> +</t-popup> + +<!-- 璁剧疆 --> +<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> + <!-- 妯″紡 --> + </view> +</t-popup> + +<!-- 娴嬭瘯鎶ュ憡 --> + +<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"> + <view class="report-li-left">棰樼洰鎬绘暟锛�</view> + <view class="report-li-right">{{questionDataList.length}}閬�</view> + </view> + <view class="report-li"> + <view class="report-li-left">鐢ㄦ椂锛�</view> + <view class="report-li-right">{{useTime}}</view> + </view> + <view class="report-li"> + <view class="report-li-left">鍏朵腑瀹㈣棰橈細</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> + <view class="report-li"> + <view class="report-li-left">绛旈敊锛�</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> + </view> + <view class="report-content-bottom"> + <t-button theme="primary" bind:tap="viewAnswer" style="width: 560rpx" + >鏌ョ湅绛旀涓庤В鏋�</t-button + > + </view> + </view> +</t-dialog> diff --git a/pages/bookServices/examination/questionOptions/index.wxss b/pages/bookServices/examination/questionOptions/index.wxss index baf2e8d..d1c5f70 100644 --- a/pages/bookServices/examination/questionOptions/index.wxss +++ b/pages/bookServices/examination/questionOptions/index.wxss @@ -28,4 +28,160 @@ --td-button-primary-border-color: #FF6C00; --td-button-primary-active-bg-color: #ff984d; --td-button-primary-active-border-color: #ff984d; +} + +/* 绛旈鍗� */ +.popup-block { + width: 100vw; + height: 700rpx; + background: #fff; + border-top-left-radius: 16rpx; + border-top-right-radius: 16rpx; +} + +.popup-header { + display: flex; + align-items: center; + height: 116rpx; +} + +.popup-title { + color: #333; + flex: 1; + text-align: center; + font-weight: 600; + font-size: 36rpx; +} + +.question-card-list { + padding: 0 20rpx; + height: 100%; + overflow-y: auto; +} + +.question-title { + margin-top: 40rpx; + display: flex; + align-items: center; +} + +.question-explain { + padding-right: 40rpx; + display: flex; + justify-content: flex-end; +} + +.explain-un-answered { + margin-left: 80rpx; +} + +.explain-answered, +.explain-un-answered { + display: flex; + align-items: center; +} + +.explain-color-box { + width: 30rpx; + height: 30rpx; + border-radius: 5rpx; + display: inline-block; + margin-right: 10rpx; +} + +.color-box { + display: inline-block; + width: 8rpx; + height: 60rpx; + background-color: #ff6c00; + border-radius: 0 10rpx 10rpx 0; +} + +.title-text { + color: #333; + margin-left: 10rpx; +} + + +.card-box:last-child { + margin-bottom: 200rpx; +} + +.question-list { + margin: 46rpx 0 64rpx 0; + display: flex; + flex-wrap: wrap; +} + +.question-box { + display: flex; + justify-content: center; + align-items: center; + margin: 38rpx 20rpx 0 0; + width: 126rpx; + height: 62rpx; + font-size: 34rpx; +} + +.question-box:nth-child(5n) { + margin-right: 0; +} + +.answered { + background-color: #FF6C00; + color: #fff; +} + +.un-answered { + background-color: #F1F3F8; + color: #B4B6BD; +} + +/* 璁剧疆 */ +.set-up-popup { + height: 400rpx; +} + +/* 娴嬭瘯鎶ュ憡 */ +.test-report { + --td-dialog-width: 660rpx +} + +.report-content-top { + padding-top: 40rpx; +} + +.report-li { + display: flex; + color: #333; + margin-bottom: 44rpx; +} + +.report-li-left { + width: 192rpx; +} + +.report-li-right { + margin-left: 120rpx; +} + +.report-content-bottom { + --td-button-border-radius: 60rpx; + --td-button-primary-bg-color: #fff; + --td-button-primary-color: #ff6c00; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-active-bg-color: #fff0e6; + --td-button-primary-active-border-color: #ff6c00; +} + +.correct-color { + color: #1FBC1F; +} + +.error-color { + color: #EE1818; +} + +.score-color { + color: #ff6c00; } \ No newline at end of file diff --git a/pages/bookServices/examination/questionSchedule/index.js b/pages/bookServices/examination/questionSchedule/index.js index 04dcf5d..311ed8a 100644 --- a/pages/bookServices/examination/questionSchedule/index.js +++ b/pages/bookServices/examination/questionSchedule/index.js @@ -5,45 +5,87 @@ * 缁勪欢鐨勫睘鎬у垪琛� */ properties: { - + questionList: { + type: Array, + value: [] + }, + submitStatus: { + type: Boolean, + value: false + }, + currentIndex: { + type: Number, + value: 1 + }, + countdownTime: { + type: Number, + value: 0 + }, + answerType: { + type: String, + value: '' + } }, created() { - // if (props.answerType == 'option') { - // this.startCountdown() - this.setData({ - countdownTime: 2 * 60 * 60 * 1000 - }) - // } }, detached() { - if (this.data.countdownInterval !== null) { - clearInterval(this.data.countdownInterval) - } }, /** * 缁勪欢鐨勫垵濮嬫暟鎹� */ data: { - countdownInterval: null, // 璁℃椂鍣� - isCountdownRunning: true, // 鏄惁鍊掕鏃� - countdownTime: "", // 鏃堕棿 - showTime: '', + showTime: '', // + percentage: 0, + ready: 0 }, observers: { - 'countdownTime': function (newValue, oldValue) { - const showTime = this.formatTime(this.data.countdownTime) + 'countdownTime': function (newValue) { + const showTime = this.formatTime(this.properties.countdownTime) this.setData({ showTime: showTime }) - console.log(this.data.showTime); + }, + 'questionList': function (newValue) { + this.setData({ + ready: 0 + }) + for (let index = 0; index < newValue.length; index++) { + const item = newValue[index]; + if (this, this.isHaveAnswer(item.userAnswer)) { + this.setData({ + ready: this.data.ready + 1 + }) + } + } } }, /** * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { - // 鏍煎紡鍖栨椂闂� + // 鍒ゆ柇鏄惁鏈夌敤鎴风瓟妗� + isHaveAnswer(data) { + if (typeof data == 'string') { + data = data + .replace(/<[^>]*>/g, '') + .replace(/ /g, '') + .trim() + if (data.length) { + return true + } else { + return false + } + } else { + const answer = data.find((item) => item.length > 0) + if (answer) { + return true + } else { + return false + } + } + }, + // // 鏍煎紡鍖栨椂闂� formatTime(ms) { const hours = Math.floor((ms / (1000 * 60 * 60)) % 24) .toString() @@ -56,60 +98,60 @@ .padStart(2, '0') return `${hours}:${minutes}:${seconds}` }, - // 鑾峰彇淇濆瓨鐨勫�掕鏃舵椂闂� - getSavedTime() { - const savedTime = wx.getStorageSync('countdownTime') - return savedTime ? parseInt(savedTime) : null - }, - // 淇濆瓨鍊掕鏃舵椂闂村埌鏈湴瀛樺偍 - saveTime() { - wx.setStorageSync('countdownTime', this.data.countdownTime.toString()) - }, - clearTime() { - this.setData({ - countdownTime: 2 * 60 * 60 * 1000 - }) - }, - // 鏆傚仠鎴栫户缁�掕鏃� - toggleCountdown() { - if (countdownInterval) { - clearInterval(this.data.countdownInterval) - this.setData({ - countdownInterval: null, - isCountdownRunning: false - }) - } else { - this.startCountdown() - this.setData({ - isCountdownRunning: true - }) - } - }, - // 寮�濮嬪�掕鏃� - startCountdown() { - // 濡傛灉璁℃椂鍣ㄥ凡缁忓瓨鍦紝鍏堟竻闄や箣鍓嶇殑璁℃椂鍣� - if (this.data.countdownInterval) { - clearInterval(this.data.countdownInterval) - this.setData({ - countdownInterval: null - }) - } - this.setData({ - countdownInterval: setInterval(() => { - this.setData({ - countdownTime: this.data.countdownTime - 1000 - }) - if (this.data.countdownTime <= 0) { - clearInterval(this.data.countdownInterval) - this.setData({ - countdownTime: 0, - isCountdownRunning: false - }) - } - this.saveTime() - }, 1000) - }) + // // 鑾峰彇淇濆瓨鐨勫�掕鏃舵椂闂� + // getSavedTime() { + // const savedTime = wx.getStorageSync('countdownTime') + // return savedTime ? parseInt(savedTime) : null + // }, + // // 淇濆瓨鍊掕鏃舵椂闂村埌鏈湴瀛樺偍 + // saveTime() { + // wx.setStorageSync('countdownTime', this.data.countdownTime.toString()) + // }, + // clearTime() { + // this.setData({ + // countdownTime: 2 * 60 * 60 * 1000 + // }) + // }, + // // 鏆傚仠鎴栫户缁�掕鏃� + // toggleCountdown() { + // if (countdownInterval) { + // clearInterval(this.data.countdownInterval) + // this.setData({ + // countdownInterval: null, + // isCountdownRunning: false + // }) + // } else { + // this.startCountdown() + // this.setData({ + // isCountdownRunning: true + // }) + // } + // }, + // // 寮�濮嬪�掕鏃� + // startCountdown() { + // // 濡傛灉璁℃椂鍣ㄥ凡缁忓瓨鍦紝鍏堟竻闄や箣鍓嶇殑璁℃椂鍣� + // if (this.data.countdownInterval) { + // clearInterval(this.data.countdownInterval) + // this.setData({ + // countdownInterval: null + // }) + // } + // this.setData({ + // countdownInterval: setInterval(() => { + // this.setData({ + // countdownTime: this.data.countdownTime - 1000 + // }) + // if (this.data.countdownTime <= 0) { + // clearInterval(this.data.countdownInterval) + // this.setData({ + // countdownTime: 0, + // isCountdownRunning: false + // }) + // } + // this.saveTime() + // }, 1000) + // }) - } + // } } }) diff --git a/pages/bookServices/examination/questionSchedule/index.wxml b/pages/bookServices/examination/questionSchedule/index.wxml index 59cd07d..c7cad08 100644 --- a/pages/bookServices/examination/questionSchedule/index.wxml +++ b/pages/bookServices/examination/questionSchedule/index.wxml @@ -1,11 +1,17 @@ <!--pages/bookServices/examination/questionSchedule/questionSchedule.wxml--> <view class="schedule"> <view class="schedule-top"> - <view class="question-schedule">绛旈杩涘害<text class="parimary-color question-num">1</text> <text>/18</text></view> - <view class="remainder">鍓╀綑鏃堕棿 <text class="parimary-color">{{showTime}}</text></view> + <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> <view class="schedule-progress"> - <t-progress percentage="80" color="#ff6c00" label="" /> + <t-progress percentage="{{percentage}}" color="#ff6c00" label="" /> </view> - -</view> \ No newline at end of file +</view> diff --git a/pages/bookServices/webpage/index.js b/pages/bookServices/webpage/index.js new file mode 100644 index 0000000..eb6ec08 --- /dev/null +++ b/pages/bookServices/webpage/index.js @@ -0,0 +1,69 @@ +// pages/bookServices/webpage/index.js +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + url: '' + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + console.log(options); + this.setData({ + url: options.url + }) + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/bookServices/webpage/index.json b/pages/bookServices/webpage/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/bookServices/webpage/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/bookServices/webpage/index.wxml b/pages/bookServices/webpage/index.wxml new file mode 100644 index 0000000..15f9aed --- /dev/null +++ b/pages/bookServices/webpage/index.wxml @@ -0,0 +1,2 @@ +<!--pages/bookServices/webpage/index.wxml--> +<web-view src="{{url}}"></web-view> diff --git a/pages/bookServices/webpage/index.wxss b/pages/bookServices/webpage/index.wxss new file mode 100644 index 0000000..650c9ac --- /dev/null +++ b/pages/bookServices/webpage/index.wxss @@ -0,0 +1 @@ +/* pages/bookServices/webpage/index.wxss */ \ No newline at end of file diff --git a/static/images/bookService/detail/checkpaper.png b/static/images/bookService/detail/checkpaper.png new file mode 100644 index 0000000..8a0b960 --- /dev/null +++ b/static/images/bookService/detail/checkpaper.png Binary files differ diff --git a/static/images/bookService/detail/notest.png b/static/images/bookService/detail/notest.png new file mode 100644 index 0000000..569238b --- /dev/null +++ b/static/images/bookService/detail/notest.png Binary files differ -- Gitblit v1.9.1