From 810be121d0ad95211ad13ebed9fb4e834c0c2f72 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 25 三月 2024 11:08:32 +0800 Subject: [PATCH] 添加资源购买功能页面 --- packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml | 4 packageBookService/pages/bookServices/detail/buyResource/index.js | 210 ++++++++++++++++++++++++++++++++++ static/images/bookService/examination/datika-w.png | 0 packageBookService/pages/bookServices/examination/questionSchedule/index.js | 3 packageBookService/pages/bookServices/detail/index.wxml | 2 static/images/bookService/examination/setting-w.png | 0 packageBookService/pages/bookServices/examination/examination.wxml | 4 packageBookService/pages/bookServices/examination/questionOptions/index.wxml | 14 + /dev/null | 1 static/images/bookService/examination/chongzuo-w.png | 0 packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js | 27 +++- static/images/bookService/examination/wodeshoucang-w.png | 0 packageBookService/pages/bookServices/detail/buyResource/index.wxml | 27 ++++ packageBookService/pages/bookServices/detail/buyResource/index.wxss | 34 +++++ packageBookService/pages/bookServices/detail/buyResource/index.json | 7 + packageBookService/pages/bookServices/detail/index.js | 12 + packageDomain/pages/resourceDetails/myAudio/index.wxss | 4 17 files changed, 321 insertions(+), 28 deletions(-) diff --git a/packageBookService/pages/bookServices/buyResource/index.json b/packageBookService/pages/bookServices/buyResource/index.json deleted file mode 100644 index 8835af0..0000000 --- a/packageBookService/pages/bookServices/buyResource/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/packageBookService/pages/bookServices/buyResource/index.wxss b/packageBookService/pages/bookServices/buyResource/index.wxss deleted file mode 100644 index df43765..0000000 --- a/packageBookService/pages/bookServices/buyResource/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* packageBookService/pages/bookServices/buyResource/index.wxss */ \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.js b/packageBookService/pages/bookServices/detail/buyResource/index.js index b15b4de..dc40f65 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.js +++ b/packageBookService/pages/bookServices/detail/buyResource/index.js @@ -1,18 +1,34 @@ // packageBookService/pages/bookServices/detail/buyResource/index.js +const app = getApp() Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - + barHeight: '', + navBarHeight: '', + learn: [], + openLearnids: [], + bookId: '', + loading: false, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + this.setData({ + barHeight: systInfo.statusBarHeight, + navBarHeight: navBarHeight, + bookId: options.bookId + }); + this.getResourceClass() + console.log(options); + this.getResourceData({ productLinkPath: options.productLinkPath, refCode: options.refCode }) }, /** @@ -62,5 +78,193 @@ */ onShareAppMessage() { - } + }, + goBack() { + wx.navigateBack() + }, + // 鑾峰彇鏁欏璧勬簮 浜戝涔� 浜戞祴璇� + getResourceData(type) { + this.setData({ + loading: true, + noResources: false + }) + let query = { + path: '*', + queryType: '*', + productId: this.data.bookId, + cmsPath: type.productLinkPath, + itemFields: { + SysType: 'CmsFolder', + // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁� + selectType: [], + freeFile: [], + file: [], + resourcesClassification: [], + isDownload: [], + jsek_resourceBrief: [], + jsek_link: [], + jsek_questionBank: [] + }, + pading: { + start: 0, + size: 999 + }, + } + app.MG.store + .getProductDetail(query) + .then(async (res) => { + if (!res.datas.cmsDatas[0].datas.length) { + return this.setData({ + noResources: true, + loading: false + }) + } + //鏁欏璧勬簮 浜戝涔� + if (type.refCode == 'jsek_teachingResources' || type.refCode == 'jsek_cloudLearning') { + if (res.datas.cmsDatas[0].datas.length > 0) { + res.datas.cmsDatas[0].datas.forEach(item => { + item.checked = false + }) + const list = await this.getAllResource(res.datas.cmsDatas[0].datas) + if (type.refCode == 'jsek_teachingResources') { + this.setData({ + teach: list, + loading: false + }) + this.findChildIds(this.data.teach, this.data.openTeachids = []) + } else if (type.refCode == 'jsek_cloudLearning') { + res.datas.cmsDatas[0].datas.forEach(item => { + item.checked = false + }) + const list = await this.getAllResource(res.datas.cmsDatas[0].datas) + this.setData({ + learn: list, + loading: false + }) + this.findChildIds(this.data.learn, this.data.openLearnids = []) + } + } else { + // 鏃犳暟鎹� + } + } else if (type.refCode == 'jsek_questionBank') { + // const list = await this.getAllResource(res.datas.cmsDatas[0].datas) + this.setData({ + test: res.datas.cmsDatas[0].datas, + loading: false + }) + } else { + console.log('鍏朵粬'); + } + }) + .catch((e) => { + console.log(e) + }) + }, + // 鑾峰彇tag涓嬫墍鏈夎祫婧� + async getAllResource(data) { + if (!data.length) return false + for (let i = 0; i < data.length; i++) { + let item = data[i] + if (item.sysType == 'CmsFolder' && item.childrenCount > 0) { + item.children = [] + item.children = await this.getFolderItem(item.productLinkPath) + await this.getAllResource(item.children) + } + } + return data + }, + // 鑾峰彇璧勬簮鎺ュ彛 + async getFolderItem(path) { + let query = { + path: '*', + queryType: '*', + productId: this.data.bookId, + cmsPath: path, + itemFields: { + SysType: 'CmsFolder', + // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁� + selectType: [], + freeFile: [], + file: [], + protectedFile: [], + resourcesClassification: [], + isDownload: [], + jsek_resourceBrief: [], + jsek_link: [], + accessType: [] + }, + pading: { + start: 0, + size: 999 + }, + } + const data = await app.MG.store.getProductDetail(query) + data.datas.cmsDatas[0].datas.forEach((item) => { + this.data.resourceClassList.forEach((type) => { + if (type.value == item.resourcesClassification) item.resourceClass = type.name + }) + // 缃戦〉 涓嶈兘涓嬭浇 绉佹湁鏂囦欢 + if (item.sysType == 'CmsItem') { + if (item.selectType == 'webpage') { + item.disabled = true + } else { + if (item.isDownload != 1) { + item.disabled = true + } + } + if (item.file) { + if (item.fileMap[item.file].protectType == 'Private') item.disabled = true + } + } + }) + data.datas.cmsDatas[0].datas.forEach(item => { + if (this.data.tabValue == 'jsek_teachingResources') { + item.checked = false + } else if (this.data.tabValue == 'jsek_cloudLearning') { + item.checked = false + item.isbuy = this.resourceIsBuy(item) + item.isShopCar = this.isShoppingCart(item) + } + }) + return data.datas.cmsDatas[0].datas + }, + // 鑾峰彇灞曞紑椤� + findChildIds(data, result) { + let index = 0 + for (let i = 0; i < data.length; i++) { + if (index < 3) { + const item = data[i] + if (item.childrenFolderCount > 0) { + result.push(item.id) + for (let j = 0; j < item.children.length; j++) { + if (index < 3) { + const childrenItme = item.children[j] + if (item.childrenCount > 0) { + result.push(childrenItme.id) + index += 1 + } + } else { + break + } + } + } else if (item.childrenCount > 0) { + result.push(item.id) + index += 1 + } + } else { + break + } + } + }, + // 鑾峰彇璧勬簮鎵�灞炲垎绫� + getResourceClass() { + let query = { + refCodes: ['resourcesClassification'] + } + app.MG.store.getProductTypeField(query).then((res) => { + this.setData({ + resourceClassList: JSON.parse(res[0].config).option + }) + }) + }, }) \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.json b/packageBookService/pages/bookServices/detail/buyResource/index.json index 8835af0..dcaf1f1 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.json +++ b/packageBookService/pages/bookServices/detail/buyResource/index.json @@ -1,3 +1,8 @@ { - "usingComponents": {} + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon", + "tree": "/packageBookService/pages/bookServices/detail/components/tree/index", + "t-loading": "tdesign-miniprogram/loading/loading" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.wxml b/packageBookService/pages/bookServices/detail/buyResource/index.wxml index d9089f7..e628055 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.wxml +++ b/packageBookService/pages/bookServices/detail/buyResource/index.wxml @@ -1,2 +1,27 @@ <!--packageBookService/pages/bookServices/detail/buyResource/index.wxml--> -<text>packageBookService/pages/bookServices/detail/buyResource/index.wxml</text> +<!--瀵艰埅鍖哄煙 --> +<view style="width: 100%; height: {{barHeight}}px; "></view> +<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> + <view class="flex"> + <view> + <t-icon + name="chevron-left" + size="30" + data-name="{{item}}" + bind:click="goBack" + /> + </view> + <view class="navbar-title">璧勬簮璐拱</view> + </view> + <view> 鍏ㄩ�� </view> +</view> + +<!-- 鍐呭 --> + +<view class="buy-resource" wx:if="{{!loading}}"> + <tree treeList="{{learn}}" tab="{{'jsek_cloudLearning'}}" /> +</view> + +<view class="noData" wx:if="{{loading}}"> + <t-loading size="60rpx" loading="{{loading}}" /> +</view> diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.wxss b/packageBookService/pages/bookServices/detail/buyResource/index.wxss index b2e7a58..af2f4f2 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.wxss +++ b/packageBookService/pages/bookServices/detail/buyResource/index.wxss @@ -1 +1,33 @@ -/* packageBookService/pages/bookServices/detail/buyResource/index.wxss */ \ No newline at end of file +/* packageBookService/pages/bookServices/detail/buyResource/index.wxss */ +.nacigationBar { + background-color: #fff; + display: flex; + align-items: center; + justify-content: space-between; +} + +.navbar-title { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #0F1214; + font-size: 40rpx; + font-weight: bold; +} + +.flex { + display: flex; +} + +.space-between { + justify-content: space-between; +} + +.noData { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + --td-loading-color: #ff6c00; +} \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js index 3a67e7b..ed3f0eb 100644 --- a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js +++ b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js @@ -4,7 +4,12 @@ * 缁勪欢鐨勫睘鎬у垪琛� */ properties: { - + buyResourceData: { + type: Object, + }, + bookId: { + type: Number + } }, /** @@ -27,14 +32,20 @@ } // 瑙﹀彂浜嬩欢鐨勯�夐」 this.triggerEvent('getFreeResource', myEventDetail, myEventOption) }, - allAddShoppiingCar() { - var myEventDetail = {} // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true - } // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent('allAddShoppiingCar', myEventDetail, myEventOption) + // allAddShoppiingCar() { + // var myEventDetail = {} // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + // var myEventOption = { + // bubbles: true, + // composed: true + // } // 瑙﹀彂浜嬩欢鐨勯�夐」 + // this.triggerEvent('allAddShoppiingCar', myEventDetail, myEventOption) + // }, + goBuyResource() { + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/detail/buyResource/index?productLinkPath=${this.properties.buyResourceData.productLinkPath}&refCode=${this.properties.buyResourceData.refCode}&bookId=${this.properties.bookId}`, + }) }, + changeReceive(type) { this.setData({ receive: type diff --git a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml index 0f43a52..6f9de93 100644 --- a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml +++ b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml @@ -16,10 +16,10 @@ class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx" - bind:tap="allAddShoppiingCar" + bind:tap="goBuyResource" > <image src="/static/images/bookService/detail/yijiangoumai.png" /> - 涓�閿喘涔� + 璧勬簮璐拱 </t-button> <t-button class="btn" diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 09c6555..c5976f2 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -72,7 +72,11 @@ fileType: "", md5: "", freePage: "" - }//闃呰鍣ㄦ暟鎹� + }, //闃呰鍣ㄦ暟鎹� + buyResourceData: { + productLinkPath: '', + refCode: '', + } }, @@ -490,6 +494,12 @@ if (e.detail.label == '鏁欏璧勬簮' || e.detail.label == '浜戝涔�' || e.detail.label == '浜戞祴璇�') { const checkData = this.data.cmsDatas.find(item => item.refCode == e.detail.value) if (checkData) { + if (e.detail.value == 'jsek_cloudLearning') { + this.setData({ + 'buyResourceData.productLinkPath': checkData.productLinkPath, + 'buyResourceData.refCode': checkData.refCode + }) + } if ((e.detail.value == 'jsek_teachingResources' && !this.data.teach.length) || (e.detail.value == 'jsek_cloudLearning' && !this.data.learn.length) || (e.detail.value == 'questionBank' && !this.data.test.length)) { diff --git a/packageBookService/pages/bookServices/detail/index.wxml b/packageBookService/pages/bookServices/detail/index.wxml index 9723a79..63fca54 100644 --- a/packageBookService/pages/bookServices/detail/index.wxml +++ b/packageBookService/pages/bookServices/detail/index.wxml @@ -219,6 +219,8 @@ bind:getFreeResource="getFreeResource" bind:allAddShoppiingCar="allAddShoppiingCar" id="learn-resource" + buyResourceData="{{buyResourceData}}" + bookId="{{bookDetail.id}}" ></learn-resource> <tree id="tree" diff --git a/packageBookService/pages/bookServices/examination/examination.wxml b/packageBookService/pages/bookServices/examination/examination.wxml index f1223d0..9b02607 100644 --- a/packageBookService/pages/bookServices/examination/examination.wxml +++ b/packageBookService/pages/bookServices/examination/examination.wxml @@ -22,7 +22,7 @@ /> </view> --> -<view class="page-content"> +<view class="page-content" style="background-color:{{isNight ? '#222' : ''}}"> <question-schedule wx:if="{{!loading}}" id="countDownRef" @@ -57,7 +57,7 @@ <!-- 搴曢儴鍖哄煙--> -<view class="page-bottom"> +<view class="page-bottom" style="background-color:{{isNight ? '#202020' : ''}}"> <question-options id="question-options" isNight="{{isNight}}" diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml b/packageBookService/pages/bookServices/examination/questionOptions/index.wxml index af3583d..6262100 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml +++ b/packageBookService/pages/bookServices/examination/questionOptions/index.wxml @@ -9,7 +9,7 @@ style="color: {{isNight ? '#fff' : '#000'}};" > <image - src="{{ questionDataList[currentIndex].isCollect ? '/static/images/bookService/detail/collecting.png' : '/static/images/bookService/examination/collect.png'}}" + src="{{ questionDataList[currentIndex].isCollect ? '/static/images/bookService/detail/collecting.png' : isNight ? '/static/images/bookService/examination/wodeshoucang-w.png' : '/static/images/bookService/examination/collect.png'}}" /> 鏀惰棌 </view> @@ -18,7 +18,9 @@ bind:tap="handlePopup" style="color: {{isNight ? '#fff' : '#000'}};" > - <image src="/static/images/bookService/examination/questionCard.png" /> + <image + src="{{isNight ? '/static/images/bookService/examination/datika-w.png' : '/static/images/bookService/examination/questionCard.png'}}" + /> 绛旈鍗� </view> <view @@ -26,7 +28,9 @@ bind:tap="setUpBtn" style="color: {{isNight ? '#fff' : '#000'}};" > - <image src="/static/images/bookService/examination/setting.png" /> + <image + src="{{isNight ? '/static/images/bookService/examination/setting-w.png' : '/static/images/bookService/examination/setting.png'}}" + /> 璁剧疆 </view> <view @@ -35,7 +39,9 @@ wx:if="{{answerType == 'option' || (answerType == 'mock' && !submitStatus)}}" style="color: {{isNight ? '#fff' : '#000'}};" > - <image src="/static/images/bookService/examination/reset.png" /> + <image + src="{{isNight ? '/static/images/bookService/examination/chongzuo-w.png' : '/static/images/bookService/examination/reset.png'}}" + /> 閲嶅仛 </view> <view class="bottom-submit"> diff --git a/packageBookService/pages/bookServices/examination/questionSchedule/index.js b/packageBookService/pages/bookServices/examination/questionSchedule/index.js index 0039701..903a716 100644 --- a/packageBookService/pages/bookServices/examination/questionSchedule/index.js +++ b/packageBookService/pages/bookServices/examination/questionSchedule/index.js @@ -79,6 +79,9 @@ this.setData({ percentage: (this.data.ready / this.data.questionList.length) * 100 }) + }, + 'isNight': function (newValue) { + console.log('is', newValue); } }, /** diff --git a/packageDomain/pages/resourceDetails/myAudio/index.wxss b/packageDomain/pages/resourceDetails/myAudio/index.wxss index f538b2e..7143b46 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.wxss +++ b/packageDomain/pages/resourceDetails/myAudio/index.wxss @@ -321,10 +321,6 @@ background-color: #FF6C00 !important; } -.audioIconBox { - /* margin-top: 10rpx; */ -} - .publicBtn { margin-right: 10rpx; /* margin-left: 40rpx; */ diff --git a/static/images/bookService/examination/chongzuo-w.png b/static/images/bookService/examination/chongzuo-w.png new file mode 100644 index 0000000..4e939e8 --- /dev/null +++ b/static/images/bookService/examination/chongzuo-w.png Binary files differ diff --git a/static/images/bookService/examination/datika-w.png b/static/images/bookService/examination/datika-w.png new file mode 100644 index 0000000..122620c --- /dev/null +++ b/static/images/bookService/examination/datika-w.png Binary files differ diff --git a/static/images/bookService/examination/setting-w.png b/static/images/bookService/examination/setting-w.png new file mode 100644 index 0000000..ca24d1f --- /dev/null +++ b/static/images/bookService/examination/setting-w.png Binary files differ diff --git a/static/images/bookService/examination/wodeshoucang-w.png b/static/images/bookService/examination/wodeshoucang-w.png new file mode 100644 index 0000000..647cd15 --- /dev/null +++ b/static/images/bookService/examination/wodeshoucang-w.png Binary files differ -- Gitblit v1.9.1