From b7ed8541113f8fa116b19d13e34a70a929310077 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 12 三月 2024 14:38:22 +0800 Subject: [PATCH] 样书申请 --- pages/sampleBookList/index.js | 995 +++++++++++++++ app.wxss | 8 pages/testLogin/index.js | 18 pages/personalCenter/activateProduct/index.json | 8 pages/personalCenter/sampleBooks/index.wxss | 179 ++ pages/bookServices/list/index.wxml | 1 pages/personalCenter/feedBack/index.js | 55 pages/personalCenter/sampleBooks/index.wxml | 73 + pages/personalCenter/activateProduct/index.wxml | 73 + pages/personalCenter/activateProduct/index.wxss | 150 ++ services/home/home.js | 2 pages/personalCenter/activateProduct/index.js | 166 ++ pages/personalCenter/sampleBooks/index.json | 10 pages/personalCenter/index.wxml | 6 pages/personalCenter/myCollection/index.wxml | 6 pages/personalCenter/myOrder/index.js | 142 ++ pages/sampleBookList/applicationForm/index.js | 306 ++++ pages/sampleBookList/applicationForm/index.json | 10 static/images/home/yangshuForm.png | 0 pages/aboutUs/index.wxml | 4 pages/sampleBookList/index.json | 16 pages/personalCenter/downloads/index.js | 139 + pages/home/home.wxml | 4 pages/personalCenter/index.js | 22 pages/home/home.wxss | 8 pages/personalCenter/sampleBooks/index.js | 185 ++ pages/sampleBookList/applicationForm/index.wxss | 180 ++ pages/sampleBookList/applicationForm/index.wxml | 80 + pages/personalCenter/feedBack/index.wxss | 93 + pages/sampleBookList/index.wxss | 260 ++++ pages/personalCenter/feedBack/index.wxml | 91 pages/personalCenter/downloads/index.json | 8 static/images/home/yangshuliebiao.png | 0 pages/personalCenter/downloads/index.wxml | 41 pages/personalCenter/downloads/index.wxss | 83 + app.json | 4 pages/personalCenter/myCollection/index.js | 16 pages/sampleBookList/index.wxml | 75 + pages/personalCenter/myOrder/index.wxml | 135 +- pages/personalCenter/myOrder/index.wxss | 107 + 40 files changed, 3,446 insertions(+), 313 deletions(-) diff --git a/app.json b/app.json index d43ff7c..e2082ff 100644 --- a/app.json +++ b/app.json @@ -1,10 +1,10 @@ { "pages": [ + "pages/home/home", "pages/resourceDetails/index", "pages/retrievalPage/index", "pages/cart/paymentPage/index", "pages/cart/index", - "pages/home/home", "pages/aboutUs/index", "pages/bookServices/assort/index", "pages/bookServices/detail/index", @@ -40,6 +40,8 @@ "pages/order/invoice/index", "pages/usercenter/name-edit/index", "pages/teacherCertification/index", + "pages/sampleBookList/index", + "pages/sampleBookList/applicationForm/index", "pages/personalCenter/index", "pages/personalCenter/myOrder/index", "pages/personalCenter/myCollection/index", diff --git a/app.wxss b/app.wxss index 66a6b86..7874623 100644 --- a/app.wxss +++ b/app.wxss @@ -1,3 +1,11 @@ @import 'style/iconfont.wxss'; @import 'style/theme.wxss'; + +page { + width: 100%; + height: 100%; + box-sizing: border-box; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); +} \ No newline at end of file diff --git a/pages/aboutUs/index.wxml b/pages/aboutUs/index.wxml index 9b311d6..f57c59d 100644 --- a/pages/aboutUs/index.wxml +++ b/pages/aboutUs/index.wxml @@ -22,9 +22,9 @@ <view class="aboutUs"> - <view class="imageBox"> + <!-- <view class="imageBox"> <image src="{{swiperList}}" alt="" /> - </view> + </view> --> <view class="aboutText"> <rich-text nodes="{{aboutText}}"></rich-text> </view> diff --git a/pages/bookServices/list/index.wxml b/pages/bookServices/list/index.wxml index 4082e4d..22b1df3 100644 --- a/pages/bookServices/list/index.wxml +++ b/pages/bookServices/list/index.wxml @@ -1,6 +1,5 @@ <!-- 鍥句功鏈嶅姟-鍒楄〃 --> <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" /> diff --git a/pages/home/home.wxml b/pages/home/home.wxml index b4eec10..c495cf0 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -63,7 +63,7 @@ </view> </view> <view class="home-page-tabs"> - <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{activeItem}}" space-evenly="{{false}}" bind:change="tabChangeHandle"> + <t-tabs t-class="t-tabs" split="{{false}}" defaultValue="{{activeItem}}" bind:change="tabChangeHandle"> <t-tab-panel wx:for="{{courseTypeList}}" wx:for-index="index" wx:key="index" label="{{item.name}}" value="{{index}}" /> </t-tabs> </view> @@ -103,7 +103,7 @@ </view> </view> <view class="home-page-tabs"> - <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{activeItem1}}" space-evenly="{{false}}" bind:change="tabBookClick"> + <t-tabs t-class="t-tabs" split="{{false}}" defaultValue="{{activeItem1}}" bind:change="tabBookClick"> <t-tab-panel wx:for="{{bookTypeList}}" wx:for-index="index" wx:key="index" label="{{item.name}}" value="{{index}}" /> </t-tabs> </view> diff --git a/pages/home/home.wxss b/pages/home/home.wxss index 8be0612..42ca54c 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -144,11 +144,11 @@ } .body-info .name { - font-size: 32rpx; + font-size: 30rpx; height: 88rpx; color: #333333; font-weight: bold; - line-height: 44rpx; + line-height: 40rpx; display: -webkit-box; margin-bottom: 10rpx; -webkit-box-orient: vertical; @@ -255,7 +255,7 @@ } .listBox2 .author { - height: 30rpx; + height: 28rpx; color: #333333; font-weight: bold; line-height: 30rpx; @@ -291,7 +291,7 @@ } .listBox3 .name { - font-size: 32rpx; + font-size: 30rpx; height: 44rpx; color: #333333; font-weight: bold; diff --git a/pages/personalCenter/activateProduct/index.js b/pages/personalCenter/activateProduct/index.js index c914b6c..7b02479 100644 --- a/pages/personalCenter/activateProduct/index.js +++ b/pages/personalCenter/activateProduct/index.js @@ -1,11 +1,25 @@ -// pages/personalCenter/activateProduct/index.js +const app = getApp(); +import moment from 'moment' +import tool2 from "../../../assets/js/toolClass.js" +import { getPublicImage } from "../../../assets/js/middleGround/tool.js"; Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - + code: "", + list: [], + //鍒嗛〉 + page: 1, + limit: 4, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false, + // 杩斿洖椤堕儴 + isBackTop: false, + setScrollValue: 0, + skeletonLoding: true, }, /** @@ -13,48 +27,146 @@ */ onLoad(options) { console.log(options); + this.getDataList(false) }, + bindTnputBlur: function (e) { + this.setData({ + code: e.detail.value, + }); + console.log(this.data.code) + }, + //婵�娲� + onActivation() { + var that = this; + let lock = true; + if (that.data.code == "") { + wx.showToast({ + title: "璇疯緭鍏ユ縺娲荤爜锛�", + icon: 'error', + duration: 1000, + }) + } else { + if (lock) { + lock = false; + app.MG.store + .userActiveCode({ + code: that.data.code, + }) + .then((res) => { + wx.showToast({ + title: res, + icon: 'none', + duration: 1000, + success: function () { + setTimeout(function () { + that.getDataList(false); + that.setData({ + list: [], + code: "" + }) + lock = true; + }, 1000) //寤惰繜鏃堕棿 + } + }) - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 - */ - onReady() { + + }); + } + } + }, + //鍟嗗搧鍒楄〃 + getDataList(isReachBottom) { + app.MG.store.userActiveCodeList({ + start: this.data.page * this.data.limit - this.data.limit, + size: this.data.limit, + sort: { + type: "Desc", + field: "CreateDate" + } + }).then((res) => { + try { + if (res.datas.length > 0) { + res.datas.forEach((item, index) => { + item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); + let oldlist = []; + oldlist = item.productList + oldlist.forEach(istrue => { + istrue.icon = getPublicImage(istrue.icon, "", 400) + }) + }) + let dataList = res.datas; + //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� + if (isReachBottom) { + dataList = [...this.data.list, ...dataList] //灏嗘柊鏁版嵁鍔犲叆鑰佹暟鎹腑 + } + this.setData({ + list: dataList, + pageTotalCount: res.totalSize, + bottomLoading: false, + isMoreData: dataList.length > 0 ? false : true, + skeletonLoding: false, + loading: false + }) + } else { + this.setData({ + skeletonLoding: false, + loading: false + }) + } + } catch (error) { + console.log(error) + } - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず - */ - onShow() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 - */ - onHide() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 - */ - onUnload() { - + }) }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ onPullDownRefresh() { - + if (this._freshing) return + this.setData({ + // list: [], + page: 1, + limit: 4, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false + }) + this._freshing = true; + this.setData({ + triggered: false, + }) + this.getDataList(false); + this._freshing = false }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom() { - + this.setData({ + bottomLoading: true, + isMoreData: false + }) + let bool = false; + if (this.data.pageTotalCount > this.data.list.length) { + bool = true; + this.setData({ + page: this.data.page + 1, + }) + } else { + setTimeout(() => { + this.setData({ + bottomLoading: false, + isMoreData: true + }) + }, 100) + return false; + } + this.getDataList(bool); }, /** diff --git a/pages/personalCenter/activateProduct/index.json b/pages/personalCenter/activateProduct/index.json index 3aebf06..de879f8 100644 --- a/pages/personalCenter/activateProduct/index.json +++ b/pages/personalCenter/activateProduct/index.json @@ -1,4 +1,10 @@ { "navigationBarTitleText": "婵�娲诲晢鍝�", - "usingComponents": {} + "usingComponents": { + "t-back-top": "tdesign-miniprogram/back-top/back-top", + "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-image": "tdesign-miniprogram/image/image", + "t-empty": "tdesign-miniprogram/empty/empty" + } } \ No newline at end of file diff --git a/pages/personalCenter/activateProduct/index.wxml b/pages/personalCenter/activateProduct/index.wxml index 880b74d..e75732a 100644 --- a/pages/personalCenter/activateProduct/index.wxml +++ b/pages/personalCenter/activateProduct/index.wxml @@ -1,2 +1,71 @@ -<!--pages/personalCenter/activateProduct/index.wxml--> -<text>pages/personalCenter/activateProduct/index.wxml</text> +<view class="container"> + <view class="activation"> + <view class="title"> + <view class="line"></view> + <view>婵�娲荤爜</view> + </view> + <view class="contentBox"> + <view class="inputBox"> + <input class="weui-input" name="code" auto-focus="true" adjust-position="true" value="{{code}}" placeholder="璇疯緭鍏ユ縺娲荤爜" bindinput="bindTnputBlur" /> + <button class="button" bindtap="onActivation">婵�娲诲晢鍝�</button> + </view> + </view> + </view> + <view class="page-content"> + <view class="title"> + <view class="line"></view> + <view>宸叉縺娲诲晢鍝�</view> + </view> + <view class="contentBox"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="list" wx:if="{{list.length > 0}}"> + <view class="content-item" wx:for="{{list}}" wx:for-item="items" wx:for-index="index" wx:key="index"> + <view class="codeInfoBox"> + <view>婵�娲荤爜锛歿{items.code}}</view> + <view>婵�娲绘椂闂达細{{items.createDate}}</view> + </view> + <view class="listBox"> + <scroll-view class="srcolbox" scroll-x scroll-with-animation='true'> + <view class="order-centent"> + <view class="bookBox" wx:for="{{items.productList}}" wx:for-item="itemes" wx:for-index="idx" wx:key="idx" bindtap="onOrderDetail" data-info="{{itemes}}"> + <view class="leftCon"> + <!-- 鑾峰彇鍥剧墖 --> + <image class="purchasedIcon" wx:if="{{itemes.icon}}" src="{{itemes.icon}}" mode="aspectFit" /> + <image class="purchasedIcon" wx:else src="/static/images/default-book-img.png" mode="aspectFit" /> + </view> + <!-- 鑾峰彇鍚嶇О --> + <view class="rightCon"> + <view class="productTitle">{{itemes.name}}</view> + <view class="typeBox"> + <text class="typeCon">{{ + itemes.orderSaleMethod.type == 'defaultSaleMethod' + ? '鐢靛瓙涔�' + : itemes.orderSaleMethod.type == 'createProductSaleMethod' && itemes.orderSaleMethod.cmsItemList == 0 ? '缁勫嵎' : '浜戝涔�' + }}</text> + </view> + </view> + </view> + </view> + </scroll-view> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> + </view> + + </view> +</view> \ No newline at end of file diff --git a/pages/personalCenter/activateProduct/index.wxss b/pages/personalCenter/activateProduct/index.wxss index d2baa87..1dafe1f 100644 --- a/pages/personalCenter/activateProduct/index.wxss +++ b/pages/personalCenter/activateProduct/index.wxss @@ -1 +1,149 @@ -/* pages/personalCenter/activateProduct/index.wxss */ \ No newline at end of file +page { + width: 100vw; + height: 100%; + background: #F2F3F8; +} + +.refresh-container { + margin: 0 auto; +} + +.bottom-loading, +.loading { + padding: 20rpx; + text-align: center; +} + +.container { + padding: 40rpx 24rpx; +} + +.activation { + height: 160rpx; + background: #fff; + border-radius: 18rpx; + padding: 30rpx 0; + +} + +.title { + display: flex; + line-height: 54rpx; + font-weight: bold; +} + +.title .line { + border-left: 8rpx solid #FF6C00; + border-radius: 0 8rpx 8rpx 0; + margin-right: 20rpx; +} + + +.contentBox { + margin-top: 20rpx; +} + +.inputBox { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 30rpx; +} + +.inputBox .weui-input { + border: 2rpx solid #D9D9D9; + border-radius: 10rpx; + height: 60rpx; + padding: 6rpx 10rpx; +} + +.button { + margin: 0; + height: 74rpx; + line-height: 74rpx; + font-size: 28rpx; + background: #FF6C00; + color: #fff; + margin-left: 10rpx; + border-color: #FF6C00; +} + +.page-content { + margin-top: 40rpx; + background: #fff; + border-radius: 18rpx; + padding: 30rpx 0; +} + +.list { + padding: 20rpx 30rpx; +} + +.content-item { + margin-bottom: 40rpx; +} + +.codeInfoBox { + border: 2rpx solid #EDECEC; + border-radius: 10rpx; + background: #f3f3f3; + padding: 20rpx; + font-size: 28rpx; + line-height: 56rpx; +} + +.order-centent { + display: flex; +} + +.bookBox { + padding: 20rpx 0; + width: 200rpx; + padding-right: 20rpx; +} + +.bookBox .leftCon { + width: 180rpx; + height: 240rpx; + box-shadow: 0px 0px 20rpx 2px #f1f1f1; +} + +.bookBox .leftCon .purchasedIcon { + width: 100%; + height: 100%; + object-fit: contain; +} + +.rightCon { + margin-top: 10rpx; +} + +.productTitle { + font-size: 28rpx; + height: 88rpx; + color: #333333; + line-height: 44rpx; + display: -webkit-box; + margin-bottom: 20rpx; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: ellipsis; +} + +.typeBox { + line-height: 60rpx; +} + +.typeCon { + background: rgba(255, 108, 0, 0.24); + border-radius: 9rpx 9rpx 9rpx 9rpx; + padding: 8rpx 20rpx; + color: #FF6C00; + font-size: 24rpx; +} + +.empyt { + padding: 100rpx 0; + background: #fff; +} \ No newline at end of file diff --git a/pages/personalCenter/downloads/index.js b/pages/personalCenter/downloads/index.js index cf38005..e3df2c0 100644 --- a/pages/personalCenter/downloads/index.js +++ b/pages/personalCenter/downloads/index.js @@ -1,11 +1,22 @@ -// pages/personalCenter/downloads/index.js +const app = getApp(); +import moment from 'moment' Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - + list: [], + //鍒嗛〉 + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false, + // 杩斿洖椤堕儴 + isBackTop: false, + setScrollValue: 0, + skeletonLoding: true, }, /** @@ -13,50 +24,122 @@ */ onLoad(options) { console.log(options); + this.getDataList(false); }, - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 - */ - onReady() { + getDataList(isReachBottom) { + app.MG.ugc.getTopicMessageList({ + appRefCode: app.config.appRefCode, + topicIdOrRefCode: "productDownLoad", + start: this.data.page * this.data.limit - this.data.limit, + size: this.data.limit, + sort: { + type: "Desc", + field: "CreateDate" + } + }) + .then(res => { + try { + if (res.datas.length > 0) { + res.datas.forEach((item) => { + item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); + item.updateDate = moment(item.updateDate).format("YYYY-MM-DD HH:mm:ss"); + if (item.feedBack) { + item.feedBack = JSON.parse(item.feedBack); + } + if (item.content) { + item.product = JSON.parse(item.content)[0]; + } + }); + let dataList = res.datas; + + //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� + if (isReachBottom) { + dataList = [...this.data.list, ...dataList] //灏嗘柊鏁版嵁鍔犲叆鑰佹暟鎹腑 + } + this.setData({ + list: dataList, + pageTotalCount: res.totalSize, + bottomLoading: false, + isMoreData: dataList.length > 0 ? false : true, + skeletonLoding: false, + }) + } else { + this.setData({ + skeletonLoding: false, + }) + } + } catch (error) { + console.log(error) + } + }) }, - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず - */ - onShow() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 - */ - onHide() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 - */ - onUnload() { - + goBookDetails(e) { + const { book } = e.currentTarget.dataset; + wx.navigateTo({ + url: `/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`, + }); }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ onPullDownRefresh() { - + if (this._freshing) return + this.setData({ + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false + }) + this._freshing = true; + this.setData({ + triggered: false, + }) + this.getDataList(false); + this._freshing = false }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom() { - + this.setData({ + bottomLoading: true, + isMoreData: false + }) + let bool = false; + if (this.data.pageTotalCount > this.data.list.length) { + bool = true; + this.setData({ + page: this.data.page + 1, + }) + } else { + setTimeout(() => { + this.setData({ + bottomLoading: false, + isMoreData: true + }) + }, 100) + return false; + } + this.getDataList(bool); }, - + // 鐩戝惉婊氬姩璺濈 + onPageScroll(e) { + if (e && e.scrollTop >= 1000) { + this.setData({ + isBackTop: true + }) + } else { + this.setData({ + isBackTop: false + }) + } + }, /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ diff --git a/pages/personalCenter/downloads/index.json b/pages/personalCenter/downloads/index.json index 294e7d0..bd59394 100644 --- a/pages/personalCenter/downloads/index.json +++ b/pages/personalCenter/downloads/index.json @@ -1,4 +1,10 @@ { "navigationBarTitleText": "鎴戠殑涓嬭浇", - "usingComponents": {} + "usingComponents": { + "t-back-top": "tdesign-miniprogram/back-top/back-top", + "t-image": "tdesign-miniprogram/image/image", + "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-empty": "tdesign-miniprogram/empty/empty" + } } \ No newline at end of file diff --git a/pages/personalCenter/downloads/index.wxml b/pages/personalCenter/downloads/index.wxml index b64266a..83981f8 100644 --- a/pages/personalCenter/downloads/index.wxml +++ b/pages/personalCenter/downloads/index.wxml @@ -1,2 +1,39 @@ -<!--pages/personalCenter/downloads/index.wxml--> -<text>pages/personalCenter/downloads/index.wxml</text> +<view class="container" wx:if="{{!skeletonLoding}}"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="pageInfo" wx:if="{{list.length > 0}}"> + <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> + <view class="item-con" data-info="{{item}}" bindtap="toList"> + <view class="icon"> + <t-image src="{{item.product.icon}}" mode="aspectFill" class="img" /> + </view> + <view class="titleBox"> + <view class="item-title">{{item.name}}</view> + <view class="createDate" wx:if="{{item.state !== 'Reject'}}">鐢宠鏃堕棿锛歿{item.createDate}}</view> + <view class="createDate reason" wx:if="{{item.state == 'Reject'}}">鍘熷洜: {{item.feedBack.reason}}</view> + <view class="createDate" wx:if="{{item.state != 'WaitAudit'}}">瀹℃牳鏃堕棿锛歿{item.updateDate}}</view> + </view> + </view> + <view class="stateBox"> + <text wx:if="{{item.state =='Normal'}}" class="success">宸查�氳繃</text> + <text wx:if="{{item.state =='WaitAudit'}}" class="wait">瀹℃牳涓�</text> + <text wx:if="{{item.state =='Reject'}}" class="reject">鏈�氳繃</text> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> + <t-back-top theme="round" wx:if="{{isBackTop}}" text="椤堕儴" bind:to-top="onToTop"></t-back-top> +</view> \ No newline at end of file diff --git a/pages/personalCenter/downloads/index.wxss b/pages/personalCenter/downloads/index.wxss index f73c53a..6d8fe3a 100644 --- a/pages/personalCenter/downloads/index.wxss +++ b/pages/personalCenter/downloads/index.wxss @@ -1 +1,82 @@ -/* pages/personalCenter/downloads/index.wxss */ \ No newline at end of file +/* pages/personalCenter/downloads/index.wxss */ +.container { + padding: 40rpx 30rpx; +} + +.content-item { + padding: 40rpx 0; + border-bottom: 1px solid #EDEDED; + display: flex; +} + +.content-item .icon { + width: 150rpx; + height: 200rpx; +} + +.content-item .icon .img { + width: 100%; + height: 100%; + object-fit: contain; +} + +.item-con { + display: flex; + flex: 1; +} + +.titleBox { + margin-left: 20rpx; +} + +.titleBox .item-title { + font-weight: bold; + margin-bottom: 20rpx; +} + +.createDate { + font-size: 28rpx; + color: #949494; + line-height: 54rpx; +} + +.reason { + width: 400rpx; + line-height: 44rpx; + font-size: 28rpx; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.stateBox { + width: 120rpx; + text-align: right; + font-size: 28rpx; + line-height: 60rpx; +} + +.success { + color: #1FBC1F +} + +.wait { + color: #FF6C00; +} + +.reject { + color: #F03939; + font-weight: bold; +} + +.refresh-container { + margin: 0 auto; +} + +.bottom-loading, +.loading { + padding: 20rpx; + text-align: center; +} \ No newline at end of file diff --git a/pages/personalCenter/feedBack/index.js b/pages/personalCenter/feedBack/index.js index 13d7ca0..9a41106 100644 --- a/pages/personalCenter/feedBack/index.js +++ b/pages/personalCenter/feedBack/index.js @@ -8,12 +8,12 @@ */ data: { active: 0, - activeName: "proposition", + activeName: "bookOpinion", tabList: [ { label: '鍥句功寤鸿', key: 0, - value: 'proposition' + value: 'bookOpinion' }, { label: '鎰忚鍙嶉', @@ -21,11 +21,7 @@ value: "feedback" } ], - list: [ - { - name: "ceshi", - } - ], + list: [], //鍒嗛〉 page: 1, limit: 10, @@ -36,7 +32,7 @@ isBackTop: false, setScrollValue: 0, skeletonLoding: true, - + topicIdOrRefCode: 'bookOpinion' }, /** @@ -44,11 +40,7 @@ */ onLoad(options) { console.log(options); - // if (this.data.activeName == "proposition") { - // this.getDataList("bookOpinion", false); - // } else { - // this.getDataList("feedback", false); - // } + this.getDataList(false); }, /** @@ -79,22 +71,19 @@ skeletonLoding: true, active: item.detail.value, activeName: info.value, + topicIdOrRefCode: info.value, list: [], page: 1, bottomLoading: false, isMoreData: false, }) - if (info.value == "proposition") { - that.getDataList("bookOpinion", false); - } else { - that.getDataList("feedback", false); - } + that.getDataList(false); }, - getDataList(code, isReachBottom) { + getDataList(isReachBottom) { app.MG.ugc.getTopicMessageList({ appRefCode: app.config.appRefCode, - topicIdOrRefCode: code, + topicIdOrRefCode: this.data.topicIdOrRefCode, start: this.data.page * this.data.limit - this.data.limit, size: this.data.limit, sort: { @@ -105,12 +94,12 @@ .then(res => { try { if (res.datas.length > 0) { - // res.datas.forEach((item) => { - // item.title = JSON.parse(item.content).content; - // item.createDate = moment(item.createDate).format("YYYY-MM-DD"); - // item.updateDate = moment(item.updateDate).format("YYYY-MM-DD");; - // item.feedBack = item.feedBack ? item.feedBack : "-"; - // }); + res.datas.forEach((item) => { + item.content = JSON.parse(item.content); + item.createDate = moment(item.createDate).format("YYYY-MM-DD"); + item.updateDate = moment(item.updateDate).format("YYYY-MM-DD"); + item.feedBack = item.feedBack ? item.feedBack : "-"; + }); let dataList = res.datas; //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� if (isReachBottom) { @@ -123,7 +112,7 @@ isMoreData: dataList.length > 0 ? false : true, skeletonLoding: false, }) - console.log(this.data.list, 333) + console.log(this.data.list, 123) } else { this.setData({ skeletonLoding: false, @@ -151,11 +140,7 @@ this.setData({ triggered: false, }) - if (this.data.activeName == "proposition") { - this.getDataList("bookOpinion", false); - } else { - this.getDataList("feedback", false); - } + this.getDataList(false); this._freshing = false }, @@ -182,11 +167,7 @@ }, 100) return false; } - if (this.data.activeName == "proposition") { - this.getDataList("bookOpinion", bool); - } else { - this.getDataList("feedback", bool); - } + this.getDataList(bool); }, // 鐩戝惉婊氬姩璺濈 diff --git a/pages/personalCenter/feedBack/index.wxml b/pages/personalCenter/feedBack/index.wxml index 2825540..3a54e3b 100644 --- a/pages/personalCenter/feedBack/index.wxml +++ b/pages/personalCenter/feedBack/index.wxml @@ -1,50 +1,55 @@ <view class="container"> - <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{active}}" space-evenly="{{false}}" bind:change="tabBookClick"> + <t-tabs t-class="t-tabs" split="{{false}}" defaultValue="{{active}}" bind:change="tabBookClick"> <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.label}}" value="{{index}}"> - <view class="pageInfo"> - <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> - <view slot="refresher" class="refresh-container"> - <view class="loading"> - <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> - </view> - </view> - {{list}} - <view class="list"> - <view wx:if="{{activeName == 'bookOpinion'}}" class="listBox"> - <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> - <view class="icon"> - <t-image src="{{item.icon}}" mode="heightFix" class="img" /> - </view> - <view class="item-con"> - <view class="titleBox"> - <view class="item-title">{{item.name}}</view> - </view> - </view> - </view> - </view> - <!-- <view wx:if="{{activeName == 'feedback'}}"> - <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> - <view class="item-con"> - <view class="titleBox"> - <view class="item-title">{{item.name}}</view> - </view> - </view> - </view> - </view> --> - </view> - <view wx:if="{{list.length == 0}}" class="empyt"> - <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> - </view> - <view class="bottom-loading" wx:if="{{bottomLoading}}"> - <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> - </view> - <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> - <text>娌℃湁鏇村浜�</text> - </view> - </scroll-view> - </view> </t-tab-panel> </t-tabs> + <view class="pageInfo"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="list" wx:if="{{list.length > 0}}"> + <view wx:if="{{activeName == 'bookOpinion'}}" class="listBox"> + <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> + <view class="icon"> + <t-image src="{{item.content.icon}}" mode="aspectFill" class="img" /> + </view> + <view class="item-con"> + <view class="titleBox"> + <view class="item-title">{{item.name}}</view> + </view> + <view class="name">寤鸿锛歿{item.content.content}}</view> + <view class="feedBack">鍙嶉锛歿{item.feedBack}}</view> + </view> + </view> + </view> + <view wx:if="{{activeName == 'feedback'}}" class="backBox"> + <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> + <view class="item-con"> + <view class="item-title">{{item.name}}</view> + <view class="backCon"> + <view> + 鍥炲锛歿{item.feedBack}} + </view> + </view> + </view> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> + </view> + <view class="submitBox" bindtap="goSubmit" wx:if="{{activeName == 'feedback'}}"> <view class="box"> <t-image src="/static/images/personal/suggestion.png" mode="heightFix" class="img" /> diff --git a/pages/personalCenter/feedBack/index.wxss b/pages/personalCenter/feedBack/index.wxss index 6e24a8b..db30755 100644 --- a/pages/personalCenter/feedBack/index.wxss +++ b/pages/personalCenter/feedBack/index.wxss @@ -4,6 +4,15 @@ padding: 0 24rpx; } +.page-header { + background-color: #F2F3F8; + width: 100%; + position: fixed; + top: 0; + left: 0; + z-index: 1 +} + .t-tabs__track { display: none; } @@ -57,18 +66,89 @@ text-align: center; } -.content { +.container { height: calc(100vh - env(safe-area-inset-bottom)); box-sizing: border-box; } -.content-item { - background: #fff; +.pageInfo { + margin-top: -30rpx; } -.listBox:nth-child(1) { - margin-top: -30rpx; - padding-top: 30rpx; +.content-item { + background: #fff; + display: flex; + margin-bottom: 30rpx; + border-radius: 10rpx; + padding: 40rpx 30rpx; +} + +.content-item:nth-child(1) { + padding-top: 70rpx; +} + +.listBox .icon { + width: 150rpx; + height: 200rpx; +} + +.listBox .icon .img { + width: 100%; + height: 100%; + object-fit: contain; +} + +.listBox .item-con { + flex: 1; + margin-left: 20rpx; +} + +.listBox .titleBox { + font-size: 28rpx; + font-weight: bold; + border-bottom: 2rpx solid #EDEDED; + line-height: 80rpx; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + overflow: hidden; + padding-bottom: 10rpx; +} + +.name { + font-size: 26rpx; + color: #9D9D9D; + line-height: 70rpx; +} + +.feedBack { + font-size: 26rpx; + color: #FF6C00; +} + +.backBox .content-item { + display: block; +} + +.backBox .item-title { + font-size: 28rpx; + font-weight: bold; + line-height: 80rpx; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + overflow: hidden; + padding-bottom: 10rpx; +} + +.backCon { + background: #FAFAFA; + border-radius: 5rpx; + padding: 10rpx 20rpx; + font-size: 28rpx; + line-height: 60rpx; } .submitBox { @@ -99,5 +179,6 @@ } .empyt { + background: #fff; padding: 200rpx 0; } \ No newline at end of file diff --git a/pages/personalCenter/index.js b/pages/personalCenter/index.js index 2c1760e..e7c30db 100644 --- a/pages/personalCenter/index.js +++ b/pages/personalCenter/index.js @@ -15,7 +15,7 @@ { title: '鎴戠殑璇佷功', icon: '/static/images/personal/certificate.png', - url: '/pages/personalCenter/certificate/index', + url: '', type: 'certificate', }, { @@ -37,16 +37,16 @@ type: 'sampleBook', }, { - title: '鍑轰功鐢宠', - icon: '/static/images/personal/chushu.png', - url: '/pages/personalCenter/publishBooks/index', - type: 'publishBooks', - }, - { title: '鎴戠殑涓婁紶', icon: '/static/images/personal/upload.png', url: '', type: 'upload', + }, + { + title: '鍑轰功鐢宠', + icon: '/static/images/personal/chushu.png', + url: '/pages/personalCenter/publishBooks/index', + type: 'publishBooks', } ]; const moreMenu = [ @@ -67,7 +67,7 @@ { title: '鍏充簬鎴戜滑', icon: '/static/images/personal/about.png', - url: '', + url: '/pages/aboutUs/index', type: 'aboutUs', }, { @@ -175,6 +175,12 @@ } }) }, + //鏁欏笀璁よ瘉 + toCertification() { + wx.navigateTo({ + url: "/pages/teacherCertification/index", + }); + }, //鐐瑰嚮鐩綍 toPages(item) { diff --git a/pages/personalCenter/index.wxml b/pages/personalCenter/index.wxml index 4e3b370..9836891 100644 --- a/pages/personalCenter/index.wxml +++ b/pages/personalCenter/index.wxml @@ -5,7 +5,7 @@ <view class="bg"> <image src="/static/images/personal/my-bg.png" mode="heightFix" class="image" /> </view> - <image class="background" src="/static/images/personal/my-bg.png" mode="heightFix" /> + <!-- <image class="background" src="/static/images/personal/my-bg.png" mode="heightFix" /> --> <t-user-center-card userInfo="{{userInfo}}" isPhoneHide="{{true}}" name-class="custom-name-class" phone-class="custom-phone-class" avatar-class="customer-avatar-class" currAuthStep="{{currAuthStep}}" bind:gotoUserEditPage="gotoUserEditPage" /> <view class="content-wrapper"> <view class="topBox"> @@ -16,8 +16,8 @@ <view class="no" wx:if="{{teacherState.state == 'Reject'}}">宸查┏鍥�</view> <view class="wait" wx:if="{{teacherState.state == ''}}">寰呰璇�</view> <view class="title"><text>鏁欏笀璁よ瘉</text> - <text class="change-info" wx:if="{{teacherState.state == ''}}">璁よ瘉</text> - <text class="change-info" wx:if="{{teacherState.state == 'Normal' || teacherState.state == 'Reject'}}">淇敼</text> + <text class="change-info" wx:if="{{teacherState.state == ''}}" bindtap="toCertification">璁よ瘉</text> + <text class="change-info" wx:if="{{teacherState.state == 'Normal' || teacherState.state == 'Reject'}}" bindtap="toCertification">淇敼</text> </view> </view> <view> diff --git a/pages/personalCenter/myCollection/index.js b/pages/personalCenter/myCollection/index.js index d5bdf97..9bbc225 100644 --- a/pages/personalCenter/myCollection/index.js +++ b/pages/personalCenter/myCollection/index.js @@ -22,11 +22,11 @@ list: [], //鍒嗛〉 page: 1, - limit: 12, + limit: 18, pageTotalCount: 0, bottomLoading: false, isMoreData: false, - // 杩斿洖椤堕儴 + // 杩斿洖椤堕儴 isBackTop: false, setScrollValue: 0, skeletonLoding: true, @@ -37,7 +37,7 @@ */ onLoad(options) { console.log(options); - this.getDataList(); + this.getDataList(false); }, /** @@ -175,11 +175,11 @@ } }) }, - goBookDetails(itemData) { - let info = itemData.currentTarget.dataset.info; - // wx.navigateTo({ - // url: "/pages/personalCenter/myMassage/massageDetail/index?id=" + info.id, - // }); + goBookDetails(e) { + const { book } = e.currentTarget.dataset; + wx.navigateTo({ + url: `/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`, + }); }, diff --git a/pages/personalCenter/myCollection/index.wxml b/pages/personalCenter/myCollection/index.wxml index c07d67f..8636000 100644 --- a/pages/personalCenter/myCollection/index.wxml +++ b/pages/personalCenter/myCollection/index.wxml @@ -1,5 +1,5 @@ <view class="container"> - <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{active}}" space-evenly="{{false}}" bind:change="tabBookClick"> + <t-tabs t-class="t-tabs" defaultValue="{{active}}" split="{{false}}" bind:change="tabBookClick"> <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.label}}" value="{{index}}"> <view class="pageInfo"> <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> @@ -11,10 +11,10 @@ <view class="list" wx:if="{{list.length > 0}}"> <view wx:if="{{activeName == 'FavoriteBookCity'}}" class="listBox"> <view class="content-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> - <view class="icon" data-info="{{item}}" bindtap="goBookDetails"> + <view class="icon" data-book="{{item}}" bindtap="goBookDetails"> <t-image src="{{item.icon}}" mode="" class="img" /> </view> - <view class="body-info" data-info="{{item}}" bindtap="goBookDetails"> + <view class="body-info" data-book="{{item}}" bindtap="goBookDetails"> <view class="name">{{item.name}}</view> <view class="author">{{item.author}}</view> </view> diff --git a/pages/personalCenter/myOrder/index.js b/pages/personalCenter/myOrder/index.js index 4537c2f..8b502b1 100644 --- a/pages/personalCenter/myOrder/index.js +++ b/pages/personalCenter/myOrder/index.js @@ -9,26 +9,21 @@ */ data: { active: 0, - activeName: "FavoriteBookCity", tabList: [ { label: '鍏ㄩ儴', - key: 0, value: 'all', }, { label: '寰呮敮浠�', - key: 1, value: 'WaitPay', }, { label: '宸插畬鎴�', - key: 1, value: 'Success', }, { label: '宸插彇娑�', - key: 1, value: 'Cancel', } ], @@ -67,7 +62,6 @@ that.setData({ skeletonLoding: true, active: item.detail.value, - activeName: info.value, queryFilter: info.value == 'all' ? [] : [{ field: 'State', value: info.value }], list: [], page: 1, @@ -138,7 +132,7 @@ } this.setData({ list: dataList, - pageTotalCount: res.total, + pageTotalCount: res.totalSize, bottomLoading: false, isMoreData: dataList.length > 0 ? false : true, skeletonLoding: false, @@ -165,7 +159,7 @@ this.setData({ // list: [], page: 1, - limit: 18, + limit: 12, pageTotalCount: 0, bottomLoading: false, isMoreData: false @@ -204,6 +198,138 @@ this.getDataList(bool); }, + onCancel(e) { + let { orderNum } = e.currentTarget.dataset + console.log(orderNum, 12) + wx.showModal({ + title: '鎻愮ず', //鎻愮ず鐨勬爣棰� + content: '纭畾瑕佸彇娑堣鍗曪紵', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + app.MG.store.cancelOrder({ orderNum: orderNum }).then(() => { + wx.showToast({ + title: "璁㈠崟宸插彇娑�", + icon: 'success', + duration: 1000 + }) + this.getDataList(false) + }) + } else if (res.cancel) { + console.log('鐢ㄦ埛鐐瑰嚮浜嗗彇娑�') + } + } + }) + + }, + //绔嬪嵆鏀粯銆佸啀娆¤喘涔� + onPayment(e) { + var that = this; + const { + orderNum + } = e.currentTarget.dataset + const data = { + orderNum: orderNum, + }; + app.MG.store.getOrderByOrderNum(data).then(res => { + if (res && res.state != "WaitPay") { + app.MG.store.confirmOrder(data).then(conRes => { + if (conRes.orderNumber) { + const resOrderNum = { + orderNum: conRes.orderNumber, + }; + if (conRes.payPrice != 0) { + app.MG.store.makeWeChatPay(resOrderNum).then(payRes => { + const payVal = JSON.parse(payRes); + wx.requestPayment({ + "appId": payVal.appId, + "timeStamp": payVal.timeStamp, + "nonceStr": payVal.nonceStr, + "package": payVal.package, + "signType": payVal.signType, + "paySign": payVal.paySign, + "success": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPaySuccess: true + }) + } + console.log(res, "鎴愬姛") + }, + "fail": function (res) { + console.log(res, "澶辫触") + }, + "complete": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPayComplete: true + }) + } + if (that.data.isPaySuccess && that.data.isPayComplete) { + that.navToBack() + } + } + }) + }); + } else { + wx.showToast({ + title: '棰嗗彇鎴愬姛', + }) + // 鍙坊鍔犺繑鍥炰笂绾� + setTimeout(() => { + that.navToBack() + }, 2000); + } + } + }); + } else { + app.MG.store + .makeWeChatPay({ + orderNum: orderNum + }) + .then(payRes => { + const payVal = JSON.parse(payRes); + wx.requestPayment({ + "appId": payVal.appId, + "timeStamp": payVal.timeStamp, + "nonceStr": payVal.nonceStr, + "package": payVal.package, + "signType": payVal.signType, + "paySign": payVal.paySign, + "success": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPaySuccess: true + }) + } + }, + "fail": function (res) { + console.log(res, "澶辫触") + }, + "complete": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPayComplete: true + }) + } + if (that.data.isPaySuccess && that.data.isPayComplete) { + that.navToBack() + } + } + }) + }); + } + }); + + }, + + //鍒犻櫎璁㈠崟 + onDel(e) { + const { + orderNum + } = e.currentTarget.dataset + + }, + /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ diff --git a/pages/personalCenter/myOrder/index.wxml b/pages/personalCenter/myOrder/index.wxml index 5140519..c0ab04c 100644 --- a/pages/personalCenter/myOrder/index.wxml +++ b/pages/personalCenter/myOrder/index.wxml @@ -1,74 +1,73 @@ -<view class="container"> +<view class="page-header"> <view class="search"> <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="璇疯緭鍏ヨ鍗曠紪鍙�" leftIcon=""> <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" bind:tap="navToSearchPage" /> </t-search> </view> - <t-tabs t-class="t-tabs" t-class-active="tabs-external__active" t-class-item="tabs-external__item" defaultValue="{{active}}" space-evenly="{{false}}" bind:change="tabBookClick"> - <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.label}}" value="{{index}}"> - <view class="pageInfo"> - <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> - <view slot="refresher" class="refresh-container"> - <view class="loading"> - <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> - </view> - </view> - <view class="list" wx:if="{{list.length > 0}}"> - <view class="content-item" wx:for="{{list}}" wx:for-item="items" wx:for-index="index" wx:key="index"> - <view class="order-cent"> - <text class="order-cent-one">璁㈠崟鍙�: {{items.orderNumber}}</text> - <text class="right {{items.colorName}}">{{items.CustomState}}</text> - </view> - <view class="order-centent"> - <view class="bookBox {{items.saleMethodLinks.length == 1 ? 'flex' : ''}}" wx:for="{{items.saleMethodLinks}}" wx:for-item="itemes" wx:for-index="idx" wx:key="idx" bindtap="onOrderDetail" data-info="{{itemes}}"> - <view class="leftCon {{items.saleMethodLinks.length == 1 ? 'fl' : ''}}"> - <!-- 鑾峰彇鍥剧墖 --> - <image class="purchasedIcon" wx:if="{{itemes.icon}}" src="{{itemes.icon}}" mode="aspectFit" /> - <image class="purchasedIcon" wx:else src="/static/images/default-book-img.png" mode="aspectFit" /> - </view> - <!-- 鑾峰彇鍚嶇О --> - <view class="rightCon"> - <view class="productTitle">{{itemes.name}}</view> - <view> - <text class="typeBox">{{ - itemes.orderSaleMethod.type == 'defaultSaleMethod' - ? '鍥句功鏈嶅姟-鐢靛瓙涔�' - : itemes.orderSaleMethod.type == 'createProductSaleMethod' && itemes.orderSaleMethod.cmsItemList == 0 ? '鍥句功鏈嶅姟-缁勫嵎' : '鍥句功鏈嶅姟-浜戝涔�' - }}</text> - </view> - <!-- <text wx:if="{{itemes.payPrice >0}}" class="price">锟{itemes.payPrice}}<text wx:if="{{itemes.oldPrice >0}}" class="oldPrice">(鍘熷畾浠凤細锟{items.oldPrice}})</text></text> - <text wx:else class="freePrice">鍏嶈垂</text> --> - <!-- <text class="productTop"><text>鍒涘缓鏃堕棿</text>锛歿{items.createDate}}</text> --> - </view> - </view> - <view class="count"> - <text wx:if="{{items.saleMethodLinks.length > 1 }}">鍏眥{items.saleMethodLinks.length}}浠�</text> - <text wx:if="{{items.saleMethodLinks.length == 1 }}">锟{items.payPrice}}</text> - </view> - </view> - <view class="order-top"> - <text class="finishedDate" wx:if="{{items.state == 'Success'}}">{{items.finishedDate}}</text> - <text class="order-top-price" wx:if="{{items.state == 'WaitPay'}}">搴斾粯锛�<text class="">锟{items.payPrice}}</text></text> - <view class="button-example" wx:if="{{items.state == 'WaitPay'}}"> - <button class="button" bindtap="onCancel" data-order-num="{{items.orderNumber}}">鍙栨秷璁㈠崟</button> - <button class="unfollow" bindtap="onPayment" data-order-num="{{items.orderNumber}}">绔嬪嵆鏀粯</button> - </view> - <view wx:if="{{items.state == 'Cancel'}}" class="button-bottem">鎬昏锛�<text class="price">锟{items.payPrice}}</text> </view> - </view> - </view> - </view> - <view wx:if="{{list.length == 0}}" class="empyt"> - <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> - </view> - <view class="bottom-loading" wx:if="{{bottomLoading}}"> - <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> - </view> - <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> - <text>娌℃湁鏇村浜�</text> - </view> - </scroll-view> - </view> - </t-tab-panel> + <t-tabs t-class="t-tabs" defaultValue="{{active}}" split="{{false}}" bind:change="tabBookClick"> + <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.label}}" value="{{index}}" /> </t-tabs> - <t-back-top theme="round" wx:if="{{isBackTop}}" text="椤堕儴" bind:to-top="onToTop"></t-back-top> -</view> \ No newline at end of file +</view> +<view class="pageInfo"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="list" wx:if="{{list.length > 0}}"> + <view class="content-item" wx:for="{{list}}" wx:for-item="items" wx:for-index="index" wx:key="index"> + <view class="order-cent"> + <text class="order-cent-one">璁㈠崟鍙�: {{items.orderNumber}}</text> + <text class="right {{items.colorName}}">{{items.CustomState}}</text> + </view> + <view class="order-centent"> + <scroll-view class="srcolbox" scroll-x scroll-with-animation='true'> + <view class="bookBox {{items.saleMethodLinks.length == 1 ? 'flex' : ''}}" wx:for="{{items.saleMethodLinks}}" wx:for-item="itemes" wx:for-index="idx" wx:key="idx" bindtap="onOrderDetail" data-info="{{itemes}}"> + <view class="leftCon {{items.saleMethodLinks.length == 1 ? 'fl' : ''}}"> + <!-- 鑾峰彇鍥剧墖 --> + <image class="purchasedIcon" wx:if="{{itemes.icon}}" src="{{itemes.icon}}" mode="aspectFit" /> + <image class="purchasedIcon" wx:else src="/static/images/default-book-img.png" mode="aspectFit" /> + </view> + <!-- 鑾峰彇鍚嶇О --> + <view class="rightCon"> + <view class="productTitle">{{itemes.name}}</view> + <view class="cmsName" wx:if="{{itemes.orderSaleMethod.type != 'defaultSaleMethod'}}">{{itemes.orderSaleMethod.cmsItemList[0].name}}</view> + <view class="{{items.saleMethodLinks.length == 1 ? 'top' : ''}}"> + <text class="typeBox">{{ + itemes.orderSaleMethod.type == 'defaultSaleMethod' + ? '鍥句功鏈嶅姟-鐢靛瓙涔�' + : itemes.orderSaleMethod.type == 'createProductSaleMethod' && itemes.orderSaleMethod.cmsItemList == 0 ? '鍥句功鏈嶅姟-缁勫嵎' : '鍥句功鏈嶅姟-浜戝涔�' + }}</text> + </view> + </view> + </view> + </scroll-view> + <view class="count"> + <text wx:if="{{items.saleMethodLinks.length > 1 }}">鍏眥{items.saleMethodLinks.length}}浠�</text> + <text wx:if="{{items.saleMethodLinks.length == 1 }}">锟{items.payPrice}}</text> + </view> + </view> + <view class="order-top"> + <text class="finishedDate" wx:if="{{items.state == 'Success'}}">{{items.finishedDate}}</text> + <text class="order-top-price" wx:if="{{items.state == 'WaitPay'}}">搴斾粯锛�<text class="">锟{items.payPrice}}</text></text> + <view class="button-example" wx:if="{{items.state == 'WaitPay'}}"> + <button class="button" bindtap="onCancel" data-order-num="{{items.orderNumber}}">鍙栨秷璁㈠崟</button> + <button class="unfollow" bindtap="onPayment" data-order-num="{{items.orderNumber}}">绔嬪嵆鏀粯</button> + </view> + <view wx:if="{{items.state == 'Cancel'}}" class="button-bottem">鎬昏锛�<text class="price">锟{items.payPrice}}</text> </view> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> +</view> +<t-back-top theme="round" wx:if="{{isBackTop}}" text="椤堕儴" bind:to-top="onToTop"></t-back-top> \ No newline at end of file diff --git a/pages/personalCenter/myOrder/index.wxss b/pages/personalCenter/myOrder/index.wxss index 8ac30eb..6b750d8 100644 --- a/pages/personalCenter/myOrder/index.wxss +++ b/pages/personalCenter/myOrder/index.wxss @@ -1,3 +1,28 @@ +page { + width: 100vw; + height: 100%; +} + +.page-header { + background: #fff; + width: 100%; + position: fixed; + top: 0rpx; + left: 0; + padding-top: 20rpx; + z-index: 1 +} + +.refresh-container { + margin: 0 auto; +} + +.bottom-loading, +.loading { + padding: 20rpx; + text-align: center; +} + .t-search__input { font-size: 28rpx !important; color: rgb(116, 116, 116) !important; @@ -17,8 +42,8 @@ } .t-tabs__track { - /* left: 28rpx !important; */ background-color: #FF6C00 !important; + width: 80rpx !important; } .t-tabs__item--active { @@ -28,6 +53,8 @@ .pageInfo { background: #F2F3F8; + padding-top: 200rpx; + height: calc(100% - 200rpx) } .list { @@ -44,6 +71,7 @@ .order-cent { padding: 10rpx 0; + font-size: 28rpx; } .right { @@ -70,25 +98,58 @@ .order-centent { display: flex; border-bottom: 2rpx solid #EFF0F1; + padding: 20rpx 0; +} + + + +.srcolbox { + flex: 1; + width: 80%; + white-space: nowrap; +} + +.srcolbox .bookBox { + display: inline-block; + width: 240rpx; + margin-right: 10rpx; + margin-left: 10rpx; + /* box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(0, 0, 0, 0.08); */ + } .bookBox { flex: 1; - padding: 30rpx 0; + padding: 20rpx 0; + margin: 20rpx 0; + text-align: center; } +.order-centent .flex { + width: 100%; + box-shadow: none; + text-align: left; + margin-right: 0; +} .bookBox .leftCon { - width: 150rpx; + /* width: 150rpx; */ + width: 240rpx; height: 210rpx; - box-shadow: 0px 0px 20rpx 2px #f1f1f1; + /* box-shadow: 0px 0px 20rpx 2px #f1f1f1; */ + border: 2rpx solid #E9e9e9; + margin: 0 auto; + padding: 20rpx 0; } .fl { + width: 150rpx !important; float: left; margin-right: 20rpx; + margin-left: 20rpx !important; + padding: 0 !important; } .bookBox .leftCon .purchasedIcon { @@ -98,40 +159,51 @@ } .productTitle { - font-size: 32rpx; - height: 88rpx; + font-size: 30rpx; color: #333333; font-weight: bold; - line-height: 44rpx; - display: -webkit-box; - margin-bottom: 30rpx; + line-height: 38rpx; + margin-bottom: 10rpx; -webkit-box-orient: vertical; - -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: ellipsis; +} + +.cmsName { + color: #949494; + font-size: 24rpx; + line-height: 24rpx; + margin-bottom: 20rpx; + -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .flex .rightCon { - margin-left: 160rpx; + margin-left: 200rpx; } .rightCon { - margin-top: 10rpx; - margin-right: 20rpx; + padding: 20rpx 10rpx; +} + +.top { + margin-top: 30rpx; } .count { display: flex; align-items: center; - margin-left: 30rpx; + margin-left: 10rpx; + font-size: 28rpx; } .typeBox { background: rgba(255, 108, 0, 0.24); - border-radius: 9rpx 9rpx 9rpx 9rpx; - padding: 8rpx 20rpx; + border-radius: 10rpx; + padding: 8rpx 16rpx; color: #FF6C00; - + font-size: 24rpx; } .order-top { @@ -139,6 +211,7 @@ display: flex; justify-content: space-between; align-items: center; + font-size: 28rpx; } .button-example { diff --git a/pages/personalCenter/sampleBooks/index.js b/pages/personalCenter/sampleBooks/index.js index 1cd80ed..984fa38 100644 --- a/pages/personalCenter/sampleBooks/index.js +++ b/pages/personalCenter/sampleBooks/index.js @@ -1,11 +1,44 @@ -// pages/personalCenter/sampleBooks/index.js +const app = getApp(); +import moment from 'moment' Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - + active: 0, + topicIdOrRefCode: "applyEntityBook", + active1: 0, + tabList: [ + { + label: '鍏ㄩ儴', + value: 'all', + }, + { + label: '瀹℃牳涓�', + value: 'waitAudit', + }, + { + label: '宸查�氳繃', + value: 'Normal', + }, + { + label: '鏈�氳繃', + value: 'Reject', + } + ], + list: [], + //鍒嗛〉 + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false, + // 杩斿洖椤堕儴 + isBackTop: false, + setScrollValue: 0, + skeletonLoding: true, + queryFilter: [] }, /** @@ -13,48 +46,140 @@ */ onLoad(options) { console.log(options); + this.getDataList(false); + }, + tabClick(item) { + let that = this; + if (item.detail.value == '1') { + that.setData({ + active: item.detail.value, + topicIdOrRefCode: 'applyBook', + }) + } else { + that.setData({ + active: item.detail.value, + topicIdOrRefCode: 'applyEntityBook', + }) + } + that.setData({ + active1: 0, + queryFilter: [], + skeletonLoding: true, + list: [], + page: 1, + bottomLoading: false, + isMoreData: false, + }) + that.getDataList(false); + }, + tabBookClick(item) { + let that = this; + let info = this.data.tabList[item.detail.value] + that.setData({ + skeletonLoding: true, + active1: item.detail.value, + queryFilter: info.value == 'all' ? [] : [{ field: 'State', value: info.value }], + list: [], + page: 1, + bottomLoading: false, + isMoreData: false, + }) + that.getDataList(false); }, - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 - */ - onReady() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず - */ - onShow() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 - */ - onHide() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 - */ - onUnload() { - + getDataList(isReachBottom) { + app.MG.ugc.getTopicMessageList({ + start: this.data.page * this.data.limit - this.data.limit, + size: this.data.limit, + topicIdOrRefCode: this.data.topicIdOrRefCode, + appRefCode: app.config.appRefCode, + filterList: this.data.queryFilter, + sort: { + type: 'Desc', + field: 'CreateDate' + } + }).then((res) => { + try { + if (res.datas.length > 0) { + res.datas.forEach((item) => { + item.updateDate = moment(item.updateDate).format("YYYY-MM-DD"); + if (item.feedBack) { + item.feedBack = JSON.parse(item.feedBack) + } + if (item.content) { + item.productList = JSON.parse(item.content) + } + }) + let dataList = res.datas; + //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� + if (isReachBottom) { + dataList = [...this.data.list, ...dataList] //灏嗘柊鏁版嵁鍔犲叆鑰佹暟鎹腑 + } + this.setData({ + list: dataList, + pageTotalCount: res.totalSize, + bottomLoading: false, + isMoreData: dataList.length > 0 ? false : true, + skeletonLoding: false, + loading: false + }) + } else { + this.setData({ + skeletonLoding: false, + loading: false + }) + } + } catch (error) { + console.log(error) + } + }) }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ onPullDownRefresh() { - + if (this._freshing) return + this.setData({ + // list: [], + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false + }) + this._freshing = true; + this.setData({ + triggered: false, + }) + this.getDataList(false); + this._freshing = false }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom() { - + this.setData({ + bottomLoading: true, + isMoreData: false + }) + let bool = false; + if (this.data.pageTotalCount > this.data.list.length) { + bool = true; + this.setData({ + page: this.data.page + 1, + }) + } else { + setTimeout(() => { + this.setData({ + bottomLoading: false, + isMoreData: true + }) + }, 100) + return false; + } + this.getDataList(bool); }, /** diff --git a/pages/personalCenter/sampleBooks/index.json b/pages/personalCenter/sampleBooks/index.json index 95911bb..d0c55b0 100644 --- a/pages/personalCenter/sampleBooks/index.json +++ b/pages/personalCenter/sampleBooks/index.json @@ -1,4 +1,12 @@ { "navigationBarTitleText": "鏍蜂功鐢宠", - "usingComponents": {} + "usingComponents": { + "t-tabs": "tdesign-miniprogram/tabs/tabs", + "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", + "t-back-top": "tdesign-miniprogram/back-top/back-top", + "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-image": "tdesign-miniprogram/image/image", + "t-empty": "tdesign-miniprogram/empty/empty" + } } \ No newline at end of file diff --git a/pages/personalCenter/sampleBooks/index.wxml b/pages/personalCenter/sampleBooks/index.wxml index d4eb5c9..98927fa 100644 --- a/pages/personalCenter/sampleBooks/index.wxml +++ b/pages/personalCenter/sampleBooks/index.wxml @@ -1,2 +1,71 @@ -<!--pages/personalCenter/sampleBooks/index.wxml--> -<text>pages/personalCenter/sampleBooks/index.wxml</text> +<view class="page-header"> + <view class="tabOne"> + <t-tabs t-class="t-tabs" defaultValue="{{active}}" split="{{false}}" bind:change="tabClick"> + <t-tab-panel label="绾歌川鏍蜂功" value="0" /> + <t-tab-panel label="鐢靛瓙鏍蜂功" value="1" /> + </t-tabs> + </view> + <view class="tabTwo"> + <t-tabs t-class="custom-tabs" value="{{active1}}" split="{{false}}" bind:change="tabBookClick"> + <t-tab-panel wx:for="{{tabList}}" wx:for-index="index" wx:key="index" label="{{item.label}}" value="{{index}}" /> + </t-tabs> + </view> +</view> +<view class="pageInfo"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="list" wx:if="{{list.length > 0}}"> + <view class="content-item" wx:for="{{list}}" wx:for-item="items" wx:for-index="index" wx:key="index"> + <view class="codeInfoBox"> + <view class="top"> + <view class="stateBox">鐘舵�侊細 + <text wx:if="{{items.state =='Normal'}}" class="success">宸查�氳繃</text> + <text wx:if="{{items.state =='WaitAudit'}}" class="wait">瀹℃牳涓�</text> + <text wx:if="{{items.state =='Reject'}}" class="reject">鏈�氳繃</text> + </view> + <view>鐢宠鏃ユ湡锛歿{items.updateDate ? items.updateDate : '-'}}</view> + </view> + <view class="down"> + <text wx:if="{{active == '1' && items.state =='Normal'}}">鏈夋晥鏈熻嚦锛歿{items.feedBack ? items.feedBack.endDate : '-'}}</text> + <text wx:if="{{items.state =='Reject'}}">鍘熷洜锛歿{items.feedBack.reason}}</text> + <view wx:if="{{active == '0' && items.state =='Normal'}}" class="mailInfo"> + <text class="mailNum">蹇�掑崟鍙凤細{{items.feedBack && items.feedBack.mailNum ? items.feedBack.mailNum : '-'}}</text> + <text>蹇�掑叕鍙革細{{items.feedBack.mailName ? items.feedBack.mailName : '-'}}</text> + </view> + </view> + </view> + <view class="listBox"> + <scroll-view class="srcolbox" scroll-x scroll-with-animation='true'> + <view class="order-centent"> + <view class="bookBox" wx:for="{{items.productList}}" wx:for-item="itemes" wx:for-index="idx" wx:key="idx" bindtap="onOrderDetail" data-info="{{itemes}}"> + <view class="leftCon"> + <!-- 鑾峰彇鍥剧墖 --> + <image class="purchasedIcon" wx:if="{{itemes.icon}}" src="{{itemes.icon}}" mode="aspectFit" /> + <image class="purchasedIcon" wx:else src="/static/images/default-book-img.png" mode="aspectFit" /> + </view> + <!-- 鑾峰彇鍚嶇О --> + <view class="rightCon"> + <view class="productTitle">{{itemes.title}}</view> + </view> + </view> + </view> + </scroll-view> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> +</view> +<t-back-top theme="round" wx:if="{{isBackTop}}" text="椤堕儴" bind:to-top="onToTop"></t-back-top> \ No newline at end of file diff --git a/pages/personalCenter/sampleBooks/index.wxss b/pages/personalCenter/sampleBooks/index.wxss index 73a1729..49d188b 100644 --- a/pages/personalCenter/sampleBooks/index.wxss +++ b/pages/personalCenter/sampleBooks/index.wxss @@ -1 +1,178 @@ -/* pages/personalCenter/sampleBooks/index.wxss */ \ No newline at end of file +/* pages/personalCenter/sampleBooks/index.wxss */ +page { + background-color: #F2F3F8; + box-sizing: border-box; +} + +.page-header { + background-color: #F2F3F8; + width: 100%; + position: fixed; + top: 0; + left: 0; + z-index: 1 +} + +.tabOne .t-tabs__track { + display: none; + +} + +.tabOne .t-tabs { + margin-top: 20rpx; + background: none !important; +} + +.tabOne .t-tabs__wrapper { + background: none !important; +} + +.tabOne .t-tabs__nav :nth-child(1) { + border-radius: 30rpx 30rpx 0 0rpx; +} + +.tabOne .t-tabs__nav :nth-child(2) { + border-radius: 0rpx 30rpx 0 30rpx; +} + +.tabOne .t-tabs__item { + flex: 1 !important; + background: #E6E8F1; + height: 76rpx !important; + margin-top: 16rpx; + border-radius: 30rpx 0 30rpx 0rpx !important; +} + +.tabOne .t-tabs__item--active { + color: #333 !important; + background: #fff; + height: 96rpx; + font-size: 32rpx; + margin-top: 0; + height: 96rpx !important; + border-radius: 30rpx 30rpx 0 0rpx !important; +} + +.tabOne .t-tabs__item--active+.t-tabs__item { + border-radius: 0 30rpx 0 30rpx !important; +} + +.tabTwo { + background: #fff; + padding-top: 50rpx; + margin-top: -30rpx; + +} + +.tabTwo .t-tabs__item { + flex: 1 !important; +} + +.tabTwo .t-tabs__track { + background-color: #FF6C00 !important; + width: 80rpx !important; +} + +.tabTwo .t-tabs__item--active { + font-size: 30rpx; + color: #FF6C00 !important; +} + +.refresh-container { + margin: 0 auto; +} + +.bottom-loading, +.loading { + padding: 20rpx; + text-align: center; +} + +.empyt { + padding: 100rpx 0; +} + +.pageInfo { + margin-top: 230rpx; +} + +.content-item { + margin-bottom: 30rpx; + padding: 30rpx; + background: #fff; + border-radius: 10rpx; +} + +.codeInfoBox { + border: 2rpx solid #EDECEC; + border-radius: 10rpx; + background: #f3f3f3; + padding: 20rpx; + font-size: 28rpx; + line-height: 56rpx; +} + +.top, +.mailInfo { + display: flex; + justify-content: space-between; +} + +.mailNum { + display: inline-block; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + max-width: 440rpx; +} + +.success { + color: #1FBC1F +} + +.wait { + color: #FF6C00; +} + +.reject { + color: #F03939; + font-weight: bold; +} + + +.order-centent { + display: flex; +} + +.bookBox { + padding: 30rpx 40rpx 0 20rpx; + width: 200rpx; +} + +.bookBox .leftCon { + width: 180rpx; + height: 240rpx; + box-shadow: 0px 0px 20rpx 2px #f1f1f1; +} + +.bookBox .leftCon .purchasedIcon { + width: 100%; + height: 100%; + object-fit: contain; +} + +.rightCon { + margin-top: 10rpx; +} + +.productTitle { + font-size: 28rpx; + height: 88rpx; + color: #333333; + line-height: 44rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: ellipsis; +} \ No newline at end of file diff --git a/pages/sampleBookList/applicationForm/index.js b/pages/sampleBookList/applicationForm/index.js new file mode 100644 index 0000000..c102bba --- /dev/null +++ b/pages/sampleBookList/applicationForm/index.js @@ -0,0 +1,306 @@ +import { worksDataBytool } from "../../../assets/js/toolClass.js"; +const app = getApp(); +Page({ + data: { + userInfo: null, + active: 0, + description: "", //鐢宠瑙勫垯 + teacherInfo: { + workInfo: null, + schoolName: "", + courseName: "", + }, + contactInfo: { + fullName: "", + phone: "", + detailedAddress: "" + }, + paperBookList: [], //鏍蜂功鍗曠焊璐ㄤ功 + electronicBookList: [], //鏍蜂功鍗曠數瀛愪功 + ebookCount: 0, + paperBookCount: 0, + bookList: [], + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad() { }, + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + if (wx.getStorageSync(app.config.userInfoKey)) { + this.setData({ + userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) + }) + if (this.data.userInfo.role == 'Teacher') { + this.setData({ + teacherInfo: { + schoolName: JSON.parse(this.data.userInfo.data).schoolName, + courseName: JSON.parse(this.data.userInfo.data).courseName, + }, + contactInfo: { + fullName: JSON.parse(this.data.userInfo.data).fullName, + phone: JSON.parse(this.data.userInfo.data).phone, + detailedAddress: JSON.parse(this.data.userInfo.data).detailedAddress + } + }) + } + if (wx.getStorageSync("paperBookList")) { + this.setData({ + paperBookList: JSON.parse(wx.getStorageSync("paperBookList")), + bookList: JSON.parse(wx.getStorageSync("paperBookList")) + }) + } + if (wx.getStorageSync("electronicBookList")) { + this.setData({ + electronicBookList: JSON.parse(wx.getStorageSync("electronicBookList")) + }) + } + this.getSelectBookCount(); + this.getSelectPaperBookCount(); + this.getPaperType(); + } else { + wx.navigateTo({ + url: "/pages/testLogin/index", + }); + } + + }, + + tabClick(item) { + let that = this; + if (item.detail.value == '1') { + that.setData({ + active: item.detail.value, + bookList: this.data.electronicBookList + }) + this.getElectronType(); + } else { + that.setData({ + active: item.detail.value, + bookList: this.data.paperBookList + }) + this.getPaperType(); + } + }, + + getElectronType() { + app.MG.resource.getCmsTypeByRefCode({ refCodes: ['jsek_electronicSampleBook'] }).then((res) => { + this.setData({ + description: res[0].description, + teacherInfo: { + workInfo: res[0].cmsTypeLinks[0].children + }, + }) + }) + }, + getPaperType() { + app.MG.resource.getCmsTypeByRefCode({ + refCodes: ['jsek_paperVersionSampleBook'] + }). + then((res) => { + if (res && res.length > 0) { + this.setData({ + description: res[0].description, + teacherInfo: { + workInfo: res[0].cmsTypeLinks[0].children + }, + }) + } + }) + }, + //鑾峰彇褰撳墠宸茬敵璇锋鏁帮紙鐢靛瓙锛� + getSelectBookCount() { + let that = this; + app.MG.app.getTicketResult({ + ticketRefCodeOrGuid: 'electronicSampleBookapplyNum', + roleId: that.data.userInfo.roleId + }) + .then((res) => { + let num = res.totalCount - res.usedCount; + that.setData({ + ebookCount: num + }) + }) + }, + //鑾峰彇褰撳墠宸茬敵璇锋鏁帮紙绾歌川锛� + getSelectPaperBookCount() { + let that = this; + app.MG.app.getTicketResult({ + ticketRefCodeOrGuid: 'paperSampleBookapplyNum', + roleId: that.data.userInfo.roleId + }) + .then((res) => { + let count = res.totalCount - res.usedCount; + that.setData({ + paperBookCount: count, + }) + }) + }, + + submit() { + let that = this; + if (that.data.bookList.length > 0) { + if (that.data.active == '1' && that.data.ebookCount == 0) { + wx.showToast({ + title: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒", + icon: 'none', + duration: 1000, + }) + return + } + if (that.data.active == '0' && that.data.paperBookCount == 0) { + wx.showToast({ + title: "鎮ㄧ殑绾歌川鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒", + icon: 'none', + duration: 1000, + }) + return + } + let data = {} + let applyInfo = {} + if (that.data.active == '1') { + data = { + topicIdOrRefCode: 'applyBook', + name: that.data.userInfo.name || '', + content: JSON.stringify(that.data.bookList), + state: 'WaitAudit', + type: 'applyForEbook', + cmsTypeRefCode: 'jsek_electronicSampleBook', + newDataListRequest: worksDataBytool(that.data.teacherInfo.workInfo, that.data.teacherInfo) + } + applyInfo = { + ticketRefCodeOrGuid: 'electronicSampleBookapplyNum', + roleId: userStore.userInfo.roleId, + refType: 'applyBook' + } + } else { + if (!(that.data.contactInfo.fullName && that.data.contactInfo.phone && that.data.contactInfo.detailedAddress)) { + wx.showToast({ + title: "璇峰皢鏀惰揣浜轰俊鎭~鍐欏畬鏁达紒", + icon: 'none', + duration: 1000, + }) + return + } + const mailAddress = JSON.stringify(that.data.contactInfo) + that.setData({ + teacherInfo: { + detailedAddress: mailAddress, + } + }) + data = { + topicIdOrRefCode: 'applyEntityBook', + name: that.data.userInfo.name || '', + content: JSON.stringify(that.data.bookList), + state: 'WaitAudit', + type: 'applyForPbook', + cmsTypeRefCode: 'jsek_paperVersionSampleBook', + newDataListRequest: worksDataBytool(that.data.teacherInfo.workInfo, that.data.teacherInfo) + } + applyInfo = { + ticketRefCodeOrGuid: 'paperSampleBookapplyNum', + roleId: that.data.userInfo.roleId, + refType: 'applyEntityBook' + } + } + app.MG.ugc.newTopicMessage(data).then((res) => { + if (res) { + app.MG.app.useTicket(applyInfo).then(() => { + if (that.data.active == '1') { + that.setData({ + electronicBookList: [], + bookList: [], + }) + wx.setStorageSync("electronicBookList", that.data.electronicBookList); + } else { + that.setData({ + paperBookList: [], + bookList: [], + }) + wx.setStorageSync("paperBookList", that.data.paperBookList); + } + + wx.showModal({ + title: '鎻愮ず锛�', //鎻愮ず鐨勬爣棰� + content: '鎮ㄧ殑鏍蜂功鐢宠宸叉彁浜わ紝绠$悊鍛樺鏍镐腑锛佺敵璇风姸鎬佸湪銆愪釜浜轰腑蹇冣�旀牱涔︾敵璇枫�戜腑鏌ヨ銆�', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + wx.navigateTo({ + url: "/pages/personalCenter/sampleBooks/index", + }); + } else if (res.cancel) { + } + } + }) + }) + } + }) + } else { + wx.showToast({ + title: "鎮ㄨ繕鏈�夋嫨鍥句功鍔犲叆鐢宠鍗曪紒", + icon: 'none', + duration: 1000, + }) + } + + }, + + onDelete(e) { + let that = this; + const item = e.currentTarget.dataset.book; + wx.showModal({ + title: '鎻愮ず锛�', //鎻愮ず鐨勬爣棰� + content: '纭畾瑕佸垹闄よ涔﹀悧锛�', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + if (that.data.active == '1') { + that.data.electronicBookList.forEach((obj, index) => { + if (obj.id == item.id) { + that.data.electronicBookList.splice(index, 1); + } + }) + that.setData({ + bookList: that.data.electronicBookList + }) + wx.setStorageSync("electronicBookList", that.data.electronicBookList); + } else { + that.data.paperBookList.forEach((obj, index) => { + if (obj.id == item.id) { + that.data.paperBookList.splice(index, 1); + } + }) + that.setData({ + bookList: this.data.paperBookList + }) + wx.setStorageSync("paperBookList", that.data.paperBookList); + } + } else if (res.cancel) { + } + } + }) + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/sampleBookList/applicationForm/index.json b/pages/sampleBookList/applicationForm/index.json new file mode 100644 index 0000000..c2b591c --- /dev/null +++ b/pages/sampleBookList/applicationForm/index.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "鏍蜂功鐢宠鍗�", + "usingComponents": { + "t-tabs": "tdesign-miniprogram/tabs/tabs", + "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", + "t-cascader": "tdesign-miniprogram/cascader/cascader", + "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell", + "t-empty": "tdesign-miniprogram/empty/empty" + } +} \ No newline at end of file diff --git a/pages/sampleBookList/applicationForm/index.wxml b/pages/sampleBookList/applicationForm/index.wxml new file mode 100644 index 0000000..3ce83ea --- /dev/null +++ b/pages/sampleBookList/applicationForm/index.wxml @@ -0,0 +1,80 @@ +<view class="page-header"> + <t-tabs t-class="t-tabs" defaultValue="{{active}}" split="{{false}}" bind:change="tabClick"> + <t-tab-panel label="绾歌川鏍蜂功" value="0" /> + <t-tab-panel label="鐢靛瓙鏍蜂功" value="1" /> + </t-tabs> +</view> +<view class="page-content"> + <view class="bookListBox"> + <view class="tips"> + <rich-text space="emsp" nodes="{{description}}" class="content" /> + </view> + <view class="bookList"> + <view wx:if="{{bookList.length > 0}}"> + <view wx:for="{{bookList}}" wx:for-item="item" wx:for-index="index" wx:key="index" class="textbooksItemBox"> + <t-swipe-cell> + <t-cell title="宸︽粦鍗曟搷浣�" note="杈呭姪淇℃伅" bordered="{{false}}"> + <view class="listItem flex"> + <view class="specialSubject-img"> + <image src="{{item.icon}}" mode="aspectFill" class="img" /> + </view> + <view class="body-info"> + <view class="name">{{item.name}}</view> + <view class="author">浣滆�咃細{{item.author}}</view> + <view class="author">ISBN:{{item.isbn}}</view> + <view class="author">鍑虹増鏃堕棿:{{item.publicationDate}}</view> + </view> + </view> + </t-cell> + <view slot="right" class="btn delete-btn" bind:tap="onDelete" data-book="{{item}}">鍒犻櫎</view> + </t-swipe-cell> + </view> + </view> + <view wx:if="{{bookList.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + </view> + </view> + <view class="formBox"> + <view class="title"> + 鎺堣鎯呭喌 + </view> + <view class="teachingInfo"> + <view class="item"> + <text class="label">瀛︽牎锛�</text> + <text>{{teacherInfo.schoolName}}</text> + </view> + <view class="item"> + <text class="label">浠绘暀璇剧▼锛�</text> + <text>{{teacherInfo.courseName}}</text> + </view> + </view> + <view class="title" wx:if="{{active =='0'}}"> + 鏀惰揣浜烘儏鍐� + </view> + <view class="receiverInfo" wx:if="{{active =='0'}}"> + <view class="item"> + <text class="label">濮撳悕锛�</text> + <view class="item-content"> + <input class="weui-input" name="userName" auto-focus="true" adjust-position="true" value="{{contactInfo.fullName}}" placeholder="璇疯緭鍏ュ鍚�" bindinput="bindTnputBlur" /> + </view> + </view> + <view class="item"> + <text class="label">鑱旂郴鐢佃瘽锛�</text> + <view class="item-content"> + <input class="weui-input" name="userName" auto-focus="true" adjust-position="true" value="{{contactInfo.phone}}" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" bindinput="bindTnputBlur" /> + </view> + </view> + <view class="item"> + <text class="label">璇︾粏鍦板潃锛�</text> + <view class="item-content"> + <input class="weui-input" name="userName" auto-focus="true" adjust-position="true" value="{{contactInfo.detailedAddress}}" placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" bindinput="bindTnputBlur" /> + </view> + </view> + </view> + </view> + <view class="btn-area"> + <button class="submit" bindtap="submit">鎻愪氦</button> + </view> + +</view> \ No newline at end of file diff --git a/pages/sampleBookList/applicationForm/index.wxss b/pages/sampleBookList/applicationForm/index.wxss new file mode 100644 index 0000000..877f863 --- /dev/null +++ b/pages/sampleBookList/applicationForm/index.wxss @@ -0,0 +1,180 @@ +page { + background-color: #F2F3F8; +} + +.page-header { + width: 100%; +} + +.t-tabs__track { + display: none; + +} + +.t-tabs { + margin-top: 20rpx; + background: none !important; +} + +.t-tabs__wrapper { + background: none !important; +} + +.t-tabs__nav :nth-child(1) { + border-radius: 30rpx 30rpx 0 0rpx; +} + +.t-tabs__nav :nth-child(2) { + border-radius: 0rpx 30rpx 0 30rpx; +} + +.t-tabs__item { + flex: 1 !important; + background: #E6E8F1; + height: 76rpx !important; + margin-top: 16rpx; + border-radius: 30rpx 0 30rpx 0rpx !important; +} + +.t-tabs__item--active { + color: #333 !important; + background: #fff; + height: 96rpx; + font-size: 32rpx; + margin-top: 0; + height: 96rpx !important; + border-radius: 30rpx 30rpx 0 0rpx !important; +} + +.t-tabs__item--active+.t-tabs__item { + border-radius: 0 30rpx 0 30rpx !important; +} + + +.bookListBox { + background: #fff; + min-height: 200rpx; + border-radius: 10rpx; + margin-top: -30rpx; + padding: 60rpx 40rpx 40rpx 40rpx; +} + +.tips { + font-size: 28rpx; + color: #ff6c00; +} + +.bookList { + margin-top: 20rpx; +} + +.textbooksItemBox { + padding: 30rpx 0; +} + +.textbooksItemBox:nth-child(1) { + border-bottom: 2rpx solid #EDEDED; +} + +.listItem { + display: flex; +} + +.specialSubject-img { + width: 200rpx; + height: 300rpx; +} + +.specialSubject-img .img { + width: 100%; + height: 100%; + object-fit: contain; +} + +.body-info { + flex: 1; + margin-left: 20rpx; + line-height: 54rpx; +} + +.name { + font-size: 32rpx; + font-weight: bold; + margin-bottom: 20rpx; + height: 96rpx; + margin-top: 20rpx; + width: 100%; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.author { + font-size: 30rpx; +} + +.t-swipe-cell__right { + width: 120rpx; + display: flex; + align-items: center; + background-color: #ff6c00; + color: #fff; +} + +.delete-btn { + margin: 0 auto; +} + +.formBox { + background: #fff; + border-radius: 10rpx; + padding: 40rpx; + margin-top: 30rpx; + +} + +.formBox .title { + font-size: 32rpx; + font-weight: bold; + border-bottom: 2rpx solid #f4f4f4; + padding-bottom: 40rpx; +} + +.teachingInfo, +.receiverInfo { + padding: 40rpx 0; + font-size: 28rpx; +} + +.item { + display: flex; + margin-bottom: 30rpx; + align-items: center; +} + +.item .label { + width: 200rpx; +} + +.item-content { + border: 2rpx solid #D9D9D9; + padding: 10rpx; + flex: 1; +} + +.weui-input { + height: 60rpx; +} + +.btn-area { + margin-top: 40rpx; + padding: 0 40rpx; +} + +.submit { + background: #ff6c00; + color: #fff; + border-radius: 50rpx; +} \ No newline at end of file diff --git a/pages/sampleBookList/index.js b/pages/sampleBookList/index.js new file mode 100644 index 0000000..8dc8a7f --- /dev/null +++ b/pages/sampleBookList/index.js @@ -0,0 +1,995 @@ +const app = getApp(); +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + barHeight: '', + navBarHeight: '', + searchValue: '', + userInfo: null, + path: '*', + pathList: [], + + bookList: [], + //楂樼骇鍒嗙被 + iconList: { + value: "", + options: [], + }, + //涓�绾у垎绫� + stairList: { + value: '', + options: [], + }, + //浜岀骇鍒嗙被 + secondList: { + value: [], + options: [], + }, + //閲嶇偣椤圭洰 + majorProjectList: { + value: [], + options: [], + }, + //鏂板舰鎬佹暀鏉� + newTextBook: { + value: [], + options: [], + }, + //楂樼骇鍒嗙被閫変腑 + assortCheck: { + name: '', + code: '', + }, + + stairCode: '', // 涓�绾у垎绫婚�変腑椤� + secondCode: '', // 浜岀骇鍒嗙被閫変腑椤� + sort: '', // 鎺掑簭 + //鍒嗛〉 + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false, + // 杩斿洖椤堕儴 + isBackTop: false, + setScrollValue: 0, + skeletonLoding: true, + alreadyPaperBookList: [], //宸茬敵璇风焊璐ㄦ牱涔� + alreadyElectronicBookList: [], //宸茬敵璇风數瀛愭牱涔� + paperBookList: [], //鏍蜂功鍗曠焊璐ㄤ功 + electronicBookList: [], //鏍蜂功鍗曠數瀛愪功 + paperBookCount: 0, //绾歌川涔﹀墿浣欐鏁� + ebookCount: 0, //鐢靛瓙涔﹀墿浣欐鏁� + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + 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 && options.searchValue) { + this.setData({ + searchValue: options.searchValue, + }); + } + // 楂樼骇鍒嗙被璧嬪�� + if (options && options.assortCode) { + this.setData({ + assortCheck: { + name: options.assorName, + code: options.assortCode, + 'iconList.value': options.assortCode + }, + }); + } + if (this.data.assortCheck.code) { + // 鑾峰彇涓�绾у垎绫� + this.getStairList(this.data.assortCheck.code); + } + // 涓�绾у垎绫诲拰path璧嬪�� + if (options && options.assortCode && options.stairCode) { + this.setData({ + 'stairList.value': options.stairCode, + stairCode: options.stairCode, + path: `${options.assortCode}\\${options.stairCode}`, + }); + } + // 浜岀骇鍒嗙被璧嬪�� + if (options && options.secondCode) { + this.setData({ + secondCode: options.secondCode, + pathList: [{ + Path: options.secondCode, + Type: '*', + StoreRefCode: app.config.goodsStore, + } + ], + }) + } + this.getIconTypeList(); + this.getBookList(false); + // 鑾峰彇閲嶇偣椤圭洰 + this.getProjectList('bookClassification'); + //鏂板舰鎬佹暀鏉� + this.getProjectList('newFormsTextbooks'); + if (wx.getStorageSync(app.config.tokenKey)) { + this.getAlreadyPBookList() + this.getAlreadyEBookList() + } + if (wx.getStorageSync(app.config.userInfoKey)) { + this.setData({ + userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) + }) + } + if (wx.getStorageSync("paperBookList")) { + this.setData({ + paperBookList: wx.getStorageSync("paperBookList") + }) + } + if (wx.getStorageSync("electronicBookList")) { + this.setData({ + electronicBookList: wx.getStorageSync("electronicBookList") + }) + } + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + goBack() { + wx.navigateBack(); + }, + //鑾峰彇楂樼骇鍒嗙被 + getIconTypeList() { + let query = { + path: '*', + filterList: [ + { + value: 'Normal', + field: 'state' + } + ], + queryType: '\\', + searchList: [], + size: '5', + start: '0', + storeRefCode: app.config.goodsStore, + sort: { type: 'Asc', field: 'LinkOrder' } + } + app.MG.store.getStoreChannelList(query).then((res) => { + let list = []; + if (res.datas.length > 0) ( + res.datas.forEach((item) => { + item.value = item.refCode; + item.label = item.name; + if (item.refCode == 'jsek_higherEducation') { + list.push(item) + } + if (item.refCode == 'jsek_vocationalEducation') { + list.push(item) + } + + }) + ) + this.setData({ + 'iconList.options': list, + 'iconList.value': this.data.assortCode, + }); + }) + }, + // 鑾峰彇涓�绾у垪琛� + 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) => { + let options = []; + if (res.datas.length > 0) { + for (let index = 0; index < res.datas.length; index++) { + let item = res.datas[index]; + options.push({ + value: item.refCode, + label: item.name, + }); + } + } + this.setData({ + 'stairList.options': options, + 'stairList.value': this.data.stairCode, + }); + }); + }, + // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被 + getSecondList(path) { + let options = []; + let 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) => { + if (res.datas.length > 0) { + 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, + }); + const second = [this.data.secondCode] + this.setData({ + 'secondList.value': second + }) + }); + }, + // 鑾峰彇閲嶇偣椤圭洰 + 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(isReachBottom) { + let that = this; + let sort; + let pathObj = {}; + if (that.data.pathList.length) { + pathObj = { + subAccess: this.data.pathList, + }; + } else { + pathObj = { + path: that.data.path, + queryType: '*', + }; + } + if (that.data.sort) { + sort = { + Name: that.data.sort, + BaseType: '', + }; + } else { + sort = { + type: 'Desc', + field: 'ViewCount', + }; + } + // 鎼滅储 + let searchObj = {}; + if (that.data.searchValue) { + searchObj = { + 'Name*': that.data.searchValue, + '||author*': that.data.searchValue, + '||isbn*': that.data.searchValue, + '||seriesName*': that.data.searchValue, + }; + } + const query = { + ...pathObj, + filterList: [ + { + value: 'Normal', + field: 'state', + }, + ], + sort, + coverSize: { + height: 145, + }, + paging: { + start: that.data.page * that.data.limit - that.data.limit, + size: that.data.limit + }, + fields: { + author: [], + isbn: [], + publicationDate: [], + isApplyBook: [], + 'isApplyBook>': ['1'], + ...searchObj, + }, + }; + app.MG.store.getProductList(query).then((res) => { + try { + if (res.datas.length > 0) { + res.datas.forEach((item) => { + item.paperDisabled = false + item.paperChecked = false + item.electronDisabled = false + item.electronChecked = false + if (item.purchasedSaleMethodIdList.indexOf(item.defaultSaleMethodId) > -1) { + item.electronDisabled = true + item.electronChecked = true + } + if (that.data.alreadyPaperBookList.length > 0) { + that.data.alreadyPaperBookList.forEach((pBook) => { + pBook.content.forEach((pBookItem) => { + if (pBookItem.id === item.id && pBook.state == 'WaitAudit') { + item.paperDisabled = true + item.paperChecked = true + } + if (pBookItem.id === item.id && pBook.state == 'Normal') { + item.paperDisabled = false + } + }) + }) + } + if (that.data.alreadyElectronicBookList.length > 0) { + that.data.alreadyElectronicBookList.forEach((eBook) => { + eBook.content.forEach((eBookItem) => { + if (eBookItem.id === item.id && !eBook.isExpiry && eBook.state != 'Reject') { + item.electronDisabled = true + item.electronChecked = true + } + }) + }) + } + if (that.data.paperBookList.length > 0) { + for (let i = 0; i < that.data.paperBookList.length; i++) { + if (that.data.paperBookList[i].id == item.id) { + item.paperChecked = true + } + } + } + if (that.data.electronicBookList.length > 0) { + for (let i = 0; i < that.data.electronicBookList.length; i++) { + if (that.data.electronicBookList[i].id == item.id) { + item.electronChecked = true + } + } + } + }); + let list = res.datas; + //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� + if (isReachBottom) { + list = [...this.data.bookList, ...list] //灏嗘柊鏁版嵁鍔犲叆鑰佹暟鎹腑 + } + that.setData({ + bookList: list, + pageTotalCount: res.total, + bottomLoading: false, + isMoreData: list.length > 0 ? false : true, + skeletonLoding: false, + loading: false + }) + } else { + that.setData({ + skeletonLoding: false, + loading: false + }) + } + } catch (error) { + console.log(error) + } + }); + }, + //楂樼骇鍒嗙被閫夋嫨 + onChangeIcon(e) { + this.setData({ + assortCheck: { + code: e.detail.value, + }, + stairCode: '', + secondCode: '', + path: `${e.detail.value}`, + 'iconList.value': e.detail.value, + }); + this.getBookList(false); + this.getStairList(this.data.assortCheck.code); + + }, + // 涓�绾у垎绫诲垏鎹� + onChangeStair(e) { + const path = e.detail.value.length + ? `${this.data.assortCheck.code}\\${e.detail.value}` + : this.data.assortCheck.code; + this.setData({ + pathList: [], + stairCode: e.detail.value, + secondCode: '', + path: path, + 'stairList.value': e.detail.value, + }); + this.getBookList(false); + this.getSecondList(path); + }, + // 浜岀骇鍒嗙被鍒囨崲 + onChangeSecond(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, + }); + + }, + // + onConfirmSecond() { + this.getBookList(false); + }, + // 閲嶇偣椤圭洰鏀瑰彉 + changeMajorProject(e) { + this.setData({ + 'majorProjectList.value': e.detail.value, + }); + this.getBookList(false); + }, + // 閲嶇偣椤圭洰閲嶇疆 + resetMajorProject() { + this.setData({ + 'majorProjectList.value': [], + }); + this.getBookList(false); + }, + changeNewText(e) { + this.setData({ + 'newTextBook.value': e.detail.value, + }); + this.getBookList(false); + }, + resetNewText() { + this.setData({ + 'newTextBook.value': [], + }); + this.getBookList(false); + }, + // 鎺掑簭鎸夐挳 + 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(false); + }, + // 鎼滅储鍥句功 + searchBook(e) { + console.log(e.detail.value); + this.setData({ + searchValue: e.detail.value, + }); + this.getBookList(false); + }, + // 璺宠浆鍥句功璇︽儏 + goDetail(e) { + const { book } = e.currentTarget.dataset; + wx.navigateTo({ + url: `/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`, + }); + }, + //鑾峰彇宸茬敵璇风焊璐ㄦ牱涔� + getAlreadyPBookList() { + const data = { + start: 0, + size: 9999, + topicIdOrRefCode: 'applyEntityBook', + appRefCode: app.config.appRefCode, + sort: { + type: 'Desc', + field: 'CreateDate' + } + } + app.MG.ugc.getTopicMessageList(data).then((res) => { + res.datas.map((item) => { + if (item.content) { + item.content = JSON.parse(item.content) + } + }) + this.setData({ + alreadyPaperBookList: res.datas, + }); + }) + }, + //鑾峰彇宸茬敵璇风數瀛愭牱涔� + getAlreadyEBookList() { + const data = { + start: 0, + size: 9999, + topicIdOrRefCode: 'applyBook', + appRefCode: app.config.appRefCode, + sort: { + type: 'Desc', + field: 'CreateDate' + } + } + app.MG.ugc.getTopicMessageList(data).then((res) => { + let list = [] + res.datas.map((item) => { + if (item.feedBack) { + item.feedBack = JSON.parse(item.feedBack) + if (item.feedBack.endDate) { + let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime() + let currentDate = new Date().getTime() + if (times < currentDate) { + item.isExpiry = true + } + } + } + if (item.content) { + item.content = JSON.parse(item.content) + } + if (item.state != 'Reject') { + list.push(item) + } + }) + this.setData({ + alreadyElectronicBookList: list, + }); + }) + }, + + + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + if (this._freshing) return + this.setData({ + page: 1, + limit: 10, + pageTotalCount: 0, + bottomLoading: false, + isMoreData: false + }) + this._freshing = true; + this.setData({ + triggered: false, + }) + this.getBookList(false); + this._freshing = false + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + this.setData({ + bottomLoading: true, + isMoreData: false + }) + let bool = false; + if (this.data.pageTotalCount > this.data.bookList.length) { + bool = true; + this.setData({ + page: this.data.page + 1, + }) + + } else { + setTimeout(() => { + this.setData({ + bottomLoading: false, + isMoreData: true + }) + }, 100) + return false; + } + this.getBookList(bool); + }, + //绾歌川鏍蜂功 + onChangePaper(e) { + const item = e.currentTarget.dataset.book; + let role = this.data.userInfo != null ? this.data.userInfo.role : null + if (role) { + if (item.paperDisabled) { + wx.showToast({ + title: "璇ユ牱涔﹀凡鐢宠", + icon: 'none', + duration: 1000, + }) + return + } + + if (item.paperChecked) { + if (this.data.paperBookList.length > 0) { + this.data.paperBookList.forEach((obj, index) => { + if (obj.id == item.id) { + this.data.paperBookList.splice(index, 1); + } + }) + } + item.paperChecked = false; + if (this.data.bookList.length > 0) { + this.data.bookList.forEach(i => { + if (i.id == item.id) { + i.paperChecked = false; + } + }) + } + wx.showToast({ + title: "宸蹭粠鏍蜂功鐢宠鍗曠Щ闄�", + icon: 'none', + duration: 1000, + }) + wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); + return + } + if (role == 'Teacher') { + this.getSelectPaperBookCount(item) + } else { + item.paperChecked = false + wx.showModal({ + title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰� + content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + wx.navigateTo({ + url: "/pages/teacherCertification/index", + }); + } else if (res.cancel) { + item.paperChecked = false + } + } + }) + } + } else { + item.paperChecked = false + } + }, + getSelectPaperBookCount(item) { + app.MG.app + .getTicketResult({ + ticketRefCodeOrGuid: 'paperSampleBookapplyNum', + roleId: this.data.userInfo.roleId + }) + .then((res) => { + this.setData({ + paperBookCount: res.totalCount - res.usedCount + }) + if (!item.paperDisabled) { + this.getAlreadyBookList(item, 'pBook') + } + }) + }, + //閫夋嫨鐢靛瓙鏍蜂功 + onChangeElectron(e) { + const item = e.currentTarget.dataset.book; + let role = this.data.userInfo != null ? this.data.userInfo.role : null; + if (role) { + if (item.electronDisabled) { + wx.showToast({ + title: "璇ユ牱涔﹀凡鐢宠", + icon: 'none', + duration: 1000, + }) + return + } + if (item.electronChecked) { + if (this.data.electronicBookList) { + this.data.electronicBookList.forEach((obj, index) => { + if (obj.id == item.id) { + this.data.electronicBookList.splice(index, 1); + } + }) + } + if (this.data.bookList.length > 0) { + this.data.bookList.forEach(i => { + if (i.id == item.id) { + i.electronChecked = false; + } + }) + } + item.electronChecked = false; + wx.showToast({ + title: "宸蹭粠鏍蜂功鐢宠鍗曠Щ闄�", + icon: 'none', + duration: 1000, + }) + wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); + return + } + if (role == 'Teacher') { + //鏈夋棤瀛愬晢鍝侊紝瀛愬晢鍝佹湁鏃犵數瀛愪功鏂囦欢 + const obj = { + path: '*', + queryType: 'SubProduct', + sort: { + type: 'Desc', + field: 'CreateDate' + }, + paging: { + start: 0, + size: 6 + }, + mainProductId: item.id, + fields: { + bookshelf_pdf: [], + bookshelf_protectedEpub: [], + } + } + app.MG.store.getProductList(obj).then((res) => { + if (res.datas.length > 0) { + if (res.datas[0].bookshelf_pdf || res.datas[0].bookshelf_protectedEpub) { + this.getSelectBookCount(item) + } else { + wx.showToast({ + title: "鏆傛棤鐢靛瓙涔︽枃浠�,璇疯仈绯荤鐞嗗憳!", + icon: 'none', + duration: 1000, + }) + } + } else { + this.getSelectBookCount(item) + } + }) + } else { + item.electronChecked = false + wx.showModal({ + title: '灏婃暚鐨勭敤鎴凤紝鎮ㄥソ锛�', //鎻愮ず鐨勬爣棰� + content: '璇峰厛杩涜鏁欏笀璁よ瘉锛�', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + wx.navigateTo({ + url: "/pages/teacherCertification/index", + }); + } else if (res.cancel) { + item.electronChecked = false + } + } + }) + } + } + }, + getSelectBookCount(item) { + app.MG.app + .getTicketResult({ + ticketRefCodeOrGuid: 'electronicSampleBookapplyNum', + roleId: this.data.userInfo.roleId + }) + .then((res) => { + this.setData({ + ebookCount: res.totalCount - res.usedCount + }) + if (!item.electronDisabled) { + this.getAlreadyBookList(item, 'eBook') + } + }) + }, + + getAlreadyBookList(item, type) { + let itemAttr = null + let isHas = false + itemAttr = { + id: item.id, + title: item.name || '-', + icon: item.icon, + checked: false, + defaultSaleMethodId: item.defaultSaleMethodId, + md5: item.datas.Icon, + author: item.author || '-', + price: item.price || '-', + isbn: item.isbn || '-', + publicationDate: item.publicationDate + } + + if (type == 'eBook') { + if (this.data.ebookCount > 0) { + const eBookData = this.data.electronicBookList + if (eBookData.length == 2) { + item.electronChecked = false + wx.showToast({ + title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�", + icon: 'none', + duration: 1000, + }) + return false + } + if (eBookData.length > 0) { + for (let i = 0; i < eBookData.length; i++) { + if (eBookData[i].id == item.id) { + isHas = true + } + } + if (!isHas) { + wx.showToast({ + title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~", + icon: "none", + duration: 1000, + }) + this.setData({ + electronicBookList: [...this.data.electronicBookList, ...[item]] + }) + wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); + } else { + item.electronChecked = false + wx.showToast({ + title: "璇ヤ功宸插湪娓呭崟鍒楄〃涓�", + icon: "none", + duration: 1000, + }) + } + } else { + wx.showToast({ + title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~", + icon: "none", + duration: 1000, + }) + this.setData({ + electronicBookList: [...this.data.electronicBookList, ...[item]] + }) + wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); + } + } else { + item.electronChecked = false + wx.showToast({ + title: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒", + icon: "none", + duration: 1000, + }) + } + } else { + if (this.data.paperBookCount > 0) { + const pBookData = this.data.paperBookList + if (pBookData.length == 2) { + item.paperChecked = false + wx.showToast({ + title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�", + icon: 'none', + duration: 1000, + }) + return false + } + if (pBookData.length > 0) { + for (let i = 0; i < pBookData.length; i++) { + if (pBookData[i].id == item.id) { + isHas = true + } + } + if (!isHas) { + item.paperChecked = true + wx.showToast({ + title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~", + icon: 'none', + duration: 1000, + }) + this.setData({ + paperBookList: [...this.data.paperBookList, ...[item]] + }) + wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); + console.log(this.data.paperBookList, "3") + } else { + item.paperChecked = false + wx.showToast({ + title: "璇ヤ功宸插湪娓呭崟鍒楄〃涓�", + icon: 'none', + duration: 1000, + }) + } + } else { + item.paperChecked = true; + wx.showToast({ + title: "娣诲姞鎴愬姛锛屽湪鏍蜂功鐢宠鍗曠瓑鎮ㄥ摝~", + icon: 'none', + duration: 1000, + }) + this.setData({ + paperBookList: [item] + }) + wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); + console.log(this.data.paperBookList, "4") + } + } else { + item.paperChecked = false + wx.showToast({ + title: "鎮ㄧ殑绾歌川鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒", + icon: 'none', + duration: 1000, + }) + } + } + }, + //鍘绘牱涔︾敵璇峰崟 + goApply() { + wx.navigateTo({ + url: "/pages/sampleBookList/applicationForm/index", + }); + }, + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/sampleBookList/index.json b/pages/sampleBookList/index.json new file mode 100644 index 0000000..cf12577 --- /dev/null +++ b/pages/sampleBookList/index.json @@ -0,0 +1,16 @@ +{ + "navigationBarTitleText": "鏍蜂功鐢宠", + "navigationStyle": "custom", + "onReachBottomDistance": 250, + "usingComponents": { + "t-image": "tdesign-miniprogram/image/image", + "t-dropdown-menu": "tdesign-miniprogram/dropdown-menu/dropdown-menu", + "t-dropdown-item": "tdesign-miniprogram/dropdown-item/dropdown-item", + "t-back-top": "tdesign-miniprogram/back-top/back-top", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-search": "tdesign-miniprogram/search/search", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh" + } +} \ No newline at end of file diff --git a/pages/sampleBookList/index.wxml b/pages/sampleBookList/index.wxml new file mode 100644 index 0000000..f1d6070 --- /dev/null +++ b/pages/sampleBookList/index.wxml @@ -0,0 +1,75 @@ +<!-- 鍥句功鏈嶅姟-鍒楄〃 --> +<view class="page-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="list-header"> + <view class="header-scroll"> + <scroll-view scroll-x scroll-with-animation='true' class="srcolbox"> + <t-dropdown-menu> + <t-dropdown-item label="鎬诲垎绫�" options="{{iconList.options}}" value="{{iconList.value}}" optionsColumns="2" bindchange="onChangeIcon" arrow-icon="" /> + <t-dropdown-item label="涓�绾�" options="{{stairList.options}}" value="{{stairList.value}}" optionsColumns="2" bindchange="onChangeStair" arrow-icon="" /> + <t-dropdown-item label="浜岀骇" options="{{secondList.options}}" optionsColumns="2" multiple value="{{secondList.value}}" bind:confirm="onConfirmSecond" bind:change="onChangeSecond" /> + </t-dropdown-menu> + </scroll-view> + </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> +</view> +<view class="bookServices-list"> + <view class="list-body"> + <scroll-view class="scroll content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{200}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> + <view slot="refresher" class="refresh-container"> + <view class="loading"> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> + </view> + </view> + <view class="title"> + <view class="line"></view> + <view class="icon"> + <t-image src="/static/images/home/yangshuliebiao.png" mode="heightFix" class="iconImage" /> + </view> + </view> + <view class="book-list" wx:if="{{bookList.length > 0}}"> + <view class="book-box" wx:for="{{bookList}}" wx:key="id"> + <view class="book-img" bind:tap="goDetail" data-book="{{item}}"> + <t-image src="{{item.icon}}" width="105" height="145" aria-label="{{item.name}}" wx:if="{{item.icon}}" /> + <t-image src="/static/images/default-book-img.png" width="105" height="145" aria-label="{{item.name}}" wx:else /> + </view> + <view class="book-name book-color" bind:tap="goDetail" data-book="{{item}}">{{ item.name}}</view> + <view class="book-author book-color">{{item.author}}</view> + <view class="checkbox"> + <t-checkbox label="绾歌川鏍蜂功" icon="rectangle" borderless='true' default-checked="{{item.paperChecked}}" disabled="{{item.paperDisabled || item.isApplyBook == '1' || item.isApplyBook == '2'}}" data-book="{{item}}" bind:change="onChangePaper" /> + <t-checkbox label="鐢靛瓙鏍蜂功" icon="rectangle" borderless='true' class="eBook" default-checked="{{item.electronChecked}}" disabled="{{item.electronDisabled || item.isApplyBook == '1' || item.isApplyBook == '3'}}" data-book="{{item}}" bind:change="onChangeElectron" /> + </view> + </view> + </view> + <view wx:if="{{list.length == 0}}" class="empyt"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="bottom-loading" wx:if="{{bottomLoading}}"> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> + </view> + <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> + <text>娌℃湁鏇村浜�</text> + </view> + </scroll-view> + </view> +</view> +<t-back-top theme="round" wx:if="{{isBackTop}}" text="椤堕儴" bind:to-top="onToTop"></t-back-top> +<view class="applyBox" bindtap="goApply"> + <view class="box"> + <t-image src="/static/images/home/yangshuForm.png" mode="heightFix" class="img" /> + <view class="num">{{num}}</view> + </view> +</view> \ No newline at end of file diff --git a/pages/sampleBookList/index.wxss b/pages/sampleBookList/index.wxss new file mode 100644 index 0000000..e1317d1 --- /dev/null +++ b/pages/sampleBookList/index.wxss @@ -0,0 +1,260 @@ +.page-header { + background-color: #fff; + position: fixed; + top: 0; + left: 0; + z-index: 1; +} + +.bookServices-list { + padding-top: 280rpx; +} + +.nacigationBar { + display: flex; + align-items: center; + --td-search-font-size: 28rpx; + margin-bottom: 30rpx; +} + +.list-header { + display: flex; + z-index: 1, +} + +.header-sort { + background-color: #fff; + line-height: 96rpx; + width: 150rpx; + font-size: 28rpx; + color: #999; + display: flex; + align-items: center; +} + +.sort-name { + margin-right: 10rpx; +} + +.header-scroll { + width: 80vw; +} + +.srcolbox { + width: 100%; + white-space: nowrap; +} + +.t-dropdown-menu:after, +.t-dropdown-menu::after { + height: 0px; +} + + +.t-dropdown-item__body, +.t-dropdown-item__footer, +.t-radio { + background: #F6F6F6 !important; +} + +.t-dropdown-item__body { + padding: 40rpx 0; +} + +.t-dropdown-menu__item { + margin: 10rpx 10rpx 0 10rpx; + border-radius: 40rpx; + height: 68rpx; + background: #F6F6F6 !important; +} + +.t-dropdown-menu__item--active { + height: 85rpx !important; + background: #F6F6F6 !important; + border-radius: 40rpx 40rpx 0 0; +} + +.t-dropdown-menu__item--active, +.t-radio__icon--checked, +.t-checkbox__icon--checked { + color: #FF6C00 !important +} + +.t-checkbox__icon--disabled { + color: #c0c4cc !important; +} + +.t-radio--block { + padding: 20rpx !important; +} + +.t-radio__border { + height: 0 !important; +} + +.sort-icon { + transform: rotate(90deg); + position: relative; +} + +.sort-icon .icon-left { + transform: rotate(180deg); +} + +.list-body { + background: #F2F3F8; + padding: 40rpx 0; +} + +.title { + display: flex; + height: 60rpx; + font-weight: bold; + align-items: center; +} + +.title .line { + border-right: 8rpx solid #FF6C00; + border-radius: 0 10rpx 10rpx 0; + margin-right: 20rpx; + height: 100%; +} + +.title .icon { + height: 36rpx; + line-height: 60rpx; +} + +.title .icon .iconImage { + height: 100%; +} + +.refresh-container { + margin: 0 auto; +} + +.bottom-loading, +.loading { + padding: 20rpx; + text-align: center; +} + +.empyt { + padding: 200rpx 0; +} + + +.book-list { + padding: 24rpx; + display: flex; + flex-wrap: wrap; + margin-top: 10rpx; +} + + + +.book-box { + box-sizing: border-box; + width: calc(100%/2 - 10rpx); + margin-right: 20rpx; + display: flex; + flex-direction: column; + align-items: center; + margin-bottom: 40rpx; + padding: 50rpx 20rpx 32rpx 20rpx; + box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(0, 0, 0, 0.08); + background: #fff; +} + +.book-box:nth-child(2n) { + margin-right: 0; +} + +.book-color { + color: #333; +} + +.book-img image { + object-fit: contain; + box-shadow: 0px 0px 20rpx 2px rgba(0, 0, 0, 0.08); +} + +.book-name { + height: 76rpx; + 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; +} + +.book-author { + height: 30rpx; + margin-top: 16rpx; + width: 100%; + font-size: 24rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.checkbox { + display: flex; +} + +.checkbox .t-checkbox--block { + padding: 20rpx 0 !important; + align-items: center; +} + +.checkbox .t-checkbox__icon { + width: 30rpx !important; + height: 30rpx !important; + font-size: 36rpx !important; +} + +.t-checkbox__icon-rectangle { + width: 60rpx !important; + height: 60rpx !important; +} + +.checkbox .t-checkbox { + font-size: 28rpx !important; +} + +.checkbox .t-checkbox__icon--left { + margin-right: 10rpx !important; +} + +.checkbox .t-checkbox__title { + color: #FF6C00 !important; +} + +.eBook { + margin-left: 10rpx; +} + + + +.applyBox { + width: 184rpx; + height: 184rpx; + position: fixed; + bottom: 20%; + right: 20rpx; +} + +.applyBox .box { + width: 184rpx; + height: 184rpx; + color: #fff; +} + +.applyBox .box .t-image { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/pages/testLogin/index.js b/pages/testLogin/index.js index d516931..8dc1a28 100644 --- a/pages/testLogin/index.js +++ b/pages/testLogin/index.js @@ -52,16 +52,26 @@ if (res) { console.log(res, "user"); let defaultUser = {}; + let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') + let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo') let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword') let WeChatInfo = res.infoList.find((item) => item.type === "WeChat"); - if (WeChatInfo) { + if (teacherRole && teacherInfos) { + defaultUser = { + ...teacherInfos, + nickName: teacherInfos.fullName, + avatarUrl: teacherInfos.icon, + userId: res.userId, + role: 'Teacher', + roleId: teacherRole.role.id + } + } else if (WeChatInfo) { defaultUser = { nickName: WeChatInfo.name, avatarUrl: WeChatInfo.icon, - userId: res.userId + userId: res.userId, } - } - if (secretData) { + } else if (secretData) { defaultUser = { nickName: secretData.credential, avatarUrl: "../../static/images/index/tab.png", diff --git a/services/home/home.js b/services/home/home.js index dc57e72..186668c 100644 --- a/services/home/home.js +++ b/services/home/home.js @@ -57,7 +57,7 @@ text: '鏍蜂功鐢宠', key: 8, icon: '/static/images/home/yangshushenqing@2x.png', - url: '', + url: '/pages/sampleBookList/index', }, { text: '鎴戣鍑轰功', diff --git a/static/images/home/yangshuForm.png b/static/images/home/yangshuForm.png new file mode 100644 index 0000000..4226548 --- /dev/null +++ b/static/images/home/yangshuForm.png Binary files differ diff --git a/static/images/home/yangshuliebiao.png b/static/images/home/yangshuliebiao.png new file mode 100644 index 0000000..12a4d5a --- /dev/null +++ b/static/images/home/yangshuliebiao.png Binary files differ -- Gitblit v1.9.1