From 3f1ea0a8e4bb02bf7544df8660b15cfa69d6b84a Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 15 三月 2024 18:54:04 +0800 Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master --- pages/bookServices/examination/questionList/index.wxss | 125 + pages/bookServices/examination/questionOptions/index.json | 5 pages/resourceDetails/myVideo/index.wxml | 75 style/theme.wxss | 8 pages/bookServices/detail/components/testResource/testResource.js | 53 static/images/document/zip200px.png | 0 pages/personalCenter/index.wxml | 4 pages/bookServices/detail/index.js | 195 + static/images/bookService/detail/notest.png | 0 pages/aboutUs/index.wxml | 29 pages/bibliographyList/index.json | 3 pages/bookServices/detail/components/testResource/testResource.json | 4 static/images/bibliographyList/square@2x.png | 0 pages/personalCenter/index.js | 8 pages/bookExhibitionDetails/index.wxss | 18 pages/cart/index.wxml | 41 pages/resourceDetails/document/index.wxss | 68 pages/bookServices/detail/index.wxml | 189 - pages/bookServices/examination/examination.json | 3 pages/resourceDetails/myAudio/index.wxml | 141 + pages/cart/paymentPage/index.wxss | 82 pages/bookServices/examination/questionSchedule/index.wxml | 16 pages/bookExhibitionList/index.wxml | 5 pages/resourceDetails/myVideo/index.js | 335 ++ pages/retrievalPage/index.wxml | 4 pages/bookServices/examination/examination.js | 896 ++++++++ pages/bookServices/examination/examination.wxss | 8 pages/resourceDetails/myAudio/index.json | 15 pages/bookServices/webpage/index.js | 69 pages/cart/index.js | 37 static/images/document/zip.png | 0 pages/cart/paymentPage/index.js | 6 pages/bookServices/examination/questionOptions/index.wxss | 156 + pages/resourceDetails/myAudio/index.js | 669 ++++++ pages/bibliographyList/index.wxss | 27 pages/bookServices/detail/components/testResource/testResource.wxml | 133 + pages/bibliographyList/index.js | 22 pages/aboutUs/index.json | 6 pages/bookServices/webpage/index.wxml | 2 pages/home/home.js | 11 pages/bookServices/examination/questionList/index.wxml | 214 ++ static/images/document/zip200px@2x.png | 0 pages/bookServices/examination/questionSchedule/index.js | 186 + pages/resourceDetails/myVideo/index.wxss | 141 + pages/testLogin/index.js | 2 pages/bookExhibitionList/index.js | 13 static/images/bookService/detail/checkpaper.png | 0 pages/bookServices/examination/questionList/index.js | 73 pages/aboutUs/index.js | 59 pages/resourceDetails/myVideo/index.json | 6 static/images/bookExhibitionList/zhuantitaolun.png | 0 pages/bookServices/webpage/index.json | 3 pages/bookServices/detail/components/note/note.js | 4 pages/home/home.wxml | 2 pages/retrievalPage/index.js | 16 pages/aboutUs/index.wxss | 22 pages/bookExhibitionDetails/index.wxml | 2 pages/cart/index.wxss | 90 pages/resourceDetails/document/index.js | 205 ++ pages/resourceDetails/document/index.wxml | 50 pages/bookServices/detail/components/tree/index.wxml | 161 - pages/cart/paymentPage/index.wxml | 102 pages/bookExhibitionList/index.wxss | 14 pages/resourceDetails/myAudio/index.wxss | 327 ++ pages/retrievalPage/index.wxss | 23 pages/bookServices/examination/questionOptions/index.js | 242 ++ app.json | 3 pages/cart/index.json | 4 /dev/null | 0 pages/bookServices/detail/components/testResource/testResource.wxss | 164 + pages/bookServices/examination/examination.wxml | 55 pages/bookServices/detail/index.json | 4 pages/bookServices/examination/questionList/index.json | 9 pages/bookServices/detail/components/tree/components/util.js | 27 pages/bookServices/examination/questionOptions/index.wxml | 143 + pages/bibliographyList/index.wxml | 15 pages/bookServices/detail/components/tree/index.js | 68 pages/bookServices/webpage/index.wxss | 1 pages/resourceDetails/document/index.json | 8 static/images/bibliographyList/square.png | 0 80 files changed, 5,085 insertions(+), 841 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/aboutUs/index.js b/pages/aboutUs/index.js index 135af2c..b5e5956 100644 --- a/pages/aboutUs/index.js +++ b/pages/aboutUs/index.js @@ -15,6 +15,9 @@ interval: 5000,//杞挱鍥惧弬鏁� navigation: { type: 'dots' },//杞挱鍥惧弬鏁� bannerList: [], //杞挱鍥惧垪琛� + navBarHeight: '', + barHeight: '', + types: '', }, /** @@ -22,36 +25,22 @@ */ onLoad(options) { - this.getBanner() + + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + + this.setData({ + navBarHeight: navBarHeight, + barHeight: systInfo.statusBarHeight, + types: options.types + }) + + console.log(this.data.types); + + + // this.getBanner() this.getAboutText() - - - // drawQrcode({ - - // width: 200, // 蹇呴』锛屼簩缁寸爜瀹藉害锛屼笌canvas鐨剋idth淇濇寔涓�鑷� - - // height: 200, // 蹇呴』锛屼簩缁寸爜楂樺害锛屼笌canvas鐨刪eight淇濇寔涓�鑷� - - // canvasId: 'myQrcode', - - // background: '#ffffff', // 闈炲繀椤伙紝浜岀淮鐮佽儗鏅鑹诧紝榛樿鍊肩櫧鑹� - - // foreground: '#000', // 闈炲繀椤伙紝浜岀淮鐮佸墠鏅壊锛岄粯璁ゅ�奸粦鑹� '#000000' - - // // ctx: wx.createCanvasContext('myQrcode'), // 闈炲繀椤伙紝缁樺浘涓婁笅鏂囷紝鍙�氳繃 wx.createCanvasContext('canvasId') 鑾峰彇锛寁1.0.0+鐗堟湰鏀寔 - - // text: '13216549865', // 蹇呴』锛屼簩缁寸爜鍐呭 - // // v1.0.0+鐗堟湰鏀寔鍦ㄤ簩缁寸爜涓婄粯鍒跺浘鐗� - - // image: { - // // imageResource: '../../images/icon.png', // 鎸囧畾浜岀淮鐮佸皬鍥炬爣 - // dx: 70, - // dy: 70, - // dWidth: 60, - // dHeight: 60 - // } - // }) - }, /** @@ -102,17 +91,15 @@ onShareAppMessage() { }, + //杞挱鍥� getBanner() { - app.MG.resource.getItem({ path: 'jsek_banner\\jsek_aboutUsBanner', paging: { start: 0, size: 9 }, - fields: { jsek_link: [] } }).then(res => { - this.setData({ bannerList: res.datas[0].icon, swiperList: res.datas[0].icon @@ -120,9 +107,12 @@ console.log(this.data.bannerList, 789); }) }, + + //鏂囧瓧 jsek_aboutUs 鍏充簬鎴戜滑 + //jsek_contactUs 鑱旂郴鎴戜滑 getAboutText() { app.MG.resource.getItem({ - path: 'jsek_aboutUs', + path: this.data.types, fields: { content: [] }, @@ -138,5 +128,8 @@ }) + }, + goBack() { + wx.navigateBack() } }) \ No newline at end of file diff --git a/pages/aboutUs/index.json b/pages/aboutUs/index.json index 45f3c00..6129956 100644 --- a/pages/aboutUs/index.json +++ b/pages/aboutUs/index.json @@ -2,6 +2,8 @@ "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-icon": "tdesign-miniprogram/icon/icon" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/aboutUs/index.wxml b/pages/aboutUs/index.wxml index f57c59d..40f4321 100644 --- a/pages/aboutUs/index.wxml +++ b/pages/aboutUs/index.wxml @@ -1,30 +1,19 @@ -<!--pages/aboutUs/index.wxml--> -<!-- <text>鍏充簬鎴戜滑</text> --> +<view style="width: 100%; height: {{barHeight}}px; "></view> +<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> + <view> + <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> + </view> + <view wx:if="{{types == 'jsek_aboutUs'}}" class="navbar-title">鍏充簬鎴戜滑</view> + <view wx:else class="navbar-title">鑱旂郴鎴戜滑</view> +</view> - - -<!-- 浜岀淮鐮佸睍绀� --> -<!-- <view class=""> - <canvas style="width: 200px; height: 200px;margin:0 auto" canvas-id="myQrcode"></canvas> -</view> --> - - - - - - -<!-- <view class="swiper-wrap"> - <t-swiper list="{{bannerList}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" /> -</view> --> <view class="aboutUs"> - <!-- <view class="imageBox"> - <image src="{{swiperList}}" alt="" /> - </view> --> + <view class="aboutText"> <rich-text nodes="{{aboutText}}"></rich-text> </view> diff --git a/pages/aboutUs/index.wxss b/pages/aboutUs/index.wxss index 5a434ed..c11d81d 100644 --- a/pages/aboutUs/index.wxss +++ b/pages/aboutUs/index.wxss @@ -1,4 +1,25 @@ /* pages/aboutUs/index.wxss */ + + +.nacigationBar { + background-color: #fff; + display: flex; + align-items: center; + +} + +.navbar-title { + white-space: nowrap; + /* overflow: hidden; */ + text-overflow: ellipsis; + color: #0F1214; + + margin-bottom: 5rpx; + font-weight: bold; + font-size: 36rpx; + color: #0F1214; +} + image { width: 100%; height: 100%; @@ -12,7 +33,6 @@ .aboutUs { margin: 30rpx; - } .aboutText { diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index cab19a3..4c3cd21 100644 --- a/pages/bibliographyList/index.js +++ b/pages/bibliographyList/index.js @@ -15,7 +15,8 @@ teacherTotal: 0, value: '', BarHeight: '', - navBarHeight: '' + navBarHeight: '', + }, /** @@ -26,13 +27,12 @@ this.vocationalGet() this.teacherGet() - - //鑾峰彇绯荤粺淇℃伅锛岀姸鎬佹爮楂樺害涓簊ysInfo['statusBarHeight']; - let sysInfo = wx.getSystemInfoSync(); - let menu = wx.getMenuButtonBoundingClientRect(); //鑳跺泭淇℃伅 - let navBarHeight = (menu.top - sysInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� this.setData({ - BarHeight: sysInfo.statusBarHeight, navBarHeight: navBarHeight + navBarHeight: navBarHeight, + barHeight: systInfo.statusBarHeight, }) @@ -227,9 +227,9 @@ console.log(111); const item = event.currentTarget.dataset.item; // console.log(item.datas.freeFile.Value); - const URL = 'http://182.92.203.7:3001/file/api/ApiDownload?md5=' + item.datas.freeFile.Value + const URL = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.datas.freeFile.Value item.determine = false - + console.log(URL, 'URL'); setTimeout(() => { if (URL) { item.determine = true @@ -264,6 +264,8 @@ }, - + goBack() { + wx.navigateBack(); + }, }) \ No newline at end of file diff --git a/pages/bibliographyList/index.json b/pages/bibliographyList/index.json index 0edd783..a9c6aab 100644 --- a/pages/bibliographyList/index.json +++ b/pages/bibliographyList/index.json @@ -3,7 +3,8 @@ "usingComponents": { "t-tabs": "tdesign-miniprogram/tabs/tabs", "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", - "t-search": "tdesign-miniprogram/search/search" + "t-search": "tdesign-miniprogram/search/search", + "t-icon": "tdesign-miniprogram/icon/icon" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/bibliographyList/index.wxml b/pages/bibliographyList/index.wxml index 8eee1f6..3b9aa81 100644 --- a/pages/bibliographyList/index.wxml +++ b/pages/bibliographyList/index.wxml @@ -1,10 +1,17 @@ <!--pages/bibliographyList/index.wxml--> -<view class="example-search"> - <t-search model:value="{{value}}" placeholder="璇疯緭鍏ヤ功鐩悕绉�" bind:submit="onSearchSubmit" /> + +<view style="width: 100%; height: {{barHeight}}px; "></view> +<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> + <view> + <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> + </view> + + <view class="example-search"> + <t-search model:value="{{value}}" placeholder="璇疯緭鍏ヤ功鐩悕绉�" bind:submit="onSearchSubmit" /> + </view> + </view> - - <!--鐘舵�佹爮楂樺害 --> diff --git a/pages/bibliographyList/index.wxss b/pages/bibliographyList/index.wxss index 6ee6962..a6426d2 100644 --- a/pages/bibliographyList/index.wxss +++ b/pages/bibliographyList/index.wxss @@ -6,6 +6,22 @@ .custom-panel { height: 120px; } */ +.nacigationBar { + background-color: #fff; + display: flex; + align-items: center; + +} + +.navbar-title { + white-space: nowrap; + /* overflow: hidden; */ + text-overflow: ellipsis; + color: #0F1214; + font-size: 40rpx; + font-weight: bold; + margin-bottom: 5rpx; +} .higherBox { width: 220rpx; @@ -65,7 +81,7 @@ .example-search { background-color: #fff; - padding: 16rpx 32rpx; + /* padding: 16rpx 32rpx; */ } @@ -94,4 +110,13 @@ box-sizing: border-box; line-height: 75rpx; height: 75rpx; +} + +.t-tabs__item--active { + color: #FF6C00 !important; + +} + +.t-tabs__track { + background-color: #FF6C00 !important; } \ No newline at end of file diff --git a/pages/bookExhibitionDetails/index.wxml b/pages/bookExhibitionDetails/index.wxml index b9fcb50..87b5129 100644 --- a/pages/bookExhibitionDetails/index.wxml +++ b/pages/bookExhibitionDetails/index.wxml @@ -18,7 +18,7 @@ -<image class="partingBox" src="/static/images/bookExhibitionDetails/Parting.png" mode="" /> +<image class="partingBox" src="/static/images/bookExhibitionDetails/Parting.png" mode="aspectFill" /> <image class="bannerBox" src="{{bookImage}}" mode="" /> diff --git a/pages/bookExhibitionDetails/index.wxss b/pages/bookExhibitionDetails/index.wxss index f6a4d81..c8feec7 100644 --- a/pages/bookExhibitionDetails/index.wxss +++ b/pages/bookExhibitionDetails/index.wxss @@ -16,15 +16,33 @@ font-size: 40rpx; font-weight: bold; margin-bottom: 5rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; } .titleBox { + height: 60rpx; font-weight: 800; font-size: 45rpx; display: flex; justify-content: center; padding: 0 30rpx; /* text-indent: 6%; */ + + /* overflow: hidden; + text-overflow: ellipsis; + + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; */ + margin: 0 130rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; } .informationBox { diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js index 067ceae..c1e3eaa 100644 --- a/pages/bookExhibitionList/index.js +++ b/pages/bookExhibitionList/index.js @@ -29,7 +29,6 @@ options: [ { value: '*', - label: '鎬诲垎绫�', }, { @@ -50,7 +49,9 @@ price: 'jsek_teacherEducation', label: '鏁欏笀鏁欒偛', }, + ], + }, multipleSelect: { value: [], @@ -169,6 +170,8 @@ }); this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 console.log(1111); + + } }, @@ -199,6 +202,7 @@ queryType: '*', fields: { jsek_link: [], + subtitle: [], 'bookClassification*': this.data.keynoteValue || [], ...searchObj }, @@ -208,7 +212,10 @@ // width: 100 // }, }).then(res => { - + res.datas.forEach((item) => { + item.subtitleName = item.subtitle + item.name + }) + console.log(res, 'item'); this.data.total = res.total // list.push(res.datas) @@ -217,7 +224,7 @@ this.setData({ bookExhibitionList: list }) - + //鍙栨秷 wx.hideLoading() // console.log(this.data.bookExhibitionList, '鏁版嵁'); diff --git a/pages/bookExhibitionList/index.wxml b/pages/bookExhibitionList/index.wxml index 1b0e4c6..e58ac3a 100644 --- a/pages/bookExhibitionList/index.wxml +++ b/pages/bookExhibitionList/index.wxml @@ -34,14 +34,15 @@ <view class="assembleContent"> <view class="titleBox"> - <view class="frameBox"></view> <text class="titleTextBox"> 绾夸笂涔﹀睍</text> + <view class="frameBox"></view> + <image class="titleTextBox" src="/static/images/bookExhibitionList/zhuantitaolun.png" mode="aspectFit" /> </view> <view class="outside"> <view class="contentBox" wx:for="{{bookExhibitionList}}" wx:key="index" wx:for-item="item" wx:for-index="index" bindtap="onBookExhibitionDetails" data-item="{{item}}"> <image wx:if="{{item.icon}}" src="{{item.icon}}" mode="aspectFit" /> <image wx:else="" src="/static/images/bookExhibitionList/banner.png" mode="" /> - <view class="textBox" title="{{item.name}}"> <text>{{item.name}}</text></view> + <view class="textBox" title="{{item.subtitleName}}"> <text>{{item.subtitleName}}</text></view> </view> </view> diff --git a/pages/bookExhibitionList/index.wxss b/pages/bookExhibitionList/index.wxss index f094d7a..4a267d8 100644 --- a/pages/bookExhibitionList/index.wxss +++ b/pages/bookExhibitionList/index.wxss @@ -93,13 +93,14 @@ .titleBox { display: flex; + align-items: center; margin: 10px; margin-left: 0; padding-top: 30rpx; } .frameBox { - width: 13rpx; + width: 7rpx; height: 54rpx; background: #FF6C00; border-radius: 0rpx 9rpx 9rpx 0rpx; @@ -107,10 +108,13 @@ } .titleTextBox { - font-size: 20px; - font-weight: bolder; - margin-left: 10px; - font-family: JDLangZhengTi, JDLangZhengTi; + + margin-left: 5px; + + width: 150rpx; + height: 37rpx; + + } .classification { diff --git a/pages/bookServices/detail/components/note/note.js b/pages/bookServices/detail/components/note/note.js index 772e741..b059f83 100644 --- a/pages/bookServices/detail/components/note/note.js +++ b/pages/bookServices/detail/components/note/note.js @@ -62,6 +62,7 @@ }) }, openDialog() { + console.log(this.properties.bookInfo.name); this.setData({ submitTitle: this.properties.bookInfo.name, showNoteDialog: true @@ -130,7 +131,7 @@ }, changeLoading() { this.setData({ - loading:true + loading: true }) }, // 鑾峰彇绗旇鍒楄〃 @@ -138,6 +139,7 @@ // this.setData({ // loading: true // }) + console.log(this.properties.bookInfo.id, 'this.properties.bookInfo.id'); let topicId await app.MG.ugc .getProductUserSubmitTopic({ 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/components/tree/components/util.js b/pages/bookServices/detail/components/tree/components/util.js new file mode 100644 index 0000000..f8a3bc2 --- /dev/null +++ b/pages/bookServices/detail/components/tree/components/util.js @@ -0,0 +1,27 @@ +/* 鍔犺浇鍔ㄧ敾鐩稿叧 */ +const showLoading = (tips = '鍔犺浇涓�...') => { + wx.showNavigationBarLoading() + wx.showLoading({ + title: tips, + }) +} + +const hideLoading = () => { + wx.hideLoading() + wx.hideNavigationBarLoading() +} + +const hideLoadingWithErrorTips = (err = '鍔犺浇澶辫触...') => { + hideLoading() + wx.showToast({ + title: err, + icon: 'error', + duration: 2000 + }) +} + +module.exports = { + showLoading: showLoading, + hideLoading: hideLoading, + hideLoadingWithErrorTips: hideLoadingWithErrorTips, +} diff --git a/pages/bookServices/detail/components/tree/index.js b/pages/bookServices/detail/components/tree/index.js index c7c1b33..3b1bd8a 100644 --- a/pages/bookServices/detail/components/tree/index.js +++ b/pages/bookServices/detail/components/tree/index.js @@ -1,5 +1,6 @@ import Message from 'tdesign-miniprogram/message/message'; +const util = require('./components/util') // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず const app = getApp() Component({ properties: { @@ -33,11 +34,14 @@ } }, data: { - activeValues: [0] + activeValues: [0], + webpageSrc: '' }, onShow() { }, + + methods: { // 鑺傜偣灞曞紑 handleChange(e) { @@ -83,17 +87,69 @@ // "pages/resourceDetails/myAudio/index", // "pages/resourceDetails/myVideo/index", // "pages/resourceDetails/document/index", + + + let url if (item.selectType == 'video') { url = '/pages/resourceDetails/myVideo/index' } else if (item.selectType == 'audio') { url = '/pages/resourceDetails/myAudio/index' - } else { + } else if (item.selectType == 'picture' || item.selectType == 'zip') { url = '/pages/resourceDetails/document/index' } + + // else { + // + // } wx.navigateTo({ url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}`, }) + + + if (item.selectType == 'document' || item.selectType == 'pdf') { + const fileLink = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file + console.log(fileLink, 'fileLink'); + //鎻愮ず鍔犺浇涓� + util.showLoading() + // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB + wx.downloadFile({ + url: fileLink, // 鍦板潃宸叉墦鐮侊紝鑷繁鎹釜鍏朵粬鐨勫湴鍧�锛�"https://www.xxxxx.com/file/娴嬭瘯閫氱煡.pdf"锛� + success: function (res) { + console.log(res, "wx.downloadFile success res") + if (res.statusCode != 200) { + util.hideLoadingWithErrorTips() + return false + } + var Path = res.tempFilePath //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + wx.openDocument({ + filePath: Path, + showMenu: true, + success: function (res) { + console.log('鎵撳紑鎴愬姛'); + util.hideLoading() + } + }) + }, + fail: function (err) { + console.log(err, "wx.downloadFile fail err"); + util.hideLoadingWithErrorTips() + } + }) + + + } + + if (item.selectType == 'webpage') { + console.log(11); + this.setData({ + webpageSrc: item.jsek_link + }) + console.log(this.data.webpageSrc, 'webpageSrc'); + } + + + }, // 鎷垮埌鎵�鏈夐」 getAllChildren(id) { @@ -116,6 +172,7 @@ result.push(...item.children); } } + console.log(this.properties.treeList); this.properties.treeList.forEach(item => { findChildren(item); }); @@ -180,6 +237,7 @@ // 绔犺妭鍕鹃�� checkResourceTitle(e) { const item = e.currentTarget.dataset.item + console.log(item, 'item'); let list = this.flattenTree([item]) let ids = [] list.forEach(item => { @@ -188,5 +246,11 @@ const tab = this.findAndUpdateItemsByIds([item], ids) console.log(ids, tab); } + }, + onCloudShoppingCart() { + console.log(this.properties.treeList); + }, + oncheckbox() { + console.log(111); } }) \ No newline at end of file diff --git a/pages/bookServices/detail/components/tree/index.wxml b/pages/bookServices/detail/components/tree/index.wxml index ce30d1f..9d3efdd 100644 --- a/pages/bookServices/detail/components/tree/index.wxml +++ b/pages/bookServices/detail/components/tree/index.wxml @@ -1,168 +1,59 @@ <view class="tree"> <t-collapse default-value="{{activeValues}}" bind:change="handleChange"> - <t-collapse-panel - wx:for="{{treeList}}" - wx:for-item="item" - wx:for-index="index" - wx:key="id" - value="{{index}}" - expandIcon - > + <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{index}}" expandIcon> <view slot="header" class="header-title"> <view wx:if="{{tab == 'jsek_cloudLearning'}}"> - <t-checkbox - icon="rectangle" - checked="{{item.checked}}" - data-item="{{item}}" - bind:change="checkResourceTitle" - /> + <t-checkbox icon="rectangle" checked="{{item.checked}}" data-item="{{item}}" bind:change="checkResourceTitle" /> </view> <text>{{item.name}}</text> </view> - <view - class="list" - wx:for="{{item.children}}" - wx:for-item="citem" - wx:for-index="cindex" - wx:key="cindex" - > + <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex"> <!-- // 鍒ゆ柇 鏃犲瓙椤� 涓斾负鍟嗗搧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="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="box-image" - style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}" - > + <view class="box-image" style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}"> <view class="checkBox" wx:if="{{tab == 'jsek_cloudLearning'}}"> - <t-checkbox - icon="rectangle" - checked="{{citem.checked}}" - disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" - catch:change="checkResource" - data-item="{{citem}}" - /> + <!-- checked="{{citem.checked}}" --> + <t-checkbox icon="rectangle" checked="{{citem.checked}}" disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" catch:change="checkResource" data-item="{{citem}}" /> </view> <!-- 鏁欏璧勬簮鍥炬爣 --> <view class="teach-icon"> - <t-image - wx:if="{{citem.selectType == 'audio'}}" - src="/static/images/bookService/detail/audioIcon.png" - mode="aspectFill" - /> - <t-image - wx:if="{{citem.selectType == 'video'}}" - src="/static/images/bookService/detail/video.png" - mode="aspectFill" - /> - <t-image - wx:if="{{citem.selectType == 'pdf'}}" - src="/static/images/bookService/detail/pdf.png" - mode="aspectFill" - /> - <t-image - wx:if="{{citem.selectType == 'webpage'}}" - src="/static/images/bookService/detail/net.png" - mode="aspectFill" - /> - <t-image - wx:if="{{citem.selectType == 'picture'}}" - src="/static/images/bookService/detail/picture.png" - mode="aspectFill" - /> - <t-image - wx:if="{{citem.selectType == 'zip'}}" - src="/static/images/bookService/detail/zip.png" - mode="aspectFill" - /> - <t-image - wx:if="{{ citem.fileMap[citem.file].extension == 'doc' || citem.fileMap[citem.file].extension == 'docx'}}" - src="/static/images/bookService/detail/word.png" - mode="aspectFill" - /> - <t-image - wx:if="{{ citem.fileMap[citem.file].extension == 'xlsx' || citem.fileMap[citem.file].extension == 'xlsx'}}" - src="/static/images/bookService/detail/excel.png" - mode="aspectFill" - /> - <t-image - wx:if="{{ citem.fileMap[citem.file].extension == 'ppt' || citem.fileMap[citem.file].extension == 'pptx'}}" - src="/static/images/bookService/detail/PPT.png" - mode="aspectFill" - /> + <t-image wx:if="{{citem.selectType == 'audio'}}" src="/static/images/bookService/detail/audioIcon.png" mode="aspectFill" /> + <t-image wx:if="{{citem.selectType == 'video'}}" src="/static/images/bookService/detail/video.png" mode="aspectFill" /> + <t-image wx:if="{{citem.selectType == 'pdf'}}" src="/static/images/bookService/detail/pdf.png" mode="aspectFill" /> + <t-image wx:if="{{citem.selectType == 'webpage'}}" src="/static/images/bookService/detail/net.png" mode="aspectFill" /> + <t-image wx:if="{{citem.selectType == 'picture'}}" src="/static/images/bookService/detail/picture.png" mode="aspectFill" /> + <t-image wx:if="{{citem.selectType == 'zip'}}" src="/static/images/bookService/detail/zip.png" mode="aspectFill" /> + <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'doc' || citem.fileMap[citem.file].extension == 'docx'}}" src="/static/images/bookService/detail/word.png" mode="aspectFill" /> + <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'xlsx' || citem.fileMap[citem.file].extension == 'xlsx'}}" src="/static/images/bookService/detail/excel.png" mode="aspectFill" /> + <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'ppt' || citem.fileMap[citem.file].extension == 'pptx'}}" src="/static/images/bookService/detail/PPT.png" mode="aspectFill" /> </view> <!-- 浜戝涔犲浘鏍� --> <view> </view> <!-- 鍚嶇О --> - <text - class="name" - style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}" - >{{citem.name}}</text - > + <text class="name" style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}">{{citem.name}}</text> </view> <!-- 鏁欏璧勬簮绫诲瀷 --> <view class="teachClass"> {{citem.resourceClass}} </view> - <view - class="teach-btn" - wx:if="{{tab == 'jsek_teachingResources'}}" - > + <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}"> <!-- 涓嬭浇鎸夐挳 --> - <t-image - src="/static/images/bookService/detail/download-icon.png" - width="16" - height="16" - class="download" - data-value="{{citem}}" - catchtap="downloadTeach" - ></t-image> + <t-image src="/static/images/bookService/detail/download-icon.png" width="16" height="16" class="download" data-value="{{citem}}" catchtap="downloadTeach"></t-image> </view> <view wx:if="{{tab == 'jsek_cloudLearning'}}"> <!-- 浜戝涔犺瘯鐪嬪浘鏍� --> - <t-image - src="/static/images/bookService/detail/shikan.png" - class="testSee" - wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}" - ></t-image> + <t-image src="/static/images/bookService/detail/shikan.png" class="testSee" wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}"></t-image> <!-- 浜戝涔犲姞鍏ヨ喘鐗╄溅鍥炬爣 --> - <t-image - src="/static/images/bookService/detail/cart.png" - wx:if="{{citem.isShopCar}}" - class="shopCar" - ></t-image> + <t-image src="/static/images/bookService/detail/cart.png" wx:if="{{citem.isShopCar}}" class="shopCar" bind:tap="onCloudShoppingCart"></t-image> <!-- 浜戝涔犺喘涔板浘鏍� --> - <t-image - src="/static/images/bookService/detail/need-buy.png" - class="need-buy" - wx:if="{{citem.isbuy }}" - ></t-image> + <t-image bind:tap="onCloudShoppingCart" src="/static/images/bookService/detail/need-buy.png" class="need-buy" wx:if="{{citem.isbuy }}"></t-image> </view> </view> </view> </view> <!-- // 鍒ゆ柇 涓嶆槸鍟嗗搧 鏈夊瓙椤� 閫掑綊缁勪欢 --> - <tree - wx:else - bookInfo="{{bookInfo}}" - treeList="{{[citem]}}" - itemId="{{itemId}}" - tab="{{tab}}" - openTeachids="{{openTeachids}}" - openLearnids="{{openLearnids}}" - ></tree> + <tree wx:else bookInfo="{{bookInfo}}" treeList="{{[citem]}}" itemId="{{itemId}}" tab="{{tab}}" openTeachids="{{openTeachids}}" openLearnids="{{openLearnids}}"></tree> </view> <view class="listItems" wx:if="{{children.length <= 0 && !loading}}"> 鏆傛棤鏁版嵁 @@ -173,3 +64,5 @@ </t-collapse-panel> </t-collapse> </view> + +<web-view wx:if="{{webpageSrc}}" src="{{webpageSrc}}"></web-view> \ No newline at end of file diff --git a/pages/bookServices/detail/index.js b/pages/bookServices/detail/index.js index 396240d..406ce39 100644 --- a/pages/bookServices/detail/index.js +++ b/pages/bookServices/detail/index.js @@ -1,5 +1,6 @@ // pages/bookServices/detail/index.js import Message from 'tdesign-miniprogram/message/index.js'; +import Toast from 'tdesign-miniprogram/toast/index'; const app = getApp(); Page({ /** @@ -41,7 +42,16 @@ 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) { this.setData({ @@ -69,10 +79,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() } }, @@ -177,6 +188,11 @@ }, // 鑾峰彇鍥句功璇︽儏 getBookInfo(id) { + this.setData({ + "mockData'.id": 0, + "mockData.price": 0, + "mockData.count": 0 + }) const query = { path: '*', queryType: '*', @@ -212,7 +228,7 @@ }, }; app.MG.store.getProductDetail(query).then(async (res) => { - + console.log(res.datas); this.setData({ bookDetail: res.datas, cmsDatas: res.datas.cmsDatas[0].datas, @@ -222,6 +238,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, @@ -230,6 +269,7 @@ 'bookDetail.paperPrice': this.numFormat(this.data.bookDetail.paperPrice), }); }); + }, // 鑾峰彇鍥句功鍒嗙被 async getBookClass(iconType, classType) { @@ -296,8 +336,8 @@ goShop(e) { const { link } = e.currentTarget.dataset; wx.navigateTo({ - url: link, - }); + url: `/pages/bookServices/webpage/index?url=${link}`, + }) }, onTabsChange(e) { this.setData({ @@ -380,6 +420,8 @@ item.checked = false }) const list = await this.getAllResource(res.datas.cmsDatas[0].datas) + + console.log(list, 'list'); this.setData({ teach: list, loading: false @@ -507,18 +549,89 @@ }, // 鍥句功娣诲姞璐墿杞� - addBookShopcCar() { + async addBookShopcCar() { + const shoppingCartGetId = [] + let query = { + start: 0, + size: 999, + filterList: [], + searchList: [] + } + const res = await app.MG.store.getShoppingCartProductList(query) + res.datas.forEach((item) => { + shoppingCartGetId.push(item.saleMethod.id) + }) + console.log(shoppingCartGetId, 'shoppingCartGetId'); + console.log(this.data.bookDetail.defaultSaleMethodId, 'this.data.bookDetail.defaultSaleMethodId'); + const determine = shoppingCartGetId.some((item) => item == this.data.bookDetail.defaultSaleMethodId) + console.log(determine); + + if (!determine) { + let query = { + requests: [ + { + saleMethodId: this.data.bookDetail.defaultSaleMethodId, + storeEventId: null, + agentCode: '鐢靛瓙涔�' + } + ] + } + const addRes = app.MG.store.addShoppingCart(query) + this.showSuccessToast() + + } else { + Toast({ + context: this, + selector: '#t-toast', + message: '宸叉坊鍔�', + theme: 'success', + direction: 'column', + }); + } + + }, + + showSuccessToast() { + Toast({ + context: this, + selector: '#t-toast', + message: '娣诲姞鎴愬姛', + theme: 'success', + direction: 'column', + }); + }, + + + + async buyBook() { + let bookOrdersId = '' + let query = { + remarks: '鐢靛瓙涔�', requests: [ { saleMethodId: this.data.bookDetail.defaultSaleMethodId, - storeEventId: null, - agentCode: '鐢靛瓙涔�' + count: 1 } ] } - const addRes = app.MG.store.addShoppingCart(query) + // 鍙戣捣璁㈠崟鍒濆鍖栬姹傚苟绛夊緟缁撴灉 + const res = await app.MG.store.initOrder(query) + // 鑾峰彇璁㈠崟鍙峰苟璧嬪�肩粰 orderNumber.value + bookOrdersId = res.orderNumber + console.log(bookOrdersId); + // 妫�鏌ヨ鍗曞彿鏄惁瀛樺湪 + if (bookOrdersId) { + const url = '/pages/cart/paymentPage/index?orderNumber=' + bookOrdersId + wx.navigateTo({ + url + }) + } else { + console.log(222); + } + }, + // 鑾峰彇鏁欏璧勬簮涓嬭浇鏄惁鐢宠閫氳繃 getApplyInfo(id) { // 鑾峰彇褰撳墠鏃堕棿 @@ -908,7 +1021,7 @@ if (initOrderRes.orderNumber) { // bookService: orderNumber.value, 灏戜紶杩欎釜 锛屾殏鏃朵笉鐭ラ亾鏈変粈涔堢敤 wx.navigateTo({ - url: `/pages/cart/paymentPage/index?&bookId=${this.data.bookDetail.id}&bookName=${this.data.bookDetail.name}&orderNum=${initOrderRes.orderNumber}`, + url: `/pages/cart/paymentPage/index?&bookId=${this.data.bookDetail.id}&bookName=${this.data.bookDetail.name}&orderNumber=${initOrderRes.orderNumber}`, }) } else { // 璁㈠崟鍙蜂笉瀛樺湪锛屾樉绀鸿鍛婃秷鎭� @@ -939,5 +1052,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.json b/pages/bookServices/detail/index.json index 72d8522..53b160f 100644 --- a/pages/bookServices/detail/index.json +++ b/pages/bookServices/detail/index.json @@ -1,4 +1,5 @@ { + "component": true, "usingComponents": { "t-icon": "tdesign-miniprogram/icon/icon", "t-image": "tdesign-miniprogram/image/image", @@ -14,7 +15,8 @@ "tree": "/pages/bookServices/detail/components/tree/index", "suggest": "/pages/bookServices/detail/components/suggest/suggest", "t-loading": "tdesign-miniprogram/loading/loading", - "t-dialog": "tdesign-miniprogram/dialog/dialog" + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-toast": "tdesign-miniprogram/toast/toast" }, "navigationStyle": "custom", "onReachBottomDistance": 200 diff --git a/pages/bookServices/detail/index.wxml b/pages/bookServices/detail/index.wxml index fff1970..e26b9f5 100644 --- a/pages/bookServices/detail/index.wxml +++ b/pages/bookServices/detail/index.wxml @@ -3,48 +3,30 @@ <view style="width: 100%; height: {{barHeight}}px; "></view> <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> <view> - <t-icon - name="chevron-left" - size="30" - data-name="{{item}}" - bind:click="goBack" - /> + <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> </view> <view class="navbar-title">{{options.name}}</view> </view> +<t-toast id="t-toast" /> <scroll-view scroll-y="{{true}}" class="book" bindscrolltolower="onReachBottom"> <!-- 鍥句功璇︽儏 --> <view class="book-box"> <view class="book-detail"> <view class="detail-left"> <view class="book-img"> - <t-image - src="{{bookDetail.icon}}" - mode="aspectFill" - width="120" - height="170" - aria-label="{{bookDetail.name}}" - /> + <t-image src="{{bookDetail.icon}}" mode="aspectFill" width="120" height="170" aria-label="{{bookDetail.name}}" /> </view> <view class="book-use"> <view class="collect" bind:tap="setCollect"> <view> - <t-image - src="/static/images/bookService/detail/collect.png" - wx:if="{{!bookDetail.isFavourite}}" - ></t-image> - <t-image - src="/static/images/bookService/detail/collecting.png" - wx:if="{{bookDetail.isFavourite}}" - ></t-image> + <t-image src="/static/images/bookService/detail/collect.png" wx:if="{{!bookDetail.isFavourite}}"></t-image> + <t-image src="/static/images/bookService/detail/collecting.png" wx:if="{{bookDetail.isFavourite}}"></t-image> </view> <view class="use-title">鏀惰棌</view> </view> <view class="suggest" bind:tap="suggestBtn"> <view> - <t-image - src="/static/images/bookService/detail/suggest.png" - ></t-image> + <t-image src="/static/images/bookService/detail/suggest.png"></t-image> </view> <view class="use-title">鎴戣寤鸿</view> </view> @@ -69,11 +51,7 @@ <view class="li-title">鍑虹増鏃堕棿锛�</view> <view class="li-content">{{bookDetail.publicationDate}}</view> </view> - <view - class="message-li" - wx:if="{{bookDetail.class}}" - style="height: 80rpx" - > + <view class="message-li" wx:if="{{bookDetail.class}}" style="height: 80rpx"> <view class="li-title">鍥句功鍒嗙被锛�</view> <view class="class-name showTow">{{bookDetail.class}}</view> </view> @@ -86,16 +64,11 @@ <!-- 鐢靛瓙涔﹀敭浠� --> <view class="electron-price"> <view> - <t-image - src="/static/images/bookService/detail/electon-price.png" - ></t-image> + <t-image src="/static/images/bookService/detail/electon-price.png"></t-image> </view> <view class="price"> - <view class="price-text" - >楼{{bookDetail.price == '0.00' ? '鍏嶈垂' :bookDetail.price}}</view - > - <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}" - >楼{{bookDetail.oldPrice}} <view class="line"></view> + <view class="price-text">楼{{bookDetail.price == '0.00' ? '鍏嶈垂' :bookDetail.price}}</view> + <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}">楼{{bookDetail.oldPrice}} <view class="line"></view> </view> </view> <view> </view> @@ -103,131 +76,49 @@ <!-- 绾歌川涔﹀敭浠� --> <view class="paper-price"> <view> - <t-image - src="/static/images/bookService/detail/paper-price.png" - ></t-image> + <t-image src="/static/images/bookService/detail/paper-price.png"></t-image> </view> - <view class="price" - >楼{{bookDetail.paperPrice == '0.00' ? '鍏嶈垂' : - bookDetail.paperPrice}}</view - > + <view class="price">楼{{bookDetail.paperPrice == '0.00' ? '鍏嶈垂' : + bookDetail.paperPrice}}</view> </view> </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/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> + <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> </view> </view> </view> <view class="book-resource"> - <t-tabs - defaultValue="{{tabValue}}" - bind:change="onTabsChange" - t-class="custom-tabs" - t-class-content="custom-panel" - class="tab-class" - > + <t-tabs defaultValue="{{tabValue}}" bind:change="onTabsChange" t-class="custom-tabs" t-class-content="custom-panel" class="tab-class"> <t-tab-panel label="鍥句功绠�浠�" value="brief" style="{{tabPanelstyle}}"> - <book-brief - content="{{bookDetail.content}}" - authorIntroduction="{{bookDetail.authorIntroduction}}" - ></book-brief> + <book-brief content="{{bookDetail.content}}" authorIntroduction="{{bookDetail.authorIntroduction}}"></book-brief> </t-tab-panel> <t-tab-panel label="鐢靛瓙涔�" value="1" style="{{tabPanelstyle}}"> 鐢靛瓙涔� </t-tab-panel> - <t-tab-panel - label="鏁欏璧勬簮" - value="jsek_teachingResources" - class="{{loading ? 'loading': ''}}" - > + <t-tab-panel label="鏁欏璧勬簮" value="jsek_teachingResources" class="{{loading ? 'loading': ''}}"> <view wx:if="{{!loading && teach.length}}"> - <teach-resource - applyState="{{applyState}}" - rejectCause="{{rejectCause}}" - bind:applyResource="applyResource" - ></teach-resource> - <tree - bookInfo="{{bookDetail}}" - treeList="{{teach}}" - tab="{{tabValue}}" - applyState="{{applyState}}" - bind:downloadTeach="downloadTeach" - openTeachids="{{openTeachids}}" - ></tree> + <teach-resource applyState="{{applyState}}" rejectCause="{{rejectCause}}" bind:applyResource="applyResource"></teach-resource> + <tree bookInfo="{{bookDetail}}" treeList="{{teach}}" tab="{{tabValue}}" applyState="{{applyState}}" bind:downloadTeach="downloadTeach" openTeachids="{{openTeachids}}"></tree> </view> - <t-loading - theme="circular" - size="60rpx" - class="loading" - loading="{{loading}}" - /> + <t-loading theme="circular" size="60rpx" class="loading" loading="{{loading}}" /> </t-tab-panel> - <t-tab-panel - label="浜戝涔�" - value="jsek_cloudLearning" - style="{{tabPanelstyle}}" - > + <t-tab-panel label="浜戝涔�" value="jsek_cloudLearning" style="{{tabPanelstyle}}"> <view wx:if="{{!loading && learn.length}}"> - <learn-resource - bind:getFreeResource="getFreeResource" - bind:allAddShoppiingCar="allAddShoppiingCar" - id="learn-resource" - ></learn-resource> - <tree - bookInfo="{{bookDetail}}" - tab="{{tabValue}}" - treeList="{{learn}}" - buyIds="{{buyIdList}}" - openLearnids="{{openLearnids}}" - ></tree> + <learn-resource bind:getFreeResource="getFreeResource" bind:allAddShoppiingCar="allAddShoppiingCar" id="learn-resource"></learn-resource> + <tree bookInfo="{{bookDetail}}" tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}" openLearnids="{{openLearnids}}"></tree> </view> </t-tab-panel> - <t-tab-panel - label="浜戞祴璇�" - value="questionBank" - style="{{tabPanelstyle}}" - > + <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}}"> - <note - bookInfo="{{bookDetail}}" - id="note" - class="note-list" - bind:changeLoaidng="changeLoaidng" - ></note> + <note bookInfo="{{bookDetail}}" id="note" class="note-list" bind:changeLoaidng="changeLoaidng"></note> </t-tab-panel> </t-tabs> </view> @@ -241,29 +132,15 @@ </view> <view class="bottom-btn"> <view> - <t-image - src="/static/images/bookService/detail/paper-book.png" - ></t-image> + <t-image src="/static/images/bookService/detail/paper-book.png"></t-image> </view> <view class="btn-text">绾歌川鏍蜂功鐢宠</view> </view> <view class="shopCar" bind:tap="addBookShopcCar">鍔犲叆璐墿杞�</view> - <view class="buy">绔嬪嵆璐拱</view> + <view class="buy" bind:tap="buyBook">绔嬪嵆璐拱</view> </view> </scroll-view> <!-- 鎴戣寤鸿寮圭獥 --> -<suggest - class="suggest-component" - id="suggest-component" - bookIcon="{{bookDetail.icon}}" - bookName="{{bookDetail.name}}" -></suggest> +<suggest class="suggest-component" id="suggest-component" bookIcon="{{bookDetail.icon}}" bookName="{{bookDetail.name}}"></suggest> <!-- 鏁欏璧勬簮涓嬭浇鎻愮ず寮圭獥 --> -<t-dialog -class="teachDownloadDialog" - visible="{{isShowTeachDownload}}" - title="鎻愮ず" - content="璇峰墠寰�PC绔笅杞�" - confirm-btn="{{ confirmBtn }}" - bind:confirm="closeTeachDownload" -/> +<t-dialog class="teachDownloadDialog" visible="{{isShowTeachDownload}}" title="鎻愮ず" content="璇峰墠寰�PC绔笅杞�" confirm-btn="{{ confirmBtn }}" bind:confirm="closeTeachDownload" /> \ No newline at end of file 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/pages/cart/index.js b/pages/cart/index.js index db4d31b..c2ea63e 100644 --- a/pages/cart/index.js +++ b/pages/cart/index.js @@ -1,6 +1,7 @@ const app = getApp(); // import { getPublicImage } from '@/assets/js/middleGround/tool.js' import { getPublicImage } from '../../assets/js/middleGround/tool'; +import Toast from 'tdesign-miniprogram/toast/index'; Page({ data: { @@ -9,7 +10,8 @@ checkAll: false, checkedList: [], selectedCount: 0, - totalPrice: 0.00 + totalPrice: 0.00, + type: '' }, onLoad(options) { @@ -39,6 +41,12 @@ app.MG.store.getShoppingCartProductList(query).then(res => { res.datas.forEach(item => { item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160'); + console.log(item); + console.log(item.saleMethod.type, 'item.saleMethod.type') + this.setData({ + type: item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' + }) + }); this.setData({ @@ -98,22 +106,29 @@ }); }, goPaymentPage() { - - const selectedItems = this.data.shoppingCartData.filter(item => item.checked); - console.log(selectedItems, 789); + // console.log(selectedItems, 789); const selectedIds = selectedItems.map(item => item.id); console.log('閫変腑鐨勫晢鍝� id:', selectedIds); + if (selectedIds.length) { + app.MG.store.shoppingCartCreateOrder({ linkIds: selectedIds }).then(res => { + console.log(res, 456); + const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber + wx.navigateTo({ + url + }); + }) + } else { - app.MG.store.shoppingCartCreateOrder({ linkIds: selectedIds }).then(res => { - console.log(res.orderNumber, 456); - const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber - wx.navigateTo({ - url + Toast({ + context: this, + selector: '#t-toast', + message: '璇烽�夋嫨鍟嗗搧', + theme: 'warning', + direction: 'column', }); + } - - }) } diff --git a/pages/cart/index.json b/pages/cart/index.json index cfbbec2..e06cfaa 100644 --- a/pages/cart/index.json +++ b/pages/cart/index.json @@ -4,6 +4,8 @@ "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell", "t-cell": "tdesign-miniprogram/cell/cell", - "t-button": "tdesign-miniprogram/button/button" + "t-button": "tdesign-miniprogram/button/button", + "t-toast": "tdesign-miniprogram/toast/toast", + "t-empty": "tdesign-miniprogram/empty/empty" } } \ No newline at end of file diff --git a/pages/cart/index.wxml b/pages/cart/index.wxml index 4219ccc..470f5f0 100644 --- a/pages/cart/index.wxml +++ b/pages/cart/index.wxml @@ -1,18 +1,51 @@ <view class="outsideContentBox"> <!-- <checkbox-group bindchange="HandelItemChange"> --> + <view wx:if="{{!shoppingCartData}}" class="noDataBox"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" font-size="80" /> + + </view> <t-swipe-cell wx:for="{{shoppingCartData}}" wx:key="index" wx:for-item="item" wx:for-index="index"> <!-- <view class="contentBox"> --> <!-- <view class="contentCheckbox"> <checkbox value="{{item.id}}" checked="{{item.checked}}"></checkbox> </view> --> <view class="itemWarp"> - <t-cell bordered="{{false}}" title="{{item.productMonWithLinkDto.product.name}}" description="锟{item.saleMethod.price}}"> + <t-cell bordered="{{false}}"> + <view slot="title" class="titleBox"> + <view class="labelBox"> + <view class="eBook" wx:if="{{type == 'product'}}">鐢靛瓙涔�</view> + <view wx:if="{{type == 'item'}}" class="cloudLearning">浜戝涔�</view> + + </view> + + <view class="boosName"> + {{item.productMonWithLinkDto.product.name}} + </view> + + + </view> + + <view slot="description" class="descriptionBox"> + + <view> + <view class="textBox" wx:if="{{type == 'product'}}">鍥句功鏈嶅姟-鐢靛瓙涔�</view> + <view class="textBox" wx:if="{{type == 'item'}}">鍥句功鏈嶅姟-浜戝涔�</view> + </view> + + <view wx:if="{{item.saleMethod.price != 0}}"> + 锟{item.saleMethod.price}} + </view> + + + <view wx:else class="descriptionBox"> 绔嬪嵆棰嗗彇</view> + </view> + <view slot="left-icon" class="left-icon"> <view class="contentCheckbox"> <t-checkbox icon="rectangle" value=" {{item.id}}" data-item="{{item}}" checked="{{item.checked}}" bindchange="HandelItemChange" /> </view> <view class="left-image"> - <image src="{{item.imgUrl}}" class="imageStyle" mode="" /> + <image src="{{item.imgUrl}}" class="imageStyle" mode="aspectFit" /> </view> </view> </t-cell> @@ -35,4 +68,6 @@ <t-button class="tButtonBox" size="small" shape="round" bind:tap="goPaymentPage">鍘荤粨绠�({{selectedCount}})</t-button> </view> </view> -</view> \ No newline at end of file +</view> + +<t-toast id="t-toast" /> \ No newline at end of file diff --git a/pages/cart/index.wxss b/pages/cart/index.wxss index 35eecdb..6323f54 100644 --- a/pages/cart/index.wxss +++ b/pages/cart/index.wxss @@ -56,25 +56,24 @@ .settlementBox { - /* width: 100%; */ + width: 80%; display: flex; align-items: center; /* justify-content: space-between; */ } .totalPrice { + flex: 1; /* margin: 0 50rpx; */ } .buttonBox { - - /* margin: 0 30rpx; */ - margin-left: 140rpx; + margin-right: 80rpx; } .tButtonBox { - background-color: #FF6C00; + /* background-color: #FF6C00; */ width: 200rpx; height: 80rpx; } @@ -166,4 +165,85 @@ .imageStyle { width: 100%; height: 100%; +} + +.t-checkbox { + --td-checkbox-icon-checked-color: #FF6C00; +} + +.t-checkbox--block { + padding: 0 !important; +} + +.t-button--default { + background-color: #FF6C00 !important; +} + +.noDataBox { + width: 100%; + margin-top: 200rpx; + display: flex; + justify-content: center; + align-items: center; +} + +page { + background: #F2F3F8; +} + +.titleBox { + display: flex; + flex-direction: row; + + margin: 15rpx; + +} + +.descriptionBox { + margin: 15rpx; +} + +.labelBox { + width: 125rpx; + height: 38rpx; + font-size: 22rpx; + color: #FFFFFF; + font-family: PingFang SC, PingFang SC; + /* margin-right: 30rpx; */ + border-radius: 0px 0px 0px 5px; +} + +.eBook { + width: 90%; + height: 100%; + background: #FF6C00; + text-align: center; + line-height: 38rpx; + border-radius: 9rpx; +} + +.cloudLearning { + width: 100%; + height: 100%; + background: #5F92FD; + text-align: center; + line-height: 38rpx; +} + +.boosName { + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.textBox { + font-family: PingFang SC, PingFang SC; + font-weight: 400; + font-size: 25rpx; + color: #333333; + /* margin: 10rpx 0; */ + margin-bottom: 20rpx; } \ No newline at end of file diff --git a/pages/cart/paymentPage/index.js b/pages/cart/paymentPage/index.js index 7a4e351..fcad534 100644 --- a/pages/cart/paymentPage/index.js +++ b/pages/cart/paymentPage/index.js @@ -143,6 +143,7 @@ } } app.MG.store.getOrderByOrderNum(query).then(res => { + console.log(res, 'res'); this.setData({ orderGoods: res.orderNumber }) @@ -155,10 +156,11 @@ res.saleMethodLinks.forEach(item => { item.paymentIcon = getPublicImage(item.orderSaleMethod.product.icon) - + console.log(item.orderSaleMethod.type); this.setData({ - productList: res.saleMethodLinks + productList: res.saleMethodLinks, + type: item.orderSaleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' }) }) diff --git a/pages/cart/paymentPage/index.wxml b/pages/cart/paymentPage/index.wxml index 6ba3df7..fbaed31 100644 --- a/pages/cart/paymentPage/index.wxml +++ b/pages/cart/paymentPage/index.wxml @@ -1,74 +1,68 @@ -<!--pages/cart/paymentPage/index.wxml--> -<view style="width: 100%; height: {{barHeight}}px; "></view> -<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> - <view> - <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> +<!-- 澶撮儴 --> +<view class="titleBox"> + <view style="width: 100%; height: {{barHeight}}px; "></view> + <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> + <view> + <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> + </view> + <view class="navbar-title">鎻愪氦璁㈠崟</view> </view> - <view class="navbar-title">鎻愪氦璁㈠崟</view> </view> +<view class="paymentPageBox"> + <view class="content"> + <t-dialog visible="{{showCloseBtn}}" close-btn bind:confirm="closeDialog" bind:cancel="closeDialog"> + <view slot="content" class="slotContent"> + <view class="myQrcodeBox"> + <canvas style="width: 200px; height: 200px;margin:0 auto" canvas-id="myQrcode"></canvas> + <view class="myQrcodeTextBox">寰俊鎵爜鏀粯</view> + </view> + </view> + </t-dialog> + + <view class="shoppingCartList"> + <view class="cartList" wx:for="{{productList}}" wx:key="index" wx:for-item="item" wx:for-index="index"> + <view class="imageBox"> + <image src="{{item.paymentIcon }}" mode="aspectFill" /> + </view> + + <view class="cartListContent"> + <view class="cartListDetails"> + <view class="labelBox"> + <view class="eBook" wx:if="{{type == 'product'}}">鐢靛瓙涔�</view> + <view wx:if="{{type == 'item'}}" class="cloudLearning">浜戝涔�</view> + </view> + <view class="boosName"> + {{item.orderSaleMethod.product.name}} + </view> -<view class="content"> - - - - - - <!-- - <t-button t-class="wrapper" theme="primary" size="large" variant="outline" data-key="showCloseBtn" bind:tap="showDialog" block> - 甯﹀叧闂寜閽� - </t-button> --> - <t-dialog visible="{{showCloseBtn}}" close-btn bind:confirm="closeDialog" bind:cancel="closeDialog"> - <view slot="content" class="slotContent"> - <view class="myQrcodeBox"> - <canvas style="width: 200px; height: 200px;margin:0 auto" canvas-id="myQrcode"></canvas> - <view class="myQrcodeTextBox">寰俊鎵爜鏀粯</view> + </view> + <view class="textBox" wx:if="{{type == 'product'}}">鍥句功鏈嶅姟-鐢靛瓙涔�</view> + <view class="textBox" wx:if="{{type == 'item'}}">鍥句功鏈嶅姟-浜戝涔�</view> + <view class="priceBox">锟{item.payPrice}}</view> + </view> </view> </view> - </t-dialog> - - - - - - <view class="shoppingCartList"> - <view class="cartList" wx:for="{{productList}}" wx:key="index" wx:for-item="item" wx:for-index="index"> - <image src="{{item.paymentIcon }}" mode="" /> - <view class="cartListContent"> - <view class="cartListDetails">{{item.orderSaleMethod.product.name}}</view> - <view class="textBox">鍥句功鏈嶅姟-鐢靛瓙涔�</view> - <view class="priceBox">锟{item.payPrice}}</view> - + <view class="priceBreakdown"> + <view class="priceBreakdownContent">浠锋牸鏄庣粏</view> + <view class="amountMoney"> + <view>鍟嗗搧閲戦</view> + <view>锟{payPrice}}</view> </view> - + <view class="amount"> + <view>鍚堣锛氾骏{{payPrice}}</view> + </view> </view> - </view> - - <view class="priceBreakdown"> - <view class="priceBreakdownContent">浠锋牸鏄庣粏</view> - <view class="amountMoney"> - <view>鍟嗗搧閲戦</view> - <view>锟{payPrice}}</view> - </view> - <view class="amount"> - <view>鍚堣锛氾骏{{payPrice}}</view> - </view> - </view> - - - - <view class="interval"></view> - + <!-- <view class="interval"></view> --> <view class="paymentBox"> <view class="residue">寰呮敮浠橈細<text class="residueTextBox">锟{payPrice}}</text></view> <view> <t-button class="buttonBox" shape="round" bind:tap="confirmOrderGet">寰俊鏀粯</t-button> </view> </view> - </view> \ No newline at end of file diff --git a/pages/cart/paymentPage/index.wxss b/pages/cart/paymentPage/index.wxss index 9159e8f..14285dc 100644 --- a/pages/cart/paymentPage/index.wxss +++ b/pages/cart/paymentPage/index.wxss @@ -18,23 +18,30 @@ .content { width: 100%; - height: 1250rpx; + background-color: #F2F3F8; padding: 40rpx 0; padding-top: 1rpx; + margin-top: 110rpx; + } .shoppingCartList { - height: 1000rpx; + min-height: 150rpx; background: #FFFFFF; border-radius: 20px; margin: 30rpx 0; } -image { +.imageBox { width: 150rpx; height: 210rpx; margin: 30rpx; +} + +image { + width: 150rpx; + height: 210rpx; } .cartListContent { @@ -55,6 +62,10 @@ font-weight: bold; font-size: 29rpx; color: #333333; + display: flex; + flex-direction: row; + padding: 0 10rpx; + } .textBox { @@ -70,14 +81,18 @@ font-weight: 500; font-size: 31rpx; color: #0F1214; + font-family: DIN, DIN; + + + } .priceBreakdown { - height: 280rpx; + height: 250rpx; background: #fff; padding: 30rpx; - + margin-bottom: 120rpx; } .priceBreakdownContent { @@ -117,6 +132,10 @@ justify-content: space-between; padding: 30rpx; align-items: center; + background-color: #fff; + width: 100%; + position: fixed; + bottom: 0; } .residue { @@ -132,6 +151,7 @@ .buttonBox { background-color: #FF6C00; border: #fff; + margin-right: 80rpx; } .myQrcodeBox { @@ -141,4 +161,56 @@ .myQrcodeTextBox { text-align: center; margin: 30rpx 0; +} + +.paymentPageBox {} + +page { + background-color: #F2F3F8; + position: relative; +} + +.titleBox { + background-color: #fff; + position: fixed; + top: 0; + width: 100%; + +} + +.eBook { + width: 90%; + height: 100%; + background: #FF6C00; + text-align: center; + line-height: 38rpx; + border-radius: 9rpx; +} + +.cloudLearning { + width: 100%; + height: 100%; + background: #5F92FD; + text-align: center; + line-height: 38rpx; + border-radius: 9rpx; +} + +.labelBox { + width: 105rpx; + height: 38rpx; + font-size: 22rpx; + color: #FFFFFF; + font-family: PingFang SC, PingFang SC; + + +} + +.boosName { + width: 300rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; } \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index 4575a24..c8ad668 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -4,6 +4,7 @@ const app = getApp() Page({ data: { + searchVal: '', isWhite: false, backUrl: null, userInfo: {}, @@ -513,6 +514,16 @@ isWhite: e.scrollTop > 50 ? true : false }) + }, + onRetrievalPage() { + console.log(this.data.searchVal); + wx.navigateTo({ + url: '/pages/retrievalPage/index?searchVal=' + this.data.searchVal + + + }) + + } }); diff --git a/pages/home/home.wxml b/pages/home/home.wxml index c495cf0..3ecf648 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -9,7 +9,7 @@ <image src="/static/images/home/home-bg@2x.png" mode="heightFix" class="image" /> </view> <view class="search"> - <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" leftIcon=""> + <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" leftIcon="" bind:submit="onRetrievalPage" model:value="{{searchVal}}"> <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" bind:tap="navToSearchPage" /> </t-search> </view> diff --git a/pages/personalCenter/index.js b/pages/personalCenter/index.js index e7c30db..7b52b27 100644 --- a/pages/personalCenter/index.js +++ b/pages/personalCenter/index.js @@ -67,13 +67,13 @@ { title: '鍏充簬鎴戜滑', icon: '/static/images/personal/about.png', - url: '/pages/aboutUs/index', + url: '/pages/aboutUs/index?types=jsek_aboutUs', type: 'aboutUs', }, { title: '鑱旂郴鎴戜滑', icon: '/static/images/personal/contact.png', - url: '', + url: '/pages/aboutUs/index?types=jsek_contactUs', type: 'contact', } ]; @@ -211,5 +211,9 @@ isWhite: e.scrollTop > 50 ? true : false }) + }, + //璺宠浆鍏充簬鎴戜滑鍜岃仈绯绘垜浠� + onAboutUS() { + console.log(111); } }) \ No newline at end of file diff --git a/pages/personalCenter/index.wxml b/pages/personalCenter/index.wxml index 9836891..c1a6791 100644 --- a/pages/personalCenter/index.wxml +++ b/pages/personalCenter/index.wxml @@ -46,8 +46,8 @@ <text>鏇村鍔熻兘</text> </view> <view class="domainList1"> - <view wx:for="{{moreMenu}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toPages" data-info="{{item}}" class="listItem"> - <view class="icon"> + <view wx:for="{{moreMenu}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toPages" data-info="{{item}}" class="listItem" > + <view class="icon" > <t-image src="{{item.icon}}" mode="heightFix" class="img" /> </view> <view class="label"> diff --git a/pages/resourceDetails/document/index.js b/pages/resourceDetails/document/index.js index 6c099d4..3db416d 100644 --- a/pages/resourceDetails/document/index.js +++ b/pages/resourceDetails/document/index.js @@ -1,18 +1,50 @@ // pages/resourceDetails/document/index.js +const app = getApp() Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - + webpageSrc: '', + navBarHeight: '', + barHeight: '', + activeId: '', + bookId: '', + bookName: '', + cmsId: '', + parentName: '', + parentProductLinkPath: '', + productLinkPath: '', + showData: '', + titleName: '', + selectType: '', + zipData: '', + naturalResources: [], + titleName: '', + pdfDatA: [], }, - /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + console.log(options); + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + this.setData({ + navBarHeight: navBarHeight, + barHeight: systInfo.statusBarHeight, + activeId: options.activeId, + bookId: options.bookId, + bookName: options.bookName, + cmsId: options.cmsId, + parentName: options.parentName, + parentProductLinkPath: options.parentProductLinkPath, + productLinkPath: options.productLinkPath + }) + this.resourceDetailsData() }, /** @@ -62,5 +94,174 @@ */ onShareAppMessage() { + }, + goBack() { + wx.navigateBack() + }, + + resourceDetailsData() { + let query = { + path: '*', + queryType: '*', + productId: this.data.bookId, + cmsPath: this.data.parentProductLinkPath, + itemFields: { + SysType: 'CmsFolder', + // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁� + selectType: [], + freeFile: [], + file: [], + protectedFile: [], + resourcesClassification: [], + isDownload: [], + jsek_resourceBrief: [], + jsek_link: [], + jsek_questionBank: [], + learnSelectType: [] + }, + pading: { + start: 0, + size: 999 + } + } + app.MG.store.getProductDetail(query).then((res) => { + console.log(res); + res.datas.cmsDatas[0].datas.forEach((item) => { + + + + + //鍒氬垰杩涙潵鐨勬椂鍊� + if (this.data.productLinkPath == item.productLinkPath) { + this.handleTeachData(item) + this.setData({ + titleName: item.name, + selectType: item.selectType + }) + } + + + }) + }) + }, + //zpi鏂囦欢涓嬭浇 + onDownloadButton() { + const item = this.data.zipData; + if (!item || !item.file) { + wx.showToast({ + title: '鏂囦欢淇℃伅缂哄け', + icon: 'none' + }); + return; + } + + const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file; + wx.showLoading({ + title: '姝e湪涓嬭浇...', + }); + + wx.downloadFile({ + url: downloadUrl, + success(res) { + if (res.statusCode === 200) { + // 涓嬭浇鎴愬姛锛屽彲浠ュ湪杩欓噷杩涜涓�浜涙搷浣滐紝渚嬪棰勮銆佷繚瀛樼瓑 + // 杩欓噷浠ヤ繚瀛樻枃浠跺埌绯荤粺涓轰緥 + wx.saveFile({ + tempFilePath: res.tempFilePath, + success(saveRes) { + wx.hideLoading(); + wx.showToast({ + title: '淇濆瓨鎴愬姛', + }); + // 鑾峰彇淇濆瓨鍚庣殑鏂囦欢璺緞 + const savedFilePath = saveRes.savedFilePath; + // 鍙互鍦ㄨ繖閲岃繘琛屽悗缁搷浣滐紝渚嬪鎵撳紑鏂囦欢 + wx.openDocument({ + filePath: savedFilePath, + success: function () { + console.log('鎵撳紑鏂囨。鎴愬姛') + }, + fail: function (error) { + console.error('鎵撳紑鏂囨。澶辫触', error); + } + }); + }, + fail() { + wx.hideLoading(); + wx.showToast({ + title: '淇濆瓨澶辫触', + icon: 'none' + }); + } + }); + } else { + wx.hideLoading(); + wx.showToast({ + title: '涓嬭浇澶辫触', + icon: 'none' + }); + } + }, + fail() { + wx.hideLoading(); + wx.showToast({ + title: '涓嬭浇澶辫触', + icon: 'none' + }); + } + }); + }, + //鍒氳繘鏉ョ殑鏃跺�欒皟鐢� + handleTeachData(item) { + //鍥剧墖 + if (item.selectType == 'picture') { + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file, + + }) + } + // 涓嬭浇鏂囦欢zip + if (item.selectType == 'zip') { + this.setData({ + zipData: item + }) + } + //缃戦〉 + if (item.selectType == 'webpage') { + this.setData({ + webpageSrc: item.jsek_link + }) + } + + //鏂囨。绛� + if (item.selectType == 'pdf' || item.selectType == 'document') { + app.MG.file.getPdfInfo({ md5: item.file }).then((res) => { + if (res && res.totalPages) { + for (let i = 0; i < res.totalPages; i++) { + const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + item.file + '&index=' + (i + 1) + '&dpi=300' + this.data.naturalResources.push(src) + // console.log(this.data.naturalResources, ' this.data.naturalResources'); + } + } + }) + + + + + } + }, + + + + handleTap: function () { + const naturalResources = this.data.naturalResources; + naturalResources.forEach(function (item) { + // console.log(item); + }); } + + + + + }) \ No newline at end of file diff --git a/pages/resourceDetails/document/index.json b/pages/resourceDetails/document/index.json index 8835af0..1e94fa8 100644 --- a/pages/resourceDetails/document/index.json +++ b/pages/resourceDetails/document/index.json @@ -1,3 +1,9 @@ { - "usingComponents": {} + "component": true, + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon", + "t-button": "tdesign-miniprogram/button/button", + "t-image": "tdesign-miniprogram/image/image" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/resourceDetails/document/index.wxml b/pages/resourceDetails/document/index.wxml index ad417e7..19620c0 100644 --- a/pages/resourceDetails/document/index.wxml +++ b/pages/resourceDetails/document/index.wxml @@ -1,6 +1,48 @@ -<!--pages/resourceDetails/document/index.wxml--> -<text>pages/resourceDetails/document/index.wxml</text> -<view> +<view style="width: 100%; height: {{barHeight}}px; "></view> +<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> + <view> + <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" /> + </view> + <view class="navbar-title">璧勬簮璇︽儏</view> +</view> + +<view class="titleNameBox" wx:if="{{selectType != 'webpage'}}"> + {{titleName}} +</view> -</view> \ No newline at end of file + +<view class="pictureBox" wx:if="{{selectType == 'picture'}}"> + <image src="{{showData}}" mode="aspectFit" /> +</view> + +<view wx:if="{{selectType == 'zip'}}"> + <view class="zipImageBox"> + <image src="/static/images/document/zip200px.png" mode="aspectFill " /> + </view> + + + <view class="button-example"> + <t-button size="large" bind:tap="onDownloadButton"> + <view class="text"> + 涓嬭浇 + </view> + </t-button> + </view> +</view> + + +<view wx:if="{{selectType == 'pdf' || selectType == 'document'}}"> + <view wx:for="{{naturalResources}}" wx:key="index" wx:for-item="item" wx:for-index="index"> + + <image src="{{item}}" alt="" style="min-height: 550px;"></image> + <view class="divider">绗� {{index + 1}} 椤�</view> + </view> + +</view> + + + + +<web-view wx:if="{{selectType == 'webpage'}}" src="{{webpageSrc}}"></web-view> +<!-- <button bind:tap="handleTap">鐐逛綅</button> --> \ No newline at end of file diff --git a/pages/resourceDetails/document/index.wxss b/pages/resourceDetails/document/index.wxss index d156ce8..2375ebb 100644 --- a/pages/resourceDetails/document/index.wxss +++ b/pages/resourceDetails/document/index.wxss @@ -1 +1,67 @@ -/* pages/resourceDetails/document/index.wxss */ \ No newline at end of file +/* pages/resourceDetails/document/index.wxss */ +.nacigationBar { + background-color: #fff; + display: flex; + align-items: center; +} + +.navbar-title { + white-space: nowrap; + /* overflow: hidden; */ + text-overflow: ellipsis; + color: #0F1214; + font-size: 40rpx; + font-weight: bold; + margin-bottom: 5rpx; +} + +.button-example { + margin: 0 70rpx; + background-color: #ff6c00; + display: flex; + justify-content: center; +} + +.button-example .text { + background-color: #ff6c00; +} + +.t-button--default { + background-color: #ff6c00 !important; +} + +.t-button { + --td-button-default-border-color: #ff6c00 !important; +} + +.zipImageBox { + display: flex; + justify-content: center; +} + +.divider { + text-align: center; + margin: 20px 0; +} + +.titleNameBox { + height: 77rpx; + background: #FFFFFF; + box-shadow: 0rpx 9rpx 9rpx 2rpx rgba(0, 0, 0, 0.06); + padding: 20rpx 50rpx; + margin-bottom: 100rpx; + font-family: PingFang SC, PingFang SC; + font-weight: 400; + font-size: 29rpx; + color: #333333; +} + +.pictureBox { + display: flex; + justify-content: center; +} + +.pictureBox image { + /* width: 520rpx; + height: 800rpx; */ +} \ No newline at end of file diff --git a/pages/resourceDetails/myAudio/index.js b/pages/resourceDetails/myAudio/index.js index fe06808..544125b 100644 --- a/pages/resourceDetails/myAudio/index.js +++ b/pages/resourceDetails/myAudio/index.js @@ -1,52 +1,671 @@ -// audio.js +// pages/resourceDetails/index.js +const app = getApp() +const myAudio = wx.createInnerAudioContext(); Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ data: { - poster: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000', - name: '姝ゆ椂姝ゅ埢', - author: '璁稿穽', - src: 'http://182.92.203.7:3001/file/api/ApiDownload?md5=aa72e586dd93b7c2633bee6320bc6c76', + noteList: [], navBarHeight: '', barHeight: '', + flag: true, // 杈撳叆妗嗘槸鍚︽樉绀� + tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', + activeValues: [0], + dialogKey: false, + style: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;', + activeId: '', + bookId: '', + bookName: '', + cmsId: '', + parentName: '', + parentProductLinkPath: '', + productLinkPath: '', + threeLeveData: [], + showData: '', + src: '', + selectedId: null, + topicId: '', + titleName: '', + submitTitle: "", + inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx', + textvalue: '', + style: 'height: 248rpx', + submitType: "new", // 鏂板缓 or 缂栬緫 + noteId: '', + myAudioDuration: '', // 瑙嗛鏃堕棿 + myAudioCurrent: '', // 褰撳墠鎾斁杩涘害 + isplay: false, //鏄惁榛樿鎾斁, + selectId: '', + speed: 1.0, }, + audio: null, + // 鏍煎紡鍖栫瑪璁版椂闂� + convertTimestamp(timestamp) { + const isoDate = new Date(timestamp) + const year = isoDate.getFullYear() + const month = String(isoDate.getMonth() + 1).padStart(2, '0') + const day = String(isoDate.getDate()).padStart(2, '0') + const hours = String(isoDate.getHours()).padStart(2, '0') + const minutes = String(isoDate.getMinutes()).padStart(2, '0') + const seconds = String(isoDate.getSeconds()).padStart(2, '0') + const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + return formattedDate + }, + + // 鏃堕棿鏍煎紡鍖� + format(t) { + let time = Math.floor(t / 60) >= 10 ? Math.floor(t / 60) : '0' + Math.floor(t / 60); + t = time + ':' + ((t % 60) / 100).toFixed(2).slice(-2); + return t; + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ onLoad(options) { + const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� - + // console.log(options, 'options'); this.setData({ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, + activeId: options.activeId, + bookId: options.bookId, + bookName: options.bookName, + cmsId: options.cmsId, + parentName: options.parentName, + parentProductLinkPath: options.parentProductLinkPath, + productLinkPath: options.productLinkPath }) - }, - onReady: function (e) { - // 浣跨敤 wx.createAudioContext 鑾峰彇 audio 涓婁笅鏂� context - this.audioCtx = wx.createAudioContext('myAudio') + + this.resourceDetailsData() + this.getNoteList() + + + }, - audioPlay: function () { - this.audioCtx.play() + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, - audioPause: function () { - this.audioCtx.pause() + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + }, - audio14: function () { - this.audioCtx.seek(14) + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + }, - audioStart: function () { - this.audioCtx.seek(0) + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + }, + onTabsChange(event) { + + }, + + onTabsClick(event) { + + }, handleChange(e) { + this.setData({ + activeValues: e.detail.value, + }); + }, + onTakeNotes() { + + }, + showDialog(e) { + + this.setData({ + submitTitle: this.data.bookName, + dialogKey: true, + // textvalue: '' + + + }); + }, + + closeDialog() { + + this.setData({ + dialogKey: false + }); }, goBack() { - wx.navigateBack() + wx.navigateBack(); }, + resourceDetailsData() { - MusicStart: function (e) { - var progress = parseInt((e.detail.currentTime / e.detail.duration) * 100) - var that = this - that.setData({ - progress: progress + let query = { + path: '*', + queryType: '*', + productId: this.data.bookId, + cmsPath: this.data.parentProductLinkPath, + itemFields: { + SysType: 'CmsFolder', + // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁� + selectType: [], + freeFile: [], + file: [], + protectedFile: [], + resourcesClassification: [], + isDownload: [], + jsek_resourceBrief: [], + jsek_link: [], + jsek_questionBank: [], + learnSelectType: [] + }, + pading: { + start: 0, + size: 999 + } + } + + app.MG.store.getProductDetail(query).then(res => { + res.datas.cmsDatas[0].datas.forEach((item, index) => { + + if (item.selectType === "audio") { + this.data.threeLeveData.push(item) + this.setData({ + threeLeveData: this.data.threeLeveData + }) + + + if (this.data.productLinkPath == item.productLinkPath) { + console.log(item.id, 'index'); + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file, + titleName: item.name + }) + this.pubulicPlayFun() + // this.setData({ + // selectedId: index + + // }) + } + } + + }) + this.data.threeLeveData.forEach((item) => { + // console.log(item.name); + }) }) - console.log('闊充箰鎾斁杩涘害涓�' + progress + '%') }, + onVideo(e) { + const item = e.currentTarget.dataset.item + if (this.data.showData != '') { + this.setData({ + showData: '' + }) + } + this.setData({ + selectedId: e.currentTarget.dataset.index, + + }) + + + this.setData({ + titleName: item.name, + selectId: item.id + }) + + if (item.selectType == "audio") { + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file + }) + this.pubulicPlayFun() + } + + }, + + getProductUserSubmitTopicGet() { + app.MG.ugc.getProductUserSubmitTopic({ + productId: this.data.bookId, + appRefCode: app.config.appRefCode + }).then((res) => { + // console.log(res); + + this.setData({ + topicId: res.id + }) + }) + }, + + + + newTopicMessageGet() { + let query = { + topicIdOrRefCode: topicId + '', + name: titleText.value, + content: form.value.noteContent, + type: 'note', + cmsTypeRefCode: '', + newDataListRequest: [] + } + app.MG.ugc.newTopicMessage(query).then(res => { + // console.log(res); + }) + }, + + // 鏍囬鏀瑰彉 + changeTitle(e) { + // console.log(e.currentTarget.dataset.value); + this.setData({ + flag: e.currentTarget.dataset.value + + }) + }, + // 鏍囬杈撳叆妗嗗�� + inputChange(e) { + this.setData({ + titleName: e.detail.value + }) + }, + + confirmSuggest() { + if (!this.data.textvalue) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁板唴瀹�', + }) + + } else if (!this.data.titleName) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁版爣棰�', + }) + } + if (this.data.submitType == 'new') { + this.makeNote() + } else if (this.data.submitType == 'edit') { + this.updateNote() + } + // console.log(this.data.textvalue); + // console.log(this.data.titleName); + this.setData({ + dialogKey: false + }); + }, + onTextarea() { + // console.log(this.data.textvalue); + }, + textareaChange(e) { + this.setData({ + textvalue: e.detail.value + }) + }, + + + // 鑾峰彇绗旇鍒楄〃 + async getNoteList() { + // this.setData({ + // loading: true + // }) + let topicId + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.data.bookId, + appRefCode: app.config.appRefCode + }) + .then((res) => { + if (res) { + topicId = res.id + } else { + return wx.showToast({ + icon: "error", + title: '鏌ヨ澶辫触', + }) + } + }) + // loadings.value.bookResource = true + let query = { + start: 0, + size: 999, + messageType: 'note', + sort: { + type: 'Desc', + field: 'CreateDate' + }, + appRefCode: app.config.appRefCode, + topicIdOrRefCode: topicId + '' + } + await app.MG.ugc.getTopicMessageList(query).then((res) => { + // notePage.value.total = res.totalSize + res.datas.forEach((item) => { + // item.compliceHover = false + // item.deleteHover = false + item.createDate = this.convertTimestamp(item.createDate) + }) + this.setData({ + "pageCount.total": res.totalSize, + noteList: res.datas, + loading: false + }) + // console.log('绗旇鍒楄〃', res.datas); + }) + }, + // 缂栬緫鎸夐挳 + editNote(e) { + const note = e.currentTarget.dataset.note + this.setData({ + submitType: "edit", + textvalue: note.content, + submitTitle: note.name, + noteId: note.id + }) + this.showDialog() + }, + + // 鍒犻櫎绗旇 + deleteNote(e) { + const id = e.currentTarget.dataset.id + const messageIds = [] + messageIds.push(id) + wx.showModal({ + title: '鎻愮ず', + content: '纭鍒犻櫎璇ョ瑪璁板悧锛�',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + placeholderText: '璇疯緭鍏ュ唴瀹瑰惂',//杈撳叆妗嗙殑榛樿鍐呭 + success: (res) => { + if (res.confirm) { + app.MG.ugc + .delTopicMessage({ messageIds }) + .then((res) => { + wx.showToast({ + title: '鍒犻櫎鎴愬姛', + }) + // if ((notePage.value.total % 3) - 1 == 0) { + // notePage.value.page -= 1 + // } + this.getNoteList() + }) + } else if (res.cancel) { + // console.log('鐢ㄦ埛鐐瑰嚮鍙栨秷') + } + } + }) + }, + // 鏂板缓绗旇鎺ュ彛 + async makeNote() { + const token = wx.getStorageSync('jsek-token') + if (!token) { + return wx.getUserProfile({ + desc: '鐢ㄦ埛鐧诲綍', + success: (res) => { + // console.log(res); + } + }) + } + let topicId + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.data.bookId, + appRefCode: app.config.appRefCode + }) + .then((res) => { + if (res) { + topicId = res.id + } else { + return wx.showToast({ + icon: 'error', + title: '鏂板缓澶辫触', + }) + } + }) + let query = { + topicIdOrRefCode: topicId + '', + name: this.data.submitTitle, + content: this.data.textvalue, + type: 'note', + cmsTypeRefCode: '', + newDataListRequest: [] + } + await app.MG.ugc.newTopicMessage(query).then((res) => { + wx.showToast({ + title: '鏂板缓鎴愬姛', + }) + this.closeDialog() + this.getNoteList() + }) + }, + // 缂栬緫绗旇鎺ュ彛 + updateNote() { + const token = wx.getStorageSync('jsek-token') + if (!token) { + return wx.getUserProfile({ + desc: '鐢ㄦ埛鐧诲綍', + success: (res) => { + // console.log(res); + } + }) + } + if (!this.data.submitTitle) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁版爣棰�', + }) + } else if (!this.data.textvalue) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁板唴瀹�', + }) + } + let query = { + id: this.data.noteId, + name: this.data.submitTitle, + description: 'string', + icon: 'string', + type: 'note', + content: this.data.textvalue, + newDataRequests: [], + updateDataRequests: [] + } + app.MG.ugc.updateTopicMessage(query).then((res) => { + wx.showToast({ + title: '缂栬緫鎴愬姛', + }) + this.closeDialog() + this.getNoteList() + }) + this.setData({ + submitType: "new" + }) + }, + // 鎾斁鍏叡浠g爜 + pubulicPlayFun() { + + + myAudio.src = this.data.showData + console.log(myAudio.src); + // 鍦╫nCanplay閲岃幏鍙栧苟璁剧疆闊抽鏃堕暱鍜屾挱鏀捐繘搴� + myAudio.onCanplay(() => { + myAudio.duration; //蹇呴』鍐欙紝涓嶇劧鑾峰彇涓嶅埌銆傘�傘�� + setTimeout(() => { + console.log(myAudio.duration); + this.setData({ + myAudioDuration: this.format(myAudio.duration), + myAudioCurrent: this.format(myAudio.currentTime) + }); + }, 1000); + }); + + + // 鎾斁瀹屾垚澶勭悊锛屾寜閽彉涓�涓� + myAudio.onEnded((res) => { + this.setData({ + isplay: false + }) + }); + + + //杩涘害鏉″彉鍖� + myAudio.onTimeUpdate(() => { + this.setData({ + myAudioPos: myAudio.currentTime / myAudio.duration * 100, + myAudioCurrent: this.format(myAudio.currentTime) + }); + }) + }, + + + //鎾斁 + play() { + console.log(22222); + myAudio.startTime = this.data.myAudioCurrent; //鑰冭檻鍒拌繘搴︽潯琚嫋鍔紝涓嶄竴瀹氫粠00:00:00寮�濮� + myAudio.play(); + this.setData({ + isplay: true + }); + + + }, + + // 鍋滄 + stop() { + console.log(11111); + myAudio.pause(); + this.setData({ + isplay: false + }); + }, + adsfhaewlf() { + + myAudio.pause(); + this.setData({ + isplay: false + }); + }, + + //鍙冲垏鎹� + onLeftSwitch() { + this.setData({ + speed: 1.0, + myAudioCurrent: '00:00' + }) + const index = this.data.threeLeveData.findIndex((item) => item.id == this.data.selectId) + if (this.data.threeLeveData[index - 1]) { + this.changeItem(this.data.threeLeveData[index - 1]) + this.setData({ + selectedId: index - 1, + + }) + } else { + console.log('宸茬粡鏄涓�棣栦簡'); + } + + }, + + //鍙冲垏鎹� + onRightSwitch() { + this.setData({ + speed: 1.0, + myAudioCurrent: '00:00' + }) + console.log('鍙冲垏鎹�'); + const index = this.data.threeLeveData.findIndex((item) => item.id == this.data.selectId) + if (this.data.threeLeveData[index + 1]) { + this.changeItem(this.data.threeLeveData[index + 1]) + this.setData({ + selectedId: index + 1, + + }) + } else { + console.log('宸茬粡鏄渶鍚庝竴棣栦簡'); + } + }, + + + changeItem(item) { + console.log(item); + + if (this.data.showData != '') { + this.setData({ + showData: '' + }) + } + this.setData({ + titleName: item.name, + selectId: item.id + }) + + if (item.selectType == "audio") { + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file + }) + this.pubulicPlayFun() + } + }, + // 鎾斁鍊嶉�� + onSpeed() { + let c = this.data.speed; + c += 0.5; + if (c <= 2) { + this.setData({ + speed: c, + }) + } else { + c = 0.5; + this.setData({ + speed: c, + }) + } + + setTimeout(() => { + myAudio.startTime = this.data.myAudioDuration //寮�濮嬫椂闂� + myAudio.playbackRate = this.data.speed; // 鎾斁閫熺巼 + }, 200); + }, + + // 鎷栧姩杩涘害鏉★紝鍒版寚瀹氫綅缃� + hanle_slider_change(e) { + const position = e.detail.value; + var currentTime = position / 100 * myAudio.duration; + myAudio.seek(currentTime); + this.setData({ + myAudioPos: position, + myAudioCurrent: this.format(currentTime) + }) + } + + }) \ No newline at end of file diff --git a/pages/resourceDetails/myAudio/index.json b/pages/resourceDetails/myAudio/index.json index 02871f3..60b450d 100644 --- a/pages/resourceDetails/myAudio/index.json +++ b/pages/resourceDetails/myAudio/index.json @@ -1,6 +1,19 @@ { + "component": true, "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon" + "t-icon": "tdesign-miniprogram/icon/icon", + "t-tabs": "tdesign-miniprogram/tabs/tabs", + "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", + "t-collapse": "tdesign-miniprogram/collapse/collapse", + "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel", + "t-button": "tdesign-miniprogram/button/button", + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-input": "tdesign-miniprogram/input/input", + "t-image": "tdesign-miniprogram/image/image", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-popup": "tdesign-miniprogram/popup/popup", + "t-slider": "tdesign-miniprogram/slider/slider" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/resourceDetails/myAudio/index.wxml b/pages/resourceDetails/myAudio/index.wxml index 4449e6d..daf0f65 100644 --- a/pages/resourceDetails/myAudio/index.wxml +++ b/pages/resourceDetails/myAudio/index.wxml @@ -9,31 +9,136 @@ -<view class="audioBox"> - <view class=""> - <image class="imageFront" src="/static/images/resourceDetailsMyAudio/cd.png" mode="aspectFit" /> - <image class=" imageAfter" src="/static/images/resourceDetailsMyAudio/video-bg.png" mode="aspectFit" /> +<view class="audioPlayerBox"> + <view class="audioBackground" style="background-image: url('/static/images/resourceDetailsMyAudio/video-bg.png');"> + + <image src="/static/images/resourceDetailsMyAudio/cd.png" alt="" /> </view> - <view class="controlBox"> + <!-- 瑙嗛鎾斁鐨勬寜閽� --> + <view class="bigFunctionBox"> + <slider activeColor='#FF6C00' class="mp-slider-bar" block-size="16" value="{{myAudioPos}}" bindchange="hanle_slider_change"></slider> - <image src="/static/images/resourceDetailsMyAudio/shangyizhang.png" mode="" /> - <image bindtap="audioPlay" src="/static/images/resourceDetailsMyAudio/zanting.png" mode="" /> - <image bindtap="audioPause" src="/static/images/resourceDetailsMyAudio/xiayizhang.png" mode="" /> + <view class="functionBox"> - <image src="/static/images/resourceDetailsMyAudio/Full screen.png" mode="" /> - <!-- <view class="free-MusicProgress"> - <view style="width:{{progress}}%;"></view> - </view> --> + + <!-- 宸﹀垏鎹� --> + <view class="leftSwitchBox color" bind:tap="onLeftSwitch"> + <t-icon name="previous" size="24" /> + </view> + + <!-- 鏆傚仠鎾斁 --> + <view class="audioIconBox color"> + <view wx:if="{{!isplay}}" bind:tap='play'> + <t-icon name="play-circle-stroke" size="24" /> + </view> + <view wx:else bind:tap="stop"> + <t-icon name="pause-circle-stroke" size="24" /> + </view> + </view> + + <!-- 鍙冲垏鎹� --> + <view class="rightSwitchBox color" bind:tap="onRightSwitch"> + <t-icon name="next" size="24" /> + </view> + + <!-- 鏃堕棿 --> + <view class="current-time color">{{myAudioCurrent}} </view> + <view class="color" style="margin: 0 10rpx;">/</view> + <view class="duration-time color"> {{myAudioDuration}} </view> + + <view class="publicBtn color" style="margin-left:100rpx ;" bind:tap="onSpeed"> + + <text class="publicText">{{"x "+speed}}</text> + </view> + </view> </view> </view> -<audio wx:if="{{false}}" bindtimeupdate="MusicStart" poster="{{poster}}" name="{{name}}" author="{{author}}" src="{{src}}" id="myAudio" controls loop> + +<!-- 鏍囬 --> +<view class="titleBox">{{titleName}}</view> + +<view class="contentBox"> + <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> + <!-- 璧勬簮鍒楄〃 --> + <t-tab-panel label="璧勬簮鍒楄〃" value="0" style="{{tabPanelstyle}}" style="width: 750rpx;"> + <view class="wrapper"> + <t-collapse value="{{activeValues}}" bind:change="handleChange"> + <t-collapse-panel header="{{parentName}}" value="{{0}}" expandIcon> + <view class="detailsName" wx:for="{{threeLeveData}}" wx:key="index" wx:for-item="item" wx:for-index="index" bind:tap="onVideo" data-item="{{item}}" data-index="{{index}}"> + <view style="color: {{selectedId == index ? '#ff6c00' : '#000'}}">{{item.name}}</view> + </view> + </t-collapse-panel> + </t-collapse> + </view> + </t-tab-panel> + <!-- 绗旇灞曠ず --> + <t-tab-panel label="绗旇" value="1" style="{{tabPanelstyle}}"> + <view class="wrapper"> + <t-collapse value="{{activeValues}}" bind:change="handleChange"> + <t-collapse-panel value="{{item.id}}" expandIcon wx:for="{{noteList}}"> + <view slot="header" class="collapse-header"> + <t-image class="note-icon" src="/static/images/bookService/detail/note-icon.png"></t-image> + <view class="header-name">{{item.name}}</view> + </view> + <view> + <view class="note-content">{{item.content}}</view> + <view class="note-bottom"> + <view class="note-time">{{item.createDate}}</view> + <view class="bottom-btn"> + <t-image src="/static/images/bookService/detail/compliceHover.png" class="complice" bind:tap="editNote" data-note="{{item}}"></t-image> + <view></view> + <t-image src="/static/images/bookService/detail/deleteHover.png" class="delete" bind:tap="deleteNote" data-id="{{item.id}}"></t-image> + </view> + </view> + </view> + </t-collapse-panel> + </t-collapse> + </view> + </t-tab-panel> + </t-tabs> + + <!-- 璁扮瑪璁� --> + <view class="takeNotes" data-key="showCloseBtn" bind:tap="showDialog"> + <view class="takeNotesLining"> + <image src="/static/images/resourceDetails/jibijii.png" mode="" /> 璁扮瑪璁� + </view> + </view> +</view> -</audio> -<!-- <button type="primary" >鎾斁</button> -<button type="primary">鏆傚仠</button> -<button type="primary" bindtap="audio14">璁剧疆褰撳墠鎾斁鏃堕棿涓�14绉�</button> -<button type="primary" bindtap="audioStart">鍥炲埌寮�澶�</button> --> \ No newline at end of file +<!-- 璁扮瑪璁板脊绐� --> +<t-popup visible="{{dialogKey}}" bind:visible-change="onVisibleChange" placement="center"> + <view class="popup"> + <view slot="title"> + <view class="title-text" wx:if="{{!flag}}"> + <text class="note-title">{{titleName}}</text> + <t-image src="/static/images/bookService/detail/edit.png" class="edit-icon" bind:tap="changeTitle" data-value="{{true}}"></t-image> + </view> + <view wx:else> + <t-input value="{{titleName}}" style="{{inputStyle}}" data-value="{{false}}" bind:enter="changeTitle" bind:blur="changeTitle" maxlength="{{50}}" bind:change="inputChange"></t-input> + </view> + </view> + + + + + <view slot='content'> + <view class="textarea-example"> + <text class="textarea-example__label">鍐呭:</text> + <t-textarea value="{{textvalue}}" t-class="external-class" placeholder="璇疯緭鍏ユ枃瀛�" bordered maxlength="500" disableDefaultPadding="{{true}}" indicator style="{{inputStyle}}" bind:change="textareaChange" /> + </view> + + + <view class="submit-btn"> + <t-button theme="primary" size="large" block bind:tap="confirmSuggest">鎻愪氦</t-button> + </view> + </view> + + + + </view> + <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" /> +</t-popup> \ No newline at end of file diff --git a/pages/resourceDetails/myAudio/index.wxss b/pages/resourceDetails/myAudio/index.wxss index 498b3dc..4d891e6 100644 --- a/pages/resourceDetails/myAudio/index.wxss +++ b/pages/resourceDetails/myAudio/index.wxss @@ -1,14 +1,12 @@ -/* pages/resourceDetails/myAudio/index.wxss */ +/* pages/resourceDetails/index.wxss */ .nacigationBar { background-color: #fff; display: flex; align-items: center; - } .navbar-title { white-space: nowrap; - /* overflow: hidden; */ text-overflow: ellipsis; color: #0F1214; font-size: 40rpx; @@ -16,51 +14,306 @@ margin-bottom: 5rpx; } -.audioBox { - width: 100%; - height: 350rpx; + + +.titleBox { + margin: 30rpx; + border-bottom: 1px #f4f4f4 solid; + padding-bottom: 20rpx; + font-weight: bold; + } -.imageFront { - width: 300rpx; - height: 300rpx; - position: absolute; - top: 150rpx; - left: 250rpx; +.contentBox { + position: relative; } -.imageAfter { - width: 100%; +.contentBox .custom-tabs { + width: 400rpx; } -.controlBox { + +.t-tabs__content { + width: 750rpx !important; + overflow: auto !important; +} + + +.custom-panel { width: 750rpx; - height: 96rpx; - background: #000000; - border-radius: 0rpx 0rpx 0rpx 0rpx; - opacity: 0.6; - position: relative; + } -.controlBox image { - width: 45rpx; - height: 45rpx; - margin: 20rpx 35rpx; -} +.contentBox .takeNotes { -audio { - position: relative; -} - -.free-MusicProgress { position: absolute; - width: 78%; - left: 21.7%; - bottom: 1px; - background: #C3C3C3; + top: 5rpx; + right: 0; + width: 350rpx; + border-bottom: 1px solid #f4f4f4; } -.free-MusicProgress>view { - background: #48c23d; - height: 5px; +.takeNotes image { + width: 30rpx; + height: 30rpx; + margin-top: 10rpx; + margin-right: 10rpx; +} + +.takeNotesLining { + margin: 25rpx; + display: flex; + justify-content: flex-end; +} + +.operateBox { + display: flex; + align-items: flex-end; + justify-content: space-between; +} + +.iconBox { + display: flex; +} + +.iconBox image { + width: 26rpx; + height: 26rpx; + margin: 0 10rpx; +} + +.t-dialog__content { + padding: 0 !important; +} + +.titleImageBox { + width: 40rpx; + height: 40rpx; + margin-left: 20rpx; +} + +.dialogTitleBox { + margin: 30rpx; + border-bottom: 1px #f4f4f4 solid; + padding-bottom: 20rpx; + font-weight: bold; + display: flex; + align-items: center; +} + +.input-example { + --td-input-vertical-padding: 24rpx; + background-color: #fff; + padding: 32rpx 32rpx 16rpx; +} + +.input-example__label { + color: rgba(0, 0, 0, 0.9); + font-size: 24rpx; + line-height: 40rpx; + margin: 0 8rpx 16rpx; +} + +.buttonBox { + display: flex; + justify-content: center; + +} + +.detailsName { + margin: 30rpx; + width: 90%; + height: 60rpx; + display: flex; + align-items: center; + padding-left: 20rpx; + background-color: #FFF6F0 +} + +.detailsName:hover { + background-color: #fff0e6; + width: 90%; + height: 60rpx; + color: #ff6c00; +} + +.audioBox { + width: 750rpx; + height: 200rpx; +} + +.title-text { + display: flex; + align-items: center; +} + +.note-title { + width: 80%; + height: 84rpx; + line-height: 84rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 10rpx; + margin-left: 20rpx; +} + +.edit-icon { + margin-left: 10rpx; + width: 30rpx; + height: 30rpx; +} + +.submit-btn { + padding: 40rpx; + --td-button-border-radius: 60rpx; + --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; +} + +.edit-icon { + margin-left: 10rpx; + width: 30rpx; + height: 30rpx; +} + +.textarea-example { + padding: 32rpx 32rpx 48rpx; + background-color: #fff; +} + +.external-class { + padding-top: 24rpx !important; + padding-bottom: 24rpx !important; +} + +.textarea-example__label { + display: block; + color: rgba(0, 0, 0, 0.9); + font-size: 24rpx; + line-height: 40rpx; + padding-bottom: 16rpx; +} + +.popup { + padding: 40rpx; + width: 600rpx; + +} + +.close-btn { + position: absolute; + left: 50%; + margin-left: -32rpx; + bottom: calc(-1 * (48rpx + 64rpx)); +} + +.collapse-header { + display: flex; +} + +.collapse-header .header-name { + font-size: 32rpx; + width: 500rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.note-icon { + width: 44rpx; + height: 48rpx; + margin-right: 20rpx; +} + +.note-content { + height: min-content; + font-size: 28rpx; + color: #949494; + margin-bottom: 20rpx; + max-height: 600rpx; + text-align: justify; +} + +.note-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} + +.note-time { + color: #D9D9D9; +} + +.bottom-btn { + height: 40rpx; + display: flex; + align-items: center; +} + +.complice, +.delete { + width: 30rpx; + height: 30rpx; + margin: 0 15rpx; +} + +.audioPlayerBox { + width: 100%; + height: 460rpx; + display: flex; + flex-direction: column; +} + +.audioBackground { + flex: 1; + background-size: 100% 110%; + background-color: #f9f9f9; + display: flex; + justify-content: center; + align-items: center; +} + +.audioBackground image { + width: 270rpx; + height: 280rpx; +} + +.functionBox { + height: 96rpx; + display: flex; + align-items: center; +} + +.functionBox .color { + color: #fff; +} + +.rightSwitchBox { + margin: 0 30rpx; +} + +.leftSwitchBox { + margin: 0 30rpx; +} + +.bigFunctionBox { + background: #000000; + opacity: 0.6; +} + +.mp-slider-bar { + margin: 0 18rpx; + margin-top: 10rpx; +} + +.t-tabs__item--active { + color: #FF6C00 !important; + +} + +.t-tabs__track { + background-color: #FF6C00 !important; } \ No newline at end of file diff --git a/pages/resourceDetails/myVideo/index.js b/pages/resourceDetails/myVideo/index.js index a954285..d99b880 100644 --- a/pages/resourceDetails/myVideo/index.js +++ b/pages/resourceDetails/myVideo/index.js @@ -7,12 +7,13 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + noteList: [], navBarHeight: '', barHeight: '', - + flag: true, // 杈撳叆妗嗘槸鍚︽樉绀� tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', activeValues: [0], - dialogKey: true, + dialogKey: false, style: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;', activeId: '', bookId: '', @@ -25,18 +26,36 @@ showData: '', src: '', selectedId: null, - topicId: '' + topicId: '', + titleName: '', + submitTitle: "", + inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx', + textvalue: '', + style: 'height: 248rpx', + submitType: "new", // 鏂板缓 or 缂栬緫 + noteId: '', }, - + // 鏍煎紡鍖栫瑪璁版椂闂� + convertTimestamp(timestamp) { + const isoDate = new Date(timestamp) + const year = isoDate.getFullYear() + const month = String(isoDate.getMonth() + 1).padStart(2, '0') + const day = String(isoDate.getDate()).padStart(2, '0') + const hours = String(isoDate.getHours()).padStart(2, '0') + const minutes = String(isoDate.getMinutes()).padStart(2, '0') + const seconds = String(isoDate.getSeconds()).padStart(2, '0') + const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + return formattedDate + }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - console.log(this.data.dialogKey, 'dialogKey'); + const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� - + console.log(options, 'options'); this.setData({ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, @@ -46,10 +65,12 @@ cmsId: options.cmsId, parentName: options.parentName, parentProductLinkPath: options.parentProductLinkPath, - productLinkPath: options.productLinkPath + productLinkPath: options.productLinkPath, + flag: false }) - console.log(this.data.parentProductLinkPath, 'parentProductLinkPath'); + this.resourceDetailsData() + this.getNoteList() }, /** @@ -106,7 +127,8 @@ onTabsClick(event) { - }, handleChange(e) { + }, + handleChange(e) { this.setData({ activeValues: e.detail.value, }); @@ -115,22 +137,28 @@ }, showDialog(e) { - const { key } = e.currentTarget.dataset; - this.setData({ [key]: true, dialogKey: key }); + + this.setData({ + submitTitle: this.data.bookName, + dialogKey: true, + // textvalue: '' + + + }); }, closeDialog() { this.setData({ - dialogKey: false + dialogKey: false, + textvalue: '', + flag: false }); }, goBack() { wx.navigateBack(); }, resourceDetailsData() { - - let query = { path: '*', queryType: '*', @@ -157,47 +185,46 @@ } app.MG.store.getProductDetail(query).then(res => { - console.log(res, 'res'); - - const list = [] - res.datas.cmsDatas[0].datas.forEach((item) => { - this.data.threeLeveData.push(item) - list.push(item) - this.setData({ - threeLeveData: list - }) - - if (this.data.productLinkPath == item.productLinkPath) { - console.log(item, 'item'); + if (item.selectType === "video") { + this.data.threeLeveData.push(item) this.setData({ - showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file + threeLeveData: this.data.threeLeveData }) - } - // console.log(this.data.threeLeveData, 'threeLeveData'); - }) + if (this.data.productLinkPath == item.productLinkPath) { + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file, + titleName: item.name + }) + } + } + + + }) + this.data.threeLeveData.forEach((item) => { + console.log(item.name); + }) }) }, onVideo(e) { - + if (this.data.showData != '') { + this.setData({ + showData: '' + }) + } this.setData({ selectedId: e.currentTarget.dataset.index, }) - - - - // console.log(e); const item = e.currentTarget.dataset.item - // console.log(item); + this.setData({ + titleName: item.name + }) + if (item.selectType == "video") { - console.log(item.file); this.setData({ showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file }) - console.log(this.data.showData); - } else { - console.log(app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file); } }, @@ -229,15 +256,229 @@ console.log(res); }) }, - // currentTarget - onConfirm() { - console.log(1111); + // 鏍囬鏀瑰彉 + changeTitle(e) { + console.log(e.currentTarget.dataset.value); + this.setData({ + flag: e.currentTarget.dataset.value + }) }, - onCancellation() { - console.log(222); + // 鏍囬杈撳叆妗嗗�� + inputChange(e) { + this.setData({ + titleName: e.detail.value + }) + }, - this.data.dialogKey = false + confirmSuggest() { + if (!this.data.textvalue) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁板唴瀹�', + }) - } + } else if (!this.data.titleName) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁版爣棰�', + }) + } + if (this.data.submitType == 'new') { + this.makeNote() + } else if (this.data.submitType == 'edit') { + this.updateNote() + } + console.log(this.data.textvalue); + console.log(this.data.titleName); + this.setData({ + dialogKey: false + }); + }, + onTextarea() { + console.log(this.data.textvalue); + }, + textareaChange(e) { + this.setData({ + textvalue: e.detail.value + }) + }, + + + // 鑾峰彇绗旇鍒楄〃 + async getNoteList() { + // this.setData({ + // loading: true + // }) + let topicId + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.data.bookId, + appRefCode: app.config.appRefCode + }) + .then((res) => { + if (res) { + topicId = res.id + } else { + return wx.showToast({ + icon: "error", + title: '鏌ヨ澶辫触', + }) + } + }) + // loadings.value.bookResource = true + let query = { + start: 0, + size: 999, + messageType: 'note', + sort: { + type: 'Desc', + field: 'CreateDate' + }, + appRefCode: app.config.appRefCode, + topicIdOrRefCode: topicId + '' + } + await app.MG.ugc.getTopicMessageList(query).then((res) => { + // notePage.value.total = res.totalSize + res.datas.forEach((item) => { + // item.compliceHover = false + // item.deleteHover = false + item.createDate = this.convertTimestamp(item.createDate) + }) + this.setData({ + "pageCount.total": res.totalSize, + noteList: res.datas, + loading: false + }) + console.log('绗旇鍒楄〃', res.datas); + }) + }, + // 缂栬緫鎸夐挳 + editNote(e) { + const note = e.currentTarget.dataset.note + this.setData({ + submitType: "edit", + textvalue: note.content, + submitTitle: note.name, + noteId: note.id + }) + this.showDialog() + }, + + // 鍒犻櫎绗旇 + deleteNote(e) { + const id = e.currentTarget.dataset.id + const messageIds = [] + messageIds.push(id) + wx.showModal({ + title: '鎻愮ず', + content: '纭鍒犻櫎璇ョ瑪璁板悧锛�',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + editable: false,//鏄惁鏄剧ず杈撳叆妗� + placeholderText: '璇疯緭鍏ュ唴瀹瑰惂',//杈撳叆妗嗙殑榛樿鍐呭 + success: (res) => { + if (res.confirm) { + app.MG.ugc + .delTopicMessage({ messageIds }) + .then((res) => { + wx.showToast({ + title: '鍒犻櫎鎴愬姛', + }) + // if ((notePage.value.total % 3) - 1 == 0) { + // notePage.value.page -= 1 + // } + this.getNoteList() + }) + } else if (res.cancel) { + console.log('鐢ㄦ埛鐐瑰嚮鍙栨秷') + } + } + }) + }, + // 鏂板缓绗旇鎺ュ彛 + async makeNote() { + const token = wx.getStorageSync('jsek-token') + if (!token) { + return wx.getUserProfile({ + desc: '鐢ㄦ埛鐧诲綍', + success: (res) => { + console.log(res); + } + }) + } + let topicId + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.data.bookId, + appRefCode: app.config.appRefCode + }) + .then((res) => { + if (res) { + topicId = res.id + } else { + return wx.showToast({ + icon: 'error', + title: '鏂板缓澶辫触', + }) + } + }) + let query = { + topicIdOrRefCode: topicId + '', + name: this.data.submitTitle, + content: this.data.textvalue, + type: 'note', + cmsTypeRefCode: '', + newDataListRequest: [] + } + await app.MG.ugc.newTopicMessage(query).then((res) => { + wx.showToast({ + title: '鏂板缓鎴愬姛', + }) + this.closeDialog() + this.getNoteList() + }) + }, + // 缂栬緫绗旇鎺ュ彛 + updateNote() { + const token = wx.getStorageSync('jsek-token') + if (!token) { + return wx.getUserProfile({ + desc: '鐢ㄦ埛鐧诲綍', + success: (res) => { + console.log(res); + } + }) + } + if (!this.data.submitTitle) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁版爣棰�', + }) + } else if (!this.data.textvalue) { + return wx.showToast({ + icon: 'error', + title: '璇峰~鍐欑瑪璁板唴瀹�', + }) + } + let query = { + id: this.data.noteId, + name: this.data.submitTitle, + description: 'string', + icon: 'string', + type: 'note', + content: this.data.textvalue, + newDataRequests: [], + updateDataRequests: [] + } + app.MG.ugc.updateTopicMessage(query).then((res) => { + wx.showToast({ + title: '缂栬緫鎴愬姛', + }) + this.closeDialog() + this.getNoteList() + }) + this.setData({ + submitType: "new" + }) + }, + }) \ No newline at end of file diff --git a/pages/resourceDetails/myVideo/index.json b/pages/resourceDetails/myVideo/index.json index c22808e..adaa91b 100644 --- a/pages/resourceDetails/myVideo/index.json +++ b/pages/resourceDetails/myVideo/index.json @@ -8,7 +8,11 @@ "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel", "t-button": "tdesign-miniprogram/button/button", "t-dialog": "tdesign-miniprogram/dialog/dialog", - "t-input": "tdesign-miniprogram/input/input" + "t-input": "tdesign-miniprogram/input/input", + "t-image": "tdesign-miniprogram/image/image", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-popup": "tdesign-miniprogram/popup/popup" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/resourceDetails/myVideo/index.wxml b/pages/resourceDetails/myVideo/index.wxml index 4986c71..8f5847e 100644 --- a/pages/resourceDetails/myVideo/index.wxml +++ b/pages/resourceDetails/myVideo/index.wxml @@ -5,15 +5,14 @@ </view> <view class="navbar-title">璧勬簮璇︽儏-瑙嗛</view> </view> -<!-- 瑙嗛 绛� --> +<!-- 瑙嗛 --> <view class="videoBox"> + <!-- autoplay='false' 鏄惁鑷姩鎾斁 --> <video src="{{showData}}" play-btn-position='center' object-fit='fill' controls enable-play-gesture enable-auto-rotation></video> - </view> <!-- 鏍囬 --> -<view class="titleBox">鍩虹鏁欒偛鐮旂┒鑳屾櫙鎬讳綋璁捐</view> - +<view class="titleBox">{{titleName}}</view> <view class="contentBox"> <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> <!-- 璧勬簮鍒楄〃 --> @@ -21,27 +20,32 @@ <view class="wrapper"> <t-collapse value="{{activeValues}}" bind:change="handleChange"> <t-collapse-panel header="{{parentName}}" value="{{0}}" expandIcon> - <view class="detailsName" wx:for="{{threeLeveData}}" wx:key="index" wx:for-item="item" wx:for-index="index" bind:tap="onVideo" data-item="{{item}}" data-index="{{index}}"> <view style="color: {{selectedId == index ? '#ff6c00' : '#000'}}">{{item.name}}</view> </view> - - </t-collapse-panel> </t-collapse> </view> </t-tab-panel> <!-- 绗旇灞曠ず --> <t-tab-panel label="绗旇" value="1" style="{{tabPanelstyle}}"> + <view class="wrapper"> <t-collapse value="{{activeValues}}" bind:change="handleChange"> - <t-collapse-panel header="绗�1绗�1璇炬椂 璇剧▼瑙嗛" value="{{0}}" expandIcon> - <view> 姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭姝ゅ鍙嚜瀹氫箟鍐呭</view> - <view class="operateBox"> - <view>2023-08-29</view> - <view class="iconBox"> - <image src="/static/images/resourceDetails/jibijiicon2.png" mode="" /> - <image src="/static/images/resourceDetails/jibijiicon3.png" mode="" /> + <t-collapse-panel value="{{item.id}}" expandIcon wx:for="{{noteList}}"> + <view slot="header" class="collapse-header"> + <t-image class="note-icon" src="/static/images/bookService/detail/note-icon.png"></t-image> + <view class="header-name">{{item.name}}</view> + </view> + <view> + <view class="note-content">{{item.content}}</view> + <view class="note-bottom"> + <view class="note-time">{{item.createDate}}</view> + <view class="bottom-btn"> + <t-image src="/static/images/bookService/detail/compliceHover.png" class="complice" bind:tap="editNote" data-note="{{item}}"></t-image> + <view></view> + <t-image src="/static/images/bookService/detail/deleteHover.png" class="delete" bind:tap="deleteNote" data-id="{{item.id}}"></t-image> + </view> </view> </view> </t-collapse-panel> @@ -60,20 +64,35 @@ <!-- 璁扮瑪璁板脊绐� --> -<t-dialog visible="{{showCloseBtn}}" close-btn bind:confirm="closeDialog" bind:cancel="closeDialog"> - <view slot='title' class="dialogTitleBox">涓�銆侀亾寰蜂笌鍝佸痉鐨勫叧绯�-鏈夎瘯鐪� - <image class="titleImageBox" src="/static/images/resourceDetails/edit.png" alt="" /> - </view> - <view slot='content'> - <view class="input-example"> - <view class="input-example__label"> 鍐呭 </view> - <t-input class="inputBox" placeholder="璇疯緭鍏ユ枃瀛�" borderless="{{true}}" style="{{style}}" /> - </view> - <view class="buttonBox"> - <view> - <t-button bind:tap="onCancellation" style="margin: 20rpx 30rpx;" variant="outline" size="extra-small">鍙栨秷</t-button> - <t-button bind:tap="onConfirm" style="margin: 20rpx 30rpx;" theme="primary" size="extra-small">纭</t-button> +<t-popup visible="{{dialogKey}}" bind:visible-change="onVisibleChange" placement="center"> + <view class="popup"> + <view slot="title"> + <view class="title-text" wx:if="{{!flag}}"> + <text class="note-title">{{titleName}}</text> + <t-image src="/static/images/bookService/detail/edit.png" class="edit-icon" bind:tap="changeTitle" data-value="{{true}}"></t-image> + </view> + <view wx:else> + <t-input value="{{titleName}}" style="{{inputStyle}}" data-value="{{false}}" bind:enter="changeTitle" bind:blur="changeTitle" maxlength="{{50}}" bind:change="inputChange"></t-input> </view> </view> + + + + + <view slot='content'> + <view class="textarea-example"> + <text class="textarea-example__label">鍐呭:</text> + <t-textarea value="{{textvalue}}" t-class="external-class" placeholder="璇疯緭鍏ユ枃瀛�" bordered maxlength="500" disableDefaultPadding="{{true}}" indicator style="{{inputStyle}}" bind:change="textareaChange" /> + </view> + + + <view class="submit-btn"> + <t-button theme="primary" size="large" block bind:tap="confirmSuggest">鎻愪氦</t-button> + </view> + </view> + + + </view> -</t-dialog> \ No newline at end of file + <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" /> +</t-popup> \ No newline at end of file diff --git a/pages/resourceDetails/myVideo/index.wxss b/pages/resourceDetails/myVideo/index.wxss index a338176..511cbd2 100644 --- a/pages/resourceDetails/myVideo/index.wxss +++ b/pages/resourceDetails/myVideo/index.wxss @@ -130,7 +130,8 @@ .buttonBox { display: flex; - justify-content: flex-end; + /* justify-content: flex-end; */ + justify-content: center; } @@ -145,8 +146,9 @@ height: 60rpx; display: flex; align-items: center; - background: #F4F4F4; + padding-left: 20rpx; + background-color: #FFF6F0 } .detailsName:hover { @@ -159,4 +161,139 @@ .audioBox { width: 750rpx; height: 200rpx; +} + +.title-text { + display: flex; + align-items: center; +} + +.note-title { + width: 80%; + height: 84rpx; + line-height: 84rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 10rpx; + margin-left: 20rpx; +} + +.edit-icon { + margin-left: 10rpx; + width: 30rpx; + height: 30rpx; +} + +.submit-btn { + padding: 40rpx; + --td-button-border-radius: 60rpx; + --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; +} + +.edit-icon { + margin-left: 10rpx; + width: 30rpx; + height: 30rpx; +} + +.textarea-example { + padding: 32rpx 32rpx 48rpx; + background-color: #fff; +} + +.external-class { + padding-top: 24rpx !important; + padding-bottom: 24rpx !important; +} + +.textarea-example__label { + display: block; + color: rgba(0, 0, 0, 0.9); + font-size: 24rpx; + line-height: 40rpx; + padding-bottom: 16rpx; +} + +.dialogIconBox { + /* width: 500rpx; + height: 300rpx; + color: #000; + background-color: ccc; */ +} + +.popup { + padding: 40rpx; + width: 600rpx; + +} + +.close-btn { + position: absolute; + left: 50%; + margin-left: -32rpx; + bottom: calc(-1 * (48rpx + 64rpx)); +} + +.collapse-header { + display: flex; +} + +.collapse-header .header-name { + font-size: 32rpx; + width: 500rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.note-icon { + width: 44rpx; + height: 48rpx; + margin-right: 20rpx; +} + +.note-content { + height: min-content; + font-size: 28rpx; + color: #949494; + margin-bottom: 20rpx; + max-height: 600rpx; + text-align: justify; + /* padding-bottom: 200rpx; */ +} + +.note-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} + +.note-time { + color: #D9D9D9; +} + +.bottom-btn { + height: 40rpx; + display: flex; + align-items: center; +} + +.complice, +.delete { + width: 30rpx; + height: 30rpx; + margin: 0 15rpx; +} + +.t-tabs__item--active { + color: #FF6C00 !important; + +} + +.t-tabs__track { + background-color: #FF6C00 !important; } \ No newline at end of file diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js index 1e532af..060d8f2 100644 --- a/pages/retrievalPage/index.js +++ b/pages/retrievalPage/index.js @@ -38,7 +38,7 @@ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, - + searchVal: options.searchVal }) @@ -431,6 +431,11 @@ fields }) + datas5.forEach((items) => { + items.subtitleName = items.subtitle + items.name + + }) + console.log(datas5, 'sadasd'); this.setData({ biblioClassificationData: datas5, biblioClassificationTotal: data5.totalCount @@ -517,6 +522,15 @@ console.log(this.data.searchVal); this.retrievalPageGet() this.bibliographyGet() + }, + onBook(e) { + console.log(e.currentTarget.dataset.item); + const item = e.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/bookServices/detail/index?id=' + item.id + '&name' + item.name + + + }) } }) \ No newline at end of file diff --git a/pages/retrievalPage/index.wxml b/pages/retrievalPage/index.wxml index bbd2708..ab0107a 100644 --- a/pages/retrievalPage/index.wxml +++ b/pages/retrievalPage/index.wxml @@ -22,7 +22,7 @@ <view class="bookDataBox"> - <view class="bookDataForBox" wx:for="{{bookData}}" wx:key="index" wx:for-item="item" wx:for-index="index"> + <view class="bookDataForBox" wx:for="{{bookData}}" wx:key="index" wx:for-item="item" wx:for-index="index" data-item="{{item}}" bind:tap="onBook"> <view class="imageBox"> <image src="{{item.icon}}" mode="aspectFill" /> </view> @@ -153,7 +153,7 @@ <view class="contentBox" wx:for="{{biblioClassificationData}}" wx:key="index" wx:for-item="item" wx:for-index="index" bindtap="onBookExhibitionDetails" data-item="{{item}}"> <image class="bookFairImage" wx:if="{{item.icon}}" src="{{item.icon}}" mode="" /> <image class="bookFairImage" wx:else="" src="/static/images/bookExhibitionList/banner.png" mode="" /> - <view class="textBox" title="{{item.name}}"> <text>{{item.name}}</text></view> + <view class="textBox" title="{{item.name}}"> <text>{{item.subtitleName}}</text></view> </view> </view> diff --git a/pages/retrievalPage/index.wxss b/pages/retrievalPage/index.wxss index 1d9cce0..a893adc 100644 --- a/pages/retrievalPage/index.wxss +++ b/pages/retrievalPage/index.wxss @@ -131,17 +131,14 @@ } .body-info .name { - font-size: 32rpx; - height: 88rpx; - color: #333333; - font-weight: bold; - line-height: 44rpx; - display: -webkit-box; - margin-bottom: 10rpx; + + font-size: 25rpx; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; + display: -webkit-box; + margin-bottom: 10rpx; } .body-info .time { @@ -176,7 +173,8 @@ .listBox1 .listItemBox { height: 220rpx; - margin-bottom: 30rpx; + margin-bottom: 20rpx; + padding: 30rpx; } .listBox1 .specialSubject-img { @@ -286,4 +284,13 @@ color: #333333; padding: 15rpx; margin-bottom: 10rpx; +} + +.t-tabs__item--active { + color: #FF6C00 !important; + +} + +.t-tabs__track { + background-color: #FF6C00 !important; } \ No newline at end of file diff --git a/pages/testLogin/index.js b/pages/testLogin/index.js index 8dc1a28..e83f718 100644 --- a/pages/testLogin/index.js +++ b/pages/testLogin/index.js @@ -7,7 +7,7 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - textName: "18892081234", + textName: "15111111116", textPassword: "xA123456", loading: false, userInfo: { diff --git a/static/images/bibliographyList/square.png b/static/images/bibliographyList/square.png new file mode 100644 index 0000000..fc6a912 --- /dev/null +++ b/static/images/bibliographyList/square.png Binary files differ diff --git a/static/images/bibliographyList/square@2x.png b/static/images/bibliographyList/square@2x.png new file mode 100644 index 0000000..da0fa8c --- /dev/null +++ b/static/images/bibliographyList/square@2x.png Binary files differ diff --git a/static/images/bookExhibitionList/zhuantitaolun.png b/static/images/bookExhibitionList/zhuantitaolun.png new file mode 100644 index 0000000..626fa37 --- /dev/null +++ b/static/images/bookExhibitionList/zhuantitaolun.png Binary files differ 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 diff --git a/static/images/document/zip.png b/static/images/document/zip.png new file mode 100644 index 0000000..aee1c67 --- /dev/null +++ b/static/images/document/zip.png Binary files differ diff --git a/static/images/document/zip200px.png b/static/images/document/zip200px.png new file mode 100644 index 0000000..2a35d90 --- /dev/null +++ b/static/images/document/zip200px.png Binary files differ diff --git a/static/images/document/zip200px@2x.png b/static/images/document/zip200px@2x.png new file mode 100644 index 0000000..ae187e8 --- /dev/null +++ b/static/images/document/zip200px@2x.png Binary files differ diff --git a/static/video/sea.mp4 b/static/video/sea.mp4 deleted file mode 100644 index 328ebe3..0000000 --- a/static/video/sea.mp4 +++ /dev/null Binary files differ diff --git a/style/theme.wxss b/style/theme.wxss index 8b563f4..b0f01a6 100644 --- a/style/theme.wxss +++ b/style/theme.wxss @@ -22,13 +22,13 @@ --td-button-font-weight: 500; --td-button-medium-font-size: 32rpx; --td-button-default-color: #fff; - --td-button-default-bg-color: #fa4126; - --td-button-default-border-color: #fa4126; + --td-button-default-bg-color: #FF6C00; + --td-button-default-border-color: #FF6C00; --td-button-default-disabled-color: #fff; --td-button-default-disabled-bg: #cccccc; --td-button-default-disabled-border-color: #cccccc; - --td-button-default-active-bg-color: #fa4126; - --td-button-default-active-border-color: #fa4126; + --td-button-default-active-bg-color: #FF6C00; + --td-button-default-active-border-color: #FF6C00; } .t-textarea { -- Gitblit v1.9.1