1 Star 0 Fork 0

links/漫威

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 5.16 KB
一键复制 编辑 原始数据 按行查看 历史
gypzxh 提交于 2018-07-23 16:21 . no message
//app.js
var config = require('./config.js');
var utils = require('./utils/util')
App({
data: {
},
onShow: function (options) {
let that = this;
console.log(options);
let q = decodeURIComponent(options.query.q);
q = q.substring(36);
if(q.length == 0){
that.globalData.channel='all';
}else{
that.globalData.channel=q;
}
if(q == "21S791SO88NUPK"){
that.globalData.hero=3;
}else if(q == "21SB91SOOHUUPK"){
that.globalData.hero=3;
}else if(q == "21S491C8811EP4"){
that.globalData.hero=3;
}else if(q == "21S191COOHHUPK"){
that.globalData.hero=3;
}else if(q == "21S591C8OHHEPK"){
that.globalData.hero=4;
}else if(q == "21S291COO11UP4"){
that.globalData.hero=4;
}else if(q == "21S691C8O11EP4"){
that.globalData.hero=1;
}else if(q == "21S891SO811UP4"){
that.globalData.hero=2;
}else if(q == "21SA91SOO1UUP4"){
that.globalData.hero=2;
}else if(q == "21S391C888NEPK"){
that.globalData.hero=2;
}else if(q == "21S091CO811UP4"){
that.globalData.hero=2;
}else{
that.globalData.hero=0;
}
// wx.showModal({
// title: '提示',
// content:that.globalData.channel,
// success: function(res) {
// }
// })
wx.getSystemInfo({
success: function (res) {
if (res.model.indexOf("iPhone X") > -1) {
that.globalData.isIpx = true;
}
}
});
},
onLaunch: function (options) {
},getUserInfo: function(cb) {
var that = this
if(this.globalData.userInfo) {
typeof cb == "function" && cb(this.globalData.userInfo)
} else {
//调用登录接口
wx.login({
success: function(res) {
console.log(res.code);
if(res.code) {
var code = res.code;
var watermark = {"appid": "wxa3c90f1b5eb8df05"}
var data = {
"code": code,
"scope": "base",
"watermark": watermark,
};
wx.request({
url: "https://staging-oauth.usocialplus.com/57bd51aa5b5529760f8b4567/v2/weapp/oauth",
data: data,
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
'content-type': 'application/json'
}, // 设置请求的 header
success: function (res) {
console.log(res);
that.globalData.weappuserInfo = res.data;
console.log(that.globalData.weappuserInfo);
that.getAvenue();
// 1.加载活动首页 标签
var trackingdata = {
"member_ids": ["58a56c887c423400da0dca73"],
"tags": ["PRO_5_1_1", "INT_1_1_1", "ACT_3_3"]
}
that.addTracking(trackingdata);
// 1.加载活动首页 事件
var trackingdata = {
"accountId": "57bd51aa5b5529760f8b4567",
"memberId": "5575548613747370538b4571",
"msgType": "customerEvent",
"subType": "c_Page_Loading",
"createTime": 1529647042000,
"eventProperties": {
"Source_Channel": "https://clear-marvel.ulcampaign.com/21S791SO88NUPK",
"Ref_ID": "5575548613747370538b4571",
"Campaign_ID": "dts_campaign_clear_2018_marvel"
}
}
that.addTracking(trackingdata);
},
fail: function (err) {
console.log(err);
}
})
} else {
console.log('获取用户登录态失败!' + res.errMsg)
}
},fail: function(res) {
console.log(res.code);
}
,complete: function(res) {
// console.log(res.code);
// console.log(res);
}
});
}
},getAvenue: function () {
var that = this;
var weappuserInfo = that.globalData.weappuserInfo;
console.log(weappuserInfo);
wx.request({
url: config.POST_URL+'index.php/Home/Index/avenue',
data: {
'miniopenid': weappuserInfo.openId,
},
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
'content-type': 'application/x-www-form-urlencoded'
}, // 设置请求的 header
success: function (res) {
that.globalData.avenue=res.data.code;
console.log(that.globalData.avenue);
},
fail: function (err) {
console.log(err);
}
})
},addTracking: function (data){
wx.request({
url: config.POST_URL+'index.php/Home/Index/addTracking',
data: data,
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
'content-type': 'application/json'
}, // 设置请求的 header
success: function (res) {
console.log(res);
},
fail: function (err) {
console.log(err);
}
})
},
globalData: {
userInfo: null,
weappuserInfo:null,
isIpx: false,
phone:null,
channel:null,
hero:0,
avenue:null,
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/links2018/marvel.git
git@gitee.com:links2018/marvel.git
links2018
marvel
漫威
master

搜索帮助