@@ -41,6 +41,7 @@ App({ | |||||
data: usrdata | data: usrdata | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
wx.setStorageSync('openId',res.data.openId) | |||||
if (res.data && res.data.score) { | if (res.data && res.data.score) { | ||||
if (res.data.score != 0) { | if (res.data.score != 0) { | ||||
that.globalData.score = res.data.score; | that.globalData.score = res.data.score; | ||||
@@ -0,0 +1,68 @@ | |||||
// components/advertisement.js | |||||
const Http = require("../../utils/HttpBasics"); | |||||
var config = require("../../config/config.js"); | |||||
Component({ | |||||
properties: { | |||||
ggdata: { | |||||
type: Object, | |||||
value: {} | |||||
} | |||||
}, | |||||
data: { | |||||
flag: false, | |||||
alphaData: null, | |||||
gameUrl: '' | |||||
}, | |||||
methods: { | |||||
gotoGg: function (e) { | |||||
let that = this; | |||||
Http.get({ | |||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
.then(res => { | |||||
console.log(e.currentTarget.dataset) | |||||
wx.navigateTo({ | |||||
url: '/pages/coupon/detail/index?couponChannelId=' + e.currentTarget.dataset.data.produceId , | |||||
}) | |||||
}) | |||||
.catch(err => { | |||||
if (err.code == 11005) { | |||||
// 用户手机未授权 | |||||
/** | |||||
* 将值传到用户手机号授权的页面 | |||||
* | |||||
*/ | |||||
wx.redirectTo({ | |||||
url: "/pages/getphoneInfo/index?path=index&pagePath=" + e.currentTarget.dataset.data.pagePath + "&id=" + e.currentTarget.dataset.data.id + "&couponChannelId=" + e.currentTarget.dataset.data.produceId | |||||
}); | |||||
} else if (err.code == 11006) { | |||||
// 用户手机已加密 | |||||
wx.redirectTo({ | |||||
url: "/pages/phoneinput/phoneinput?path=index&pagePath=" + e.target.dataset.data.pagePath + "&id=" + e.currentTarget.dataset.data.id + "&couponChannelId=" + e.currentTarget.dataset.data.produceId | |||||
}); | |||||
} else { | |||||
wx.showToast({ | |||||
title: err.errMsg, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
} | |||||
}) | |||||
}, | |||||
a: function () { | |||||
this.setData({ flag: false }) | |||||
}, | |||||
closeGg: function () { | |||||
let that = this; | |||||
var animation = wx.createAnimation({}) | |||||
// animation.opacity(0).step({ duration: 1000 }) | |||||
setTimeout(function () { | |||||
that.setData({ flag: true }) | |||||
}, 500) | |||||
animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 }) | |||||
that.setData({ alphaData: animation.export() }); | |||||
}, | |||||
}, | |||||
}); |
@@ -0,0 +1,4 @@ | |||||
{ | |||||
"component": true, | |||||
"usingComponents": {} | |||||
} |
@@ -0,0 +1,10 @@ | |||||
<!--components/advertisement.wxml--> | |||||
<view class="b1" hidden="{{flag}}"> | |||||
<view class="t_w"> | |||||
<view class="b2" animation="{{alphaData}}"> | |||||
<icon type="cancel" size="40" color="#fff" class='cancel_icon' bindtap="closeGg"/> | |||||
<view class='line'></view> | |||||
<image class="t_image" data-data="{{ggdata}}" mode='widthFix' src="{{ggdata.coverImg}}" bindtap="gotoGg" data-couponChannelId="{{ggdata.produceId}}" /> | |||||
</view> | |||||
</view> | |||||
</view> |
@@ -0,0 +1,37 @@ | |||||
/* components/advertisement.wxss */ | |||||
.b1{ | |||||
position:fixed; | |||||
width:100%; | |||||
height:100%; | |||||
top:0px; | |||||
background:rgba(0,0,0,0.8); | |||||
overflow: hidden; | |||||
z-index: 1000; | |||||
} | |||||
.t_w{ | |||||
position:relative; | |||||
} | |||||
.b2{ | |||||
width: 90%; | |||||
margin:45% auto; | |||||
overflow: hidden; | |||||
border-radius: 10rpx; | |||||
} | |||||
.t_image{ | |||||
border-radius: 16rpx; | |||||
display: block; | |||||
margin: 0 auto; | |||||
} | |||||
.cancel_icon{ | |||||
position: absolute; | |||||
right: 300rpx; | |||||
bottom: -200rpx; | |||||
} | |||||
.line{ | |||||
width:2rpx; | |||||
height: 75rpx; | |||||
background: #fff; | |||||
position: absolute; | |||||
right: 340rpx; | |||||
bottom: -125rpx; | |||||
} |
@@ -128,7 +128,7 @@ Component({ | |||||
e.currentTarget.dataset.targetad | e.currentTarget.dataset.targetad | ||||
}` | }` | ||||
}); | }); | ||||
}, | |||||
}, | |||||
}, | }, | ||||
ready() { | ready() { | ||||
app.couponChannelListCallback = (token,val) => { | app.couponChannelListCallback = (token,val) => { | ||||
@@ -171,6 +171,10 @@ var config = { | |||||
* 小程序获取游戏路径 | * 小程序获取游戏路径 | ||||
*/ | */ | ||||
getGame:'/game/getOne', | getGame:'/game/getOne', | ||||
/** | |||||
* 小程序获取广告路径 | |||||
*/ | |||||
getGg: '/floatingLayer/getFloatingLayer', | |||||
/** | /** | ||||
* 小程序某一个游戏信息 | * 小程序某一个游戏信息 | ||||
*/ | */ | ||||
@@ -74,7 +74,10 @@ Page({ | |||||
display: 'none', | display: 'none', | ||||
display1: 'none', | display1: 'none', | ||||
optionsData: null, | optionsData: null, | ||||
page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||||
page: 1 ,// 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||||
openId:'', | |||||
showGg: false, | |||||
ggdata:{} | |||||
}, | }, | ||||
alphaClick: function(even) { | alphaClick: function(even) { | ||||
var animation = wx.createAnimation({}) | var animation = wx.createAnimation({}) | ||||
@@ -189,6 +192,12 @@ Page({ | |||||
this.getLocation(); | this.getLocation(); | ||||
let that = this; | let that = this; | ||||
let optionss; | let optionss; | ||||
let openId = wx.getStorageSync('openId') | |||||
if(openId){ | |||||
that.setData({ | |||||
openId:openId | |||||
}) | |||||
} | |||||
if (wx.getStorageSync('options')){ | if (wx.getStorageSync('options')){ | ||||
optionss = JSON.parse(wx.getStorageSync('options')); | optionss = JSON.parse(wx.getStorageSync('options')); | ||||
} | } | ||||
@@ -284,7 +293,7 @@ Page({ | |||||
levelName: res.data.levelName, | levelName: res.data.levelName, | ||||
upgradePercent: res.data.upgradePercent, | upgradePercent: res.data.upgradePercent, | ||||
upgradeScore: res.data.upgradeScore, | upgradeScore: res.data.upgradeScore, | ||||
memberId: res.data.id | |||||
memberId: res.data.id, | |||||
}) | }) | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
@@ -347,6 +356,7 @@ Page({ | |||||
that.topicShow(); | that.topicShow(); | ||||
that.getxsList(); | that.getxsList(); | ||||
that.getMallInfo(app.globalData.token); | that.getMallInfo(app.globalData.token); | ||||
if (app.couponChannelListCallback) { | if (app.couponChannelListCallback) { | ||||
app.couponChannelListCallback(app.globalData.token); | app.couponChannelListCallback(app.globalData.token); | ||||
} | } | ||||
@@ -363,8 +373,10 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
that.getGameOne(app.globalData.token) | |||||
console.log(res) | |||||
// that.getGameOne(app.globalData.token) | |||||
that.getStaticGame(app.globalData.token) | that.getStaticGame(app.globalData.token) | ||||
that.getGg(app.globalData.token) | |||||
let weapNote = JSON.parse(res.data.weapNote); | let weapNote = JSON.parse(res.data.weapNote); | ||||
that.setData({ | that.setData({ | ||||
desc: weapNote.firstpage.desc, | desc: weapNote.firstpage.desc, | ||||
@@ -372,8 +384,9 @@ Page({ | |||||
}) | }) | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
that.getGameOne(app.globalData.token) | |||||
// that.getGameOne(app.globalData.token) | |||||
that.getStaticGame(app.globalData.token) | that.getStaticGame(app.globalData.token) | ||||
that.getGg(app.globalData.token) | |||||
wx.showModal({ | wx.showModal({ | ||||
title: "提示", | title: "提示", | ||||
content: err.errMsg, | content: err.errMsg, | ||||
@@ -616,6 +629,42 @@ Page({ | |||||
e.currentTarget.dataset.couponchannelid | e.currentTarget.dataset.couponchannelid | ||||
}&couponId=${e.currentTarget.dataset.couponid}` | }&couponId=${e.currentTarget.dataset.couponid}` | ||||
}); | }); | ||||
}, | |||||
//浮层广告 | |||||
getGg: function (token) { | |||||
let that = this | |||||
Http.get({ | |||||
url: config.api.getGg, | |||||
data: { | |||||
token: token, | |||||
appId: config.weapp.AppId, | |||||
openId: that.data.openId | |||||
} | |||||
}).then(res => { | |||||
console.log(res) | |||||
if (res.data.id) { | |||||
that.setData({ | |||||
showGg: true, | |||||
}) | |||||
console.log(that.data.showGg,1111111111111) | |||||
} else { | |||||
that.setData({ | |||||
showGg: false | |||||
}) | |||||
that.getGameOne(app.globalData.token) | |||||
console.log(that.data.showGg,222222222222222222) | |||||
} | |||||
that.setData({ | |||||
ggdata: res.data | |||||
}) | |||||
}) | |||||
.catch(err => { | |||||
this.setData({ | |||||
showGg: false | |||||
}) | |||||
that.getGameOne(app.globalData.token) | |||||
that.alphaClick(); | |||||
}) | |||||
}, | }, | ||||
/** | /** | ||||
* 刷新 | * 刷新 | ||||
@@ -5,6 +5,7 @@ | |||||
"c-coupons": "../pages/main/coupons/index", | "c-coupons": "../pages/main/coupons/index", | ||||
"g-entry": "../components/gameentry/gentry", | "g-entry": "../components/gameentry/gentry", | ||||
"c-hot": "../components/hot/index", | "c-hot": "../components/hot/index", | ||||
"c-advertisement":"../components/advertisement/advertisement", | |||||
"navbar": "../components/navbar/navbar" | "navbar": "../components/navbar/navbar" | ||||
}, | }, | ||||
"enablePullDownRefresh": true, | "enablePullDownRefresh": true, | ||||
@@ -105,7 +105,10 @@ | |||||
<image src='{{cover}}' mode='widthFix' ></image> | <image src='{{cover}}' mode='widthFix' ></image> | ||||
</view> | </view> | ||||
<c-coupons id="lists" bind:myevent="onGetCode" class="business" loadingtext="{{loadingtext}}" loading="{{loading}}" /> | <c-coupons id="lists" bind:myevent="onGetCode" class="business" loadingtext="{{loadingtext}}" loading="{{loading}}" /> | ||||
<!-- 游戏蒙层 --> | |||||
<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="" /> | ||||
<!-- 广告蒙层 --> | |||||
<c-advertisement id="advertisement" wx:if="{{showGg&&!played&&!havePlayEd}}" ggdata="{{ggdata}}"/> | |||||
</view> | </view> | ||||
<!-- 顶部签到成长值 --> | <!-- 顶部签到成长值 --> | ||||
<view class='signin' wx:if="{{fistLogin}}" animation="{{alphaData}}"> | <view class='signin' wx:if="{{fistLogin}}" animation="{{alphaData}}"> | ||||
@@ -237,15 +237,18 @@ Page({ | |||||
data: {} | data: {} | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res) | console.log(res) | ||||
if (res && res.data.businessHours) { | |||||
if (res.data.businessHours !=='[]') { | |||||
that.setData({ | that.setData({ | ||||
aboutShow: true | aboutShow: true | ||||
}) | }) | ||||
}else{ | |||||
that.setData({ | |||||
aboutShow: false | |||||
}) | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
}) | }) | ||||
}, | }, | ||||
//适配不同屏幕大小的canvas | //适配不同屏幕大小的canvas | ||||
setCanvasSize: function() { | setCanvasSize: function() { | ||||
@@ -1,7 +1,7 @@ | |||||
<navbar text="我的" background='#FD832D' color="white"></navbar> | <navbar text="我的" background='#FD832D' color="white"></navbar> | ||||
<view class="user" style="padding-top:{{navigationBarHeight}};"> | <view class="user" style="padding-top:{{navigationBarHeight}};"> | ||||
<view class="top" style='background:{{banneColor}}'> | <view class="top" style='background:{{banneColor}}'> | ||||
<view class='aboutUs' bindtap='gomallInfo' wx:if="{{aboutShow}}"> | |||||
<view class='aboutUs' bindtap='gomallInfo' wx:if="{{aboutShow == true}}"> | |||||
<image class='aboutIcons' src="{{aboutUs}}" mode='widthFix'></image> | <image class='aboutIcons' src="{{aboutUs}}" mode='widthFix'></image> | ||||
<text>关于我们</text> | <text>关于我们</text> | ||||
</view> | </view> | ||||