From 6a734d758720185f538e672c879121adb6732274 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 02 四月 2024 09:20:45 +0800 Subject: [PATCH] 代码合并,问题修改,学习 --- packagePersonal/pages/userSetting/index.wxml | 15 packagePersonal/pages/userSetting/index.wxss | 40 ++ pages/home/home.js | 13 pages/student/index.wxml | 2 packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml | 53 ---- packagePersonal/pages/myOrder/index.js | 116 +++------- packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss | 8 packageDomain/pages/resourceDetails/myVideo/index.js | 42 +++ packageDomain/pages/resourceDetails/myAudio/index.js | 43 +++ packageDomain/pages/sampleBookList/applicationForm/index.wxss | 1 packageBookService/pages/components/webView/index.js | 40 +++ packagePersonal/pages/userSetting/index.js | 133 ++++++----- pages/student/index.js | 32 ++ packageDomain/pages/sampleBookList/applicationForm/index.wxml | 4 packageDomain/pages/resourceDetails/document/index.js | 45 +++ packageDomain/pages/teacherCertification/index.wxss | 3 packageDomain/pages/teacherCertification/index.wxml | 4 packageBookService/pages/bookServices/examination/examination.js | 38 +++ pages/personalCenter/index.wxss | 1 packageBookService/pages/bookServices/detail/index.js | 2 20 files changed, 397 insertions(+), 238 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml b/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml index c122654..92262ab 100644 --- a/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml +++ b/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml @@ -9,64 +9,25 @@ </view> </t-dialog> --> <!-- <view class="suggest"> --> -<t-popup - visible="{{showWithInput}}" - bind:visible-change="onVisibleChange" - placement="center" -> +<t-popup visible="{{showWithInput}}" bind:visible-change="onVisibleChange" placement="center"> <view class="top-icon"> <t-image src="/static/images/bookService/detail/feedback.png"></t-image> </view> <view slot="content" class="content"> <view class="top-title">鎴戣寤鸿</view> <view class="demo-rate"> - <t-rate - value="{{ratevalue}}" - catch:change="onChangeRate" - size="{{30}}" - color="#FFB400" - /> + <t-rate value="{{ratevalue}}" catch:change="onChangeRate" size="{{30}}" color="#FFB400" /> </view> <view class="phone-input"> - <t-input - value="{{inputvalue}}" - slot="content" - label="" - placeholder="璇疯緭鍏ヨ仈绯绘柟寮�" - bind:change="inputChange" - type="number" - maxlength="{{11}}" - class="phone" - style="{{inputStyle}}" - placeholder-class="t-input__placeholder input-placeholder" - /> + <t-input clearable value="{{inputvalue}}" slot="content" label="" placeholder="璇疯緭鍏ヨ仈绯绘柟寮�" bind:change="inputChange" type="number" maxlength="{{11}}" class="phone" style="{{inputStyle}}" /> </view> <view style="width: 100%"> - <t-textarea - value="{{textvalue}}" - t-class="external-class" - label="" - placeholder="璇疯緭鍏ュ弽棣堝唴瀹�" - maxcharacter="200" - disableDefaultPadding="{{true}}" - indicator - bind:change="textareaChange" - style="{{inputStyle}}" - placeholder-style="{{placeholderstyle}}" - /> + <t-textarea value="{{textvalue}}" t-class="external-class" label="" placeholder="璇疯緭鍏ュ弽棣堝唴瀹�" maxcharacter="200" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" style="{{inputStyle}}" placeholder-style="{{placeholderstyle}}" /> </view> </view> <view class="submit-btn"> - <t-button theme="primary" size="large" block bind:tap="confirmSuggest" - >鎻愪氦</t-button - > + <t-button theme="primary" size="large" block bind:tap="confirmSuggest">鎻愪氦</t-button> </view> - <t-icon - t-class="close-btn" - name="close-circle" - size="32" - color="#fff" - bind:tap="closeDialog" - /> + <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" /> </t-popup> -<!-- </view> --> +<!-- </view> --> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss b/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss index 7e38dd5..023fb6d 100644 --- a/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss +++ b/packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss @@ -1,8 +1,5 @@ /* pages/bookServices/detail/components/suggest/suggest.wxss */ - - - .t-input__wrap .t-input__content, .t-input__control { font-size: 28rpx !important; @@ -114,4 +111,9 @@ color: #0F1214; font-size: 40rpx; font-weight: bold; +} + + +.phone-input .input-placeholder { + font-size: 28rpx !important } \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 94ce20c..831de07 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -1537,7 +1537,7 @@ return false; } wx.navigateTo({ - url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage + '&bookBuy=' + this.data.bookBuy + url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage + '&bookBuy=' + this.data.bookBuy + '&bookId=' + this.data.bookDetail.id }) }, diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index 83953d8..b10cd73 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -45,6 +45,8 @@ saveTime: 20, isNight: false, sliderValue: 0, // 瀛椾綋婊戝潡 + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, /** @@ -110,6 +112,9 @@ } }, 1000) } + this.setData({ + startTime: Date.now() + }) }, /** @@ -118,6 +123,13 @@ onHide() { if (wx.timer) { clearInterval(wx.timer) + } + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) } }, @@ -131,6 +143,32 @@ if (this.data.countdownInterval !== null) { clearInterval(this.data.countdownInterval) } + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } + }, + + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (this.data.bookId) { + data.productId = this.data.bookId + } + //闃呰璧勬簮鐨刬d + // if (product.cmsItemId) { + // data.cmsItemId = product.cmsItemId + // } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) }, /** diff --git a/packageBookService/pages/components/webView/index.js b/packageBookService/pages/components/webView/index.js index 797d971..4ee82de 100644 --- a/packageBookService/pages/components/webView/index.js +++ b/packageBookService/pages/components/webView/index.js @@ -12,6 +12,8 @@ currentPage: '', pdfList: [], skeletonLoding: true, + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, /** @@ -86,7 +88,6 @@ md5: data.md5 }).then((res) => { let pageCount = data.bookBuy ? res.totalPages : Number(data.freePage) - if (pageCount) { let list = []; @@ -179,21 +180,54 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - + this.setData({ + startTime: Date.now() + }) }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ onHide() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } + }, + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (epubObj.bookId) { + data.productId = epubObj.bookId + } + //闃呰璧勬簮鐨刬d + // if (product.cmsItemId) { + // data.cmsItemId = product.cmsItemId + // } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) }, /** diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js index 3db416d..03bc46d 100644 --- a/packageDomain/pages/resourceDetails/document/index.js +++ b/packageDomain/pages/resourceDetails/document/index.js @@ -23,6 +23,8 @@ naturalResources: [], titleName: '', pdfDatA: [], + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 @@ -58,23 +60,56 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - + this.setData({ + startTime: Date.now() + }) }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ onHide() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, + /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (this.data.bookId) { + data.productId = this.data.bookId + } + //闃呰璧勬簮鐨刬d + if (this.data.cmsId) { + data.cmsItemId = this.data.cmsId + } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ @@ -235,7 +270,9 @@ //鏂囨。绛� if (item.selectType == 'pdf' || item.selectType == 'document') { - app.MG.file.getPdfInfo({ md5: item.file }).then((res) => { + app.MG.file.getPdfInfo({ + md5: item.file + }).then((res) => { if (res && res.totalPages) { for (let i = 0; i < res.totalPages; i++) { const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + item.file + '&index=' + (i + 1) + '&dpi=300' diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js index 0fbf416..fa54b36 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.js +++ b/packageDomain/pages/resourceDetails/myAudio/index.js @@ -42,7 +42,9 @@ isplay: false, //鏄惁榛樿鎾斁, selectId: '', speed: 1.0, - myAudioPos: '' + myAudioPos: '', + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, // // 鏃堕棿鏍煎紡鍖� // format(t) { @@ -126,7 +128,9 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - + this.setData({ + startTime: Date.now() + }) }, @@ -134,16 +138,45 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ onHide() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, - + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (this.data.bookId) { + data.productId = this.data.bookId + } + //闃呰璧勬簮鐨刬d + if (this.data.cmsId) { + data.cmsItemId = this.data.cmsId + } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js index 04b67c6..421bf0d 100644 --- a/packageDomain/pages/resourceDetails/myVideo/index.js +++ b/packageDomain/pages/resourceDetails/myVideo/index.js @@ -35,7 +35,9 @@ submitType: "new", // 鏂板缓 or 缂栬緫 noteId: '', - videoChange: true + videoChange: true, + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, // 鏍煎紡鍖栫瑪璁版椂闂� convertTimestamp(timestamp) { @@ -86,6 +88,9 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { + this.setData({ + startTime: Date.now() + }) }, @@ -93,16 +98,45 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ onHide() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey)) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, - + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (this.data.bookId) { + data.productId = this.data.bookId + } + //闃呰璧勬簮鐨刬d + if (this.data.cmsId) { + data.cmsItemId = this.data.cmsId + } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ diff --git a/packageDomain/pages/sampleBookList/applicationForm/index.wxml b/packageDomain/pages/sampleBookList/applicationForm/index.wxml index 4024024..eea814a 100644 --- a/packageDomain/pages/sampleBookList/applicationForm/index.wxml +++ b/packageDomain/pages/sampleBookList/applicationForm/index.wxml @@ -5,7 +5,7 @@ </t-tabs> <view class="page-content"> <view class="con-bg"></view> - <view class="content"> + <scroll-view class="scroll content" scroll-y> <view class="bookListBox"> <view class="tips"> <rich-text space="emsp" nodes="{{description}}" class="content" /> @@ -78,6 +78,6 @@ <view class="btn-area"> <button class="submit" bindtap="submit">鎻愪氦</button> </view> - </view> + </scroll-view> </view> </view> \ No newline at end of file diff --git a/packageDomain/pages/sampleBookList/applicationForm/index.wxss b/packageDomain/pages/sampleBookList/applicationForm/index.wxss index a49b424..613a3ff 100644 --- a/packageDomain/pages/sampleBookList/applicationForm/index.wxss +++ b/packageDomain/pages/sampleBookList/applicationForm/index.wxss @@ -21,7 +21,6 @@ .content { box-sizing: border-box; height: calc(100vh - env(safe-area-inset-bottom) - 96rpx); - overflow-y: auto; } .t-tabs__track { diff --git a/packageDomain/pages/teacherCertification/index.wxml b/packageDomain/pages/teacherCertification/index.wxml index 9fb3d69..eb95bd7 100644 --- a/packageDomain/pages/teacherCertification/index.wxml +++ b/packageDomain/pages/teacherCertification/index.wxml @@ -1,5 +1,5 @@ <view class="container"> - <view class="content"> + <scroll-view class="scroll content" scroll-y> <view class="tips"> 浠呴檺瀛︽牎鏈绋嬩换璇炬暀甯堢敵璇凤紱璇蜂笂浼犳湁鏁堝湪鑱屾暀甯堝伐浣滆瘉灏嗘湁鍔╀簬瀹℃牳銆� </view> <view class="body-loading" wx:if="{{skeletonLoding}}"> <t-loading theme="circular" size="40rpx" class="wrapper" /> @@ -99,7 +99,7 @@ <button class="submit" bindtap="submit">鎻愪氦</button> </view> </view> - </view> + </scroll-view> <view class="popupBox"> <t-popup visible="{{protocolShow}}" bind:visible-change="onVisibleChange" placement="center"> <view class="block"> diff --git a/packageDomain/pages/teacherCertification/index.wxss b/packageDomain/pages/teacherCertification/index.wxss index b4881bd..80d5e0b 100644 --- a/packageDomain/pages/teacherCertification/index.wxss +++ b/packageDomain/pages/teacherCertification/index.wxss @@ -10,7 +10,6 @@ .content { height: calc(100vh - env(safe-area-inset-bottom)); box-sizing: border-box; - overflow-y: auto; } .tips { @@ -174,7 +173,7 @@ .block { position: relative; width: 600rpx; - height: 820rpx; + height: 600rpx; padding: 20rpx 0; background: #fff; border-radius: 16rpx; diff --git a/packagePersonal/pages/myOrder/index.js b/packagePersonal/pages/myOrder/index.js index f89f220..129bb1f 100644 --- a/packagePersonal/pages/myOrder/index.js +++ b/packagePersonal/pages/myOrder/index.js @@ -263,91 +263,41 @@ 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.getDataList(false) - } - if (that.data.isPaySuccess && that.data.isPayComplete) { - that.navToBack() - } - } + app.MG.store.makeWeChatPay({ + orderNum: res.orderNumber, + platform: "WeChatAppCustom" + }) + .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 }) - }); - } 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() - } } - }) - }); - } + }, + "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() + } + } + }) + }); }); }, diff --git a/packagePersonal/pages/userSetting/index.js b/packagePersonal/pages/userSetting/index.js index eefb2a4..1fcc0ea 100644 --- a/packagePersonal/pages/userSetting/index.js +++ b/packagePersonal/pages/userSetting/index.js @@ -1,4 +1,5 @@ const app = getApp() +import SparkMD5 from 'spark-md5' import tool from "../../../assets/js/toolClass.js"; import FormData from '../../../utils/formdata/index.js'; Page({ @@ -64,7 +65,7 @@ defaultUser = { ...teacherInfos, nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name, - icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '', + icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, userId: res.userId, role: 'Teacher', roleId: teacherRole.role.id, @@ -120,72 +121,78 @@ editIconInfo(e) { var that = this; wx.chooseMedia({ - // count: 1, // 榛樿9 + count: 1, // 榛樿9 sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� sourceType: ['album', 'camera'], // 鍙互鎸囧畾鏉ユ簮鏄浉鍐岃繕鏄浉鏈猴紝榛樿浜岃�呴兘鏈� success: function (res) { - // 杩斿洖閫夊畾鐓х墖鐨勬湰鍦版枃浠惰矾寰勫垪琛紝tempFilePath涔熷彲浠ヤ綔涓篿mg鏍囩鐨剆rc灞炴�ф樉绀哄浘鐗� - tool.getFileMd5(res.tempFiles[0]).then((e) => { - let formData = new FormData(); - formData.append('Md5', e); - formData.append('FileName', e); - formData.append('FileType', res.tempFiles[0].fileType); - formData.appendFile("file", res.tempFiles[0].tempFilePath); - const data = formData.getData(); - let _token = wx.getStorageSync(app.config.tokenKey); - let header = {}; - if (_token == null) { - header["Authorization"] = `Basic ${Base64.encode(website.clientId + ":" + website.clientSecret)}`; - } else { - header["Authorization"] = `Bearer ` + _token; - } - new Promise((resolve, reject) => { - wx.request({ - url: app.config.requestCtx + '/file/api/ApiUpload', - method: 'POST', - header: { - 'content-type': data.contentType, - ...header - }, - data: data.buffer, - success(res) { - if (res.statusCode == 200) { - resolve(res.data); - if (res.data) { - that.setData({ - 'userInfoForm.icon': app.config.requestCtx + `/file/GetPreViewImage?md5=` + e, - }); - let userTypeInfo = { - "requests": [{ - data: JSON.stringify({ - nickName: that.data.userInfo.nickName, - icon: that.data.userInfoForm.icon - }), - name: '鐢ㄦ埛鏄电О澶村儚', - type: 'nickName' - }] - } - app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => { - if (res) { - wx.showToast({ - title: "淇敼鎴愬姛", - icon: 'success', - duration: 1000, - }) - this.getUserInfo() - this.setData({ - userInfoBox: false, - }); + wx.getFileSystemManager().readFile({ + filePath: res.tempFiles[0].tempFilePath, //閫夋嫨鍥剧墖杩斿洖鐨勭浉瀵硅矾寰� + // encoding: 'binary', //缂栫爜鏍煎紡 + success: ress => { + //鎴愬姛鐨勫洖璋� + let spark = new SparkMD5.ArrayBuffer(); + spark.append(ress.data); + let md5 = spark.end(false); + let formData = new FormData(); + formData.append('Md5', md5); + formData.append('FileName', md5); + formData.append('FileType', res.tempFiles[0].fileType); + formData.appendFile("file", res.tempFiles[0].tempFilePath); + const data = formData.getData(); + let _token = wx.getStorageSync(app.config.tokenKey); + let header = {}; + if (_token == null) { + header["Authorization"] = `Basic ${Base64.encode(website.clientId + ":" + website.clientSecret)}`; + } else { + header["Authorization"] = `Bearer ` + _token; + } + new Promise((resolve, reject) => { + wx.request({ + url: app.config.requestCtx + '/file/api/ApiUpload', + method: 'POST', + header: { + 'content-type': data.contentType, + ...header + }, + data: data.buffer, + success(res) { + if (res.statusCode == 200) { + resolve(res.data); + if (res.data) { + that.setData({ + 'userInfoForm.icon': app.config.requestCtx + `/file/GetPreViewImage?md5=` + md5, + }); + let userTypeInfo = { + "requests": [{ + data: JSON.stringify({ + nickName: that.data.userInfo.nickName, + icon: that.data.userInfoForm.icon + }), + name: '鐢ㄦ埛鏄电О澶村儚', + type: 'nickName' + }] } - }) + app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => { + if (res) { + wx.showToast({ + title: "淇敼鎴愬姛", + icon: 'success', + duration: 1000, + }) + that.getUserInfo() + that.setData({ + userInfoBox: false, + }); + } + }) + } + } else { + reject('杩愯鏃堕敊璇�,璇风◢鍚庡啀璇�'); } - } else { - reject('杩愯鏃堕敊璇�,璇风◢鍚庡啀璇�'); } - } + }) }) - }) - + } }) } }); @@ -430,6 +437,12 @@ } }, + + onCloseProtocol() { + this.setData({ + userInfoBox: false, + }); + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ diff --git a/packagePersonal/pages/userSetting/index.wxml b/packagePersonal/pages/userSetting/index.wxml index aaf6525..46bf5f3 100644 --- a/packagePersonal/pages/userSetting/index.wxml +++ b/packagePersonal/pages/userSetting/index.wxml @@ -16,21 +16,21 @@ <view class="itemList"> <view class="label">鎵嬫満鍙风爜</view> <view class="content" data-info="{{'phone'}}" bindtap="editUserInfo">{{userInfo.phoneNumber || '鏈粦瀹氭墜鏈哄彿'}}</view> - <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" /> + <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" data-info="{{'phone'}}" bindtap="editUserInfo" /> </view> <view class="itemList"> <view class="label">閭</view> <view class="content" data-info="{{'email'}}" bindtap="editUserInfo">{{userInfo.Email}}</view> - <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" /> + <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" data-info="{{'email'}}" bindtap="editUserInfo" /> </view> - <t-popup visible="{{userInfoBox}}" bind:visible-change="onVisibleChange" placement="bottom"> + <t-popup visible="{{userInfoBox}}" bind:visible-change="onVisibleChange" placement="center"> <view class="block"> <view class="body"> <view class="from-item" wx:if="{{editType == 'nickName'}}"> <view class="label"> 鏄电О锛� </view> <view class="item-content"> <view class="inputBox1"> - <t-input placeholder="杈撳叆鐢ㄦ埛鍚�" borderless value="{{userInfoForm.nickName}}" bindchange="onNameInput" /> + <t-input placeholder="杈撳叆鏄电О" borderless value="{{userInfoForm.nickName}}" bindchange="onNameInput" /> </view> </view> </view> @@ -85,9 +85,10 @@ </view> </view> </view> - </view> - <view class="footer"> - <button class="submit" bindtap="confirmInfo">纭畾</button> + <view class="footer"> + <button class="submit" bindtap="confirmInfo">纭畾</button> + </view> + <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="onCloseProtocol" /> </view> </t-popup> </view> \ No newline at end of file diff --git a/packagePersonal/pages/userSetting/index.wxss b/packagePersonal/pages/userSetting/index.wxss index e5530ca..490dc08 100644 --- a/packagePersonal/pages/userSetting/index.wxss +++ b/packagePersonal/pages/userSetting/index.wxss @@ -51,26 +51,21 @@ .block .body { padding: 40rpx; - display: flex; - flex-wrap: wrap; - justify-content: space-between; } .block .body .from-item { margin-bottom: 20rpx; - display: flex; align-items: center; } .block .body .from-item .label { - width: 200rpx; - height: 72rpx; - line-height: 72rpx; + min-width: 100rpx; + height: 60rpx; + line-height: 60rpx; font-size: 32rpx; } .block .body .from-item .item-content { - padding: 10rpx; flex: 1; display: flex; } @@ -82,17 +77,35 @@ } .inputBox1 .t-input { - width: 440rpx !important; + width: 380rpx !important; +} + +.block { + position: relative; + width: 600rpx; + min-height: 500rpx; + padding: 20rpx 0; + background: #fff; + border-radius: 16rpx; +} + + +.block .body { + min-height: 280rpx; } .block .body .inputBox { - width: 250rpx; + width: 300rpx; height: 72rpx; border: 2rpx solid #D9D9D9; } .t-input { padding: 10rpx !important; +} + +.t-input__placeholder { + font-size: 28rpx !important; } .imgCode { @@ -125,4 +138,11 @@ background: #ff6c00; color: #fff; border-radius: 50rpx; +} + +.close-btn { + position: absolute; + left: 50%; + margin-left: -32rpx; + bottom: calc(-1 * (48rpx + 64rpx)); } \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index f037922..b7e213f 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -118,13 +118,15 @@ }) }, navToActivityDetail(e) { - console.log(item) let { info } = e.currentTarget.dataset - wx.navigateTo({ - url: info.link, - }); + console.log(info) + if (info.link) { + wx.navigateTo({ + url: info.link, + }); + } }, loadHomePage() { @@ -247,6 +249,9 @@ }, tabChangeHandle(item) { let info = this.data.courseTypeList[item.detail.value] + this.setData({ + courseList: [] + }) this.getCourseList(info) }, //鍥句功鏈嶅姟鍒嗙被 diff --git a/pages/personalCenter/index.wxss b/pages/personalCenter/index.wxss index 5235b34..b198e26 100644 --- a/pages/personalCenter/index.wxss +++ b/pages/personalCenter/index.wxss @@ -149,6 +149,7 @@ background: #fff; border-top-left-radius: 16rpx; border-top-right-radius: 16rpx; + margin-bottom: 100rpx; } .block .header { diff --git a/pages/student/index.js b/pages/student/index.js index e6050f6..a94d555 100644 --- a/pages/student/index.js +++ b/pages/student/index.js @@ -31,6 +31,7 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad() { + this.getStaticsSum(); this.getDataList(false); }, @@ -50,6 +51,37 @@ active: 2 }) } + + }, + getStaticsSum() { + const data = { + start: 0, + size: 10, + filterList: [{ + value: "LearningTime", + field: "type", + }], + }; + app.MG.app.getStaticsSum(data).then((res) => { + if (res) { + let minutes = Number(res) / (1000 * 60) + let hours = Number(res) / (1000 * 60 * 60) + if (minutes > 0 && minutes < 60) { + this.setData({ + learningDuration: Math.round(minutes) + "鍒嗛挓" + }) + } else if (minutes > 60) { + this.setData({ + learningDuration: Math.round(hours) + "灏忔椂" + }) + } else { + this.setData({ + learningDuration: "0灏忔椂" + }) + } + + } + }) }, tabClick(item) { diff --git a/pages/student/index.wxml b/pages/student/index.wxml index c8014d6..fdd6118 100644 --- a/pages/student/index.wxml +++ b/pages/student/index.wxml @@ -3,7 +3,7 @@ <view class="boxStyle"> <view class="box-item"> <view>绱瀛︿範鏃堕暱</view> - <view class="result"><text class="num">{{learningDuration}}</text>灏忔椂</view> + <view class="result"><text class="num">{{learningDuration}}</text></view> </view> <view class="box-item"> <view>涓婁竴娆$櫥闄嗘椂闂�</view> -- Gitblit v1.9.1