| @@ -26,9 +26,10 @@ App({ | |||
| // urlRoot: "",//接口根目录 | |||
| urlStatic:"https://www.jiyou-tech.com/2020/496_qichen/static",//静态资源根目录 | |||
| openid: "",//OPENID | |||
| friendOpenid:"",//推荐人的openid | |||
| session_key: "",//session_key | |||
| openidSuccessFuc: null,//方法回调 | |||
| nowPage:'1',//当前tabBar | |||
| nowPage:'0',//当前tabBar | |||
| isRegister:false,//是否已注册 | |||
| userMobile:null,//用户手机号 | |||
| isFirstLogin:true,//是否为第一次登录 | |||
| @@ -13,7 +13,10 @@ Page({ | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| if (options.friendOpenid){ | |||
| app.globalData.friendOpenid = options.friendOpenid; | |||
| app.globalData.nowPage = 0; | |||
| } | |||
| }, | |||
| /** | |||
| @@ -64,7 +67,8 @@ Page({ | |||
| onShareAppMessage: function () { | |||
| }, | |||
| receive:function(){//立即领取 | |||
| receive: function () {//立即领取 | |||
| app.globalData.nowPage = 1; | |||
| wx.redirectTo({ | |||
| url: '../index/index', | |||
| }) | |||
| @@ -20,7 +20,7 @@ Page({ | |||
| province:"",//省份 | |||
| agent_code: "",//经销商编码 | |||
| agentDetail: "",//经销商详细信息 | |||
| parentOpenid: "",//好友openid | |||
| parentOpenid: app.globalData.friendOpenid,//好友openid | |||
| }, | |||
| startAdvertisingUrl:'',//开屏广告路径 | |||
| isStartAdvertising: 1,//开屏广告透明度 | |||
| @@ -48,21 +48,38 @@ Page({ | |||
| this.getHomeVideo();//获取视频 | |||
| this.getOrderInfo(); | |||
| } else { | |||
| this.setData({ | |||
| mainShow:true, | |||
| isStartAdvertisingShow:false, | |||
| bannerList: app.globalData.indexData.bannerList, | |||
| videoList: app.globalData.indexData.videoList, | |||
| provinceArr: app.globalData.indexData.provinceArr, | |||
| storeArr: app.globalData.indexData.storeArr, | |||
| provinceValue: app.globalData.indexData.provinceValue, | |||
| storeValue: app.globalData.indexData.storeValue, | |||
| isRegister: app.globalData.isRegister | |||
| }) | |||
| this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province; | |||
| this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail; | |||
| this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code; | |||
| if (app.globalData.indexData.bannerList){ | |||
| this.setData({ | |||
| bannerList: app.globalData.indexData.bannerList | |||
| }) | |||
| } else { | |||
| this.getHomeBanner();//获取banner | |||
| } | |||
| if (app.globalData.indexData.videoList) { | |||
| this.setData({ | |||
| videoList: app.globalData.indexData.videoList | |||
| }) | |||
| } else { | |||
| this.getHomeVideo();//获取视频 | |||
| } | |||
| if (app.globalData.indexData.provinceArr){ | |||
| this.setData({ | |||
| provinceArr: app.globalData.indexData.provinceArr, | |||
| storeArr: app.globalData.indexData.storeArr, | |||
| provinceValue: app.globalData.indexData.provinceValue, | |||
| storeValue: app.globalData.indexData.storeValue | |||
| }) | |||
| this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province; | |||
| this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail; | |||
| this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code; | |||
| } | |||
| } | |||
| this.setData({ | |||
| mainShow: true, | |||
| isStartAdvertisingShow: false, | |||
| isRegister: app.globalData.isRegister | |||
| }) | |||
| console.log(app.globalData.isRegister); | |||
| }, | |||
| provinceChane: function (e) {//选中省 | |||
| this.setData({ | |||
| @@ -85,7 +102,9 @@ Page({ | |||
| this.setData({ | |||
| phoneInputShow: true | |||
| }) | |||
| this.getUserLocation();//获取用户当前位置 | |||
| if (!app.globalData.indexData.provinceArr) { | |||
| this.getUserLocation();//获取用户当前位置 | |||
| } | |||
| if (e.detail.errMsg=='getPhoneNumber:ok'){ | |||
| app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => { | |||
| if (res.code == 200) { | |||
| @@ -44,7 +44,7 @@ | |||
| <image class="successIcon" src="{{imgUrl+'/images/successIcon.png'}}"></image> | |||
| <view class="titleGroup"></view> | |||
| <view class="successTip">幸运满格,大奖到手</view> | |||
| <image class="prizePic" src="{{imgUrl+'/images/prizePic1.png'}}"></image> | |||
| <image class="prizePic" src="{{imgUrl+'/images/prizePic1.png'}}" mode="aspectFit"></image> | |||
| <view class="prizeName">头等舱机票一张</view> | |||
| <view class="startRegister">立即领奖</view> | |||
| </view> | |||
| @@ -29,7 +29,7 @@ Page({ | |||
| province: "",//省份 | |||
| agent_code: "",//经销商编码 | |||
| agentDetail: "",//经销商详细信息 | |||
| parentOpenid: "",//好友openid | |||
| parentOpenid: app.globalData.friendOpenid,//好友openid | |||
| }, | |||
| userData:{ | |||
| avatarUrl: null, | |||
| @@ -44,7 +44,8 @@ Page({ | |||
| count:20 | |||
| }, | |||
| noData:false, | |||
| optionsData:null | |||
| optionsData:null, | |||
| lookDescId:null, | |||
| }, | |||
| /** | |||
| @@ -62,9 +63,6 @@ Page({ | |||
| }, | |||
| loadFun: function () { | |||
| this.getUserInfo(); | |||
| this.getTaskProgress(); | |||
| this.getShareList(); | |||
| this.getMyAwardList(); | |||
| if (app.globalData.myCenterData) { | |||
| this.setData({ | |||
| provinceArr: app.globalData.myCenterData.provinceArr, | |||
| @@ -77,7 +75,6 @@ Page({ | |||
| this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail; | |||
| this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code; | |||
| }else{ | |||
| app.globalData.myCenterData = {}; | |||
| this.getOrderInfo(); | |||
| } | |||
| if (this.data.optionsData){ | |||
| @@ -140,9 +137,17 @@ Page({ | |||
| this.setData({ | |||
| selectNow: e.currentTarget.dataset.value | |||
| }) | |||
| if (e.currentTarget.dataset.value==3){ | |||
| this.data.parames.page=0; | |||
| this.data.getShareList = []; | |||
| if (e.currentTarget.dataset.value == 1) { | |||
| this.getTaskProgress(); | |||
| } else if (e.currentTarget.dataset.value == 2) { | |||
| this.getMyAwardList(); | |||
| } else if (e.currentTarget.dataset.value == 3){ | |||
| this.data.parames.page = 0; | |||
| this.setData({ | |||
| parames: this.data.parames, | |||
| shareFriendList:[] | |||
| }) | |||
| this.getShareList(); | |||
| } | |||
| }, | |||
| selectTask: function (e) { | |||
| @@ -182,6 +187,7 @@ Page({ | |||
| getDistributorList: function (longitude, latitude) {//获取经销商列表 | |||
| app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude }, res => { | |||
| if (res.code == 200) { | |||
| app.globalData.myCenterData = {}; | |||
| this.setData({ | |||
| provinceArr: res.data.list, | |||
| storeArr: res.data.list[res.data.nearData.provinceIndex].children, | |||
| @@ -337,13 +343,13 @@ Page({ | |||
| app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => { | |||
| if(res.code==200){ | |||
| // res.data.userLevel = 3; | |||
| if(res.data.avatarUrl){ | |||
| if (res.data) { | |||
| this.data.userData.avatarUrl = res.data.avatarUrl; | |||
| this.data.userData.nickName = res.data.nickName; | |||
| this.data.userData.userLevel = res.data.userLevel; | |||
| this.setData({ | |||
| userData:this.data.userData, | |||
| isLogin:true | |||
| userData: this.data.userData, | |||
| isLogin: true | |||
| }) | |||
| } | |||
| } | |||
| @@ -360,7 +366,8 @@ Page({ | |||
| }, | |||
| lookDesc:function(e){//查看奖品详情 | |||
| this.setData({ | |||
| descFrameShow: e.currentTarget.dataset.value | |||
| descFrameShow: !this.data.descFrameShow, | |||
| lookDescId: e.currentTarget.dataset.value || e.currentTarget.dataset.value==0 ? e.currentTarget.dataset.value:null | |||
| }) | |||
| }, | |||
| lookRule: function (e) {//查看奖品详情 | |||
| @@ -420,7 +427,9 @@ Page({ | |||
| this.setData({ | |||
| phoneInputShow: true | |||
| }) | |||
| this.getUserLocation();//获取用户当前位置 | |||
| if (!app.globalData.myCenterData) { | |||
| this.getUserLocation();//获取用户当前位置 | |||
| } | |||
| if (e.detail.errMsg == 'getPhoneNumber:ok') { | |||
| app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => { | |||
| if (res.code == 200) { | |||
| @@ -104,11 +104,12 @@ | |||
| </view> | |||
| </view> | |||
| <view class="recordPic"> | |||
| <image class="recordTip" bindtap="lookDesc" data-value="{{true}}" src="{{imgUrl+'/images/recordTip.png'}}"></image> | |||
| <image wx:if="{{false}}" class="rewardIcon" src="{{imgUrl+'/images/jiangpin.png'}}"></image> | |||
| <view class="rewardCash"> | |||
| <image class="recordTip" bindtap="lookDesc" data-value="{{index}}" src="{{imgUrl+'/images/recordTip.png'}}"></image> | |||
| <image wx:if="{{item.awardId!=1 && recordNow!=3}}" class="rewardIcon" mode="aspectFit" src="{{item.awardPicurl}}"></image> | |||
| <image wx:if="{{item.awardId!=1 && recordNow==3}}" class="luckyClaw" mode="aspectFit" src="{{item.awardPicurl}}"></image> | |||
| <view class="rewardCash" wx:if="{{item.awardId==1}}"> | |||
| <view class="cashGroup"> | |||
| <view class="cashNum">500</view> | |||
| <view class="cashNum">{{item.awardMoney}}</view> | |||
| <view class="cashCompany">元</view> | |||
| </view> | |||
| <view class="rewardCashText">购车红包</view> | |||
| @@ -169,15 +170,15 @@ | |||
| </view> | |||
| <service></service> | |||
| <view class="prizeDesc" catchtouchmove="ture" wx:if="{{descFrameShow}}"> | |||
| <view class="prizeImgGroup" wx:if="{{false}}"> | |||
| <image class="prizeImg" src="http://www.jiyou-tech.com/2020/496_qichen/static/images/indexBg.jpg"></image> | |||
| <view class="prizeImgGroup" wx:if="{{recordList[lookDescId].awardId!=1}}"> | |||
| <image class="prizeImg" src="{{recordList[lookDescId].awardDetailPicurl}}" mode="widthFix"></image> | |||
| <image bindtap="lookDesc" data-value="{{false}}" class="closeDescIcon" src="{{imgUrl+'/images/closeDescIcon.png'}}"></image> | |||
| </view> | |||
| <view class="prizeCustomGroup"> | |||
| <view class="prizeCustomGroup" wx:if="{{recordList[lookDescId].awardId==1}}"> | |||
| <view class="prizeCustom"> | |||
| <view class="prizeTitle">500元购车券</view> | |||
| <view class="prizeTitle">{{recordList[lookDescId].awardMoney}}元购车券</view> | |||
| <view class="prizeDescText">恭喜您!</view> | |||
| <view class="prizeDescText">500元购车券,已放入您个人中心</view> | |||
| <view class="prizeDescText">{{recordList[lookDescId].awardMoney}}元购车券,已放入您个人中心</view> | |||
| <view class="prizeDescText">此购车券仅限</view> | |||
| <view class="prizeDescText">全国东风启辰专营店购买启辰星使用</view> | |||
| <view class="prizeDescText">同时,您也可以加入星探计划,</view> | |||
| @@ -584,4 +584,8 @@ view{ | |||
| } | |||
| .getPhoneBtn{ | |||
| opacity: 0; | |||
| } | |||
| .luckyClaw{ | |||
| width: 198rpx; | |||
| height: 75rpx; | |||
| } | |||
| @@ -8,7 +8,10 @@ Page({ | |||
| data: { | |||
| imgUrl: app.globalData.urlStatic,//图片路径 | |||
| canvasContron:null,//canvas | |||
| qrCodeUrl:"https://www.jiyou-tech.com/2020/496_qichen/static/images/testQrCode.png", | |||
| posterBg:[],//海报背景 | |||
| qrCodeUrl:"https://www.jiyou-tech.com/2020/496_qichen/static/images/testQrCode.png",//二维码图片 | |||
| userHead: app.globalData.urlStatic + '/images/defaultHead.png',//用户头像 | |||
| rankNum: '8908',//缓存数字 | |||
| windowScale:0,//屏幕缩放比 | |||
| windowW: 0,//屏幕宽度 | |||
| windowH: 0,//屏幕高度 | |||
| @@ -21,7 +24,7 @@ Page({ | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| this.data.posterBg.push(); | |||
| }, | |||
| /** | |||
| @@ -30,11 +33,55 @@ Page({ | |||
| onReady: function () { | |||
| this.data.canvasContron = wx.createCanvasContext('myCanvas'); | |||
| wx.getSystemInfo({ | |||
| success: res => { | |||
| this.data.windowScale = res.windowWidth / 750; | |||
| this.data.windowW = res.windowWidth; | |||
| this.data.windowH = res.windowHeight; | |||
| this.posterDrawing(1); | |||
| success: option => { | |||
| this.data.windowScale = option.windowWidth / 750; | |||
| this.data.windowW = option.windowWidth; | |||
| this.data.windowH = option.windowHeight; | |||
| var countNum = 0; | |||
| wx.getImageInfo({//缓存海报背景 | |||
| src: this.data.imgUrl + '/images/tempImg1.jpg', | |||
| success: res => { | |||
| this.data.posterBg.push(res.path); | |||
| countNum+=1; | |||
| } | |||
| }) | |||
| wx.getImageInfo({//缓存二维码 | |||
| src: this.data.qrCodeUrl, | |||
| success: res => { | |||
| this.data.qrCodeUrl = res.path; | |||
| countNum += 1; | |||
| } | |||
| }) | |||
| wx.getImageInfo({//缓存头像 | |||
| src: this.data.userHead, | |||
| success: res => { | |||
| this.data.userHead = res.path; | |||
| countNum += 1; | |||
| } | |||
| }) | |||
| wx.getImageInfo({//缓存数字背景 | |||
| src: this.data.imgUrl + '/images/posterNum.png', | |||
| success: res => { | |||
| this.data.numBg = res.path; | |||
| countNum += 1; | |||
| } | |||
| }) | |||
| this.data.rankNum = this.data.rankNum.toString().split(""); | |||
| for (let i = 0; i < this.data.rankNum.length; i++) { | |||
| wx.getImageInfo({//缓存数字 | |||
| src: this.data.imgUrl + '/images/nums/' + this.data.rankNum[i]+'.png', | |||
| success: res => { | |||
| this.data.rankNum[i] = res.path; | |||
| countNum += 1; | |||
| } | |||
| }) | |||
| } | |||
| let setInt = setInterval(() => { | |||
| if (countNum >= 8) { | |||
| this.posterDrawing(1); | |||
| clearInterval(setInt); | |||
| } | |||
| },50); | |||
| } | |||
| }) | |||
| }, | |||
| @@ -81,33 +128,31 @@ Page({ | |||
| return { | |||
| title: '500元购车券', | |||
| imageUrl: "", | |||
| path: "/pages/coupon/coupon" | |||
| path: "/pages/coupon/coupon?friendOpenid=" + app.globalData.openid | |||
| } | |||
| }, | |||
| saveImg:function(){//保存到手机 | |||
| wx.saveFile({ | |||
| tempFilePath: this.data.posterUrl[this.data.swiperCurrent], | |||
| wx.saveImageToPhotosAlbum({ | |||
| filePath: this.data.posterUrl[this.data.swiperCurrent], | |||
| success(res) { | |||
| if (res.errMsg== "saveFile:ok"){ | |||
| wx.showToast({ | |||
| title: '保存成功' | |||
| }) | |||
| } | |||
| } | |||
| wx.showToast({ | |||
| title: '保存成功' | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| posterDrawing: function (e) {//海报绘制 | |||
| var ctx = this.data.canvasContron;//canvas对象 | |||
| var scale = this.data.windowScale;//屏幕缩放比 | |||
| //背景 | |||
| ctx.drawImage(this.data.imgUrl + '/images/tempImg'+e+'.jpg', 0, 0, scale * 444, scale * 817);//defaultHead | |||
| ctx.drawImage(this.data.posterBg[e-1], 0, 0, scale * 444, scale * 817);// | |||
| ctx.setFillStyle("#FFFFFF"); | |||
| ctx.save(); | |||
| ctx.beginPath(); //开始绘制 | |||
| //先画个圆 前两个参数确定了圆心 (x,y) 坐标 第三个参数是圆的半径 四参数是绘图方向 默认是false,即顺时针 | |||
| ctx.arc(scale * 48 / 2 + scale * 49, scale * 48 / 2 + scale * 538, scale * 48 / 2, 0, Math.PI * 2, false); | |||
| ctx.clip(); //剪切 | |||
| ctx.drawImage(this.data.imgUrl + '/images/coupon.png', scale * 49, scale * 538, scale * 48, scale * 48); //头像 | |||
| ctx.drawImage(this.data.userHead, scale * 49, scale * 538, scale * 48, scale * 48); //头像 | |||
| ctx.restore(); //恢复之前保存的绘图上下文 | |||
| //名称 | |||
| ctx.setFontSize(scale * 28); | |||
| @@ -115,17 +160,19 @@ Page({ | |||
| ctx.setTextAlign('left'); | |||
| ctx.fillText("啦啦啦", scale * 102, scale *572); | |||
| //我是第XXX星探 | |||
| ctx.drawImage(this.data.imgUrl + '/images/posterNum.png', scale * 50, scale * 598, scale * 333, scale * 74); | |||
| ctx.drawImage(this.data.numBg, scale * 50, scale * 598, scale * 333, scale * 74); | |||
| //排名数字 | |||
| ctx.drawImage(this.data.imgUrl + '/images/nums/8.png', scale * 168, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.imgUrl + '/images/nums/9.png', scale * 202, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.imgUrl + '/images/nums/0.png', scale * 236, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.imgUrl + '/images/nums/8.png', scale * 270, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.rankNum[0], scale * 168, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.rankNum[1], scale * 202, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.rankNum[2], scale * 236, scale * 602, scale * 32, scale * 40); | |||
| ctx.drawImage(this.data.rankNum[3], scale * 270, scale * 602, scale * 32, scale * 40); | |||
| //二维码 | |||
| ctx.drawImage(this.data.qrCodeUrl, scale * 282, scale * 672, scale * 105, scale* 106); | |||
| //绘制 | |||
| ctx.draw(false, setTimeout(() => { | |||
| wx.canvasToTempFilePath({ | |||
| width:scale*444, | |||
| height: scale * 817, | |||
| canvasId: 'myCanvas', | |||
| success: res => { | |||
| this.data.posterUrl.push(res.tempFilePath); | |||
| @@ -133,7 +180,13 @@ Page({ | |||
| posterUrl: this.data.posterUrl | |||
| }) | |||
| if (e < 3) { | |||
| this.posterDrawing(e+1); | |||
| wx.getImageInfo({ | |||
| src: this.data.imgUrl + '/images/tempImg'+(e+1)+'.jpg', | |||
| success: res => { | |||
| this.data.posterBg.push(res.path); | |||
| this.posterDrawing(e + 1); | |||
| } | |||
| }) | |||
| }else{ | |||
| this.setData({ | |||
| canvasShow:false | |||
| @@ -56,6 +56,7 @@ view{ | |||
| margin: 0 auto; | |||
| margin-top: 92rpx; | |||
| box-sizing: border-box; | |||
| background-color: #00548C; | |||
| } | |||
| .selectTempFrameBorder{ | |||
| border: 10rpx solid #00548C; | |||
| @@ -70,12 +71,11 @@ view{ | |||
| z-index: 2; | |||
| } | |||
| .canvasDraw{ | |||
| width:444rpx; | |||
| height:817rpx; | |||
| opacity: 0; | |||
| width:1776rpx; | |||
| height:3268rpx; | |||
| position: fixed; | |||
| top: 0; | |||
| left: 0; | |||
| left: -1776rpx; | |||
| } | |||
| .lookBigPic{ | |||
| display: flex; | |||