index:false, | index:false, | ||||
luckyStar:false, | luckyStar:false, | ||||
star:false, | star:false, | ||||
myCenter:false | |||||
myCenter:false, | |||||
guessPrize:false, | |||||
everyday:false | |||||
} | } | ||||
}, | }, | ||||
// 获取openId | // 获取openId |
"pages/scoutRule/scoutRule", | "pages/scoutRule/scoutRule", | ||||
"pages/vrLookCar/vrLookCar", | "pages/vrLookCar/vrLookCar", | ||||
"pages/configure/configure", | "pages/configure/configure", | ||||
"pages/guess/guess" | |||||
"pages/guess/guess", | |||||
"pages/guessPrize/guessPrize" | |||||
], | ], | ||||
"window": { | "window": { | ||||
"backgroundTextStyle": "light", | "backgroundTextStyle": "light", |
} | } | ||||
}, | }, | ||||
loadFun: function () { | loadFun: function () { | ||||
if (!app.globalData.addPageEnterState.everyday) { | |||||
app.addPageEnter("800C896F3ED88D22DDE9C125CE61D0D2"); | |||||
app.globalData.addPageEnterState.everyday = true; | |||||
} | |||||
this.getTaskProgress(); | this.getTaskProgress(); | ||||
this.getAddress(); | this.getAddress(); | ||||
// if (this.data.isFriendShare) { | // if (this.data.isFriendShare) { |
*/ | */ | ||||
data: { | data: { | ||||
imgUrl: app.globalData.urlStatic,//图片路径 | imgUrl: app.globalData.urlStatic,//图片路径 | ||||
yuyueShow:false, | |||||
}, | }, | ||||
*/ | */ | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
}, | |||||
enterLucky:function(){//每日抽奖 | |||||
wx.navigateTo({ | |||||
url: '/pages/luckyStar/luckyStar' | |||||
}) | |||||
}, | |||||
yuyueControl:function(){//预约 | |||||
this.setData({ | |||||
yuyueShow: !this.data.yuyueShow | |||||
}) | |||||
}, | |||||
enterGuessPrize:function(){//开始竞猜 | |||||
wx.navigateTo({ | |||||
url: '/pages/guessPrize/guessPrize' | |||||
}) | |||||
} | } | ||||
}) | }) |
{ | { | ||||
"navigationBarTitleText": "猜出惊喜", | "navigationBarTitleText": "猜出惊喜", | ||||
"usingComponents": { | "usingComponents": { | ||||
"tabBar": "../component/tabBar/index" | |||||
"tabBar": "../component/tabBar/index", | |||||
"yuyue": "/pages/yuyue/yuyue" | |||||
} | } | ||||
} | } |
<!--pages/guess/guess.wxml--> | <!--pages/guess/guess.wxml--> | ||||
<view class="all"> | <view class="all"> | ||||
<view class="main"> | <view class="main"> | ||||
<image class="pageBg" src="{{imgUrl+'/versions/3.png'}}"></image> | |||||
<image class="pageBg" src="{{imgUrl+'/versions/3.png'}}"></image> | |||||
<image class="pageBg" src="{{imgUrl+'/versions/3.png?v=002'}}"></image> | |||||
<image class="gameRule" src="{{imgUrl+'/versions/4.png?v=002'}}"></image> | |||||
<image class="startBtn" bindtap="enterGuessPrize" src="{{imgUrl+'/versions/2.png?v=002'}}"></image> | |||||
<image class="drawBtn" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | |||||
<image class="yuyue" bindtap="yuyueControl" src="{{imgUrl+'/newIcon/4.png'}}"></image> | |||||
</view> | </view> | ||||
<yuyue bindyuyue="yuyueControl" wx:if="{{yuyueShow}}"></yuyue> | |||||
<tabBar></tabBar> | <tabBar></tabBar> | ||||
</view> | </view> |
image{ | image{ | ||||
display: block; | display: block; | ||||
} | } | ||||
view{ | |||||
-webkit-overflow-scrolling: touch; | |||||
} | |||||
.main{ | .main{ | ||||
height: calc(100vh - 120rpx); | height: calc(100vh - 120rpx); | ||||
overflow: auto; | overflow: auto; | ||||
position: relative; | position: relative; | ||||
} | } | ||||
.pageBg{ | .pageBg{ | ||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
width: 750rpx; | width: 750rpx; | ||||
height: 1388rpx; | |||||
height: 1389rpx; | |||||
} | |||||
.gameRule{ | |||||
width: 750rpx; | |||||
height: 2363rpx; | |||||
margin-top: -1rpx; | |||||
} | |||||
.startBtn{ | |||||
position: fixed; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
bottom: 170rpx; | |||||
width: 710rpx; | |||||
height: 71rpx; | |||||
} | |||||
.drawBtn{ | |||||
width: 81rpx; | |||||
height: 81rpx; | |||||
position: fixed; | |||||
right: 35rpx; | |||||
top: 220rpx; | |||||
} | |||||
.yuyue{ | |||||
width: 81rpx; | |||||
height: 81rpx; | |||||
position: fixed; | |||||
right: 35rpx; | |||||
top: 334rpx; | |||||
} | } |
// pages/guessPrize/guessPrize.js | |||||
const app = getApp(); | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
imgUrl: app.globalData.urlStatic,//图片路径 | |||||
ruleShow:false,//是否显示规则 | |||||
yuyueShow:false,//是否显示预约 | |||||
firstPrice:false,//是否有首轮竞猜价格 | |||||
httpState:false,//是否正在进行http请求 | |||||
guessPrice:123456,//竞猜价格 | |||||
guessPriceArr:['1','2','3','4','5','6'], | |||||
shareShow:false,//是否显示分享弹窗 | |||||
slideState:false,//滑动状态 | |||||
slideNum:0,//滑动距离 | |||||
slideDay:['0','0'],//距离上市时间 | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
app.globalData.nowPage = 3; | |||||
this.distanceDay(); | |||||
if (app.globalData.openid) { | |||||
this.loadFun(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.loadFun; | |||||
} | |||||
}, | |||||
loadFun:function(){ | |||||
if (!app.globalData.addPageEnterState.guessPrize) { | |||||
app.addPageEnter("7C8AAA38F8D85EFC48C2995FB6EBAC19"); | |||||
app.globalData.addPageEnterState.guessPrize = true; | |||||
} | |||||
this.getFirstGuessInfo(); | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
return { | |||||
title: '召唤预言帝!快来和我一起猜启辰星售价,赢升舱大奖!', | |||||
imageUrl: this.data.imgUrl + "/versions/guessShareImg.jpg", | |||||
path: "/pages/guess/guess" | |||||
} | |||||
}, | |||||
ruleControl:function(){//规则显示控制 | |||||
this.setData({ | |||||
ruleShow:!this.data.ruleShow | |||||
}) | |||||
}, | |||||
shareWindowControl:function(){//邀请好友弹窗显示控制 | |||||
this.setData({ | |||||
shareShow:!this.data.shareShow | |||||
}) | |||||
}, | |||||
lookConfigure:function(){//查看车型详细参数 | |||||
wx.navigateTo({ | |||||
url: '/pages/configure/configure', | |||||
}) | |||||
}, | |||||
enterLucky:function(){//每日抽奖 | |||||
wx.navigateTo({ | |||||
url: '/pages/luckyStar/luckyStar' | |||||
}) | |||||
}, | |||||
yuyueControl:function(){//预约 | |||||
this.setData({ | |||||
yuyueShow: !this.data.yuyueShow | |||||
}) | |||||
}, | |||||
getFirstGuessInfo:function(){//获取首轮竞猜价格信息 | |||||
app.wxRequest(app.globalData.urlRoot + "guessPrice/getFirstGuessInfo", {}, res => { | |||||
// res.data = null; | |||||
if (res.code == 200 && res.data) { | |||||
this.data.guessPriceArr = res.data.guess_price.toString().split(""); | |||||
this.setData({ | |||||
firstPrice:true, | |||||
guessPriceArr:this.data.guessPriceArr | |||||
}) | |||||
} | |||||
}, this); | |||||
}, | |||||
submitPrice:function(){ | |||||
if(this.data.firstPrice){ | |||||
this.shareWindowControl(); | |||||
}else{ | |||||
this.submitFirstGuessInfo(); | |||||
} | |||||
}, | |||||
submitFirstGuessInfo:function(){//提交首轮竞猜价格 | |||||
if(this.data.httpState){ | |||||
return; | |||||
} | |||||
this.data.httpState = true; | |||||
app.wxRequest(app.globalData.urlRoot + "guessPrice/submitFirstGuessInfo", {guess_price:this.data.guessPrice,statistics_scene:app.globalData.sceneSource}, res => { | |||||
this.data.httpState = false; | |||||
if (res.code == 200) { | |||||
this.setData({ | |||||
firstPrice:true | |||||
}) | |||||
this.shareWindowControl(); | |||||
}else{ | |||||
wx.showToast({ | |||||
title: res.msg, | |||||
icon:"none" | |||||
}) | |||||
} | |||||
}, this,"POST"); | |||||
}, | |||||
stratMove:function(e){ | |||||
var index = e.currentTarget.dataset.index; | |||||
if(index == 0){ | |||||
return; | |||||
} | |||||
this.setData({ | |||||
slideState:true | |||||
}) | |||||
this.data.slideNum = e.changedTouches[0].pageY; | |||||
}, | |||||
endMove:function(e){ | |||||
var index = e.currentTarget.dataset.index; | |||||
if(index == 0){ | |||||
return; | |||||
} | |||||
this.setData({ | |||||
slideState:false | |||||
}) | |||||
if(e.changedTouches[0].pageY-this.data.slideNum>=10){ | |||||
console.log("往下滑"); | |||||
if(index==1){ | |||||
this.data.guessPrice-=10000; | |||||
}else if(index==2){ | |||||
this.data.guessPrice-=1000; | |||||
}else if(index==3){ | |||||
this.data.guessPrice-=100; | |||||
}else if(index==4){ | |||||
this.data.guessPrice-=10; | |||||
}else if(index==5){ | |||||
this.data.guessPrice-=1; | |||||
} | |||||
if(this.data.guessPrice<110000){ | |||||
this.data.guessPrice = 110000; | |||||
} | |||||
this.data.guessPriceArr = this.data.guessPrice.toString().split(""); | |||||
this.setData({ | |||||
guessPriceArr:this.data.guessPriceArr | |||||
}) | |||||
}else if(e.changedTouches[0].pageY+10<=this.data.slideNum){ | |||||
console.log("往上滑"); | |||||
if(index==1){ | |||||
this.data.guessPrice+=10000; | |||||
}else if(index==2){ | |||||
this.data.guessPrice+=1000; | |||||
}else if(index==3){ | |||||
this.data.guessPrice+=100; | |||||
}else if(index==4){ | |||||
this.data.guessPrice+=10; | |||||
}else if(index==5){ | |||||
this.data.guessPrice+=1; | |||||
} | |||||
if(this.data.guessPrice>150000){ | |||||
this.data.guessPrice = 150000; | |||||
} | |||||
this.data.guessPriceArr = this.data.guessPrice.toString().split(""); | |||||
this.setData({ | |||||
guessPriceArr:this.data.guessPriceArr | |||||
}) | |||||
} | |||||
}, | |||||
distanceDay:function(){//距离4月23日上市还有XX天 | |||||
var timestamp = Date.parse(new Date()); //今天的时间戳 | |||||
var timestamp2 = Date.parse(new Date('2020-04-23')); //上市时间时间戳 | |||||
if(timestamp2>timestamp){ | |||||
var slideNum = Math.ceil((timestamp2-timestamp)/60/60/24/1000).toString().split(""); | |||||
this.setData({ | |||||
slideDay:slideNum//距离上市时间 | |||||
}) | |||||
} | |||||
} | |||||
}) |
{ | |||||
"navigationBarTitleText": "猜出惊喜", | |||||
"usingComponents": { | |||||
"tabBar": "../component/tabBar/index", | |||||
"yuyue": "/pages/yuyue/yuyue" | |||||
} | |||||
} |
<!--pages/guessPrize/guessPrize.wxml--> | |||||
<view class="all"> | |||||
<view class="main" style="overflow:{{slideState?'hidden':'auto'}};"> | |||||
<image class="pageBg" src="{{imgUrl+'/versions/20.png'}}"></image> | |||||
<image class="ruleBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | |||||
<image class="versions-14" src="{{imgUrl+'/versions/14.png'}}"></image> | |||||
<image class="versions-15" src="{{imgUrl+'/versions/15.png'}}"></image> | |||||
<image class="versions-9" bindtap="lookConfigure" src="{{imgUrl+'/versions/9.png'}}"></image> | |||||
<image class="versions-16" src="{{imgUrl+'/versions/16.png'}}"></image> | |||||
<image class="versions-17" src="{{imgUrl+'/versions/17.png'}}"></image> | |||||
<view class="selectFream"> | |||||
<image class="versions-19" src="{{imgUrl+'/versions/19.png'}}"></image> | |||||
<view class="priceGroup" bindtouchstart="stratMove" bindtouchend="endMove" wx:for="{{guessPriceArr}}" wx:key="index" data-index="{{index}}" style="left:{{154+index*77}}rpx"> | |||||
<image class="priceImg" src="{{imgUrl+'/versions/nums/'+item+'.png?v=002'}}"></image> | |||||
</view> | |||||
<view wx:if="{{firstPrice}}" class="slideMask"></view> | |||||
</view> | |||||
<image class="versions-8" bindtap="submitPrice" src="{{imgUrl+'/versions/8.png'}}"></image> | |||||
<image class="versions-18" src="{{imgUrl+'/versions/18.png'}}"></image> | |||||
<view class="timeFrame"> | |||||
<image class="versions-12" src="{{imgUrl+'/versions/12.png'}}"></image> | |||||
<image class="versions-10" src="{{imgUrl+'/versions/10.png'}}"></image> | |||||
<view class="numGroup"> | |||||
<image class="versions-13" src="{{imgUrl+'/versions/13.png'}}"></image> | |||||
<view class="numText">{{slideDay[0]}}</view> | |||||
</view> | |||||
<view class="numGroup"> | |||||
<image class="versions-13" src="{{imgUrl+'/versions/13.png'}}"></image> | |||||
<view class="numText">{{slideDay[1]}}</view> | |||||
</view> | |||||
<image class="versions-11" src="{{imgUrl+'/versions/11.png'}}"></image> | |||||
<image class="versions-12" src="{{imgUrl+'/versions/12.png'}}"></image> | |||||
</view> | |||||
<image class="versions-5" bindtap="yuyueControl" src="{{imgUrl+'/versions/5.png'}}"></image> | |||||
<image class="versions-5" bindtap="enterLucky" style="margin-top:20rpx;" src="{{imgUrl+'/versions/6.png'}}"></image> | |||||
<view class="ruleFrame" wx:if="{{ruleShow}}"> | |||||
<image class="gameRule" src="{{imgUrl+'/versions/4.png?v=002'}}"></image> | |||||
<image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | |||||
</view> | |||||
<view class="shareWindow" wx:if="{{shareShow}}"> | |||||
<view class="shareWindowGroup"> | |||||
<image class="versions-23" src="{{imgUrl+'/versions/23.png?v=002'}}"></image> | |||||
<image class="versions-22" src="{{imgUrl+'/versions/22.png'}}"></image> | |||||
<button open-type="share" style="min-height:0;width: 462rpx;" class="shareBtn"></button> | |||||
<image class="versions-24" bindtap="shareWindowControl" src="{{imgUrl+'/versions/24.png'}}"></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<yuyue bindyuyue="yuyueControl" wx:if="{{yuyueShow}}"></yuyue> | |||||
<tabBar></tabBar> | |||||
</view> |
/* pages/guessPrize/guessPrize.wxss */ | |||||
image{ | |||||
display: block; | |||||
} | |||||
view{ | |||||
-webkit-overflow-scrolling: touch; | |||||
} | |||||
.main{ | |||||
height: calc(100vh - 120rpx); | |||||
overflow: auto; | |||||
position: relative; | |||||
} | |||||
.pageBg{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 750rpx; | |||||
height: 1388rpx; | |||||
z-index: -1; | |||||
} | |||||
.ruleBtn{ | |||||
width: 81rpx; | |||||
height: 81rpx; | |||||
position: fixed; | |||||
right: 35rpx; | |||||
top: 100rpx; | |||||
} | |||||
.ruleFrame{ | |||||
position: fixed; | |||||
top:0; | |||||
left: 0; | |||||
height: calc(100vh - 120rpx); | |||||
overflow: auto; | |||||
} | |||||
.gameRule{ | |||||
width: 750rpx; | |||||
height: 2363rpx; | |||||
margin-top: -1rpx; | |||||
} | |||||
.closeRule{ | |||||
position: fixed; | |||||
right: 70rpx; | |||||
top: 102rpx; | |||||
width: 56rpx; | |||||
height: 57rpx; | |||||
} | |||||
.versions-14{ | |||||
width: 150rpx; | |||||
height: 36rpx; | |||||
margin: 0 auto; | |||||
margin-top: 208rpx; | |||||
} | |||||
.versions-15{ | |||||
width: 368rpx; | |||||
height: 30rpx; | |||||
margin: 15rpx auto; | |||||
} | |||||
.versions-9{ | |||||
width: 374rpx; | |||||
height: 44rpx; | |||||
margin: 0 auto; | |||||
} | |||||
.versions-16{ | |||||
width: 513rpx; | |||||
height: 51rpx; | |||||
margin: 0 auto; | |||||
margin-top: 50rpx; | |||||
} | |||||
.versions-17{ | |||||
width: 589rpx; | |||||
height: 51rpx; | |||||
margin: 0 auto; | |||||
margin-top: 88rpx; | |||||
} | |||||
.selectFream{ | |||||
position: relative; | |||||
margin-top: 30rpx; | |||||
} | |||||
.slideMask{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
opacity: 0; | |||||
} | |||||
.versions-19{ | |||||
width: 535rpx; | |||||
height: 137rpx; | |||||
margin: 0 auto; | |||||
margin-left: 124rpx; | |||||
} | |||||
.versions-8{ | |||||
width: 374rpx; | |||||
height: 44rpx; | |||||
margin: 0 auto; | |||||
margin-top: 15rpx; | |||||
} | |||||
.versions-18{ | |||||
width: 382rpx; | |||||
height: 54rpx; | |||||
margin: 0 auto; | |||||
margin-top: 20rpx; | |||||
} | |||||
.timeFrame{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
margin-top: 95rpx; | |||||
} | |||||
.versions-12{ | |||||
width: 87rpx; | |||||
height: 3rpx; | |||||
} | |||||
.versions-10{ | |||||
width: 218rpx; | |||||
height: 24rpx; | |||||
margin-left: 10rpx; | |||||
margin-right: 5rpx; | |||||
} | |||||
.versions-11{ | |||||
width: 22rpx; | |||||
height: 23rpx; | |||||
margin-left:5rpx; | |||||
margin-right: 10rpx; | |||||
} | |||||
.numGroup{ | |||||
position: relative; | |||||
} | |||||
.versions-13{ | |||||
width: 31rpx; | |||||
height: 31rpx; | |||||
} | |||||
.numText{ | |||||
position: absolute; | |||||
top: 50%; | |||||
left: 50%; | |||||
transform: translate(-50%,-50%); | |||||
line-height: 25rpx; | |||||
font-size:25rpx; | |||||
font-family:NissanBrand; | |||||
font-weight:400; | |||||
color:rgba(24,42,114,1); | |||||
} | |||||
.versions-5{ | |||||
width: 710rpx; | |||||
height: 70rpx; | |||||
margin: 0 auto; | |||||
margin-top: 140rpx; | |||||
} | |||||
.shareWindow{ | |||||
position: fixed; | |||||
top:0; | |||||
left: 0; | |||||
width: 100%; | |||||
height: calc(100vh - 120rpx); | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
background-color: rgba(000, 000, 000, 0.5); | |||||
} | |||||
.shareWindowGroup{ | |||||
position: relative; | |||||
width: 591rpx; | |||||
height: 611rpx; | |||||
} | |||||
.versions-23{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.versions-22{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
bottom: 60rpx; | |||||
width: 462rpx; | |||||
height: 54rpx; | |||||
} | |||||
.shareBtn{ | |||||
position: absolute; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
bottom: 60rpx; | |||||
height: 54rpx; | |||||
margin: 0; | |||||
padding: 0; | |||||
opacity: 0; | |||||
} | |||||
.versions-24{ | |||||
position: absolute; | |||||
top: -42rpx; | |||||
right: -42rpx; | |||||
width: 42rpx; | |||||
height: 42rpx; | |||||
} | |||||
.priceGroup{ | |||||
position: absolute; | |||||
top: 18rpx; | |||||
left: 154rpx; | |||||
width: 60rpx; | |||||
height: 100rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
/* background-color: red; */ | |||||
} | |||||
.priceImg{ | |||||
width: 51rpx; | |||||
height: 64rpx; | |||||
} |
"name": "猜出惊喜", | "name": "猜出惊喜", | ||||
"pathName": "pages/guess/guess", | "pathName": "pages/guess/guess", | ||||
"query": "" | "query": "" | ||||
}, | |||||
{ | |||||
"id": -1, | |||||
"name": "预测价格", | |||||
"pathName": "pages/guessPrize/guessPrize", | |||||
"query": "" | |||||
} | } | ||||
] | ] | ||||
} | } |