From 7802b0bddaccecd066e2838e0b977ef0c2052abd Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期四, 29 二月 2024 21:26:08 +0800 Subject: [PATCH] feat: 图书服务 --- pages/bookServices/detail/components/brief/index.json | 6 app.wxss | 2 static/images/bookService/detail/collecting.png | 0 static/images/bookService/assort/book-img.png | 0 pages/bookServices/list/index.wxss | 115 +++ style/theme.wxss | 3 pages/bookServices/list/index.wxml | 74 ++ pages/bookServices/assort/index.js | 178 +++++ pages/bookServices/detail/components/brief/index.js | 12 static/images/bookService/detail/ebook.png | 0 services/home/home.js | 20 pages/bookServices/list/index.js | 397 +++++++++++++ app.js | 8 pages/bookServices/detail/index.js | 246 ++++++++ static/images/bookService/detail/paper-price.png | 0 pages/bookServices/assort/index.wxml | 76 ++ pages/bookServices/assort/index.wxss | 129 ++++ static/images/bookService/detail/book-brief.png | 0 static/images/bookService/detail/collect.png | 0 static/images/bookService/detail/electon-price.png | 0 static/images/bookService/detail/author.png | 0 pages/bookServices/detail/index.wxml | 162 +++++ pages/bookServices/detail/index.wxss | 218 +++++++ static/images/bookService/detail/paper-book.png | 0 pages/bookServices/list/index.json | 10 static/images/bookService/detail/suggest.png | 0 static/images/bookService/detail/dangdang.png | 0 static/images/bookService/detail/tmall.png | 0 custom-tab-bar/data.js | 2 app.json | 12 pages/bookServices/detail/components/brief/index.wxml | 26 /dev/null | 1 pages/bookServices/detail/components/brief/index.wxss | 23 pages/bookServices/detail/index.json | 10 static/images/bookService/detail/jd.png | 0 pages/bookServices/assort/index.json | 17 static/images/bookService/detail/label.png | 0 37 files changed, 1,723 insertions(+), 24 deletions(-) diff --git a/app.js b/app.js index 09258b6..8b530a9 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,10 @@ import updateManager from './common/updateManager'; -import MG from './assets/js/middleGround/WebMiddleGroundApi' +import MG from './assets/js/middleGround/WebMiddleGroundApi'; +import config from './assets/js/config'; App({ - MG:MG, - onLaunch: function () { }, + MG: MG, + config: config, + onLaunch: function () {}, onShow: function () { updateManager(); }, diff --git a/app.json b/app.json index 252d23e..abba3f6 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,8 @@ { "pages": [ "pages/home/home", - "pages/bookServices/index", + "pages/bookServices/assort/index", + "pages/bookServices/detail/index", "pages/usercenter/index", "pages/usercenter/person-info/index", "pages/usercenter/address/list/index", @@ -43,7 +44,7 @@ "text": "棣栭〉" }, { - "pagePath": "pages/bookServices/index", + "pagePath": "pages/bookServices/assort/index", "text": "鍥句功鏈嶅姟" }, { @@ -60,10 +61,7 @@ } ] }, - "requiredPrivateInfos": [ - "chooseAddress" - ], - "lazyCodeLoading": "requiredComponents", + "requiredPrivateInfos": ["chooseAddress"], "usingComponents": {}, "window": { "backgroundTextStyle": "light", @@ -77,4 +75,4 @@ "desc": "浣犵殑浣嶇疆淇℃伅灏嗙敤浜庡皬绋嬪簭浣嶇疆鎺ュ彛鐨勬晥鏋滃睍绀�" } } -} \ No newline at end of file +} diff --git a/app.wxss b/app.wxss index 9ff2554..66a6b86 100644 --- a/app.wxss +++ b/app.wxss @@ -1,3 +1,3 @@ @import 'style/iconfont.wxss'; -@import 'style/theme.wxss'; \ No newline at end of file +@import 'style/theme.wxss'; diff --git a/custom-tab-bar/data.js b/custom-tab-bar/data.js index 023a451..c6a4cb9 100644 --- a/custom-tab-bar/data.js +++ b/custom-tab-bar/data.js @@ -7,7 +7,7 @@ { icon: 'sort', text: '鍥句功鏈嶅姟', - url: 'pages/bookServices/index' + url: 'pages/bookServices/assort/index', }, { icon: 'sort', diff --git a/pages/bookServices/assort/index.js b/pages/bookServices/assort/index.js new file mode 100644 index 0000000..024fe3d --- /dev/null +++ b/pages/bookServices/assort/index.js @@ -0,0 +1,178 @@ +// pages/bookServices/assort/index.js +const app = getApp(); +Page({ + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + assortList: [], + assortCheck: { + name: '', + code: '', + }, + startList: [], + startCheck: '', + bookList: [], + listLoding: false, + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + // this.getAssortList() + console.log(options); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + this.getAssortList(); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() {}, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() {}, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() {}, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() {}, + + // 鑾峰彇渚ц竟鏍忓垪琛� + getAssortList() { + const query = { + path: '*', + filterList: [ + { + value: 'Normal', + field: 'state', + }, + ], + queryType: '\\', + searchList: [], + size: '30', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' }, + }; + app.MG.store.getStoreChannelList(query).then((res) => { + const list = res.datas.filter((item) => item.refCode != 'jsek_homepageBookService'); + this.setData({ + assortList: list, + }); + this.setData({ + assortCheck: { + name: res.datas[0].name, + code: res.datas[0].refCode, + }, + }); + this.getStairList(res.datas[0].refCode); + }); + }, + // 渚ц竟鏍忓垏鎹� + changeAssort(data) { + this.setData({ + assortCheck: { + name: data.detail.label, + code: data.detail.value, + }, + }); + this.getStairList(data.detail.value); + }, + // 鑾峰彇涓�绾у垎绫� + getStairList(path) { + this.setData({ + listLoding: true, + }); + const query = { + path, + filterList: [], + queryType: '\\', + searchList: [], + size: '30', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' }, + }; + app.MG.store.getStoreChannelList(query).then(async (res) => { + // 涓�绾у垎绫婚�変腑 + this.setData({ + startCheck: res.datas[0].refCode, + }); + // 鑾峰彇浜岀骇鍒嗙被 + for (let index = 0; index < res.datas.length; index++) { + const item = res.datas[index]; + item.children = await this.getSecondList(item); + } + // 涓�绾у垎绫昏祴鍊� + this.setData({ + startList: res.datas, + }); + }); + this.setData({ + listLoding: false, + }); + }, + + // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被 + async getSecondList(tab) { + const path = `${this.data.assortCheck.code}\\${tab.refCode}`; + let datas; + const query = { + path, + filterList: [], + queryType: '\\', + searchList: [], + size: '30', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' }, + }; + await app.MG.store.getStoreChannelList(query).then((res) => { + datas = res.datas; + }); + return datas; + }, + tabClick(tabData) { + const data = tabData.currentTarget.dataset.tabdata; + this.setData({ + startCheck: data.refCode, + }); + }, + // 璺宠浆鍒楄〃椤� + goPageList(item) { + const secondCode = `${item.currentTarget.dataset.staircode.pathLinks[0].linkPath}\\${item.currentTarget.dataset.staircode.id}`; + wx.navigateTo({ + url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&secondCode=${secondCode}`, + }); + }, + navToSearchPage(e) { + console.log(e.detail.value); + wx.navigateTo({ + url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&searchValue=${e.detail.value}`, + }); + }, +}); diff --git a/pages/bookServices/assort/index.json b/pages/bookServices/assort/index.json new file mode 100644 index 0000000..56ee96c --- /dev/null +++ b/pages/bookServices/assort/index.json @@ -0,0 +1,17 @@ +{ + "navigationBarTitleText": "鍥句功鏈嶅姟", + "onReachBottomDistance": 10, + "backgroundTextStyle": "light", + "enablePullDownRefresh": true, + "usingComponents": { + "t-search": "tdesign-miniprogram/search/search", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-side-bar": "tdesign-miniprogram/side-bar/side-bar", + "t-side-bar-item": "tdesign-miniprogram/side-bar-item/side-bar-item", + "t-radio": "tdesign-miniprogram/radio/radio", + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-button": "tdesign-miniprogram/button/button", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-image": "/components/webp-image/index" + } +} diff --git a/pages/bookServices/assort/index.wxml b/pages/bookServices/assort/index.wxml new file mode 100644 index 0000000..bd6d2dd --- /dev/null +++ b/pages/bookServices/assort/index.wxml @@ -0,0 +1,76 @@ +<!--鍥句功鏈嶅姟鍒嗙被--> +<view class="page-header"> + <!-- 鎼滅储妗� --> + <view class="search"> + <t-search + t-class-input="t-search__input" + t-class-input-container="t-search__input-container" + placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" + leftIcon="" + bind:submit="navToSearchPage" + > + <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" /> + </t-search> + </view> +</view> + +<view class="page-container"> + <view class="side-bar-wrapper"> + <view class="tab-left"> + <t-side-bar value="{{assortCheck.code}}" bind:change="changeAssort"> + <t-side-bar-item + wx:for="{{assortList}}" + wx:key="id" + value="{{item.refCode}}" + label="{{item.name}}" + badge-props="{{item.badgeProps}}" + /> + </t-side-bar> + </view> + <view class="side-bar-content"> + <!-- 涓�绾у垎绫� --> + <view class="tab-top"> + <scroll-view scroll-x="{{true}}" class="myScroll"> + <view + wx:for="{{startList}}" + wx:key="id" + class="row {{startCheck == item.refCode ? 'tab-active' : ''}}" + bind:tap="tabClick" + data-tabData="{{item}}" + wx:if="{{item.children.length}}" + >{{item.name}}</view + > + </scroll-view> + </view> + <!-- 鍐呭 --> + <scroll-view scroll-y="{{true}}" class="class-list" scroll-into-view="{{startCheck}}"> + <view wx:if="{{listLoading}}"> + <t-loading theme="spinner" size="400rpx" loading="{{listLoading}}"></t-loading> + </view> + <view + wx:for="{{startList}}" + wx:for-item="item" + wx:key="item.refCode" + id="{{item.refCode}}" + class="class-box" + wx:if="{{item.children.length && !listLoading}}" + > + <view class="class-name">{{item.name}}</view> + <view class="class-content"> + <view + wx:for="{{item.children}}" + wx:for-item="citem" + wx:key="id" + class="book-box" + bind:tap="goPageList" + data-stairCode="{{citem}}" + > + <t-image src="/static/images/bookService/assort/book-img.png" mode="heightFix" width="58" height="72" /> + <view class="classify">{{citem.name}}</view> + </view> + </view> + </view> + </scroll-view> + </view> + </view> +</view> diff --git a/pages/bookServices/assort/index.wxss b/pages/bookServices/assort/index.wxss new file mode 100644 index 0000000..3c71ffe --- /dev/null +++ b/pages/bookServices/assort/index.wxss @@ -0,0 +1,129 @@ +page { + box-sizing: border-box; + padding-bottom: calc(env(safe-area-inset-bottom) + 96rpx); +} + +.page-header { + position: relative; +} + +.search { + position: absolute; + top: 20rpx; + left: 0; + width: 100%; + z-index: 99; +} + +.page-header .t-search__input-container { + border-radius: 15rpx !important; + margin: 0 24rpx; + height: 64rpx !important; +} + +.page-container { + padding: 120rpx 0 20rpx 0; + width: 100%; +} + +.side-bar-wrapper { + background-color: #f2f3f8; + display: flex; +} + +.side-bar-content { + width: 70%; + padding: 0 20rpx; +} + +.tab-left { + --td-side-bar-font-size: 14px; + /* 閫変腑鏂囧瓧棰滆壊 */ + --td-side-bar-active-color: #ff6c00; + /* 鏁翠綋鑳屾櫙 */ + --td-side-bar-bg-color: #fff; + /* 閫変腑鑳屾櫙 */ + --td-bg-color-container: #f2f3f8; + /* 鏈�変腑鏂囧瓧棰滆壊 */ + --td-side-bar-color: '#333' +} + +.tab-top { + overflow-x: scroll; +} + +.tab-active { + background-color: #ff6c00 !important; + color: #fff; +} + +.myScroll { + /* 鐩掑瓙鐨勬牱寮� */ + width: 100%; + height: 98rpx; + white-space: nowrap; +} + +.myScroll .row { + font-size: 14px; + padding: 10rpx 14rpx; + margin: 20rpx 0; + border-radius: 10rpx; + /* 瀹氫箟姣忎釜瀛愪欢 */ + height: 40rpx; + background: #fff; + margin-right: 20rpx; + display: inline-block; +} + +.myScroll .row:last-child { + /* 閫夋嫨鏈�鍚庝竴涓瓙浠� 娓呴浂杈硅窛 */ + margin-right: 0; +} + +.class-list { + /* overflow-y: auto; */ + height: 72.5vh; + width: 262px; +} + +.class-box { + background-color: #fff; + margin-bottom: 10rpx; + padding: 10rpx 12rpx; + border-radius: 12rpx; + /* height: 60rpx; */ +} + +.class-name { + font-size: 32rpx; + font-weight: 700; +} + +.class-content { + display: flex; + flex-wrap: wrap; + padding: 5rpx 20rpx 30rpx 30rpx; +} + +.book-box { + width: 140rpx; + margin-right: 10rpx; +} + +.book-box:nth-child(3n) { + margin-right: 0; +} + +.book-box image { + width: 58px; + height: 70px; +} + +.classify { + max-width: 90%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-size: 14px; +} \ No newline at end of file diff --git a/pages/bookServices/detail/components/brief/index.js b/pages/bookServices/detail/components/brief/index.js new file mode 100644 index 0000000..4eeb653 --- /dev/null +++ b/pages/bookServices/detail/components/brief/index.js @@ -0,0 +1,12 @@ +Component({ + properties: { + content: { + type: String, + value: '', + }, + authorIntroduction: { + type: String, + value: '', + }, + }, +}); diff --git a/pages/bookServices/detail/components/brief/index.json b/pages/bookServices/detail/components/brief/index.json new file mode 100644 index 0000000..7d15281 --- /dev/null +++ b/pages/bookServices/detail/components/brief/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "t-image": "tdesign-miniprogram/image/image" + }, + "component": true +} diff --git a/pages/bookServices/detail/components/brief/index.wxml b/pages/bookServices/detail/components/brief/index.wxml new file mode 100644 index 0000000..77b7c89 --- /dev/null +++ b/pages/bookServices/detail/components/brief/index.wxml @@ -0,0 +1,26 @@ +<view class="message"> + <view class="basic"> + <view class="basic-title"> + <view> + <t-image src="/static/images/bookService/detail/label.png"></t-image> + </view> + <view class="title-name">鍩烘湰淇℃伅</view> + </view> + <rich-text + nodes="{{content}}" + style="font-size: 28rpx; color: #333; line-height: 48rpx; text-align: justify" + ></rich-text> + </view> + <view class="basic"> + <view class="basic-title"> + <view> + <t-image src="/static/images/bookService/detail/author.png"></t-image> + </view> + <view class="title-name">浣滆�呯畝浠�</view> + </view> + </view> + <rich-text + nodes="{{authorIntroduction}}" + style="font-size: 28rpx; color: #333; line-height: 48rpx; text-align: justify" + /> +</view> diff --git a/pages/bookServices/detail/components/brief/index.wxss b/pages/bookServices/detail/components/brief/index.wxss new file mode 100644 index 0000000..57980bf --- /dev/null +++ b/pages/bookServices/detail/components/brief/index.wxss @@ -0,0 +1,23 @@ +/* pages/bookServices/detail/components/brief/index.wxss */ +.message { + padding: 0 40rpx 40rpx 40rpx; +} + +.message image { + width: 42rpx; + height: 48rpx; +} + +.basic-title { + margin-top: 40rpx; + display: flex; + align-items: center; + margin-bottom: 24rpx; +} + +.title-name { + margin-left: 18rpx; + font-size: 32rpx; + color: #333; + font-weight: bold; +} \ No newline at end of file diff --git a/pages/bookServices/detail/index.js b/pages/bookServices/detail/index.js new file mode 100644 index 0000000..324478a --- /dev/null +++ b/pages/bookServices/detail/index.js @@ -0,0 +1,246 @@ +// pages/bookServices/detail/index.js +import Message from 'tdesign-miniprogram/message/index'; +const app = getApp(); +Page({ + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + barHeight: '', + navBarHeight: '', + options: { + id: '', + name: '', + }, + bookDetail: {}, + link: { + jd: '', + tamll: '', + dang: '', + micro: '', + }, + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + 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.setData({ + options: { + id: options.id, + name: options.name, + }, + }); + this.getBookInfo(options.id); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() {}, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() {}, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() {}, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() {}, + // 鏍煎紡鍖栨棩鏈� + formatDate(dateString) { + if (!dateString) { + return 'Invalid date'; + } + const match = dateString.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/); + if (!match) { + throw new Error('Invalid date format'); + } + + const [, year, month, day, hours, minutes, seconds] = match; + const date = new Date( + parseInt(year, 10), + parseInt(month, 10) - 1, + parseInt(day, 10), + parseInt(hours, 10), + parseInt(minutes, 10), + parseInt(seconds, 10), + ); + + if (isNaN(date.getTime())) { + throw new Error('Invalid date'); + } + + // 鐢变簬灏忕▼搴忕幆澧冨彲鑳戒笉鏀寔 Intl.DateTimeFormat锛屾垜浠娇鐢ㄧ畝鍖栫殑鏍煎紡鍖栨柟娉� + const formatted = `${year}骞�${this.formatMonth(month)}`; + return formatted; + }, + // 绠�鍖栫殑鏈堜唤鏍煎紡鍖栧嚱鏁帮紝杩斿洖鏈堜唤鐨勪腑鏂囪〃杈� + formatMonth(month) { + const months = ['1鏈�', '2鏈�', '3鏈�', '4鏈�', '5鏈�', '6鏈�', '7鏈�', '8鏈�', '9鏈�', '10鏈�', '11鏈�', '12鏈�']; + return months[parseInt(month, 10) - 1]; + }, + // 閲戦鏄剧ず.00鏍煎紡 + numFormat(value) { + if (!value) return '0.00'; + value = Number(value).toFixed(2); + var intPart = Math.trunc(value); // 鑾峰彇鏁存暟閮ㄥ垎 + var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); // 灏嗘暣鏁伴儴鍒嗛�笁涓�鏂� + var floatPart = '.00'; // 棰勫畾涔夊皬鏁伴儴鍒� + var value2Array = value.split('.'); + // =2琛ㄧず鏁版嵁鏈夊皬鏁颁綅 + if (value2Array.length === 2) { + floatPart = value2Array[1].toString(); // 鎷垮埌灏忔暟閮ㄥ垎 + if (floatPart.length === 1) { + return `${intPartFormat}.${floatPart}0`; + } + return `${intPartFormat}.${floatPart}`; + } + return intPartFormat + floatPart; + }, + // 杩斿洖 + goBack() { + wx.navigateBack(); + }, + // 鑾峰彇鍥句功璇︽儏 + getBookInfo(id) { + const query = { + path: '*', + queryType: '*', + productId: id, + favoriteTypes: 'FavoriteBookCity', + itemFields: { + 'SysType=': 'CmsFolder', + }, + coverSize: { + height: 300, + }, + fields: { + seriesName: [], + author: [], + isbn: [], + publicationDate: [], + bookClassification: [], + paperPrice: [], + JDLink: [], + tmallLink: [], + dangdangLink: [], + weidianLink: [], + content: [], + authorIntroduction: [], + // isApplyPaperBook: [], + // isApplyEBook: [], + isApplyBook: [], + isSell: [], + pdf: [], + protectedEpub: [], + probationPage: [], //pdf璇曡椤垫暟 + freeEpubPage: [], //epub璇曡鐧惧垎姣� + }, + }; + app.MG.store.getProductDetail(query).then((res) => { + this.setData({ + bookDetail: res.datas, + }); + console.log('璇︽儏', res.datas); + // 鑾峰彇鍥句功鍒嗙被 + const iconType = JSON.parse(res.datas.bookClassification)[0][0]; + const classType = JSON.parse(res.datas.bookClassification)[0][1]; + this.setData({ + 'bookDetail.publicationDate': this.formatDate(this.data.bookDetail.publicationDate), + 'bookDetail.class': this.getBookClass(iconType, classType), + 'bookDetail.price': this.numFormat(this.data.bookDetail.price), + 'bookDetail.oldPrice': this.numFormat(this.data.bookDetail.oldPrice), + 'bookDetail.paperPrice': this.numFormat(this.data.bookDetail.paperPrice), + }); + }); + }, + // 鑾峰彇鍥句功鍒嗙被 + getBookClass(iconType, classType) { + let name = ''; + const query = { + refCodes: ['bookClassification'], + }; + app.MG.store.getProductTypeField(query).then((res) => { + JSON.parse(res[0].config).option.forEach((item) => { + if (item.value == iconType) { + item.child.forEach((item) => { + if (item.value == classType) { + name = item.name; + } + }); + } + }); + }); + return name; + }, + // 鏀惰棌 + setCollect() { + if (this.data.bookDetail.isFavourite) { + app.MG.store + .delProductLink({ + productIds: [this.data.bookDetail.id], + linkType: 'FavoriteBookCity', + }) + .then(() => { + this.data.bookDetail.isFavourite = false; + Message.success({ + context: this, + offset: ['20rpx', '32rpx'], + duration: 2000, + content: '鍙栨秷鏀惰棌', + }); + }); + } else { + const params = { + productIds: [this.data.bookDetail.id], + linkType: 'FavoriteBookCity', + }; + app.MG.store.addProductLink(params).then((res) => { + console.log(res); + this.data.bookDetail.isFavourite = true; + Message.success({ + context: this, + offset: ['20rpx', '32rpx'], + duration: 2000, + content: '鏀惰棌鎴愬姛', + }); + }); + } + }, + // 璺宠浆缃戝簵 + goShop(e) { + const { link } = e.currentTarget.dataset; + wx.navigateTo({ + url: link, + }); + }, +}); diff --git a/pages/bookServices/detail/index.json b/pages/bookServices/detail/index.json new file mode 100644 index 0000000..09e62ae --- /dev/null +++ b/pages/bookServices/detail/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon", + "t-image": "tdesign-miniprogram/image/image", + "t-tabs": "tdesign-miniprogram/tabs/tabs", + "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", + "book-brief": "/pages/bookServices/detail/components/brief/index" + }, + "navigationStyle": "custom" +} diff --git a/pages/bookServices/detail/index.wxml b/pages/bookServices/detail/index.wxml new file mode 100644 index 0000000..9788ffb --- /dev/null +++ b/pages/bookServices/detail/index.wxml @@ -0,0 +1,162 @@ +<!--pages/bookServices/detail/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> + <view class="navbar-title">{{options.name}}</view> +</view> +<scroll-view scroll-y="{{true}}" class="book"> + <!-- 鍥句功璇︽儏 --> + <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}}" + /> + </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> + </view> + <view>鏀惰棌</view> + </view> + <view class="suggest"> + <view> + <t-image src="/static/images/bookService/detail/suggest.png"></t-image> + </view> + <view>鎴戣寤鸿</view> + </view> + </view> + </view> + <view class="detail-right"> + <view class="book-name">{{bookDetail.name}}</view> + <view class="book-message"> + <view class="message-li"> + <view class="li-title">涓涗功鍚嶏細</view> + <view class="li-content">{{bookDetail.seriesName}}</view> + </view> + <view class="message-li"> + <view class="li-title">浣滆�咃細</view> + <view class="li-content">{{bookDetail.author}}</view> + </view> + <view class="message-li"> + <view class="li-title">ISBN锛�</view> + <view class="li-content">{{bookDetail.isbn}}</view> + </view> + <view class="message-li"> + <view class="li-title">鍑虹増鏃堕棿锛�</view> + <view class="li-content">{{bookDetail.publicationDate}}</view> + </view> + <view class="message-li"> + <view class="li-title">鍥句功鍒嗙被锛�</view> + <view class="li-content">{{bookDetail.class}}</view> + </view> + </view> + </view> + </view> + <!-- 閿�鍞俊鎭� --> + <view class="book-sale"> + <view class="book-price"> + <!-- 鐢靛瓙涔﹀敭浠� --> + <view class="electron-price"> + <view> + <t-image src="/static/images/bookService/detail/electon-price.png"></t-image> + </view> + <view class="price"> + <view>楼{{bookDetail.price}}</view> + <view class="price-old">楼{{bookDetail.oldPrice}} <view class="line"></view> </view> + </view> + <view> </view> + </view> + <!-- 绾歌川涔﹀敭浠� --> + <view class="paper-price"> + <view> + <t-image src="/static/images/bookService/detail/paper-price.png"></t-image> + </view> + <view class="price">楼{{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> + </view> + </view> + </view> + <view class="book-resource"> + <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}}"> + <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="2" style="{{tabPanelstyle}}">閫夐」涓夊唴瀹�</t-tab-panel> + <t-tab-panel label="浜戞祴璇�" value="3" style="{{tabPanelstyle}}">閫夐」鍥涘唴瀹�</t-tab-panel> + </t-tabs> + </view> + <!-- 璐拱鎸夐挳 --> + <view class="box-bottom"> + <view class="bottom-btn"> + <view> + <t-image src="/static/images/bookService/detail/ebook.png"></t-image> + </view> + <view>鐢靛瓙鏍蜂功鐢宠</view> + </view> + <view class="bottom-btn"> + <view> + <t-image src="/static/images/bookService/detail/paper-book.png"></t-image> + </view> + <view>绾歌川鏍蜂功鐢宠</view> + </view> + <view class="shopCar">鍔犲叆璐墿杞�</view> + <view class="buy">绔嬪嵆璐拱</view> + </view> +</scroll-view> diff --git a/pages/bookServices/detail/index.wxss b/pages/bookServices/detail/index.wxss new file mode 100644 index 0000000..30834df --- /dev/null +++ b/pages/bookServices/detail/index.wxss @@ -0,0 +1,218 @@ +/* pages/bookServices/detail/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; +} + +.book { + position: relative; + height: 81vh; + background-color: #F2F3F8; +} + +.book-detail { + padding: 32rpx; + display: flex; + border-radius: 0 0 20rpx 20rpx; +} + +.detail-left { + margin-right: 36rpx; +} + +.detail-right .book-name { + font-weight: bold; + font-size: 36rpx; + color: #000000; +} + +.book-message { + margin-top: 10rpx; +} + +.message-li { + font-size: 28rpx; + color: #333333; + display: flex; + height: 40rpx; + margin-bottom: 20rpx; +} + +.li-title { + width: 140rpx; +} + +.book-use { + margin-top: 16rpx; + display: flex; + justify-content: space-evenly; + font-size: 24rpx; + color: #949494; +} + +.collect, +.suggest { + display: flex; + flex-direction: column; + align-items: center; +} + +.book-use image { + width: 38rpx; + height: 38rpx; + margin-bottom: 8rpx; +} + +.book-box { + background: linear-gradient(to right, #FFB400, #FF6C00); + border-radius: 0 0 20rpx 20rpx; +} + +.book-detail { + background-color: #fff; +} + +/* 閿�鍞俊鎭� */ +.book-sale { + padding: 0 30rpx; + display: flex; + align-items: center; + width: 100%; + height: 150rpx; + border-radius: 0 0 20rpx 20rpx; +} + +.book-price { + height: 100%; + display: flex; +} + +.book-price image { + width: 58rpx; + height: 70rpx; +} + +.paper-price, +.electron-price { + display: flex; + align-items: center; +} + +.paper-price { + margin-left: 30rpx; +} + +.price { + margin-left: 12rpx; + font-size: 34rpx; + color: #fff; +} + +.price-old { + margin-left: 10rpx; + position: relative; + font-size: 28rpx; + opacity: 0.6; +} + +.line { + position: absolute; + top: 50%; + left: -5rpx; + width: 80%; + height: 3rpx; + background-color: #fff; +} + +.book-web { + margin-left: 30rpx; +} + +.book-web image { + margin-left: 20rpx; + width: 45rpx; + height: 45rpx; +} + +.book-web image:first-child { + margin-left: 0; +} + +/* 鍥句功璧勬簮 */ +.book-resource { + margin-top: 20rpx; +} + +.custom-tabs { + --td-tab-item-active-color: #FF6C00 +} + + +/* 搴曢儴 */ +.box-bottom { + position: fixed; + left: 0; + bottom: 40rpx; + width: 100%; + height: 110rpx; + +} + +.box-bottom { + display: flex; + border: 1px solid #DDD; +} + +.box-bottom image { + width: 36rpx; + height: 44rpx; +} + +.bottom-btn { + background-color: #fff; + width: 25%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + font-size: 24rpx; + color: #010101; + box-sizing: border-box; +} + +.bottom-btn image { + margin-bottom: 6rpx; +} + +.bottom-btn:nth-child(1) { + border-right: 1px solid #DDD; +} + +.shopCar, +.buy { + width: 25%; + display: flex; + align-items: center; + justify-content: center; + color: #fff; +} + +.shopCar { + background-color: #F1AC37; +} + +.buy { + background-color: #F14B3B; +} \ No newline at end of file diff --git a/pages/bookServices/index.js b/pages/bookServices/index.js deleted file mode 100644 index e1c47c7..0000000 --- a/pages/bookServices/index.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/bookServices/index.js -Page({ - - /** - * 椤甸潰鐨勫垵濮嬫暟鎹� - */ - data: { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 - */ - onLoad(options) { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 - */ - onReady() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず - */ - onShow() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 - */ - onHide() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 - */ - onUnload() { - - }, - - /** - * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 - */ - onPullDownRefresh() { - - }, - - /** - * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� - */ - onReachBottom() { - - }, - - /** - * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/bookServices/index.json b/pages/bookServices/index.json deleted file mode 100644 index 8835af0..0000000 --- a/pages/bookServices/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/bookServices/index.wxml b/pages/bookServices/index.wxml deleted file mode 100644 index dc094eb..0000000 --- a/pages/bookServices/index.wxml +++ /dev/null @@ -1 +0,0 @@ -<text>鍥句功鏈嶅姟</text> \ No newline at end of file diff --git a/pages/bookServices/index.wxss b/pages/bookServices/index.wxss deleted file mode 100644 index c2cb44d..0000000 --- a/pages/bookServices/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/bookServices/index.wxss */ \ No newline at end of file diff --git a/pages/bookServices/list/index.js b/pages/bookServices/list/index.js new file mode 100644 index 0000000..7388ef4 --- /dev/null +++ b/pages/bookServices/list/index.js @@ -0,0 +1,397 @@ +const app = getApp(); +Page({ + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + barHeight: '', + navBarHeight: '', + searchValue: '', + path: '', + pathList: [], + page: 1, + assortCheck: { + name: '', + code: '', + }, + bookList: [], + stairList: { + value: '', + options: [ + { + value: '', + label: '涓�绾�', + }, + ], + }, + secondList: { + value: [], + options: [], + }, + majorProjectList: { + value: [], + options: [], + }, + newTextBook: { + value: [], + options: [], + }, + stairCode: '', // 涓�绾у垎绫婚�変腑椤� + secondCode: '', // 浜岀骇鍒嗙被閫変腑椤� + sort: '', // 鎺掑簭 + }, + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + 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, + }); + // 鎼滅储璧嬪�� + if (options.searchValue) { + this.setData({ + searchValue: options.searchValue, + }); + } + // 楂樼骇鍒嗙被璧嬪�� + this.setData({ + assortCheck: { + name: options.assorName, + code: options.assortCode, + }, + }); + if (this.data.assortCheck.code) { + this.setData({}); + } + // 鑾峰彇涓�绾у垎绫� + this.getStairList(options.assortCode); + // 涓�绾у垎绫诲拰path璧嬪�� + if (options.stairCode) { + this.setData({ + 'stairList.value': options.stairCode, + stairCode: options.stairCode, + secondCode: options.secondCode, + 'secondList.value': options.secondCode, + path: `${options.assortCode}\\${options.stairCode}`, + }); + } + // 鑾峰彇浜岀骇鍒嗙被 + this.getSecondList(`${options.assortCode}\\${options.stairCode}`); + this.getBookList(`${options.assortCode}\\${options.stairCode}`); + // 鑾峰彇閲嶇偣椤圭洰 + this.getProjectList('bookClassification'); + this.getProjectList('newFormsTextbooks'); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() {}, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() {}, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() {}, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() {}, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() {}, + goBack() { + wx.navigateBack(); + }, + // 鑾峰彇涓�绾у垪琛� + getStairList(path) { + const query = { + path, + filterList: [], + queryType: '\\', + searchList: [], + size: '30', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' }, + }; + app.MG.store.getStoreChannelList(query).then(async (res) => { + const options = [ + { + value: '', + label: '涓�绾�', + }, + ]; + for (let index = 0; index < res.datas.length; index++) { + const item = res.datas[index]; + options.push({ + value: item.refCode, + label: item.name, + }); + } + this.setData({ + 'stairList.options': options, + 'stairList.value': this.data.stairCode, + }); + }); + }, + // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被 + getSecondList(path) { + const options = []; + const query = { + path, + filterList: [], + queryType: '\\', + searchList: [], + size: '30', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' }, + }; + app.MG.store.getStoreChannelList(query).then((res) => { + for (let index = 0; index < res.datas.length; index++) { + const item = res.datas[index]; + options.push({ + value: `${item.pathLinks[0].linkPath}\\${item.id}`, + label: item.name, + }); + } + this.setData({ + 'secondList.options': options, + 'secondList.value': this.data.secondCode, + }); + }); + }, + // 鑾峰彇閲嶇偣椤圭洰 + getProjectList(type) { + const options = []; + const arr = []; + let array = []; + const query = { + refCodes: [type], + }; + app.MG.store.getProductTypeField(query).then((res) => { + array = JSON.parse(res[0].config).option; + for (let index = 0; index < array.length; index++) { + const element = array[index]; + if (element.child) { + for (let index = 0; index < element.child.length; index++) { + const item = element.child[index]; + arr.push(item); + } + } + } + if (type == 'bookClassification') { + for (let index = 0; index < arr.length; index++) { + const element = arr[index]; + options.push({ + value: element.value, + label: element.name, + }); + } + this.setData({ + 'majorProjectList.options': options, + }); + } else if (type == 'newFormsTextbooks') { + for (let index = 0; index < arr.length; index++) { + const element = arr[index]; + options.push({ + value: element.value, + label: element.name, + }); + } + this.setData({ + 'newTextBook.options': options, + }); + console.log('閲嶇偣椤圭洰', this.data.newTextBook); + } + }); + }, + // 鑾峰彇鍥句功鍒楄〃 + getBookList(path) { + let sort; + let pathObj = {}; + if (this.data.pathList.length) { + pathObj = { + subAccess: this.data.pathList, + }; + } else { + pathObj = { + path, + queryType: '*', + }; + } + if (this.data.sort) { + sort = { + Name: this.data.sort, + BaseType: '', + }; + } else { + sort = { + type: 'Desc', + field: 'ViewCount', + }; + } + // 鎼滅储 + let searchObj = {}; + if (this.data.searchValue) { + searchObj = { + 'Name*': this.data.searchValue, + '||author*': this.data.searchValue, + '||isbn*': this.data.searchValue, + '||seriesName*': this.data.searchValue, + }; + } + const query = { + ...pathObj, + filterList: [ + { + value: 'Normal', + field: 'state', + }, + ], + sort, + coverSize: { + height: 145, + }, + paging: { + start: (this.data.page - 1) * 16, + size: 16, + }, + fields: { + author: [], + publicationDate: [], + ...searchObj, + 'bookClassification*': this.data.majorProjectList.value, + 'newFormsTextbooks*': this.data.newTextBook.value, + }, + }; + app.MG.store.getProductList(query).then((res) => { + this.setData({ + bookList: res.datas, + }); + }); + }, + // 涓�绾у垎绫诲垏鎹� + onChangeStair(e) { + const path = e.detail.value.length + ? `${this.data.assortCheck.code}\\${e.detail.value}` + : this.data.assortCheck.code; + this.setData({ + stairCode: e.detail.value, + secondCode: '', + path: path, + 'stairList.value': e.detail.value, + }); + this.getBookList(path); + this.getSecondList(path); + }, + // 浜岀骇鍒嗙被鍒囨崲 + onChangeSecond(e) { + console.log(e); + const pathList = []; + for (let index = 0; index < e.detail.value.length; index++) { + const element = e.detail.value[index]; + pathList.push({ + Path: element, + Type: '*', + StoreRefCode: app.config.goodsStore, + }); + } + this.setData({ + pathList: pathList, + 'secondList.value': e.detail.value, + }); + this.getBookList(this.data.path); + }, + // 閲嶇偣椤圭洰鏀瑰彉 + changeMajorProject(e) { + this.setData({ + 'majorProjectList.value': e.detail.value, + }); + this.getBookList(this.data.path); + }, + // 閲嶇偣椤圭洰閲嶇疆 + resetMajorProject() { + this.setData({ + 'majorProjectList.value': [], + }); + this.getBookList(this.data.path); + }, + changeNewText(e) { + this.setData({ + 'newTextBook.value': e.detail.value, + }); + this.getBookList(this.data.path); + }, + resetNewText() { + this.setData({ + 'newTextBook.value': [], + }); + this.getBookList(this.data.path); + }, + // 鎺掑簭鎸夐挳 + sortClick() { + if (!this.data.sort.length) { + this.setData({ + sort: 'Desc', + }); + } else if (this.data.sort == 'Desc') { + this.setData({ + sort: 'Asc', + }); + } else if (this.data.sort == 'Asc') { + this.setData({ + sort: '', + }); + } + let path; + if (this.data.secondCode) { + path = this.data.secondCode; + } else if (this.data.stairCode) { + path = `${this.data.assortCheck.code}\\${this.data.stairCode}`; + } else { + path = this.data.assortCheck.code; + } + this.setData({ + path: path, + }); + this.getBookList(path); + }, + // 鎼滅储鍥句功 + searchBook(e) { + console.log(e.detail.value); + this.setData({ + searchValue: e.detail.value, + }); + this.getBookList(this.data.path); + }, + // 璺宠浆鍥句功璇︽儏 + goDetail(e) { + const { book } = e.currentTarget.dataset; + wx.navigateTo({ + url: `/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`, + }); + }, +}); diff --git a/pages/bookServices/list/index.json b/pages/bookServices/list/index.json new file mode 100644 index 0000000..c1b8601 --- /dev/null +++ b/pages/bookServices/list/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu", + "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-image": "tdesign-miniprogram/image/image", + "t-search": "tdesign-miniprogram/search/search" + }, + "navigationStyle": "custom" +} diff --git a/pages/bookServices/list/index.wxml b/pages/bookServices/list/index.wxml new file mode 100644 index 0000000..20900a8 --- /dev/null +++ b/pages/bookServices/list/index.wxml @@ -0,0 +1,74 @@ +<!-- 鍥句功鏈嶅姟-鍒楄〃 --> +<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="bookServices-list"> + <view class="list-header"> + <scroll-view scroll-x="{{true}}" class="header-scroll"> + <t-dropdown-menu> + <t-dropdown-item options="{{stairList.options}}" value="{{stairList.value}}" bindchange="onChangeStair" /> + <t-dropdown-item + label="浜岀骇" + options="{{secondList.options}}" + optionsColumns="2" + multiple + defaultValue="{{secondList.value}}" + bind:confirm="onChangeSecond" + /> + <t-dropdown-item + label="閲嶇偣椤圭洰" + options="{{majorProjectList.options}}" + optionsColumns="2" + multiple + defaultValue="{{majorProjectList.value}}" + bind:confirm="changeMajorProject" + bind:reset="resetMajorProject" + /> + <t-dropdown-item + label="鏂板舰鎬佹暀鏉�" + options="{{newTextBook.options}}" + optionsColumns="2" + multiple + defaultValue="{{newTextBook.value}}" + bind:confirm="changeNewText" + bind:reset="resetNewText" + /> + </t-dropdown-menu> + </scroll-view> + <view class="header-sort" bind:tap="sortClick"> + <view class="sort-name">鎺掑簭</view> + <view class="sort-icon"> + <t-icon name="swap-left" size="24rpx" class="icon-right" color="{{sort == 'Asc' ? '#ff6c00' : ''}}" /> + <t-icon name="swap-left" size="24rpx" class="icon-left" color="{{sort == 'Desc' ? '#ff6c00' : ''}}" /> + </view> + </view> + </view> + <scroll-view scroll-y="{{true}}" class="list-container"> + <view class="assort-title"> + <view class="title-box"></view> + <view class="title-name">{{assortCheck.name}}</view> + </view> + <view class="book-list"> + <view class="book-box" wx:for="{{bookList}}" wx:key="id" bind:tap="goDetail" data-book="{{item}}"> + <view class="book-img"> + <t-image src="{{item.icon}}" width="105" height="145" aria-label="{item.name{}}" /> + </view> + <view class="book-name book-color">{{ item.name}}</view> + <view class="book-author book-color">{{item.author}}</view> + </view> + </view> + </scroll-view> +</view> diff --git a/pages/bookServices/list/index.wxss b/pages/bookServices/list/index.wxss new file mode 100644 index 0000000..4e86439 --- /dev/null +++ b/pages/bookServices/list/index.wxss @@ -0,0 +1,115 @@ +/* pages/bookServices/list/index.wxss */ +page { + background-color: #f7f7f7; +} + +.nacigationBar { + display: flex; + align-items: center; + --td-search-font-size: 28rpx; + margin-bottom: 30rpx; +} + +.list-header { + display: flex; +} + +.header-sort { + background-color: #fff; + line-height: 96rpx; + width: 150rpx; + font-size: 28rpx; + color: #999; + display: flex; +} + +.header-scroll { + width: 80vw; +} + +.sort-icon { + transform: rotate(90deg); + position: relative; +} + +.sort-icon .icon-left { + transform: rotate(180deg); +} + +.list-container { + height: 80vh; + margin-top: 20rpx; + background-color: #fff; +} + +.assort-title { + padding: 20rpx 0; + display: flex; + align-items: center; +} + +.assort-title .title-box { + width: 8rpx; + height: 60rpx; + background-color: #ff6c00; +} + +.assort-title .title-name { + font-size: 32rpx; + margin-left: 32rpx; + font-weight: 700; +} + +.book-list { + padding: 32rpx; + display: flex; + flex-wrap: wrap; +} + +.book-box { + box-sizing: border-box; + width: 48%; + background-color: #f7f7f7; + display: flex; + flex-direction: column; + align-items: center; + margin-bottom: 40rpx; + padding: 50rpx 20rpx 32rpx 20rpx; + box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16); +} + +.book-box:nth-child(2n) { + margin-left: 18rpx; +} + +.book-color { + color: #333; +} + +.book-img image { + object-fit: contain; + box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16); +} + +.book-name { + margin-top: 24rpx; + 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: center; +} + +.book-author { + margin-top: 16rpx; + width: 100%; + font-size: 24rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-align: center; +} \ No newline at end of file diff --git a/services/home/home.js b/services/home/home.js index 5bb98db..8733ecf 100644 --- a/services/home/home.js +++ b/services/home/home.js @@ -9,7 +9,7 @@ text: '鍥句功鏈嶅姟', key: 0, icon: '/static/images/home/1.png', - url: '/pages/bookServices/index', + url: '/pages/bookServices/assort/index', }, { text: '鏁板瓧闃呰', @@ -20,51 +20,51 @@ { text: '鏁板瓧璇剧▼', key: 2, - icon: "", + icon: '', url: '', }, { text: '鏁板瓧鏁欐潗', key: 3, - icon: "", + icon: '', url: '', }, { text: '涓撻璁ㄨ', key: 4, - icon: "", + icon: '', url: '', }, { text: '绾夸笂涔﹀睍', key: 5, - icon: "", + icon: '', url: '', }, { text: '涔︾洰涓嬭浇', key: 6, - icon: "", + icon: '', url: '', }, { text: '鏁欏笀璁よ瘉', key: 7, - icon: "", + icon: '', url: '', }, { text: '鏍蜂功鐢宠', key: 8, - icon: "", + icon: '', url: '', }, { text: '鎴戣鍑轰功', key: 9, - icon: "", + icon: '', url: '', - } + }, ], }; }); diff --git a/static/images/bookService/assort/book-img.png b/static/images/bookService/assort/book-img.png new file mode 100644 index 0000000..6343c4c --- /dev/null +++ b/static/images/bookService/assort/book-img.png Binary files differ diff --git a/static/images/bookService/detail/author.png b/static/images/bookService/detail/author.png new file mode 100644 index 0000000..0dd153d --- /dev/null +++ b/static/images/bookService/detail/author.png Binary files differ diff --git a/static/images/bookService/detail/book-brief.png b/static/images/bookService/detail/book-brief.png new file mode 100644 index 0000000..34295ff --- /dev/null +++ b/static/images/bookService/detail/book-brief.png Binary files differ diff --git a/static/images/bookService/detail/collect.png b/static/images/bookService/detail/collect.png new file mode 100644 index 0000000..fdac645 --- /dev/null +++ b/static/images/bookService/detail/collect.png Binary files differ diff --git a/static/images/bookService/detail/collecting.png b/static/images/bookService/detail/collecting.png new file mode 100644 index 0000000..a187188 --- /dev/null +++ b/static/images/bookService/detail/collecting.png Binary files differ diff --git a/static/images/bookService/detail/dangdang.png b/static/images/bookService/detail/dangdang.png new file mode 100644 index 0000000..4aa62c2 --- /dev/null +++ b/static/images/bookService/detail/dangdang.png Binary files differ diff --git a/static/images/bookService/detail/ebook.png b/static/images/bookService/detail/ebook.png new file mode 100644 index 0000000..bafee65 --- /dev/null +++ b/static/images/bookService/detail/ebook.png Binary files differ diff --git a/static/images/bookService/detail/electon-price.png b/static/images/bookService/detail/electon-price.png new file mode 100644 index 0000000..e6c5467 --- /dev/null +++ b/static/images/bookService/detail/electon-price.png Binary files differ diff --git a/static/images/bookService/detail/jd.png b/static/images/bookService/detail/jd.png new file mode 100644 index 0000000..a58147c --- /dev/null +++ b/static/images/bookService/detail/jd.png Binary files differ diff --git a/static/images/bookService/detail/label.png b/static/images/bookService/detail/label.png new file mode 100644 index 0000000..8e2272e --- /dev/null +++ b/static/images/bookService/detail/label.png Binary files differ diff --git a/static/images/bookService/detail/paper-book.png b/static/images/bookService/detail/paper-book.png new file mode 100644 index 0000000..59a6219 --- /dev/null +++ b/static/images/bookService/detail/paper-book.png Binary files differ diff --git a/static/images/bookService/detail/paper-price.png b/static/images/bookService/detail/paper-price.png new file mode 100644 index 0000000..9989488 --- /dev/null +++ b/static/images/bookService/detail/paper-price.png Binary files differ diff --git a/static/images/bookService/detail/suggest.png b/static/images/bookService/detail/suggest.png new file mode 100644 index 0000000..0ece03a --- /dev/null +++ b/static/images/bookService/detail/suggest.png Binary files differ diff --git a/static/images/bookService/detail/tmall.png b/static/images/bookService/detail/tmall.png new file mode 100644 index 0000000..b660d14 --- /dev/null +++ b/static/images/bookService/detail/tmall.png Binary files differ diff --git a/style/theme.wxss b/style/theme.wxss index bb1249e..8b563f4 100644 --- a/style/theme.wxss +++ b/style/theme.wxss @@ -1,4 +1,5 @@ /* 涓婚瀹氬埗 */ + .t-input { --td-input-placeholder-text-color: #bbbbbb; --td-input-text-color: #333333; @@ -44,4 +45,4 @@ .dialog__button-cancel { color: #aeb3b7 !important; -} +} \ No newline at end of file -- Gitblit v1.9.1