From 1fa826006ce5458722eb68bdbd814b08bd6baad3 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期二, 04 六月 2024 18:05:01 +0800 Subject: [PATCH] 数字教材列表 --- pages/digitalTextbooks/index.wxml | 63 ++++++ app.json | 4 pages/digitalTextbooks/digitalTextbooksDetails/index.wxml | 5 pages/digitalTextbooks/digitalTextbooksDetails/index.wxss | 1 pages/digitalTextbooks/index.json | 9 pages/digitalTextbooks/digitalTextbooksDetails/index.json | 3 pages/digitalTextbooks/index.wxss | 186 ++++++++++++++++++ packageDomain/pages/resourceDetails/myAudio/index.js | 8 pages/retrievalPage/index.wxml | 5 pages/digitalTextbooks/digitalTextbooksDetails/index.js | 66 ++++++ pages/retrievalPage/index.js | 10 pages/digitalTextbooks/index.js | 232 +++++++++++++++++++++++ 12 files changed, 587 insertions(+), 5 deletions(-) diff --git a/app.json b/app.json index f78a613..9411650 100644 --- a/app.json +++ b/app.json @@ -15,7 +15,9 @@ "pages/bookServices/assort/index", "pages/testLogin/index", "pages/bindInfo/index", - "pages/bookExhibitionList/select/select" + "pages/bookExhibitionList/select/select", + "pages/digitalTextbooks/index", + "pages/digitalTextbooks/digitalTextbooksDetails/index" ], "subPackages": [ { diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js index e0d3d9a..2e996c8 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.js +++ b/packageDomain/pages/resourceDetails/myAudio/index.js @@ -573,6 +573,8 @@ myAudio.onCanplay(() => { myAudio.duration; //蹇呴』鍐欙紝涓嶇劧鑾峰彇涓嶅埌 setTimeout(() => { + // 瑕佸垵濮嬪寲闊抽鐨勬椂闂� + // myAudio.startTime = myAudio.currentTime //寮�濮嬫椂闂� this.setData({ myAudioDuration: this.format(myAudio.duration), myAudioCurrent: this.format(myAudio.currentTime) @@ -595,16 +597,20 @@ myAudioCurrent: '00:00', myAudioPos: '', }) + + + }); //杩涘害鏉″彉鍖� myAudio.onTimeUpdate(() => { + myAudio.startTime = 0 this.setData({ myAudioPos: myAudio.currentTime / myAudio.duration * 100, myAudioCurrent: this.format(myAudio.currentTime), myAudioDuration: this.format(myAudio.duration), }); - console.log(myAudio.currentTime, myAudio.duration); + console.log(myAudio.currentTime.toFixed(3), myAudio.duration); }) }, diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.js b/pages/digitalTextbooks/digitalTextbooksDetails/index.js new file mode 100644 index 0000000..1e62a7d --- /dev/null +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.js @@ -0,0 +1,66 @@ +// pages/digitalTextbooks/digitalTextbooksDetails/index.js +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + console.log(options.id); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.json b/pages/digitalTextbooks/digitalTextbooksDetails/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.wxml b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxml new file mode 100644 index 0000000..3227377 --- /dev/null +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxml @@ -0,0 +1,5 @@ +<!--pages/digitalTextbooks/digitalTextbooksDetails/index.wxml--> +<view> + 鏁板瓧鏁欐潗璇︽儏 + +</view> \ No newline at end of file diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss new file mode 100644 index 0000000..57c9936 --- /dev/null +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss @@ -0,0 +1 @@ +/* pages/digitalTextbooks/digitalTextbooksDetails/index.wxss */ \ No newline at end of file diff --git a/pages/digitalTextbooks/index.js b/pages/digitalTextbooks/index.js new file mode 100644 index 0000000..b3e1e93 --- /dev/null +++ b/pages/digitalTextbooks/index.js @@ -0,0 +1,232 @@ +// pages/digitalTextbooks/digitalTextbooks.js +const app = getApp() +import { + getPublicImage +} from "../../assets/js/middleGround/tool"; +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + barHeight: "", + navBarHeight: "", + searchValue: "", + tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', + tabList: [], + selectedIndex: 0, + digitalTextbooksData: [], + path: "jsek_dTHigherEducation", + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + 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, + }); + this.getCourseTypeListList() + this.bookExhibitionGet() + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + }, + //鏂板姞鐨勫嚱鏁� + + getCourseTypeListList() { + const data = { + path: '*', + filterList: [{ + value: 'Normal', + field: 'state' + }], + queryType: '\\', + searchList: [], + size: '20', + start: '0', + storeRefCode: app.config.digitalTextbooks, + sort: { + type: 'Asc', + field: 'LinkOrder' + } + } + app.MG.store.getStoreChannelList(data).then((res) => { + // 鍘婚櫎鏁扮粍鏈�鍚庝竴涓厓绱� + const newData = res.datas.slice(0, res.datas.length - 1) + + // 閬嶅巻鏁扮粍骞舵坊鍔犳柊鐨勫睘鎬� + newData.forEach((item) => { + item.titleIcon = getPublicImage(item.icon, '', '160') + }) + + this.setData({ + tabList: newData + }) + console.log(this.data.tabList); + + }) + }, + + + + + goBack() { + wx.navigateBack(); + }, + + selectTab(e) { + // console.log(index); + let index = e.currentTarget.dataset.index + console.log(index); + this.setData({ + selectedIndex: index + }) + + if (index == 0) { + this.setData({ + path: this.data.tabList[0].refCode + }) + + } else if (index == 1) { + this.setData({ + path: this.data.tabList[1].refCode + }) + + } else if (index == 2) { + this.setData({ + path: this.data.tabList[2].refCode + }) + + } else if (index == 3) { + this.setData({ + path: this.data.tabList[3].refCode + }) + + } + this.bookExhibitionGet() + + }, + // 鑾峰彇鍥剧墖鏂囧瓧鍒楄〃 + bookExhibitionGet(keyword) { + // console.log(path.value, '456') + + // loading.value = true + let searchObj = {} + // let sort = {} + // 鎼滅储妗� + if (keyword) { + searchObj = { + 'Name*': keyword.trim(), + '||subtitle*': keyword.trim() + } + } + + // if (timeSort.value) { + // sort = { + // CreateDate: timeSort.value || 'Desc' + // } + // } else { + // sort = { + // ViewCount: nameSort.value || 'Desc' + + // } + // // 缁勫悎鐨勫啓娉� 瑕佹煡璇㈢殑瀛楁:鍗囧簭鍜岄檷搴� + + // // Name: "Desc" + // //涓�鑸殑鎺掑簭浼犳硶 + // // type: "Asc", + // // field: "CreateDate", + // } + app.MG.store + .getProductList({ + storeInfo: 'jsek_digitalTextbooks', + path: this.data.path, + queryType: '*', + paging: { + start: 0, + size: 99 + }, + // sort: sort, + fields: { + content: [], + subtitle: [], + backgroundSelection: [], + author: [], + viewCount: [], + ...searchObj + } + }) + .then((res) => { + this.setData({ + digitalTextbooksData: res.datas + }) + console.log(this.data.digitalTextbooksData); + }) + }, + searchBook: function (e) { + const keyword = e.detail.value; + this.bookExhibitionGet(keyword) + }, + jumpDetails(e) { + const item = e.currentTarget.dataset.item + console.log(item); + // 鍦ㄦ煇涓簨浠跺鐞嗗嚱鏁颁腑锛屾瘮濡傛寜閽殑鐐瑰嚮浜嬩欢 + wx.navigateTo({ + url: '/pages/digitalTextbooks/digitalTextbooksDetails/index?id=' + item.id + }); + + } +}) \ No newline at end of file diff --git a/pages/digitalTextbooks/index.json b/pages/digitalTextbooks/index.json new file mode 100644 index 0000000..68f7bd2 --- /dev/null +++ b/pages/digitalTextbooks/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon", + "t-search": "tdesign-miniprogram/search/search", + "t-empty": "tdesign-miniprogram/empty/empty" + }, + "navigationStyle": "custom", + "disableScroll": false +} \ No newline at end of file diff --git a/pages/digitalTextbooks/index.wxml b/pages/digitalTextbooks/index.wxml new file mode 100644 index 0000000..94baf84 --- /dev/null +++ b/pages/digitalTextbooks/index.wxml @@ -0,0 +1,63 @@ +<!--pages/digitalTextbooks/digitalTextbooks.wxml--> + +<view class="fixed-header"> + <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> + <t-search model:value="{{searchValue}}" shape="round" placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" class="navBar-search" style="width: 464rpx" bind:submit="searchBook" /> + </view> + + + + <view class="tabBox"> + <view wx:for="{{tabList}}" wx:key="index" wx:for-item="item" wx:for-index="index" class="{{selectedIndex == index? 'nameBox' :''}}" data-index="{{index}}" bind:tap="selectTab"> + <view> + {{item.name}} + </view> + <view style="margin-top: 20rpx; " class="{{selectedIndex == index? 'bottomLineBox' :''}}"></view> + </view> + </view> + +</view> + + + +<view class="contentBox"> + + <view class="titleBox"> + <view class="frameBox"></view> + <view class="titleTextBox"> + <!-- <image src="/static/images/bookExhibitionList/zhuantitaolun.png" mode="aspectFit" /> --> + + <view>鏁板瓧鏁欐潗鍒楄〃</view> + </view> + </view> + + + + <view class="bookContentBox"> + <view class="external" wx:for="{{digitalTextbooksData}}" wx:key="index" wx:for-item="item" wx:for-index="index" data-item="{{item}}" bind:tap="jumpDetails"> + <view class="amountClick"> + <t-icon name="browse" size="15" data-name="{{item}}" bind:click="goBack" /> + <view>{{item.viewCount}}</view> + </view> + <view class="imageBox"> + <image src="{{item.icon ? item.icon : '/static/images/default-book-img.png'}}" mode="" /> + </view> + <view class="bookName">{{item.name}}</view> + <view class="information"> + <view wx:if="{{item.author}}" class="book-author"> + {{ item.author }} + </view> + <view wx:else>-</view> + <view wx:if="{{item.price == 0}}" class="price"> 鍏嶈垂</view> + <view wx:else class="price">锟{ item.price }}</view> + </view> + </view> + <view wx:if="{{!digitalTextbooksData.length }}" class="noData"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/digitalTextbooks/index.wxss b/pages/digitalTextbooks/index.wxss new file mode 100644 index 0000000..41e8c87 --- /dev/null +++ b/pages/digitalTextbooks/index.wxss @@ -0,0 +1,186 @@ +/* pages/digitalTextbooks/index.wxss */ + +.nacigationBar { + display: flex; + align-items: center; + --td-search-font-size: 28rpx; + margin-bottom: 30rpx; +} + + +.nacigationBar .t-icon-base { + font-size: 38rpx; +} + +.t-search__input-box { + height: var(--td-search-height, 70rpx) !important; +} + +.t-icon { + font-family: t !important; +} + + + + + +.tabBox { + display: flex; + flex-direction: row; + justify-content: space-around; + width: 750rpx; + overflow-x: auto; + /* 娣诲姞姘村钩婊氬姩鏉� */ + white-space: nowrap; + /* 淇濇寔瀛愬厓绱犲湪涓�琛屾樉绀� */ + +} + +.tabBox .nameBox { + color: #FF6C00; + height: 70rpx; + /* border-bottom: 1px solid #FF6C00; */ +} + +.bottomLineBox { + height: 5rpx; + width: 50rpx; + background-color: #FF6C00; + margin: 0 auto; +} + +.contentBox { + background-color: #F2F3F8; + height: 100%; + margin-top: 268rpx; +} + +.titleBox { + display: flex; + align-items: center; + margin: 10px; + margin-left: 0; + padding-top: 30rpx; +} + +.frameBox { + width: 7rpx; + height: 54rpx; + background: #FF6C00; + border-radius: 0rpx 9rpx 9rpx 0rpx; +} + +.titleTextBox { + margin-left: 15px; + min-width: 180rpx; + min-height: 36rpx; + /*瀹� 3.7 楂�1 */ +} + +.titleTextBox image { + width: 100%; + height: 100%; + image-rendering: -webkit-optimize-contrast; +} + +.bookContentBox { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; + margin: 20rpx; +} + +.external { + width: 300rpx; + min-height: 520rpx; + background-color: #fff; + margin: 30rpx 10rpx; + box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16); + padding: 15rpx; +} + +.imageBox { + width: 210rpx; + height: 290rpx; + margin: 30rpx auto; + box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16); +} + +image { + width: 100%; + height: 100%; +} + +.amountClick { + display: flex; + flex-direction: row; + justify-content: flex-end; + align-items: center; + font-size: 30rpx; + +} + +.information { + display: flex; + flex-direction: row; + justify-content: space-between; + margin: 0 20rpx; +} + +.bookName { + margin: 0 20rpx; + height: 75rpx; + color: #333; + width: 100%; + font-size: 28rpx; + font-weight: 700; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + text-align: left; +} + +.book-author { + color: #333; + margin: 16rpx 0; + font-size: 24rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-align: left; +} + +.price { + color: #FF6C00; + margin: 16rpx 0; + font-size: 24rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-align: left; +} + +.noData { + margin: 0 auto; + margin-top: 100rpx; +} + +/* 鍥哄畾鍦ㄩ《閮ㄧ殑鐩掑瓙鏍峰紡 */ +.fixed-header { + position: fixed; + /* 鍥哄畾瀹氫綅 */ + top: 0; + /* 璺濈椤堕儴0px */ + left: 0; + /* 璺濈宸︿晶0px */ + width: 100%; + /* 瀹藉害涓�100%锛屽彲鏍规嵁闇�瑕佽皟鏁� */ + background-color: #ffffff; + /* 鑳屾櫙棰滆壊锛屽彲鏍规嵁闇�瑕佽皟鏁� */ + z-index: 999; + /* 纭繚鐩掑瓙鍦ㄩ〉闈㈠叾浠栧厓绱犵殑涓婃柟 */ + /* 鍏朵粬鏍峰紡锛屽padding銆乥ox-shadow绛� */ +} \ No newline at end of file diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js index 720521c..36d58a7 100644 --- a/pages/retrievalPage/index.js +++ b/pages/retrievalPage/index.js @@ -38,7 +38,8 @@ page: 1, total: 0, }, - tabValue: '0' + tabValue: '0', + tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', }, /** @@ -554,6 +555,7 @@ * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom(e) { + console.log(this.data.tabValue); if (this.data.tabValue == 0) { console.log(0); if (this.data.bookData.length < this.data.bookTotal) { @@ -867,4 +869,10 @@ } } }, + onTabsClick(event) { + console.log(`Click tab, tab-panel value is ${event.detail.value}.`); + }, + tabClick() { + console.log(2323); + } }) \ No newline at end of file diff --git a/pages/retrievalPage/index.wxml b/pages/retrievalPage/index.wxml index e7562ba..fbcff18 100644 --- a/pages/retrievalPage/index.wxml +++ b/pages/retrievalPage/index.wxml @@ -12,8 +12,9 @@ <view class="tabsBox"> <!-- sticky="true" --> - <t-tabs defaultValue="{{0}}" value="{{tabValue}}" bind:change="onTabsChange" t-class="custom-tabs" t-class-content="custom-panel"> - <t-tab-panel label="鍥句功({{bookTotal}})" value="0"> + <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> + + <t-tab-panel label="鍥句功({{bookTotal}})" value="0" style="{{tabPanelstyle}}" bind:tap="tabClick"> <view wx:if="{{bookData.length <= 0}}" class="noDataBox"> <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> </view> -- Gitblit v1.9.1