mainShow:false, | mainShow:false, | ||||
isOnce:false, | isOnce:false, | ||||
userData:null, | userData:null, | ||||
kvurl: app.globalData.kvurl,//顶部大图 | |||||
kvurl: null,//顶部大图 | |||||
}, | }, | ||||
onLoad: function () { | onLoad: function () { | ||||
app.globalData.nowPage = 1; | app.globalData.nowPage = 1; | ||||
} | } | ||||
}, | }, | ||||
loadFun: function () { | loadFun: function () { | ||||
this.setData({ | |||||
kvurl: app.globalData.kvurl | |||||
}) | |||||
if (app.globalData.userInfoData) { | if (app.globalData.userInfoData) { | ||||
this.setData({ | this.setData({ | ||||
userData: app.globalData.userInfoData | userData: app.globalData.userInfoData | ||||
getStartAdvertising: function () {//获取开屏广告 | getStartAdvertising: function () {//获取开屏广告 | ||||
app.wxRequest(app.globalData.urlRoot + "home/getStartAdvertising", {}, res => { | app.wxRequest(app.globalData.urlRoot + "home/getStartAdvertising", {}, res => { | ||||
this.data.isOnce = true; | this.data.isOnce = true; | ||||
if (app.globalData.openid) { | |||||
this.loadFun(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.loadFun; | |||||
} | |||||
if(res.code==200){ | if(res.code==200){ | ||||
this.setData({ | this.setData({ | ||||
startAdvertisingUrl: res.data.picurl, | startAdvertisingUrl: res.data.picurl, | ||||
},1000); | },1000); | ||||
}, 3000); | }, 3000); | ||||
} | } | ||||
if (app.globalData.openid) { | |||||
this.loadFun(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.loadFun; | |||||
} | |||||
},this); | },this); | ||||
}, | }, | ||||
getHomeBanner: function () {//获取banner | getHomeBanner: function () {//获取banner |
<view class="all" wx:if="{{mainShow}}"> | <view class="all" wx:if="{{mainShow}}"> | ||||
<view class="main" wx:if="{{isStartAdvertising==0 || !isStartAdvertisingShow}}"> | <view class="main" wx:if="{{isStartAdvertising==0 || !isStartAdvertisingShow}}"> | ||||
<view class="contentFrame"> | <view class="contentFrame"> | ||||
<image style="width:750rpx;height:1506rpx;" src="{{kvurl}}"></image> | |||||
<image style="width:750rpx;" mode="widthFix" src="{{kvurl}}"></image> | |||||
<image style="width:750rpx;height:331rpx;" src="{{imgUrl+'/images/indexText.png'}}"></image> | <image style="width:750rpx;height:331rpx;" src="{{imgUrl+'/images/indexText.png'}}"></image> | ||||
<view class="swiperFrame"> | <view class="swiperFrame"> | ||||
<swiper class="swiperSty" autoplay current="{{swiperCurrent}}" bindchange="swiperChange"> | <swiper class="swiperSty" autoplay current="{{swiperCurrent}}" bindchange="swiperChange"> | ||||
</view> | </view> | ||||
<tabBar wx:if="{{isStartAdvertising==0 || !isStartAdvertisingShow}}"></tabBar> | <tabBar wx:if="{{isStartAdvertising==0 || !isStartAdvertisingShow}}"></tabBar> | ||||
<!-- <view wx:if="{{isStartAdvertisingShow}}" class='imgBg' catchtouchmove="ture"></view> --> | <!-- <view wx:if="{{isStartAdvertisingShow}}" class='imgBg' catchtouchmove="ture"></view> --> | ||||
<image wx:if="{{isStartAdvertisingShow}}" style="opacity:{{isStartAdvertising}};" src="{{startAdvertisingUrl}}" class='imgBg' catchtouchmove="ture"></image> | |||||
<image wx:if="{{isStartAdvertisingShow}}" mode="widthFix" style="opacity:{{isStartAdvertising}};" src="{{startAdvertisingUrl}}" class='imgBg' catchtouchmove="ture"></image> | |||||
</view> | </view> |
top: 0; | top: 0; | ||||
left: 0; | left: 0; | ||||
width: 750rpx; | width: 750rpx; | ||||
height: 1506rpx; | |||||
transition: opacity 1000ms; | transition: opacity 1000ms; | ||||
z-index: 100; | z-index: 100; | ||||
} | } |
isMore:true, | isMore:true, | ||||
startDown:-1,//游戏开始倒计时 | startDown:-1,//游戏开始倒计时 | ||||
clawType:false,//是否正在抓取 | clawType:false,//是否正在抓取 | ||||
gameEnd:true | |||||
}, | }, | ||||
/** | /** | ||||
}) | }) | ||||
var setInt2 = setInterval(() => { | var setInt2 = setInterval(() => { | ||||
if (this.data.startDown > -1) { | if (this.data.startDown > -1) { | ||||
this.data.startDown -= 1; | |||||
this.setData({ | this.setData({ | ||||
startDown: this.data.startDown -= 1 | |||||
startDown: this.data.startDown | |||||
}) | }) | ||||
} else { | |||||
this.setData({ | |||||
startDown: -1 | |||||
}) | |||||
clearInterval(setInt2); | |||||
this.data.gameSign = res.data.sign; | |||||
this.endGame(); | |||||
if (this.data.gameSign) { | |||||
this.downTimeFun(); | |||||
if (this.data.startDown==-1){ | |||||
clearInterval(setInt2); | |||||
this.data.gameSign = res.data.sign; | |||||
this.endGame(); | |||||
if (this.data.gameSign) { | |||||
this.downTimeFun(); | |||||
} | |||||
} | } | ||||
} | } | ||||
}, 1000); | }, 1000); | ||||
this.setData({ | this.setData({ | ||||
btnGroup: this.data.btnGroup | btnGroup: this.data.btnGroup | ||||
}) | }) | ||||
if (this.data.clawLeft <= 130) { | |||||
if (this.data.clawLeft <= 110) { | |||||
return; | return; | ||||
} | } | ||||
this.data.setGroup.left = setInterval(() => { | this.data.setGroup.left = setInterval(() => { | ||||
this.setData({ | this.setData({ | ||||
clawLeft: this.data.clawLeft-=2 | clawLeft: this.data.clawLeft-=2 | ||||
}) | }) | ||||
if (this.data.clawLeft <= 130) { | |||||
if (this.data.clawLeft <= 110) { | |||||
clearInterval(this.data.setGroup.left); | clearInterval(this.data.setGroup.left); | ||||
} | } | ||||
},20); | },20); | ||||
this.setData({ | this.setData({ | ||||
btnGroup: this.data.btnGroup | btnGroup: this.data.btnGroup | ||||
}) | }) | ||||
if (this.data.clawLeft >= 445) { | |||||
if (this.data.clawLeft >= 415) { | |||||
return; | return; | ||||
} | } | ||||
this.data.setGroup.right = setInterval(() => { | this.data.setGroup.right = setInterval(() => { | ||||
this.setData({ | this.setData({ | ||||
clawLeft: this.data.clawLeft += 2 | clawLeft: this.data.clawLeft += 2 | ||||
}) | }) | ||||
if (this.data.clawLeft >= 445) { | |||||
if (this.data.clawLeft >= 415) { | |||||
clearInterval(this.data.setGroup.right); | clearInterval(this.data.setGroup.right); | ||||
} | } | ||||
}, 20); | }, 20); | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
},1000) | |||||
},800) | |||||
}, | }, | ||||
downTimeFun: function () {//游戏倒计时 | downTimeFun: function () {//游戏倒计时 | ||||
this.data.gameState = true; | this.data.gameState = true; | ||||
downNum: 30, | downNum: 30, | ||||
clawTop: this.data.clawScale > 1 ? -100 - (2 * (this.data.clawScale - 1) * 440) : -100 + (2 * (1 - this.data.clawScale) * 440) | clawTop: this.data.clawScale > 1 ? -100 - (2 * (this.data.clawScale - 1) * 440) : -100 + (2 * (1 - this.data.clawScale) * 440) | ||||
}) | }) | ||||
setTimeout(()=>{ | |||||
setTimeout(() => { | |||||
this.setData({ | |||||
gameEnd:false | |||||
}) | |||||
this.setData({ | this.setData({ | ||||
downNum: 30, | downNum: 30, | ||||
clawTop: -440, | |||||
clawLeft: 268, | |||||
clawScale:1 | |||||
clawScale: 1 | |||||
}) | }) | ||||
}, 1200); | |||||
setTimeout(() => { | |||||
this.setData({ | |||||
clawTop: -440, | |||||
}) | |||||
}, 800) | |||||
setTimeout(()=>{ | |||||
this.setData({ | |||||
clawLeft: 268 | |||||
}) | |||||
},1600) | |||||
setTimeout(()=>{ | |||||
this.setData({ | |||||
gameEnd: true | |||||
}) | |||||
},2400) | |||||
}, 800); | |||||
}, | }, | ||||
prizeLook:function(){//活动奖品 | prizeLook:function(){//活动奖品 | ||||
if(!this.data.gameState){ | if(!this.data.gameState){ | ||||
if(res.data.length<this.data.configure.count){ | if(res.data.length<this.data.configure.count){ | ||||
this.data.isMore = false; | this.data.isMore = false; | ||||
} | } | ||||
console.log(this.data.isMore); | |||||
for(let i=0;i<res.data.length;i++){ | for(let i=0;i<res.data.length;i++){ | ||||
this.data.gameAwardList.push(res.data[i]); | this.data.gameAwardList.push(res.data[i]); | ||||
} | } | ||||
} | } | ||||
}, | }, | ||||
changeScroll:function(){ | changeScroll:function(){ | ||||
this.data.setInt = setInterval(()=>{ | |||||
this.setData({ | |||||
scrollNum: this.data.scrollNum+=1 | |||||
}) | |||||
},30); | |||||
// this.data.setInt = setInterval(()=>{ | |||||
// this.setData({ | |||||
// scrollNum: this.data.scrollNum+=1 | |||||
// }) | |||||
// },30); | |||||
}, | }, | ||||
getMore:function(){ | getMore:function(){ | ||||
if (!this.data.isMore){ | if (!this.data.isMore){ |
<image class="gameTitle" src="{{imgUrl+'/images/luckyTitle.png'}}"></image> | <image class="gameTitle" src="{{imgUrl+'/images/luckyTitle.png'}}"></image> | ||||
<view class="downTime">{{'00:'+downNum}}</view> | <view class="downTime">{{'00:'+downNum}}</view> | ||||
<image class="prizeIcon2" src="{{imgUrl+'/images/prizeIcon2.png?v=003'}}"></image> | <image class="prizeIcon2" src="{{imgUrl+'/images/prizeIcon2.png?v=003'}}"></image> | ||||
<image class="gameClaw" style="top:{{clawTop}}rpx;left:{{clawLeft}}rpx;transform: scale({{clawScale}});" src="{{imgUrl+'/images/gameClaw'+(clawType?2:1)+'.png'}}"></image> | |||||
<image class="gameClaw {{!gameEnd?'gameClaw2':''}}" style="top:{{clawTop}}rpx;left:{{clawLeft}}rpx;transform: scale({{clawScale}});" src="{{imgUrl+'/images/gameClaw'+(clawType?2:1)+'.png'}}"></image> | |||||
<image class="prizeIcon1" src="{{imgUrl+'/images/prizeIcon1.png?v=003'}}"></image> | <image class="prizeIcon1" src="{{imgUrl+'/images/prizeIcon1.png?v=003'}}"></image> | ||||
<view class="getPrizeTip"> | <view class="getPrizeTip"> | ||||
<view class="prizeTipLine"></view> | <view class="prizeTipLine"></view> |
transform: scale(2); | transform: scale(2); | ||||
transform-origin:50% 0 0; | transform-origin:50% 0 0; | ||||
} | } | ||||
.gameClaw2{ | |||||
transition: all 0.8s linear; | |||||
} | |||||
.prizeIcon2{ | .prizeIcon2{ | ||||
position: absolute; | position: absolute; | ||||
left: 74rpx; | left: 74rpx; |