| @@ -10,6 +10,7 @@ Component({ | |||||
| }, | }, | ||||
| data: { | data: { | ||||
| flag: false, | flag: false, | ||||
| alphaData: null, | |||||
| gameUrl: '' | gameUrl: '' | ||||
| }, | }, | ||||
| methods:{ | methods:{ | ||||
| @@ -63,7 +64,14 @@ Component({ | |||||
| this.setData({ flag: false }) | this.setData({ flag: false }) | ||||
| }, | }, | ||||
| closeGame: function () { | closeGame: function () { | ||||
| this.setData({ flag: true }) | |||||
| let that = this; | |||||
| var animation = wx.createAnimation({}) | |||||
| // animation.opacity(0).step({ duration: 1000 }) | |||||
| animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 }) | |||||
| that.setData({ alphaData: animation.export() }); | |||||
| setTimeout(function () { | |||||
| that.setData({ flag: true }) | |||||
| }, 1000) | |||||
| }, | }, | ||||
| }, | }, | ||||
| onReady: function () { | onReady: function () { | ||||
| @@ -1,7 +1,7 @@ | |||||
| <view class="b1" hidden="{{flag}}"> | <view class="b1" hidden="{{flag}}"> | ||||
| <view class="t_w"> | <view class="t_w"> | ||||
| <view class="b2"> | |||||
| <view class="b2" animation="{{alphaData}}"> | |||||
| <icon type="cancel" size="40" color="rgb(0,255,255)" class='cancel_icon' bindtap="closeGame"/> | <icon type="cancel" size="40" color="rgb(0,255,255)" class='cancel_icon' bindtap="closeGame"/> | ||||
| <image class="t_image" data-data="{{gamedata}}" mode='widthFix' src="{{gamedata.imgUrl}}" bindtap="gotogame" /> | <image class="t_image" data-data="{{gamedata}}" mode='widthFix' src="{{gamedata.imgUrl}}" bindtap="gotogame" /> | ||||
| </view> | </view> | ||||
| @@ -15,6 +15,7 @@ Page({ | |||||
| couponId:'',//游戏返回时传回的字段 | couponId:'',//游戏返回时传回的字段 | ||||
| played:false,//从游戏页面跳回首页返回true | played:false,//从游戏页面跳回首页返回true | ||||
| havePlayEd: app.globalData.havePlayEd, | havePlayEd: app.globalData.havePlayEd, | ||||
| staticGamedata:{}, | |||||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | ||||
| }, | }, | ||||
| swiperChange: function(e) { | swiperChange: function(e) { | ||||
| @@ -23,9 +24,50 @@ Page({ | |||||
| }); | }); | ||||
| }, | }, | ||||
| gotogame:function(){ | gotogame:function(){ | ||||
| wx.navigateTo({ | |||||
| url: '../game/index', | |||||
| }) | |||||
| let that = this; | |||||
| Http.post({ | |||||
| url: config.api.checkPhoneStatus, | |||||
| data: {} | |||||
| }) | |||||
| .then(res => { | |||||
| console.log(res); | |||||
| var data = { | |||||
| couponChannelId: "" + that.data.couponChannelId, | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| if (that.data.couponChannelId == null) { | |||||
| var data = { | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| } | |||||
| wx.redirectTo({ | |||||
| url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }) | |||||
| }) | |||||
| .catch(err => { | |||||
| if (err.code == 11005) { | |||||
| // 用户手机未授权 | |||||
| /** | |||||
| * 将值传到用户手机号授权的页面 | |||||
| * | |||||
| */ | |||||
| wx.redirectTo({ | |||||
| url: "/pages/getphoneInfo/index?path=index" | |||||
| }); | |||||
| } else if (err.code == 11006) { | |||||
| // 用户手机已加密 | |||||
| wx.redirectTo({ | |||||
| url: "/pages/phoneinput/phoneinput?path=index" | |||||
| }); | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: err.message, | |||||
| image: "../../assets/img/fail.png", | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| } | |||||
| }) | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -149,6 +191,7 @@ Page({ | |||||
| showGame: true | showGame: true | ||||
| }) | }) | ||||
| that.getGameOne(res.data.token) | that.getGameOne(res.data.token) | ||||
| that.getStaticGame(res.data.token) | |||||
| } | } | ||||
| Http.setToken(res.data.token); | Http.setToken(res.data.token); | ||||
| that.checkUserCarStatus(); | that.checkUserCarStatus(); | ||||
| @@ -183,6 +226,20 @@ Page({ | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| getStaticGame(token){ | |||||
| let _this = this; | |||||
| Http.get({ | |||||
| url: config.api.getGame, | |||||
| data: { | |||||
| triggleAction:2, | |||||
| token: token | |||||
| } | |||||
| }).then(res => { | |||||
| _this.setData({ | |||||
| staticGamedata: res.data | |||||
| }) | |||||
| }) | |||||
| }, | |||||
| getGameOne:function(token){ | getGameOne:function(token){ | ||||
| let _this=this; | let _this=this; | ||||
| Http.get({ | Http.get({ | ||||
| @@ -3,11 +3,13 @@ | |||||
| <c-banner wx:key="unique" list="{{list}}" /> | <c-banner wx:key="unique" list="{{list}}" /> | ||||
| <c-rushToBuy /> | <c-rushToBuy /> | ||||
| <!-- 小游戏暂时注释 --> | <!-- 小游戏暂时注释 --> | ||||
| <!-- <view class='game' bindtap="gotogame" wx:if="{{showGame}}"> | |||||
| <image src='./../../assets/img/game.png' mode='widthFix'></image> | |||||
| <text>新用户专享神秘礼物</text> | |||||
| <text>独家福利,抢完即止</text> | |||||
| </view> --> | |||||
| <view class='game' bindtap="gotogame"> | |||||
| <view class='game-entry'> | |||||
| <image src="{{staticGamedata.imgUrl}}" class='gameimg' mode='widthFix'></image> | |||||
| <text>新用户专享神秘礼物</text> | |||||
| <text>独家福利,抢完即止</text> | |||||
| </view> | |||||
| </view> | |||||
| <c-coupons id="lists" bind:myevent="onGetCode" /> | <c-coupons id="lists" bind:myevent="onGetCode" /> | ||||
| <g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | <g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | ||||
| </view> | </view> | ||||
| @@ -23,14 +23,27 @@ page { | |||||
| .txt { | .txt { | ||||
| margin-left: 20rpx; | margin-left: 20rpx; | ||||
| } | } | ||||
| .game-entry{ | |||||
| width: 690rpx; | |||||
| height: 140rpx; | |||||
| margin: 0 auto; | |||||
| border-radius: 20rpx; | |||||
| box-shadow: 1px 4px 20px #C4C4C4; | |||||
| } | |||||
| .game { | .game { | ||||
| display: none; | |||||
| position: relative; | position: relative; | ||||
| width: 750rpx; | width: 750rpx; | ||||
| height: 200rpx; | height: 200rpx; | ||||
| margin: 0 auto; | |||||
| padding-top: 30rpx; | |||||
| box-sizing: border-box; | |||||
| } | |||||
| .gameimg{ | |||||
| position: absolute; | |||||
| right: 25rpx; | |||||
| top: 0rpx; | |||||
| width: 220rpx; | |||||
| } | } | ||||
| .game text { | .game text { | ||||
| display: block; | display: block; | ||||
| position: relative; | position: relative; | ||||
| @@ -38,7 +51,7 @@ page { | |||||
| .game text:nth-of-type(1) { | .game text:nth-of-type(1) { | ||||
| display: inline-block; | display: inline-block; | ||||
| padding-top: 65rpx; | |||||
| padding-top: 39rpx; | |||||
| padding-left: 70rpx; | padding-left: 70rpx; | ||||
| font-size: 32rpx; | font-size: 32rpx; | ||||
| color: #333; | color: #333; | ||||
| @@ -52,11 +65,11 @@ page { | |||||
| padding-left: 70rpx; | padding-left: 70rpx; | ||||
| } | } | ||||
| .game image { | |||||
| /* .game image { | |||||
| position: absolute; | position: absolute; | ||||
| width: 100%; | width: 100%; | ||||
| left: 0; | left: 0; | ||||
| right: 0; | right: 0; | ||||
| top: 0; | top: 0; | ||||
| bottom: 0; | bottom: 0; | ||||
| } | |||||
| } */ | |||||