From d5965e688427480c5449496bd7ddbf222b59a443 Mon Sep 17 00:00:00 2001 From: Cyy <547766613@qq.com> Date: Thu, 22 Dec 2022 10:00:51 +0800 Subject: [PATCH] OA更新 --- packageA/pages/liveStream/liveStream.js | 341 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------- packageA/pages/liveStream/liveStream.wxml | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------ packageA/pages/liveStream/liveStream.wxss | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- pages/goods/categoryList/categoryList.wxml | 14 ++++++++------ pages/goods/categoryList/categoryList.wxss | 2 +- pages/user/order_list/order_list.js | 4 ++-- 6 files changed, 595 insertions(+), 86 deletions(-) diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index 990d007..3d48339 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -21,6 +21,8 @@ Page({ */ data: { curPage: 1, + ad_data: null, + sharimg:"", living: {}, livetoBegin: {}, liveOver: {}, @@ -28,7 +30,23 @@ Page({ isLoading: false, // 检测是否已经发送请求,防止重复发送请求 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 - + details: {}, + status: '', + btnText: '', + showActionSheet: true, + showPlaybill: true, + windowWidth: 0, + windowHeight: 0, + dpr: 0, + canvasScale: 1.0, + nickName: '', + avatarUrl: '', + coverImg: '', + canvasToImgPath: '', + screenWidth: 0, + canvasHidden: 1, + gid: '', + shareImgPath: '' }, // list: [], // live: { @@ -216,7 +234,29 @@ Page({ }); }); }) - + + + getApp().request.promiseGet("/api/weshop/ad/page?pid=1207&store_id=" + os.stoid, { + data: { + enabled: 1 + } + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { + var a = res.data.data.pageData; + var narr = []; + for (var i in a) { + var tt = { + 'ad_code': os.imghost + a[i].ad_code, + 'media_link': '', + 'ad_weapplink': a[i].ad_weapplink + }; + narr.push(tt); + } + self.setData({ + ad_data: narr + }); + } + }) }, /** @@ -244,40 +284,14 @@ Page({ self.getData(true, '/api/weshop/wx/livelist/page', { //请求直播中列表 storedId: o.stoid, - live_status: 101, - pageSize: 100, + pageSize: 100, + ordertype:1, + liveshow:1 }).then((res) => { self.setData({ living: self.data.list, }); - - - console.log(self.data.living); - - //直播中列表请求完后,请求即将开始列表 - self.getData(true, '/api/weshop/wx/livelist/page', { - storedId: o.stoid, - live_status: 102, - pageSize: 100, - }).then((res) => { - self.setData({ - livetoBegin: self.data.list, - }); - - //即将开始列表请求完后,请求结束列表 - self.getData(true, '/api/weshop/wx/livelist/page', { - storedId: o.stoid, - live_status: 103, - }).then((res) => { - self.setData({ - liveOver: self.data.list, - }); - }); - - - }); - - + }); @@ -306,6 +320,249 @@ Page({ }, + + + // 分享操作表 + clickShare: function (e) { + var sharimg = e.currentTarget.dataset.sharimg + if(!getApp().globalData.user_id){ + getApp().goto("/packageE/pages/togoin/togoin"); + return false; + } + this.setData({ + showActionSheet: !this.data.showActionSheet, + sharimg : sharimg + }) + }, + + // actionSheet - 取消按钮 + hiddenActionSheet: function () { + this.setData({ + showActionSheet: 'false' + }) + if(!this.data.showPlaybill) { + this.setData({ + showPlaybill: 'true' + }); + } + }, + + // 获取图片信息 + getImageInfo(src) { + return new Promise((resolve, reject) => { + wx.getImageInfo({ + src: src, + success: (res) => { + resolve(res); + } + }) + }); + }, + + closeWin: function () { + this.setData({ + showPlaybill: 'true' + }); + }, + + //生成海报 + createPlaybill: function () { + // 1.提示 “正在生成海报...” + wx.showLoading({ + title: '正在生成海报...' + }); + + // 3.展示生成的海报 + this.setData({ + showActionSheet: 'false', + // showPlaybill: !this.data.showPlaybill + }); + + // 2.生成海报,如果生成完毕,关闭提示 + this.drawPlaybill(); + + }, + + + // 生成海报 + drawPlaybill: async function () { + + var that=this; + // wx.showLoading({ + // title: '正在生成海报...' + // }); + + + if(!this.data.coverImg) { + + // 请求主图 + await that.getImageInfo(that.data['shareimg']).then(res => { + that.setData({ + coverImg: res.path, + coverImgWidth: res.width, + coverImgHeight: res.height, + coverImgSize: that.imageResize(res.width, res.height), + // coverImgHeight: res.height, + }); + // console.log('主图加载成功~', that.data.coverImgSize); + }); + } + + if(!this.data.avatarUrl) { + + // 请求头像 + await that.getImageInfo(app.globalData.userInfo['head_pic']).then(res => { + that.setData({ + avatarUrl: res.path + }); + console.log('头像加载成功~') + }); + } + + // 请求二维码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; + + if(!this.data.ewm) { + + await that.getImageInfo(path3).then(res => { + that.setData({ + ewm: res.path + }); + console.log('二维码加载成功~') + }); + } + + + + // 数据准备 + const title = this.data.details.name; + // const headImg = app.globalData.userInfo['head_pic']; + + // console.log('----------------v', headImg); + + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails"; + + // 以iPhone6为例,375/750 = 0.5 + // let scale = this.data.windowWidth / 375; + let scale = this.data.screenWidth / 750 * 1.35 + + + // 适配屏get幕 + // let scale = this.data.windowWidth / 375.0; + // this.setData({totalHeight: 667 * scale}); + + // 获取Canvas + let ctx = wx.createCanvasContext('myCanvas'); + + // 放大 因为不放大的话,生成的分享图会模糊。暂时先注释 + // ctx.scale(this.data.canvasScale, this.data.canvasScale) + + + + // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + // os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; + // + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails" + // console.log('path3---->', path3); + + + // 绘制主背景白色 + ctx.setFillStyle('#ffffff'); + ctx.fillRect(0, 0, 480, 738); + + // 绘制头像 + ctx.save(); + ctx.beginPath(); + ctx.arc(58, 52, 28, 0, 2*Math.PI); + ctx.clip(); + // console.log('1__________________>',app.globalData.userInfo['head_pic']); + ctx.drawImage(this.data.avatarUrl, 30, 24, 56, 56); + ctx.restore(); + + // 绘制昵称 + ctx.setFontSize(22); + ctx.setFillStyle('#ADADAD'); + ctx.fillText(this.data.nickName, 106, 60); + + // 绘制主图 + ctx.setFillStyle('#f8f8f8'); + ctx.fillRect(0, 104, 480, 380); + + // var w = this.data.coverImgWidth; + // var h = this.data.coverImgHeight; + var w = this.data.coverImgSize.imageWidth; + var h = this.data.coverImgSize.imageHeight; + // var dw = 480/w //canvas与图片的宽高比 + // var dh = 380/h + // var ratio + // // 裁剪图片中间部分 + // if(w > 480 && h > 380 || w < 480 && h < 380){ + // if (dw > dh) { + // ctx.drawImage(this.data.coverImg, 0, (h - 380/dw)/2, w, 380/dw, 0, 104, 480, 380); + // } else { + // ctx.drawImage(this.data.coverImg, (w - 480/dh)/2, 0, 480/dh, h, 0, 104, 480, 380); + // }; + // } + // // 拉伸图片 + // else{ + // if(w < 300){ + // ctx.drawImage(this.data.coverImg, 0, (h - 380/dw)/2, w, 380/dw, 0, 104, 480, 380); + // }else { + // ctx.drawImage(this.data.coverImg, (w - 480/dh)/2, 0, 480/dh, h, 0, 104, 480, 380); + // } + // }; + ctx.drawImage(this.data.coverImg, (480-w)/2, (380-h)/2+104, w, h); + + + // 绘制文字 + ctx.setFontSize(24); + ctx.setFillStyle('#1E1E1E'); + this.drawText(ctx, title, 30, 600, 200, 460, 2); + + // 绘制小程序码 + ctx.drawImage(this.data.ewm, 310, 540, 132, 132); + + + //绘制文字:长按识别 + ctx.setFontSize(20); + ctx.setFillStyle('#1E1E1E'); + ctx.fillText('长按识别小程序', 309, 710); + + ctx.draw(true, function() { + setTimeout(function() { + // console.log("我进来了~~~~~"); + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1217, + destWidth: 750, + destHeight: 1217, + canvasId: 'myCanvas', + fileType: 'jpg', + success: function(res) { + wx.hideLoading(); + that.setData({ + canvasToImgPath: res.tempFilePath, + showPlaybill: !that.data.showPlaybill + }); + // console.log('生成海报陈宫啦', that.data.canvasToImgPath); + // that.saveImageToPhotosAlbum(res.tempFilePath); + // console.log('截图陈宫:', that.data.canvasToImgPath); + // wx.previewImage({ + // //将图片预览出来 + // urls: [that.data.canvasToImgPath] + // }); + } + }) + }, 1000) + }); + + + + }, + /** * 页面相关事件处理函数--监听用户下拉动作 */ @@ -351,17 +608,27 @@ Page({ }); }, - /** + /** * 用户点击右上角分享 */ - onShareAppMessage: function () { getApp().globalData.no_clear=1; + onShareAppMessage: function (res) { + getApp().globalData.clear=1; + this.setData({ + showActionSheet: 'false' + }) + var self = this; if (res.from === 'button') { // 来自页面内转发按钮 - // console.log(res.target) + console.log(res.target) } return { - title: '直播列表' - // path: '/page/user?id=123' + title: this.data.details.name, + success: function(res) { + console.log('res---->', res); + }, + complete: function(res) { + console.log('comple', res) + } } }, diff --git a/packageA/pages/liveStream/liveStream.wxml b/packageA/pages/liveStream/liveStream.wxml index e762f12..cb55640 100644 --- a/packageA/pages/liveStream/liveStream.wxml +++ b/packageA/pages/liveStream/liveStream.wxml @@ -1,8 +1,8 @@ - - + + - - - 直播中 - - - - - - - - - {{item.name}} - {{filter.format_time(item.start_time, 2)}} 开始 - 主播:{{item['anchor_name']}} - - 观看直播 - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 正在直播 + 即将开播 + 回放 + 已失效 + + + + 小程序直播 + + + + + + + {{item.name}} + + + + {{item['anchor_name']}} + + + + + 分享 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packageA/pages/liveStream/liveStream.wxss b/packageA/pages/liveStream/liveStream.wxss index 5e8c15f..e2842a7 100644 --- a/packageA/pages/liveStream/liveStream.wxss +++ b/packageA/pages/liveStream/liveStream.wxss @@ -1,18 +1,41 @@ /* pages/liveStream/liveStream.wxss */ +page{ + background-color: #eee; +} .title { font-size: 30rpx; padding: 50rpx 32rpx; } .list-item { - padding: 0 32rpx 30rpx; display: flex; } .list-item-left { position: relative; - width: 340rpx; - height: 220rpx; flex-shrink: 0; } + +.xcx-image { + width: 20rpx; + height: 20rpx; + margin-left: 18rpx; + margin-top: 8rpx; + background-size:contain; + background-repeat: no-repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAlQTFRFPcRKAAAA////QjSLrQAAAAN0Uk5T/wD/aewfvgAAATZJREFUeJzt1MFxBSEIANDfRErTAyXQj+nAg1T58wVUEDObnfxLJl52xrcKKvr4SIf2OMG/vF0yUY2FvlqJBF9CgeQOPJ8VYGm7kLTiJatUL3AUVCEvdEGKlTylXhXgPlmrl8ZDAymciBOUbcZImo69Knoy+YakSMr3Es52W8L1lLniSPYdFQlOQQTsmdYp9rSRhoCpHeh/cQ8aoUVMJUo2XbIR9NJU5LcusN6FvEkRgU2SCNISRwqVRWt8ZKB3e+Sp6+lDhrQ096CqjGz4k+e7M2KOqlqlhoLLKe+STtJuSP1V+XEGIJLD3TlLSXqhVnn1fKZll4xIwQcij5cTfurGmXshLSAjeJTxtK/LcZKcjNe4eUlRmHmzfBgWCMLMG+zDiOA+mci2NVPQR5nvjkt5kb39NXkCPTYQh7BBvFgAAAAASUVORK5CYII= + + ) ; +} + +.share-image { + width: 30rpx; + height: 30rpx; + margin-left: 18rpx; + margin-top: 8rpx; + background-size:contain; + background-repeat: no-repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAACFQTFRFAAAA/04w/04w/04w/04w/04w/0ww/0Aw/0AA/00w/04wncLKIgAAAAt0Uk5TAP8/LxsOQBAE4ZBG21G1AAABIUlEQVR4nO3W2w3CMAwF0AYEEnzRDRiBEViFERiBzUEg+vK913ZFEUjxRyWanDqP4rRpatT4YpR2EIdlyAg8YhEyFQEyFT4xSfzp55M0qh++X4QoeJRqLKRJTZg8Tk14LrGtclkpYVN5bzK4jQndW7pg/A1iRLxChJQ0ka92hIBGQ/S/ARGyH4rgKShSZA5BeAWwrZ5gRFWZjxBP2A5uEkKUwESXWEPccZke/rj+gRw74pxJPTl1RIsBOXe/TacyStyTTZ6sn9cLIJPB9mT1vF4JOSDyilue7PJknydbsJMOQV8HHgFRSSW/TwKlzvSZR+LlMUpMZZ9J/OM0R+yp7n2yoHaHtGAYbSRQ5owIpcETzIhAGroqGeEYvfwJUGOZuAN2OElDEXSpWQAAAABJRU5ErkJggg== + ) ; +} .list-item-right { display: flex; flex-direction: column; @@ -21,11 +44,54 @@ /* position: relative; padding-bottom: 70rpx; */ } + +.share-actionSheet { + background-color: white; + padding-top: 45rpx; + position: fixed; + width: 100%; + bottom: 0; + z-index: 2; +} +.share-actionSheet-title { + font-size: 38rpx; + +} +.share-actionSheet-list { + display: flex; + justify-content: space-around; + padding-bottom: 30rpx; +} +.share-actionSheet-item { + text-align: center; + padding: 20rpx; +} +.share-actionSheet-pic { + display: block; + width: 118rpx; + height: 118rpx; + border-radius: 50%; + margin: 0 auto; +} +.share-actionSheet-desc { + font-size: 28rpx; +} + +.share-actionSheet-title, +.share-actionSheet-cancle { + text-align: center; +} + +.share-actionSheet-cancle { + padding: 30rpx 0; + border-top: 2rpx solid #CBCBCB; +} .item-pic { /* width: 400rpx; */ width: 100%; height: 100%; background-color: #eee; + border-radius: 15rpx; } .item-desc { position: absolute; @@ -55,7 +121,7 @@ display: -webkit-box; -webkit-box-orient: vertical; - -webkit-line-clamp: 2; + -webkit-line-clamp: 1; overflow: hidden; } .item-time { @@ -66,6 +132,12 @@ .item-anchor { color: #999; font-size: 24rpx; + text-align: justify; + + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; } .item-btn { @@ -76,7 +148,81 @@ color: #fff; font-size: 24rpx; text-align: center; + position: absolute;top: 15rpx;left: 7px; + border-radius: 15rpx; +} +.item-btnhf { + width: 172rpx; + height: 56rpx; + line-height: 56rpx; + background-color: #acacac; + color: #fff; + font-size: 24rpx; + text-align: center; + position: absolute;top: 15rpx;left: 7px; + border-radius: 15rpx; +} +.item-btnjjkb { + width: 172rpx; + height: 56rpx; + line-height: 56rpx; + background-color: rgb(250, 182, 36); + color: #fff; + font-size: 24rpx; + text-align: center; + position: absolute;top: 15rpx;left: 7px; + border-radius: 15rpx; +} + + +.item-btnld { + width: 202rpx; + height: 56rpx; + line-height: 56rpx; + background-color: #c9c9c9; + font-size: 24rpx; + text-align: center; + position: absolute; + bottom: 12rpx; + border-top-right-radius: 15rpx; + overflow: hidden; + opacity: 0.3; +} +.item-btnldt { + width: 202rpx; + height: 56rpx; + line-height: 56rpx; + color: white; + font-size: 24rpx; + text-align: center; + position: absolute; + bottom: 12rpx; + overflow: hidden; + margin-left: 20rpx; +} + +.item-btnxcx { + width: 32rpx; + height: 32rpx; + line-height: 56rpx; + color: rgb(233, 233, 233); + font-size: 24rpx; + left: 0; + bottom: 22rpx; + position: absolute; + overflow: hidden; + +} + +.content { + background-color: white; + padding-bottom: 168rpx; + position: relative; } +button::after { + border: none; +} + subscribe { position: relative; } @@ -108,4 +254,9 @@ subscribe { line-height: 3; color: #909090; text-align: center; +} + +.share-actionSheet.active ~ .mask, +.playbill.active ~ .mask { + display: block; } \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index 79d6e7f..988baee 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -292,7 +292,8 @@ - + + @@ -303,7 +304,7 @@ - + - + + - {{goods.items.name}} + {{goods.items.name}} 更多 @@ -335,7 +337,7 @@ - + {{item.name}} diff --git a/pages/goods/categoryList/categoryList.wxss b/pages/goods/categoryList/categoryList.wxss index 5115230..b18a19c 100644 --- a/pages/goods/categoryList/categoryList.wxss +++ b/pages/goods/categoryList/categoryList.wxss @@ -400,7 +400,7 @@ line-height: 65rpx; } .type_img_frame { box-sizing: border-box; - width: calc(100% / 3); + width: calc(90% / 3); height: 140rpx; margin-top: 20rpx; margin-bottom: 20rpx; diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index ce01aad..03ccf24 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -2051,7 +2051,6 @@ Page({ let list= []; if(currentIndex == 1) { - list = th.data.list2; list = list.concat(data); th.setData({list2:list}); }; @@ -2228,7 +2227,8 @@ Page({ this.setData({ currentPage2: 1, list2: [], - is_no_data2: 0, + is_no_data2: 0, + is_no_more2:0 }); -- libgit2 0.21.4