@@ -1,6 +1,7 @@ | |||
{ | |||
"pages": [ | |||
"pages/index/index", | |||
"pages/game/index", | |||
"pages/edit/edit", | |||
"pages/cartest/cartest", | |||
"pages/actdetail/actdetail", | |||
@@ -30,7 +31,6 @@ | |||
"pages/passCar/couponDetail/couponDetail", | |||
"pages/managelicenseplate/managelicenseplate", | |||
"pages/payrule/payrule", | |||
"pages/game/index", | |||
"pages/grade/grade" | |||
], | |||
"tabBar": { | |||
@@ -1,4 +1,6 @@ | |||
// pages/index/sw/index.js | |||
const Http = require("../../utils/HttpBasics"); | |||
var config = require("../../config/config.js"); | |||
Component({ | |||
properties: { | |||
gamedata: { | |||
@@ -12,8 +14,49 @@ Component({ | |||
}, | |||
methods:{ | |||
gotogame: function (e) { | |||
wx.navigateTo({ | |||
url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, | |||
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.navigateTo({ | |||
url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.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 | |||
}); | |||
} | |||
}) | |||
}, | |||
a: function () { | |||
@@ -2,5 +2,5 @@ | |||
"usingComponents": { | |||
}, | |||
"navigationBarTitleText": "" | |||
"navigationBarTitleText": "富茂小游戏" | |||
} |
@@ -5,9 +5,13 @@ Page({ | |||
data: { | |||
canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | |||
couponChannelId: "", | |||
couponId: "" | |||
couponId: "", | |||
path:null | |||
}, | |||
onLoad: function (options) { | |||
if(options.path=='index'){ | |||
this.path = options.path | |||
} | |||
var that = this; | |||
console.log(options); | |||
if (options.couponChannelId && options.couponId) { | |||
@@ -52,25 +56,31 @@ Page({ | |||
console.log(that.data.couponId); | |||
console.log("这是从立即支付传回来的值 因为用户没有授权手机号"); | |||
app.globalData.phone = res.data.phone; | |||
wx.showToast({ | |||
title: res.data.msg, | |||
icon: "success", | |||
success: function (res) { | |||
if (that.data.couponChannelId && that.data.couponId) { | |||
wx.redirectTo({ | |||
url: "/pages/coupon/detail/index?couponChannelId=" + | |||
that.data.couponChannelId + | |||
"&couponId=" + | |||
that.data.couponId + | |||
"&flag=pay" | |||
}) | |||
} else { | |||
wx.switchTab({ | |||
url: '/pages/passCar/passCar', | |||
}) | |||
if (that.path == 'index') { | |||
wx.reLaunch({ | |||
url: "/pages/game/index" | |||
}) | |||
} else { | |||
wx.showToast({ | |||
title: res.data.msg, | |||
icon: "success", | |||
success: function (res) { | |||
if (that.data.couponChannelId && that.data.couponId) { | |||
wx.redirectTo({ | |||
url: "/pages/coupon/detail/index?couponChannelId=" + | |||
that.data.couponChannelId + | |||
"&couponId=" + | |||
that.data.couponId + | |||
"&flag=pay" | |||
}) | |||
} else { | |||
wx.switchTab({ | |||
url: '/pages/passCar/passCar', | |||
}) | |||
} | |||
} | |||
} | |||
}); | |||
}); | |||
} | |||
}, | |||
function (error) { | |||
wx.showToast({ | |||
@@ -3,10 +3,14 @@ var app = getApp(); | |||
const Http = require("../../utils/HttpBasics"); | |||
Page({ | |||
data: { | |||
canIUse: wx.canIUse("button.open-type.getUserInfo") | |||
canIUse: wx.canIUse("button.open-type.getUserInfo"), | |||
path:null | |||
}, | |||
onLoad: function(options) { | |||
var that = this; | |||
if (options.path == 'index') { | |||
this.path = options.path | |||
} | |||
Http.get({ | |||
url: config.api.marketicon, | |||
data: { | |||
@@ -24,6 +28,7 @@ Page({ | |||
}, | |||
bindGetUserInfo: function(e) { | |||
let that=this; | |||
console.log(e); | |||
var iv = e.detail.iv; | |||
var encryptedData = e.detail.encryptedData; | |||
@@ -38,11 +43,17 @@ Page({ | |||
}).then( | |||
function(res) { | |||
console.log(res); | |||
console.log("授权个人信息返回的数据") | |||
//返回主页 | |||
wx.switchTab({ | |||
url: "/pages/index/index" | |||
}); | |||
console.log("授权个人信息返回的数据", that.path) | |||
if(that.path=='index'){ | |||
wx.reLaunch({ | |||
url: "/pages/game/index" | |||
}); | |||
}else{ | |||
//返回主页 | |||
wx.switchTab({ | |||
url: "/pages/index/index" | |||
}); | |||
} | |||
}, | |||
function(error) { | |||
wx.showToast({ | |||
@@ -13,6 +13,7 @@ Page({ | |||
gamedata:{}, | |||
couponId:'',//游戏返回时传回的字段 | |||
played:false,//从游戏页面跳回首页返回true | |||
havePlayEd: app.globalData.havePlayEd, | |||
page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||
}, | |||
swiperChange: function(e) { | |||
@@ -25,7 +26,6 @@ Page({ | |||
url: '../game/index', | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
@@ -68,6 +68,10 @@ Page({ | |||
}) | |||
}, | |||
onShow:function(){ | |||
// console.log(app.globalData.havePlayEd) | |||
this.setData({ | |||
havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd:false | |||
}) | |||
let num = wx.getStorageSync('couponNum'); | |||
if (num =='couponNum'){ | |||
wx.showTabBarRedDot({ | |||
@@ -155,7 +159,7 @@ Page({ | |||
} | |||
Http.setToken(res.data.token); | |||
that.checkUserCarStatus(); | |||
that.getUserInfo(); | |||
// that.getUserInfo(); | |||
that.getBannerlist(); | |||
if (app.couponChannelListCallback) { | |||
app.couponChannelListCallback(app.globalData.token); | |||
@@ -269,6 +273,7 @@ Page({ | |||
wx.getUserInfo({ | |||
success: res => { | |||
// 可以将 res 发送给后台解码出 unionId | |||
debugger | |||
console.log("getUserInfo", res); | |||
} | |||
}); | |||
@@ -7,5 +7,5 @@ | |||
<text>独家福利,抢完即止</text> | |||
</view> | |||
<c-coupons id="lists" bind:myevent="onGetCode" /> | |||
<g-entry id="listss" wx:if="{{showGame&&!played}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||
<g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||
</view> |
@@ -10,9 +10,13 @@ Page({ | |||
retry: false, | |||
time: 60, | |||
couponChannelId: null, | |||
couponId:null | |||
couponId:null, | |||
path:null | |||
}, | |||
onLoad: function (options) { | |||
if(options.path=='index'){ | |||
this.path = options.path | |||
} | |||
var that = this; | |||
console.log(options); | |||
that.setData({ | |||
@@ -39,9 +43,15 @@ Page({ | |||
} | |||
}) | |||
.then(res => { | |||
wx.redirectTo({ | |||
url: '/pages/coupon/detail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId + "&flag=pay", | |||
}) | |||
if(that.path!=null){ | |||
wx.redirectTo({ | |||
url: "/pages/index/index" | |||
}) | |||
}else{ | |||
wx.redirectTo({ | |||
url: '/pages/coupon/detail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId + "&flag=pay", | |||
}) | |||
} | |||
}) | |||
.catch(error => { | |||
wx.showToast({ | |||
@@ -4,7 +4,7 @@ | |||
"ignore": [] | |||
}, | |||
"setting": { | |||
"urlCheck": false, | |||
"urlCheck": true, | |||
"es6": true, | |||
"postcss": true, | |||
"minified": true, | |||