diff --git a/packageB/images/luckDraw/jiang.png b/packageB/images/luckDraw/jiang.png new file mode 100644 index 0000000..78b4218 --- /dev/null +++ b/packageB/images/luckDraw/jiang.png diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index 381e508..7e9a2f7 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -6,7 +6,7 @@ let self = null; let imgDraw = { "width": "554px", "height": "899px", - "background": "http://jmh.xinda100.cn/public/images/share_bg.png", + "background": imghost + "miniapp/images/share_bg.png", "views": [ { //0.头像 "type": "image", @@ -38,7 +38,7 @@ let imgDraw = { "css": { "color": "#fff", "background": "#FF6768", - "width": "110px", + "width": "105px", "height": "26px", "lineHeight": "26px", "top": "70px", @@ -53,20 +53,18 @@ let imgDraw = { "type": "text", "text": "", "css": { - "color": "red", "width": "554px", "padding": "20px", "left": "20px", - "top": "140px", + "top": "160px", "fontSize": "28px", - "textAlign": "center", + "textAlign": "left", "maxLines": "1", - "fontWeight": "bold", } }, { //4.分享内容 "type": "text", - "text": "分享内容分享内容分享内容分享内容分享内容分享内容分享内容分享内容分享内容", + "text": "", "css": { "color": "#000000", "width": "554px", @@ -80,12 +78,14 @@ let imgDraw = { }, { //5.分享图片 "type": "image", - "url": "", + "url": "/packageB/images/luckDraw/jiang.png", "css": { - "width": "554px", + "width": "auto", "height": "350px", - "top": "240px", - "mode": "scaleToFill", + "top": "230px", + "left": "277px", + "align": "center", + "mode": "aspectFill", } }, { //6 @@ -280,6 +280,8 @@ Page({ self = this; let first_leader = null; this.data.options = options; + + // this.setData({ // options, // imghost, @@ -307,7 +309,7 @@ Page({ }; if(first_leader) { - console.log("log---", first_leader); + // console.log("log---", first_leader); app.globalData.first_leader = first_leader; //调用接口判断是不是会员 app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{ @@ -324,7 +326,7 @@ Page({ }, onShow() { - console.log('show~~`'); + // console.log('show~~`'); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -360,31 +362,59 @@ Page({ // console.log('luckInfo', res.data.data); let luckInfo = res.data.data; + self.setData({ + 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题 + // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 + 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 + }); if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; app.request.get(url, { success: function(res) { - // if(res.data.code == 0) { + if(res.data.code == 0) { self.setData({ template: res.data.data, - bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 + bannerUrl: imghost + res.data.data.bannerUrl, //背景图 'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 - 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.tilte : self.data.luckInfo.act_name,//分享标题 - 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享标题 - 'imgDraw.views[5].url': imghost + ((res.data.data&&res.data.data.share_image) ? res.data.data.share_image:self.data.luckInfo.imageurl),//分享图片 - 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 + 'imgDraw.views[3].text': res.data.data.title, //分享标题 + 'imgDraw.views[5].url': imghost + (res.data.data&&res.data.data.share_image ? res.data.data.share_image:self.data.luckInfo.imageurl), //分享图片 + }); + + // self.setData({ + // template: res.data.data, + // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 + // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 + // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 + // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题 + // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容 + // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片 + // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 + // }); + } else { + self.setData({ + 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 + //'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + //'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 }); - // }; + }; }, }); } else { + + if(luckInfo && luckInfo.imageurl) { + self.setData({ + 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片 + }); + }; if(luckInfo && luckInfo.store_bannerUrl) { self.setData({ bannerUrl: imghost + luckInfo.store_bannerUrl, + custom: true, }); }; @@ -413,7 +443,7 @@ Page({ self.setData({ award, }); - console.log('award', award); + // console.log('award', award); self.prizeLayout(award); }, @@ -463,9 +493,9 @@ Page({ // let user_id = app.globalData.userInfo.user_id; wx.getImageInfo({ - src: `${mainUrl}/api/wx/open/app/user/getWeAppEwm/${store_id}?sceneValue=${user_id}_${cj_id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`, + src: `${mainUrl}/api/wx/open/app/user/getWeAppEwm/${store_id}?sceneValue=${user_id}_${cj_id}&pageValue=pages/index/index/index`, success (res) { - if(res.data.code != -1) { + if(res.code != -1) { self.setData({ 'imgDraw.views[16].url': res.path, }); @@ -498,7 +528,7 @@ Page({ if(length == 1) { [0,2,4,6].map(function(item, index) { prizes[item] = { - id: award[0].record_id, + id: award[0].id, lbtype: award[0].lbtype, fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -522,7 +552,7 @@ Page({ if(length == 2) { [0,4].map(function(item, index) { prizes[item] = { - id: award[0].record_id, + id: award[0].id, lbtype: award[0].lbtype, fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -538,7 +568,7 @@ Page({ [2,6].map(function(item, index) { prizes[item] = { - id: award[1].record_id, + id: award[1].id, lbtype: award[1].lbtype, fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -562,7 +592,7 @@ Page({ if(length == 3) { [0,4].map(function(item, index) { prizes[item] = { - id: award[0].record_id, + id: award[0].id, lbtype: award[0].lbtype, fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -578,7 +608,7 @@ Page({ [1,5].map(function(item, index) { prizes[item] = { - id: award[1].record_id, + id: award[1].id, lbtype: award[1].lbtype, fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -594,7 +624,7 @@ Page({ [2,6].map(function(item, index) { prizes[item] = { - id: award[2].record_id, + id: award[2].id, lbtype: award[2].lbtype, fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -619,7 +649,7 @@ Page({ if(length == 4) { [0,2,4,6].map(function(item, index) { prizes[item] = { - id: award[index].record_id, + id: award[index].id, lbtype: award[index].lbtype, fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -643,7 +673,7 @@ Page({ if(length == 5) { [0,2,3,5,6].map(function(item, index) { prizes[item] = { - id: award[index].record_id, + id: award[index].id, lbtype: award[index].lbtype, fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -667,7 +697,7 @@ Page({ if(length == 6) { prizes = award.map(function(item, index) { return { - id: item.record_id, + id: item.id, lbtype: item.lbtype, fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}], imgs: [ @@ -790,7 +820,7 @@ Page({ if(res.data.code == 0) { if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { - console.log('start choujiang'); + // console.log('start choujiang'); // let start = false; if(!self.data.start) { self.data.start = true; @@ -810,7 +840,7 @@ Page({ success: function(res) { if(res.data.code == 0) { - console.log('开始摇奖', res.data.data); + // console.log('开始摇奖', res.data.data); if(self.data.luckInfo.vip_act_num != 0) { self.setData({ 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, @@ -823,6 +853,7 @@ Page({ isActive: true, wow: res.data.data, }); + // console.log('wow', self.data.wow); // console.log('请求成功', res.data.data); let luckyId = res.data.data.id; let indexArr = self.luckyIndex(self.data.prizes, luckyId); @@ -938,12 +969,12 @@ Page({ console.log('抽奖结果:',event.detail); let no_luck_urltype = this.data.luckInfo.no_luck_urltype; let lbtype = null; - let good_id = null; + // let good_id = null; let resultTitle = event.detail.fonts[0].text.replace('\n',''); - if(event.detail.id) { - console.log('~~~~~~----++++++',event.detail.id); - good_id = event.detail.id; - }; + // if(event.detail.id) { + // console.log('~~~~~~----++++++',event.detail.id); + // good_id = event.detail.id; + // }; if(event.detail.lbtype == 5) { lbtype = 5; } else { @@ -957,7 +988,7 @@ Page({ resultTitle, showPopup: false, currentLbtype: lbtype, - good_id, + // good_id, }); @@ -1194,10 +1225,10 @@ Page({ if(e && e.currentTarget.dataset.id) { id = e.currentTarget.dataset.id; } else { - id = this.data.good_id; + id = this.data.wow.record_id; }; let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; - console.log('good_id', id, url); + // console.log('good_id', id, url); app.request.put(url, { success: function(res) { if(res.data.code == 0) { @@ -1229,7 +1260,6 @@ Page({ clickReceive() { this.setData({ showResult: false, - showMask: false, }); this.showQr(); }, @@ -1257,4 +1287,34 @@ Page({ myimg: e.detail.path, }); }, + + + imageSize(e, boxWidth, boxHeight) { + var imageSize = {}; + var originalWidth = e.detail.width;//图片原始宽 + var originalHeight = e.detail.height;//图片原始高 + var originalScale = originalHeight/originalWidth;//图片高宽比 + console.log('originalWidth: ' + originalWidth) + console.log('originalHeight: ' + originalHeight) + + //获取屏幕宽高 + var boxWidth = boxWidth; + var boxHeight = boxHeight; + var boxscale = boxHeight/boxWidth;//屏幕高宽比 + console.log('windowWidth: ' + boxWidth) + console.log('windowHeight: ' + boxHeight) + if(originalScale < boxscale){//图片高宽比小于屏幕高宽比 + //图片缩放后的宽为屏幕宽 + imageSize.imageWidth = boxWidth; + imageSize.imageHeight = (boxWidth * originalHeight) / originalWidth; + }else{//图片高宽比大于屏幕高宽比 + //图片缩放后的高为屏幕高 + imageSize.imageHeight = boxHeight; + imageSize.imageWidth = (boxHeight * originalWidth) / originalHeight; + } + console.log('缩放后的宽: ' + imageSize.imageWidth) + console.log('缩放后的高: ' + imageSize.imageHeight) + console.log('图片尺寸', imageSize); + return imageSize; + }, }) \ No newline at end of file diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml index 8608cd8..7fda334 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml @@ -1,6 +1,6 @@ - + @@ -36,7 +36,7 @@ /> 今天你有 不限次 抽奖机会 - 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 + 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 @@ -118,7 +118,7 @@ - 提供技术支持 + 提供技术支持 diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxss b/packageB/pages/luckactivity/luckinfo/luckinfo.wxss index 93d1a92..2b88782 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxss +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxss @@ -113,8 +113,8 @@ page, } .logo { - width: 120rpx; - height: 40rpx; + width: 132rpx; + height: 37rpx; margin-right: 10rpx; } @@ -470,7 +470,7 @@ page, } .luck-container.on .panel { - box-shadow: 0 16rpx 24rpx #e7e9eb; + box-shadow: 0 0 24rpx #e7e9eb; } .luck-container.on .cs {