ソースを参照

[c端][新增][浮层广告]

tags/C.10.02
hurui 5年前
コミット
c63ab33624
12個のファイルの変更188行の追加8行の削除
  1. +1
    -0
      app.js
  2. +68
    -0
      components/advertisement/advertisement.js
  3. +4
    -0
      components/advertisement/advertisement.json
  4. +10
    -0
      components/advertisement/advertisement.wxml
  5. +37
    -0
      components/advertisement/advertisement.wxss
  6. +1
    -1
      components/hot/index.js
  7. +4
    -0
      config/config.js
  8. +53
    -4
      index/index.js
  9. +1
    -0
      index/index.json
  10. +3
    -0
      index/index.wxml
  11. +5
    -2
      index/user.js
  12. +1
    -1
      index/user.wxml

+ 1
- 0
app.js ファイルの表示

@@ -41,6 +41,7 @@ App({
data: usrdata
})
.then(res => {
wx.setStorageSync('openId',res.data.openId)
if (res.data && res.data.score) {
if (res.data.score != 0) {
that.globalData.score = res.data.score;


+ 68
- 0
components/advertisement/advertisement.js ファイルの表示

@@ -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() });
},
},
});

+ 4
- 0
components/advertisement/advertisement.json ファイルの表示

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

+ 10
- 0
components/advertisement/advertisement.wxml ファイルの表示

@@ -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>

+ 37
- 0
components/advertisement/advertisement.wxss ファイルの表示

@@ -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;
}

+ 1
- 1
components/hot/index.js ファイルの表示

@@ -128,7 +128,7 @@ Component({
e.currentTarget.dataset.targetad
}`
});
},
},
},
ready() {
app.couponChannelListCallback = (token,val) => {


+ 4
- 0
config/config.js ファイルの表示

@@ -171,6 +171,10 @@ var config = {
* 小程序获取游戏路径
*/
getGame:'/game/getOne',
/**
* 小程序获取广告路径
*/
getGg: '/floatingLayer/getFloatingLayer',
/**
* 小程序某一个游戏信息
*/


+ 53
- 4
index/index.js ファイルの表示

@@ -74,7 +74,10 @@ Page({
display: 'none',
display1: 'none',
optionsData: null,
page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载
page: 1 ,// 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载
openId:'',
showGg: false,
ggdata:{}
},
alphaClick: function(even) {
var animation = wx.createAnimation({})
@@ -189,6 +192,12 @@ Page({
this.getLocation();
let that = this;
let optionss;
let openId = wx.getStorageSync('openId')
if(openId){
that.setData({
openId:openId
})
}
if (wx.getStorageSync('options')){
optionss = JSON.parse(wx.getStorageSync('options'));
}
@@ -284,7 +293,7 @@ Page({
levelName: res.data.levelName,
upgradePercent: res.data.upgradePercent,
upgradeScore: res.data.upgradeScore,
memberId: res.data.id
memberId: res.data.id,
})
})
.catch(err => {
@@ -347,6 +356,7 @@ Page({
that.topicShow();
that.getxsList();
that.getMallInfo(app.globalData.token);
if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
}
@@ -363,8 +373,10 @@ Page({
}
})
.then(res => {
that.getGameOne(app.globalData.token)
console.log(res)
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.firstpage.desc,
@@ -372,8 +384,9 @@ Page({
})
})
.catch(err => {
that.getGameOne(app.globalData.token)
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
wx.showModal({
title: "提示",
content: err.errMsg,
@@ -616,6 +629,42 @@ Page({
e.currentTarget.dataset.couponchannelid
}&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();
})
},
/**
* 刷新


+ 1
- 0
index/index.json ファイルの表示

@@ -5,6 +5,7 @@
"c-coupons": "../pages/main/coupons/index",
"g-entry": "../components/gameentry/gentry",
"c-hot": "../components/hot/index",
"c-advertisement":"../components/advertisement/advertisement",
"navbar": "../components/navbar/navbar"
},
"enablePullDownRefresh": true,


+ 3
- 0
index/index.wxml ファイルの表示

@@ -105,7 +105,10 @@
<image src='{{cover}}' mode='widthFix' ></image>
</view>
<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="" />
<!-- 广告蒙层 -->
<c-advertisement id="advertisement" wx:if="{{showGg&&!played&&!havePlayEd}}" ggdata="{{ggdata}}"/>
</view>
<!-- 顶部签到成长值 -->
<view class='signin' wx:if="{{fistLogin}}" animation="{{alphaData}}">


+ 5
- 2
index/user.js ファイルの表示

@@ -237,15 +237,18 @@ Page({
data: {}
}).then(res => {
console.log(res)
if (res && res.data.businessHours) {
if (res.data.businessHours !=='[]') {
that.setData({
aboutShow: true
})
}else{
that.setData({
aboutShow: false
})
}
})
.catch(err => {
})

},
//适配不同屏幕大小的canvas
setCanvasSize: function() {


+ 1
- 1
index/user.wxml ファイルの表示

@@ -1,7 +1,7 @@
<navbar text="我的" background='#FD832D' color="white"></navbar>
<view class="user" style="padding-top:{{navigationBarHeight}};">
<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>
<text>关于我们</text>
</view>


読み込み中…
キャンセル
保存