}) | }) | ||||
}, | }, | ||||
globalData: { | globalData: { | ||||
// urlRoot: "https://dongfengqichen.jiyou-tech.com/",//测试接口根目录 | |||||
urlRoot: "https://xing.venucia.com/api/",//接口根目录 | |||||
// urlStatic: "https://www.jiyou-tech.com/2020/496_qichen/static",//测试静态资源根目录 | |||||
urlStatic: "https://xingb.venucia.com/resource",//静态资源根目录 | |||||
urlRoot: "https://dongfengqichen.jiyou-tech.com/",//测试接口根目录 | |||||
// urlRoot: "https://xing.venucia.com/api/",//接口根目录 | |||||
urlStatic: "https://www.jiyou-tech.com/2020/496_qichen/static",//测试静态资源根目录 | |||||
// urlStatic: "https://xingb.venucia.com/resource",//静态资源根目录 | |||||
openid: "",//OPENID | openid: "",//OPENID | ||||
parentOpenid:"",//推荐人的openid | parentOpenid:"",//推荐人的openid | ||||
session_key: "",//session_key | session_key: "",//session_key | ||||
getSecondGuessInfo:{//第二轮价格竞猜信息 | getSecondGuessInfo:{//第二轮价格竞猜信息 | ||||
secondData:null, | secondData:null, | ||||
firstData:null | firstData:null | ||||
} | |||||
}, | |||||
getSecondGuessInfoV2:null,//第二轮价格竞猜结果 | |||||
}, | }, | ||||
// 获取openId | // 获取openId | ||||
getOpenid: function (code) { | getOpenid: function (code) { |
"pages/guessSecond/guessSecond", | "pages/guessSecond/guessSecond", | ||||
"pages/perfectMsg/perfectMsg", | "pages/perfectMsg/perfectMsg", | ||||
"pages/guessPoster/guessPoster", | "pages/guessPoster/guessPoster", | ||||
"pages/guessSecondPrize/guessSecondPrize" | |||||
"pages/guessSecondPrize/guessSecondPrize", | |||||
"pages/guessSecondResult/guessSecondResult", | |||||
"pages/guessSecondPoster/guessSecondPoster" | |||||
], | ], | ||||
"window": { | "window": { | ||||
"backgroundTextStyle": "light", | "backgroundTextStyle": "light", |
data: { | data: { | ||||
imgUrl: app.globalData.urlStatic,//图片路径 | imgUrl: app.globalData.urlStatic,//图片路径 | ||||
yuyueShow:false, | yuyueShow:false, | ||||
userType:1, | |||||
userType:0, | |||||
isShowFun:false, | isShowFun:false, | ||||
tipWindow2:false | tipWindow2:false | ||||
}, | }, | ||||
app.globalData.addPageEnterState.guessPrize = true; | app.globalData.addPageEnterState.guessPrize = true; | ||||
this.tipWindowControl2(); | this.tipWindowControl2(); | ||||
} | } | ||||
this.getSecondGuessInfo(); | |||||
// this.getSecondGuessInfo(); | |||||
this.getSecondResult(); | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
this.setData({ | this.setData({ | ||||
tipWindow2:!this.data.tipWindow2 | tipWindow2:!this.data.tipWindow2 | ||||
}) | }) | ||||
}, | |||||
getSecondResult:function(){//获取第二轮竞猜结果 | |||||
app.wxRequest(app.globalData.urlRoot + "guessPrice/getSecondGuessInfoV2", {}, res => { | |||||
if (res.code == 200) { | |||||
app.globalData.getSecondGuessInfoV2 = res.data; | |||||
} | |||||
}, this); | |||||
}, | |||||
enterGuessSecondResult:function(){//进入第二轮竞猜结果页面 | |||||
wx.navigateTo({ | |||||
url: '/pages/guessSecondResult/guessSecondResult', | |||||
}) | |||||
} | } | ||||
}) | }) |
<image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==4}}" src="{{imgUrl+'/newImages5/61.png'}}"></image> | <image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==4}}" src="{{imgUrl+'/newImages5/61.png'}}"></image> | ||||
<image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==3}}" src="{{imgUrl+'/newImages5/62.png'}}"></image> | <image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==3}}" src="{{imgUrl+'/newImages5/62.png'}}"></image> | ||||
<image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==2}}" src="{{imgUrl+'/newImages5/63.png'}}"></image> | <image class="startBtn" bindtap="enterGuessPrize" wx:if="{{userType==2}}" src="{{imgUrl+'/newImages5/63.png'}}"></image> | ||||
<image class="startBtn" bindtap="enterGuessSecondResult" src="{{imgUrl+'/newImages5/60.png'}}"></image> | |||||
<image class="drawBtn" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | <image class="drawBtn" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | ||||
<image class="yuyue" bindtap="yuyueControl" src="{{imgUrl+'/newIcon/4.png'}}"></image> | <image class="yuyue" bindtap="yuyueControl" src="{{imgUrl+'/newIcon/4.png'}}"></image> | ||||
</view> | </view> | ||||
<view class="ruleFrame ruleFrame2" wx:if="{{tipWindow2}}"> | <view class="ruleFrame ruleFrame2" wx:if="{{tipWindow2}}"> | ||||
<view class="tipWindow"> | <view class="tipWindow"> | ||||
<image class="tipWindowBg" src="{{imgUrl+'/newImages5/77.png'}}"></image> | |||||
<image class="tipWindowBg" src="{{imgUrl+'/newImages6/1.png'}}"></image> | |||||
<image class="tipWindowClose" bindtap="tipWindowControl2" src="{{imgUrl+'/newImages4/27.png'}}"></image> | <image class="tipWindowClose" bindtap="tipWindowControl2" src="{{imgUrl+'/newImages4/27.png'}}"></image> | ||||
</view> | </view> | ||||
</view> | </view> |
} | } | ||||
.tipWindow{ | .tipWindow{ | ||||
position: relative; | position: relative; | ||||
width: 501rpx; | |||||
height: 395rpx; | |||||
width: 500rpx; | |||||
height: 555rpx; | |||||
} | } | ||||
.tipWindowBg{ | .tipWindowBg{ | ||||
width: 100%; | width: 100%; |
// pages/guessSecondPoster/guessSecondPoster.js | |||||
const app = getApp(); | |||||
let _savePostBg = "";//用于绘制海报的背景 | |||||
let _totalDownloadTask = 2;//绘制需要下载的图片总数 | |||||
let _currentSuccessDownloadTask = 0;//已完成下载的图片数 | |||||
let windowScale = 0;//屏幕缩放比 | |||||
let canvasContron = null;//canvas | |||||
let posterUrl = "";//合成后的海报路径 | |||||
let _saveImg = false; | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
imgUrl: app.globalData.urlStatic,//图片路径 | |||||
selectType:1,//选中的分享类型 | |||||
userName:"",//用户昵称 | |||||
qrCodeUrl:"",//用户二维码 | |||||
prizeLevel:1,//奖品 1:升舱卡,2:百元京东卡 | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
app.globalData.nowPage = 3; | |||||
this.setData({ | |||||
userName:app.globalData.userInfoData.nickName | |||||
}) | |||||
}, | |||||
loadFun:function(){ | |||||
this.getGuessPriceQrCode(); | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
canvasContron = wx.createCanvasContext('myCanvas'); | |||||
if (app.globalData.openid) { | |||||
this.loadFun(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.loadFun; | |||||
} | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
return { | |||||
title: '发现宝藏小程序!我中了'+(this.data.prizeLevel==2?'百元京东卡':'免费升舱大奖')+',来一起探寻更多惊喜吧!', | |||||
imageUrl:this.data.imgUrl+'/newImages5/56.jpg', | |||||
path: "/pages/guess/guess" | |||||
} | |||||
}, | |||||
changeType:function(){//切换分享类型 | |||||
this.setData({ | |||||
selectType:this.data.selectType==1?2:1 | |||||
}) | |||||
}, | |||||
getGuessPriceQrCode:function(){//获取竞猜分享小程序码 | |||||
app.wxRequest(app.globalData.urlRoot + "guessPrice/getGuessPriceQrCode", {}, res => { | |||||
if (res.code == 200) { | |||||
this.setData({ | |||||
qrCodeUrl:res.data.qrcodeUrl | |||||
}) | |||||
this.cacheFun(); | |||||
} | |||||
}, this); | |||||
}, | |||||
cacheFun:function(){//缓存所需要的网络图片 | |||||
wx.getSystemInfo({ | |||||
success: option => { | |||||
windowScale = option.windowWidth / 750; | |||||
wx.getImageInfo({//缓存海报背景 | |||||
src: this.data.imgUrl + '/newImages6/17.png', | |||||
success: res => { | |||||
_savePostBg = res.path; | |||||
_currentSuccessDownloadTask ++; | |||||
this.posterDrawing(); | |||||
} | |||||
}) | |||||
wx.getImageInfo({//缓存二维码 | |||||
src: this.data.qrCodeUrl, | |||||
success: res => { | |||||
this.data.qrCodeUrl = res.path; | |||||
_currentSuccessDownloadTask++; | |||||
this.posterDrawing(); | |||||
} | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
posterDrawing: function (e) {//海报绘制 | |||||
//图片尚未下载完成,禁止绘制 | |||||
if(_currentSuccessDownloadTask < _totalDownloadTask){ | |||||
return; | |||||
} | |||||
var ctx = canvasContron;//canvas对象 | |||||
var scale = windowScale;//屏幕缩放比 | |||||
//背景 | |||||
ctx.drawImage(_savePostBg, 0, 0, scale * 750, scale * 1376); | |||||
//绘制文字 | |||||
ctx.setFontSize(scale * 33); | |||||
ctx.setFillStyle('#FFFFFF'); | |||||
ctx.setTextAlign('left'); | |||||
ctx.fillText(this.data.userName?'@'+this.data.userName:"@", scale * 128, scale *950); | |||||
ctx.setFontSize(scale * 27); | |||||
ctx.fillText("在猜价活动中,赢得"+(this.data.prizeLevel==1?"免费升舱卡!":"百元京东卡!"), scale * 128, scale *1006); | |||||
ctx.fillText("小程序内还有更多惊喜活动,", scale * 128, scale *1045); | |||||
ctx.fillText("一起来发现吧!", scale * 128, scale *1085); | |||||
//二维码 | |||||
ctx.drawImage(this.data.qrCodeUrl, scale * 573, scale * 1220, scale * 130, scale * 130); | |||||
//绘制 | |||||
ctx.draw(false, setTimeout(() => { | |||||
wx.canvasToTempFilePath({ | |||||
width:scale*750, | |||||
height: scale * 1380, | |||||
canvasId: 'myCanvas', | |||||
success: res => { | |||||
posterUrl = res.tempFilePath; | |||||
if(_saveImg){ | |||||
this.savePic(); | |||||
} | |||||
} | |||||
}) | |||||
}, 300)); | |||||
}, | |||||
saveImg: function () {//保存到手机 | |||||
if (!posterUrl){ | |||||
wx.showLoading({ | |||||
title: '海报合成中', | |||||
mask:true | |||||
}) | |||||
_saveImg = true; | |||||
}else{ | |||||
this.savePic(); | |||||
} | |||||
}, | |||||
savePic: function () { | |||||
wx.hideLoading(); | |||||
wx.saveImageToPhotosAlbum({ | |||||
filePath: posterUrl, | |||||
success(res) { | |||||
wx.showToast({ | |||||
title: '保存成功' | |||||
}) | |||||
}, | |||||
fail: res => { | |||||
wx.getSetting({ | |||||
success: res => { | |||||
if (res.authSetting['scope.writePhotosAlbum']) { | |||||
wx.showToast({ | |||||
title: '保存失败', | |||||
icon: "none" | |||||
}) | |||||
} else { | |||||
wx.showModal({ | |||||
title: '授权设置', | |||||
content: '请授权“保存到相册”', | |||||
success: (opt) => { | |||||
if (opt.confirm) { | |||||
wx.openSetting({ | |||||
success: e => { | |||||
if (e.authSetting['scope.writePhotosAlbum']) { | |||||
wx.saveImageToPhotosAlbum({ | |||||
filePath: posterUrl, | |||||
success(res) { | |||||
wx.showToast({ | |||||
title: '保存成功' | |||||
}) | |||||
} | |||||
}) | |||||
} else { | |||||
wx.showToast({ | |||||
title: '授权失败', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
} | |||||
}) | |||||
} | |||||
}) |
{ | |||||
"navigationBarTitleText": "东风启辰“猜出惊喜”", | |||||
"usingComponents": { | |||||
"tabBar": "../component/tabBar/index" | |||||
} | |||||
} |
<!--pages/guessSecondPoster/guessSecondPoster.wxml--> | |||||
<view class="main"> | |||||
<view class="selectGroup"> | |||||
<image class="selectImg" wx:if="{{selectType==1}}" bindtap="changeType" src="{{imgUrl+'/newImages5/22.png'}}"></image> | |||||
<image class="selectImg" wx:if="{{selectType==2}}" bindtap="changeType" src="{{imgUrl+'/newImages5/23.png'}}"></image> | |||||
<view class="selectMask" style="left:{{selectType==1?0:'50%'}};"></view> | |||||
</view> | |||||
<view wx:if="{{selectType==1}}"> | |||||
<view class="posterGroup"> | |||||
<image class="posterImg" src="{{imgUrl+'/newImages6/18.png'}}"></image> | |||||
<view class="posterText" style="font-size:17rpx;">@{{userName}}</view> | |||||
<view class="posterText" style="display:flex;align-items:center;top:550rpx;"> | |||||
<view>在猜价活动中,赢得</view> | |||||
<view style="font-weight:bold;">{{prizeLevel==1?'免费升舱卡!':'百元京东卡!'}}</view> | |||||
</view> | |||||
<view class="posterText" style="font-size:17rpx;top:570rpx;">小程序内还有更多惊喜活动,</view> | |||||
<view class="posterText" style="font-size:17rpx;top:590rpx;">一起来发现吧!</view> | |||||
<image class="posterCode" src="{{qrCodeUrl}}"></image> | |||||
</view> | |||||
<view class="bottomGroup"> | |||||
<image class="bottomImg" src="{{imgUrl+'/newImages5/64.png'}}"></image> | |||||
<view class="saveGroup"> | |||||
<image class="saveIcon" bindtap="saveImg" src="{{imgUrl+'/newImages5/26.png'}}"></image> | |||||
<image class="saveBtn" bindtap="saveImg" src="{{imgUrl+'/newImages5/27.png'}}"></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view wx:if="{{selectType==2}}"> | |||||
<image class="linkShareImg" src="{{imgUrl+'/newImages6/'+(prizeLevel==1?'19':'20')+'.png'}}"></image> | |||||
<view class="linkShareGroup"> | |||||
<image class="linkShareBg" src="{{imgUrl+'/newImages5/65.png'}}"></image> | |||||
<image class="linkShareBtn" src="{{imgUrl+'/newImages5/55.png'}}"></image> | |||||
<button open-type="share" style="width:268rpx;height:168rpx;min-height:0;" class="shareBtn"></button> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<canvas class="canvasDraw" canvas-id="myCanvas"></canvas> | |||||
<tabBar></tabBar> |
/* pages/guessSecondPoster/guessSecondPoster.wxss */ | |||||
image{ | |||||
display: block; | |||||
} | |||||
view{ | |||||
-webkit-overflow-scrolling: touch; | |||||
} | |||||
.main{ | |||||
height: calc(100vh - 120rpx); | |||||
overflow: auto; | |||||
position: relative; | |||||
} | |||||
.selectGroup{ | |||||
position: relative; | |||||
margin: 50rpx auto 70rpx; | |||||
width: 611rpx; | |||||
height: 71rpx; | |||||
} | |||||
.selectImg{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.selectMask{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 50%; | |||||
height: 100%; | |||||
opacity: 0; | |||||
} | |||||
.canvasDraw{ | |||||
width:1776rpx; | |||||
height:3268rpx; | |||||
position: fixed; | |||||
top: 0; | |||||
left: -1776rpx; | |||||
background-color: black; | |||||
} | |||||
.posterGroup{ | |||||
position: relative; | |||||
width: 395rpx; | |||||
height: 750rpx; | |||||
margin: 0 auto; | |||||
} | |||||
.posterImg{ | |||||
width: 100%; | |||||
height:100%; | |||||
} | |||||
.posterCode{ | |||||
position: absolute; | |||||
right: 30rpx; | |||||
bottom: 21rpx; | |||||
width: 68rpx; | |||||
height: 68rpx; | |||||
} | |||||
.bottomGroup{ | |||||
position: relative; | |||||
margin-top: 35rpx; | |||||
width: 750rpx; | |||||
height: 200rpx; | |||||
} | |||||
.bottomImg{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 750rpx; | |||||
height: 370rpx; | |||||
} | |||||
.saveGroup{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
display: flex; | |||||
align-items: center; | |||||
flex-direction: column; | |||||
} | |||||
.saveIcon{ | |||||
width: 95rpx; | |||||
height: 96rpx; | |||||
margin-top: 30rpx; | |||||
margin-bottom: 15rpx; | |||||
} | |||||
.saveBtn{ | |||||
width: 267rpx; | |||||
height: 54rpx; | |||||
} | |||||
.posterText{ | |||||
position: absolute; | |||||
left: 70rpx; | |||||
top: 520rpx; | |||||
line-height: 14rpx; | |||||
font-size:14rpx; | |||||
font-family:MHeiPRC; | |||||
font-weight:500; | |||||
color:rgba(255,255,255,1); | |||||
} | |||||
.linkShareImg{ | |||||
width: 462rpx; | |||||
height: 640rpx; | |||||
margin: 0 auto; | |||||
} | |||||
.linkShareGroup{ | |||||
position: relative; | |||||
width: 750rpx; | |||||
height: 464rpx; | |||||
margin-top: 44rpx; | |||||
} | |||||
.linkShareBg{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.linkShareBtn{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
top: 123rpx; | |||||
width: 268rpx; | |||||
height: 168rpx; | |||||
} | |||||
.shareBtn{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
top: 123rpx; | |||||
margin: 0; | |||||
padding: 0; | |||||
opacity: 0; | |||||
width: 268rpx; | |||||
height: 168rpx; | |||||
} |
// pages/guessSecondResult/guessSecondResult.js | |||||
const app = getApp(); | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
imgUrl: app.globalData.urlStatic,//图片路径 | |||||
ruleShow:false,//是否显示竞猜规则 | |||||
isUserAddress:false,//用户是否有地址 | |||||
guessPriceArr:[1,2,3,4,5,6],//用户的竞猜价格 | |||||
guessResult:3,//用户竞猜结果1:猜中,2:未猜中,3:未参加 | |||||
drawResult:0,//竞猜成功的用户抽奖结果1:升舱卡,2:京东卡,3:未中奖 | |||||
drawState:false,//是否抽过奖 | |||||
placing: false, | |||||
buyState: false, | |||||
httpState:false,//是否正在进行http请求 | |||||
isUserInfo:false,//是否有个人信息 | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
app.globalData.nowPage = 3; | |||||
var getSecondGuessInfoV2 = app.globalData.getSecondGuessInfoV2; | |||||
var userType = 3; | |||||
console.log(getSecondGuessInfoV2); | |||||
if(getSecondGuessInfoV2){ | |||||
if(getSecondGuessInfoV2.lucky_result==-1){ | |||||
userType = 2 | |||||
}else{ | |||||
userType = 1; | |||||
if(getSecondGuessInfoV2.lucky_result!=0){ | |||||
this.setData({ | |||||
drawState:getSecondGuessInfoV2.lucky_result | |||||
}) | |||||
} | |||||
} | |||||
this.data.guessPriceArr = getSecondGuessInfoV2.guess_price.toString().split(""); | |||||
for(let i=0;i<this.data.guessPriceArr.length;i++){ | |||||
this.data.guessPriceArr[i] = parseInt(this.data.guessPriceArr[i]); | |||||
} | |||||
this.setData({ | |||||
guessPriceArr:this.data.guessPriceArr | |||||
}) | |||||
} | |||||
if(app.globalData.userInfoData && app.globalData.userInfoData.nickName){ | |||||
this.setData({ | |||||
isUserInfo:true | |||||
}) | |||||
} | |||||
this.setData({ | |||||
guessResult:userType | |||||
}) | |||||
}, | |||||
loadFun:function(){ | |||||
this.getAddress(); | |||||
this.setData({ | |||||
buyState: app.globalData.getBuyState?app.globalData.getBuyState.success:false | |||||
}) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
if (app.globalData.openid) { | |||||
this.loadFun(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.loadFun; | |||||
} | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
return { | |||||
title: '召唤预言帝!快来和我一起猜启辰星售价,赢升舱大奖!', | |||||
imageUrl: this.data.imgUrl+'/newImages5/56.jpg', | |||||
path: "/pages/guess/guess" | |||||
} | |||||
}, | |||||
ruleControl:function(){//规则显示控制 | |||||
this.setData({ | |||||
ruleShow:!this.data.ruleShow | |||||
}) | |||||
}, | |||||
enterLucky:function(){//每日抽奖 | |||||
wx.navigateTo({ | |||||
url: '/pages/luckyStar/luckyStar' | |||||
}) | |||||
}, | |||||
drawBtn:function(){//立即抽取大奖 | |||||
if(this.data.httpState){ | |||||
return; | |||||
} | |||||
this.data.httpState = true; | |||||
app.wxRequest(app.globalData.urlRoot + "guessPrice/getSecondPriceLucky", {}, res => { | |||||
this.data.httpState = false; | |||||
if (res.code == 200) { | |||||
var drawResult = 0; | |||||
if(res.data.lucky_result==1){ | |||||
drawResult = 1; | |||||
}else if(res.data.lucky_result==2){ | |||||
drawResult = 2; | |||||
}else{ | |||||
drawResult = 3; | |||||
} | |||||
this.setData({ | |||||
drawResult:drawResult, | |||||
drawState:res.data.lucky_result | |||||
}) | |||||
} | |||||
}, this); | |||||
}, | |||||
closeWindow:function(){//关闭抽奖结果弹窗 | |||||
this.setData({ | |||||
drawResult:0 | |||||
}) | |||||
}, | |||||
getAddress: function () {//获取地址 | |||||
app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => { | |||||
if (res.code == 200) { | |||||
if (res.data && res.data.agentDetail) { | |||||
this.data.isUserAddress = true; | |||||
} | |||||
} | |||||
}, this); | |||||
}, | |||||
acceptPrize:function(){//马上领奖 | |||||
if(this.data.isUserAddress){ | |||||
wx.reLaunch({ | |||||
url: '/pages/myCenter/myCenter' | |||||
}) | |||||
}else{ | |||||
wx.navigateTo({ | |||||
url: '/pages/perfectMsg/perfectMsg', | |||||
}) | |||||
} | |||||
}, | |||||
goLuckyStar:function(){//领取上市好礼 | |||||
if(app.globalData.getBuyState.success){ | |||||
wx.navigateTo({ | |||||
url: '/pages/luckyStar/luckyStar', | |||||
}) | |||||
}else{ | |||||
this.placingControl(); | |||||
} | |||||
}, | |||||
placingControl: function () { | |||||
if (app.globalData.getBuyState){ | |||||
if (app.globalData.getBuyState.success != this.data.buyState) { | |||||
this.setData({ | |||||
buyState: app.globalData.getBuyState.success | |||||
}) | |||||
} | |||||
} | |||||
this.setData({ | |||||
placing: !this.data.placing | |||||
}) | |||||
}, | |||||
enterGuess:function(){ | |||||
wx.navigateTo({ | |||||
url: '/pages/guessSecondPoster/guessSecondPoster', | |||||
}) | |||||
}, | |||||
getUserWxMsg:function(e){//通过微信获取用户信息 | |||||
if (e.detail.errMsg == "getUserInfo:ok") { | |||||
this.setData({ | |||||
isUserInfo:true | |||||
}) | |||||
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||||
this.enterGuess(); | |||||
} | |||||
} | |||||
}) |
{ | |||||
"navigationBarTitleText": "东风启辰“猜出惊喜”", | |||||
"disableScroll":true, | |||||
"usingComponents": { | |||||
"placingOrder": "/pages/placingOrder/placingOrder", | |||||
"tabBar": "../component/tabBar/index" | |||||
} | |||||
} |
<!--pages/guessSecondResult/guessSecondResult.wxml--> | |||||
<view class="main"> | |||||
<image class="pageBg" src="{{imgUrl+'/versions/20.png?v=002'}}"></image> | |||||
<view class="pageContent"> | |||||
<view class="topGroup"> | |||||
<view style="position: relative;width:100%;height:100%;"> | |||||
<image class="newImages5-2" src="{{imgUrl+'/newImages5/78.png'}}"></image> | |||||
<view class="lookDetail" bindtap="lookConfigure"></view> | |||||
</view> | |||||
</view> | |||||
<image class="newImages6-2" src="{{imgUrl+'/newImages6/'+(guessResult==1?'5':guessResult==2?'6':'7')+'.png'}}"></image> | |||||
<image class="newImages6-9" src="{{imgUrl+'/newImages6/9.png'}}"></image> | |||||
<view class="selectFream"> | |||||
<image class="versions-19" src="{{imgUrl+'/versions/19.png'}}"></image> | |||||
<view class="priceGroup" wx:for="{{guessPriceArr}}" wx:key="index" data-index="{{index}}" style="left:{{154+index*77}}rpx"> | |||||
<image wx:if="{{guessResult!=3}}" class="priceImg priceImg2" src="{{imgUrl+'/newImages4/newNum/'+(item-1<0?9:item-1)+'.png?v=002'}}"></image> | |||||
<image wx:if="{{guessResult!=3}}" class="priceImg" src="{{imgUrl+'/newImages4/newNum/'+item+'.png?v=002'}}"></image> | |||||
<image wx:if="{{guessResult==3}}" class="priceImg" src="{{imgUrl+'/newImages6/8.png'}}"></image> | |||||
<image wx:if="{{guessResult!=3}}" class="priceImg priceImg3" src="{{imgUrl+'/newImages4/newNum/'+(item+1>9?1:item+1)+'.png?v=002'}}"></image> | |||||
</view> | |||||
<view class="slideMask"></view> | |||||
</view> | |||||
<image class="bottomBtn2" bindtap="drawBtn" wx:if="{{guessResult==1 && !drawState}}" src="{{imgUrl+'/newImages6/2.png'}}"></image> | |||||
<view class="bottomBtn2" wx:if="{{guessResult==1 && drawState}}"> | |||||
<image style="width:100%;height:100%;" bindtap="enterGuess" src="{{imgUrl+'/newImages6/21.png'}}"></image> | |||||
<button open-type="getUserInfo" wx:if="{{!isUserInfo}}" bindgetuserinfo="getUserWxMsg" style="min-height:0;width: 100%;" class="getUserInfoBtn"></button> | |||||
</view> | |||||
<image class="bottomBtn2" bindtap="goLuckyStar" wx:if="{{drawState==-2}}" src="{{imgUrl+'/newImages6/22.png'}}"></image> | |||||
<image class="bottomBtn2" bindtap="goLuckyStar" wx:if="{{guessResult==2 || guessResult==3}}" src="{{imgUrl+'/newImages6/3.png'}}"></image> | |||||
</view> | |||||
</view> | |||||
<image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | |||||
<image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | |||||
<view class="ruleFrame" wx:if="{{ruleShow}}"> | |||||
<image class="gameRule" src="{{imgUrl+'/newImages5/87.png'}}"></image> | |||||
<image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | |||||
</view> | |||||
<view class="ruleFrame ruleFrame2" wx:if="{{drawResult==1 || drawResult==2}}"> | |||||
<view class="prizeWindow"> | |||||
<image class="prizeWindowBg" wx:if="{{drawResult==1}}" src="{{imgUrl+'/newImages6/12.png'}}"></image> | |||||
<image class="prizeWindowBg" wx:if="{{drawResult==2}}" src="{{imgUrl+'/newImages6/11.png'}}"></image> | |||||
<image class="prizeBtn" bindtap="acceptPrize" src="{{imgUrl+'/newImages6/10.png'}}"></image> | |||||
<image class="prizeWindowClose" bindtap="closeWindow" src="{{imgUrl+'/newImages5/12.png'}}"></image> | |||||
</view> | |||||
</view> | |||||
<view class="ruleFrame ruleFrame2" wx:if="{{drawResult==3}}"> | |||||
<view class="prizeWindow"> | |||||
<image class="prizeWindowBg" src="{{imgUrl+'/newImages6/16.png'}}"></image> | |||||
<image class="prizeBtn" bindtap="goLuckyStar" style="bottom:65rpx;" src="{{imgUrl+'/newImages6/15.png'}}"></image> | |||||
<image class="prizeWindowClose" bindtap="closeWindow" src="{{imgUrl+'/newImages5/12.png'}}"></image> | |||||
</view> | |||||
</view> | |||||
<placingOrder bindplacing="placingControl" wx:if="{{placing}}"></placingOrder> | |||||
<tabBar></tabBar> |
/* pages/guessSecondResult/guessSecondResult.wxss */ | |||||
image{ | |||||
display: block; | |||||
} | |||||
view{ | |||||
-webkit-overflow-scrolling: touch; | |||||
} | |||||
.main{ | |||||
height: calc(100vh - 120rpx); | |||||
overflow: auto; | |||||
position: relative; | |||||
} | |||||
.pageBg{ | |||||
position: absolute; | |||||
left: 0; | |||||
bottom: 0; | |||||
width: 750rpx; | |||||
height: 1506rpx; | |||||
} | |||||
.pageContent{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
right: 0; | |||||
bottom: 0; | |||||
overflow-x: hidden; | |||||
} | |||||
.topGroup{ | |||||
position: relative; | |||||
width: 711rpx; | |||||
height: 440rpx; | |||||
margin-left: auto; | |||||
margin-right: 0; | |||||
margin-top: 70rpx; | |||||
} | |||||
.lookDetail{ | |||||
position: absolute; | |||||
left: 52rpx; | |||||
bottom: 60rpx; | |||||
width: 230rpx; | |||||
height: 30rpx; | |||||
/* background-color: rgba(0,0,0,0.5); */ | |||||
} | |||||
.newImages5-2{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.newImages6-2{ | |||||
width: 634rpx; | |||||
height: 163rpx; | |||||
margin:0 auto; | |||||
margin-top: 50rpx; | |||||
} | |||||
.newImages6-9{ | |||||
width: 151rpx; | |||||
height: 30rpx; | |||||
margin: 0 auto; | |||||
margin-top: 26rpx; | |||||
} | |||||
.selectFream{ | |||||
position: relative; | |||||
margin-top: 7rpx; | |||||
} | |||||
.versions-19{ | |||||
width: 535rpx; | |||||
height: 137rpx; | |||||
margin: 0 auto; | |||||
margin-left: 124rpx; | |||||
} | |||||
.priceGroup{ | |||||
position: absolute; | |||||
top: 18rpx; | |||||
left: 154rpx; | |||||
width: 60rpx; | |||||
height: 100rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
overflow: hidden; | |||||
} | |||||
.priceImg{ | |||||
width: 36rpx; | |||||
height: 43rpx; | |||||
} | |||||
.priceImg2,.priceImg3{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
top: -23rpx; | |||||
} | |||||
.priceImg3{ | |||||
top: auto; | |||||
bottom: -23rpx; | |||||
} | |||||
.slideMask{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
opacity: 0; | |||||
} | |||||
.drawBtn{ | |||||
width: 81rpx; | |||||
height: 81rpx; | |||||
position: fixed; | |||||
right: 35rpx; | |||||
top: 107rpx; | |||||
} | |||||
.yuyue{ | |||||
width: 81rpx; | |||||
height: 81rpx; | |||||
position: fixed; | |||||
right: 35rpx; | |||||
top: 214rpx; | |||||
} | |||||
.ruleFrame{ | |||||
position: fixed; | |||||
top:0; | |||||
left: 0; | |||||
height: calc(100vh - 120rpx); | |||||
overflow: auto; | |||||
} | |||||
.ruleFrame2{ | |||||
width: 100%; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
background-color: rgba(0,0,0,0.5); | |||||
z-index: 9; | |||||
} | |||||
.gameRule{ | |||||
width: 750rpx; | |||||
height: 2511rpx; | |||||
margin-top: -1rpx; | |||||
} | |||||
.closeRule{ | |||||
position: fixed; | |||||
right: 70rpx; | |||||
top: 102rpx; | |||||
width: 56rpx; | |||||
height: 57rpx; | |||||
} | |||||
.bottomBtn1,.bottomBtn2{ | |||||
position: fixed; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
bottom: 270rpx; | |||||
width: 710rpx; | |||||
height: 70rpx; | |||||
} | |||||
.bottomBtn2{ | |||||
bottom: 170rpx; | |||||
} | |||||
.prizeWindow{ | |||||
position: relative; | |||||
width: 501rpx; | |||||
height: 470rpx; | |||||
} | |||||
.prizeWindowBg{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.prizeGroup{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
} | |||||
.prizeWindowClose{ | |||||
position: absolute; | |||||
top: -32rpx; | |||||
right: -32rpx; | |||||
width: 42rpx; | |||||
height: 42rpx; | |||||
} | |||||
.prizeImg{ | |||||
margin-top: 60rpx; | |||||
width:501rpx; | |||||
height: 469rpx; | |||||
} | |||||
.prizeBtn{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
bottom: 50rpx; | |||||
width: 390rpx; | |||||
height: 60rpx; | |||||
} | |||||
.prizeImg2{ | |||||
width: 416rpx; | |||||
height: 282rpx; | |||||
margin-top: 85rpx; | |||||
} | |||||
.prizeImg3{ | |||||
width: 294rpx; | |||||
height: 100rpx; | |||||
margin-top: 85rpx; | |||||
margin-bottom: 6rpx; | |||||
} | |||||
.getUserInfoBtn{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
margin: 0; | |||||
padding: 0; | |||||
opacity: 0; | |||||
} |
storeValue: 0,//选中的专营店下标 | storeValue: 0,//选中的专营店下标 | ||||
httpState:false,//是否正在进行http请求 | httpState:false,//是否正在进行http请求 | ||||
windowTipShow:false,//是否显示完善信息后的弹窗 | windowTipShow:false,//是否显示完善信息后的弹窗 | ||||
isUserInfo:false,//是否有个人信息 | |||||
}, | }, | ||||
/** | /** | ||||
marginT: -20 | marginT: -20 | ||||
}) | }) | ||||
} | } | ||||
if(app.globalData.userInfoData && app.globalData.userInfoData.nickName){ | |||||
this.setData({ | |||||
isUserInfo:true | |||||
}) | |||||
} | |||||
}, | }, | ||||
loadFun:function(){ | loadFun:function(){ | ||||
if (app.globalData.userMobile) { | if (app.globalData.userMobile) { | ||||
}) | }) | ||||
}, | }, | ||||
enterGuess:function(){//去竞猜 | enterGuess:function(){//去竞猜 | ||||
// wx.redirectTo({ | |||||
// url: '/pages/guessSecondPrize/guessSecondPrize', | |||||
// }) | |||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '/pages/guessSecondPrize/guessSecondPrize', | |||||
url: '/pages/guessSecondPoster/guessSecondPoster', | |||||
}) | }) | ||||
}, | |||||
getUserWxMsg:function(e){//通过微信获取用户信息 | |||||
if (e.detail.errMsg == "getUserInfo:ok") { | |||||
this.setData({ | |||||
isUserInfo:true | |||||
}) | |||||
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||||
this.enterGuess(); | |||||
} | |||||
} | } | ||||
}) | }) |
<image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | <image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | ||||
<image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | <image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | ||||
<view class="ruleFrame" wx:if="{{ruleShow}}"> | <view class="ruleFrame" wx:if="{{ruleShow}}"> | ||||
<image class="gameRule" src="{{imgUrl+'/newImages4/17.png'}}"></image> | |||||
<image class="gameRule" src="{{imgUrl+'/newImages5/87.png'}}"></image> | |||||
<image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | <image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | ||||
</view> | </view> | ||||
<view class="ruleFrame ruleFrame2" wx:if="{{windowTipShow}}"> | |||||
<view class="ruleFrame ruleFrame2" wx:if="{{!windowTipShow}}"> | |||||
<view class="windowTipGroup"> | <view class="windowTipGroup"> | ||||
<image class="windowTipImg" src="{{imgUrl+'/newImages5/49.png'}}"></image> | |||||
<image class="windowTipBtn" bindtap="enterGuess" src="{{imgUrl+'/newImages5/48.png'}}"></image> | |||||
<image class="windowTipClose" bindtap="enterGuess" src="{{imgUrl+'/newImages5/50.png'}}"></image> | |||||
<image class="windowTipImg" src="{{imgUrl+'/newImages6/14.png'}}"></image> | |||||
<view class="windowTipBtn"> | |||||
<image style="width:100%;height:100%;" bindtap="enterGuess" src="{{imgUrl+'/newImages6/13.png'}}"></image> | |||||
<button open-type="getUserInfo" wx:if="{{!isUserInfo}}" bindgetuserinfo="getUserWxMsg" style="left: 50%;transform: translateX(-50%);bottom: 66rpx;min-height:0;width: 100%;" class="getUserInfoBtn"></button> | |||||
</view> | |||||
<view class="windowTipClose"> | |||||
<image style="width:100%;height:100%;" bindtap="enterGuess" src="{{imgUrl+'/newImages5/50.png'}}"></image> | |||||
<button open-type="getUserInfo" wx:if="{{!isUserInfo}}" bindgetuserinfo="getUserWxMsg" style="transform: translateX(0);min-height:0;width: 100%;" class="getUserInfoBtn"></button> | |||||
</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> |
left: 0; | left: 0; | ||||
height: calc(100vh - 120rpx); | height: calc(100vh - 120rpx); | ||||
overflow: auto; | overflow: auto; | ||||
z-index: 9; | |||||
} | } | ||||
.gameRule{ | .gameRule{ | ||||
width: 750rpx; | width: 750rpx; | ||||
height: 2362rpx; | |||||
height: 2511rpx; | |||||
margin-top: -1rpx; | margin-top: -1rpx; | ||||
} | } | ||||
.closeRule{ | .closeRule{ | ||||
.windowTipGroup{ | .windowTipGroup{ | ||||
position: relative; | position: relative; | ||||
width: 501rpx; | width: 501rpx; | ||||
height: 550rpx; | |||||
height: 470rpx; | |||||
} | } | ||||
.windowTipImg{ | .windowTipImg{ | ||||
width: 100%; | width: 100%; | ||||
height: 42rpx; | height: 42rpx; | ||||
top: -32rpx; | top: -32rpx; | ||||
right: -32rpx; | right: -32rpx; | ||||
} | |||||
.getUserInfoBtn{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
margin: 0; | |||||
padding: 0; | |||||
opacity: 0; | |||||
} | } |
"ignore": [] | "ignore": [] | ||||
}, | }, | ||||
"setting": { | "setting": { | ||||
"urlCheck": true, | |||||
"urlCheck": false, | |||||
"es6": true, | "es6": true, | ||||
"postcss": true, | "postcss": true, | ||||
"minified": true, | "minified": true, | ||||
"name": "二次竞猜价格", | "name": "二次竞猜价格", | ||||
"pathName": "pages/guessSecondPrize/guessSecondPrize", | "pathName": "pages/guessSecondPrize/guessSecondPrize", | ||||
"query": "" | "query": "" | ||||
}, | |||||
{ | |||||
"id": -1, | |||||
"name": "二次竞猜结果", | |||||
"pathName": "pages/guessSecondResult/guessSecondResult", | |||||
"query": "" | |||||
}, | |||||
{ | |||||
"id": -1, | |||||
"name": "二次竞猜结果海报", | |||||
"pathName": "pages/guessSecondPoster/guessSecondPoster", | |||||
"query": "" | |||||
} | } | ||||
] | ] | ||||
} | } |