@@ -1,7 +1,7 @@ | |||
var config = { | |||
name: "富茂", | |||
name: "富茂科技", | |||
url: "https://ciformall.youlane.cn/C/api", | |||
//url: "http://fd1a0cab.ngrok.io/C/api", | |||
// url: "http://fd1a0cab.ngrok.io/C/api", | |||
api: { | |||
/** | |||
* 接口用途:login | |||
@@ -120,7 +120,14 @@ var config = { | |||
/** | |||
* banner详情页面 | |||
*/ | |||
bannerDetail: "/wxCampaign/findById" | |||
bannerDetail: "/wxCampaign/findById", | |||
/** | |||
* 授权个人信息 | |||
* 和授权手机号 | |||
* 和login页面 | |||
* 页面的图标 | |||
*/ | |||
marketicon:'/mall/getAppIcon' | |||
}, | |||
weapp: { | |||
@@ -132,7 +132,7 @@ Page({ | |||
console.log(that.data.couponChannelId); | |||
console.log(that.data.couponId); | |||
console.log("我即将要跳转到用户手机号授权的页面"); | |||
if (err.code == "3002") { | |||
if (err.code == "3001") { | |||
wx.showToast({ | |||
title: "领取达到上限", | |||
image: "./../../../assets/img/fail.png", | |||
@@ -140,6 +140,30 @@ Page({ | |||
mask: false | |||
}); | |||
} | |||
if (err.code == "3002") { | |||
wx.showToast({ | |||
title: "订单失败", | |||
image: "./../../../assets/img/fail.png", | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} | |||
if (err.code == "3003") { | |||
wx.showToast({ | |||
title: "订单不存在", | |||
image: "./../../../assets/img/fail.png", | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} | |||
if (err.code == "3004") { | |||
wx.showToast({ | |||
title: "订单不存在", | |||
image: "./../../../assets/img/fail.png", | |||
duration: 2000, | |||
mask: false | |||
}); | |||
} | |||
if (err.code == "4003") { | |||
wx.showToast({ | |||
title: "卡券已作废", | |||
@@ -1,11 +1,11 @@ | |||
var config = require('../../config/config.js'); | |||
var config = require("../../config/config.js"); | |||
const Http = require("../../utils/HttpBasics"); | |||
var app = getApp(); | |||
Page({ | |||
data: { | |||
canIUse: wx.canIUse('button.open-type.getPhoneNumber'), | |||
canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | |||
couponChannelId: "", | |||
couponId:"" | |||
couponId: "" | |||
}, | |||
onLoad: function(options) { | |||
var that = this; | |||
@@ -13,41 +13,59 @@ Page({ | |||
that.setData({ | |||
couponChannelId: options.couponChannelId, | |||
couponId: options.couponId | |||
}) | |||
}); | |||
Http.get({ | |||
url: config.api.marketicon, | |||
data: { | |||
appId: config.weapp.AppId | |||
} | |||
}).then(res => { | |||
console.log(res.data.mallImgUrl); | |||
that.setData({ | |||
mallImgUrl: res.data.mallImgUrl | |||
}); | |||
}); | |||
}, | |||
getPhoneNumber: function(e) { | |||
var that = this; | |||
var iv = e.detail.iv; | |||
var encryptedData = e.detail.encryptedData; | |||
Http.post({ | |||
url: config.api.getUserPhone, | |||
data: { | |||
encryptedData: encryptedData, | |||
iv: iv, | |||
} | |||
}) | |||
.then(function(res) { | |||
console.log(res); | |||
console.log("这是用户授权手机号的结果") | |||
console.log(that.data.couponChannelId) | |||
console.log(that.data.couponId) | |||
console.log("这是从立即支付传回来的值 因为用户没有授权手机号") | |||
app.globalData.phone = res.data.phone; | |||
wx.showToast({ | |||
title: res.data.msg, | |||
icon: "success", | |||
success: function(res) { | |||
wx.redirectTo({ | |||
url: '/pages/coupon/detail/index?couponChannelId='+ that.data.couponChannelId + '&couponId='+ that.data.couponId +'&flag=pay' | |||
}) | |||
} | |||
}) | |||
}, | |||
function(error) { | |||
wx.showToast({ | |||
title: '请重新授权手机号', | |||
icon: "none", | |||
}) | |||
}) | |||
url: config.api.getUserPhone, | |||
data: { | |||
encryptedData: encryptedData, | |||
iv: iv | |||
} | |||
}).then( | |||
function(res) { | |||
console.log(res); | |||
console.log("这是用户授权手机号的结果"); | |||
console.log(that.data.couponChannelId); | |||
console.log(that.data.couponId); | |||
console.log("这是从立即支付传回来的值 因为用户没有授权手机号"); | |||
app.globalData.phone = res.data.phone; | |||
wx.showToast({ | |||
title: res.data.msg, | |||
icon: "success", | |||
success: function(res) { | |||
wx.redirectTo({ | |||
url: | |||
"/pages/coupon/detail/index?couponChannelId=" + | |||
that.data.couponChannelId + | |||
"&couponId=" + | |||
that.data.couponId + | |||
"&flag=pay" | |||
}); | |||
} | |||
}); | |||
}, | |||
function(error) { | |||
wx.showToast({ | |||
title: "请重新授权手机号", | |||
icon: "none" | |||
}); | |||
} | |||
); | |||
} | |||
}) | |||
}); |
@@ -1,12 +1,6 @@ | |||
<!-- <view class='registerd'> | |||
<image src='http://f.cdn.cloudolphin.com/banner_logo.jpg' mode='widthFix'></image> | |||
<button class="btn" hover-class='bg_color' wx:if="{{canIUse}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">授权手机号</button> | |||
<view wx:else>请升级微信版本</view> | |||
</view> --> | |||
<view class="login-body"> | |||
<view class="login-logo"> | |||
<image src="../../assets/img/logo.png"></image> | |||
<image src="{{mallImgUrl}}"></image> | |||
</view> | |||
<view class="login-btn"> | |||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | |||
@@ -1,38 +1,51 @@ | |||
var config = require('../../config/config.js'); | |||
var config = require("../../config/config.js"); | |||
var app = getApp(); | |||
const Http = require("../../utils/HttpBasics"); | |||
Page({ | |||
data: { | |||
canIUse: wx.canIUse('button.open-type.getUserInfo') | |||
canIUse: wx.canIUse("button.open-type.getUserInfo") | |||
}, | |||
onLoad: function(options) { | |||
var that = this; | |||
Http.get({ | |||
url: config.api.marketicon, | |||
data: { | |||
appId: config.weapp.AppId | |||
} | |||
}).then(res => { | |||
console.log(res.data.mallImgUrl); | |||
that.setData({ | |||
mallImgUrl: res.data.mallImgUrl | |||
}); | |||
}); | |||
}, | |||
bindGetUserInfo: function(e) { | |||
console.log(e); | |||
var iv = e.detail.iv; | |||
var encryptedData = e.detail.encryptedData; | |||
console.log(iv) | |||
console.log(encryptedData) | |||
console.log(iv); | |||
console.log(encryptedData); | |||
Http.post({ | |||
url: config.api.getUserInfo, | |||
data: { | |||
encryptedData: encryptedData, | |||
iv: iv, | |||
} | |||
}) | |||
.then(function(res) { | |||
url: config.api.getUserInfo, | |||
data: { | |||
encryptedData: encryptedData, | |||
iv: iv | |||
} | |||
}).then( | |||
function(res) { | |||
console.log(res); | |||
//返回主页 | |||
wx.switchTab({ | |||
url: '/pages/index/index', | |||
}) | |||
}, function(error) { | |||
url: "/pages/index/index" | |||
}); | |||
}, | |||
function(error) { | |||
wx.showToast({ | |||
title: '请授权个人信息', | |||
title: "请授权个人信息", | |||
icon: "none" | |||
}) | |||
}) | |||
}, | |||
}) | |||
}); | |||
} | |||
); | |||
} | |||
}); |
@@ -1,15 +1,6 @@ | |||
<!-- <view class='userinfo'> | |||
<image src='http://f.cdn.cloudolphin.com/banner_logo.jpg' mode='widthFix'></image> | |||
<button class="weui-btn" hover-class='bg_color' wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">头像昵称授权登录</button> | |||
<view wx:else>请升级微信版本</view> | |||
</view> --> | |||
<view class="login-body"> | |||
<view class="login-logo"> | |||
<image src="../../assets/img/logo.png"></image> | |||
<image src="{{mallImgUrl}}"></image> | |||
</view> | |||
<view class="login-btn"> | |||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | |||
@@ -1,21 +1,28 @@ | |||
let app = getApp() | |||
var config = require("../../config/config.js"); | |||
const Http = require("../../utils/HttpBasics"); | |||
Page({ | |||
data: { | |||
}, | |||
getPhoneNumber: function (e) { | |||
console.log(e.detail.errMsg) | |||
console.log(e.detail.iv) | |||
console.log(e.detail.encryptedData) | |||
data: {}, | |||
getPhoneNumber: function(e) { | |||
console.log(e.detail.errMsg); | |||
console.log(e.detail.iv); | |||
console.log(e.detail.encryptedData); | |||
wx.navigateBack({ | |||
delta: 1 | |||
}) | |||
}); | |||
}, | |||
onLoad() { | |||
}, | |||
onLogin: function () { | |||
console.log("登陆"); | |||
let that = this; | |||
console.log(config.weapp.AppId) | |||
Http.get({ | |||
url: config.api.marketicon, | |||
data: { | |||
appId: config.weapp.AppId | |||
} | |||
}).then(res=>{ | |||
console.log(res.data.mallImgUrl); | |||
that.setData({ | |||
mallImgUrl: res.data.mallImgUrl | |||
}); | |||
}) | |||
} | |||
}) | |||
}); |
@@ -1,6 +1,6 @@ | |||
<view class="login-body"> | |||
<view class="login-logo"> | |||
<image src="../../assets/img/logo.png"></image> | |||
<image src="{{mallImgUrl}}"></image> | |||
</view> | |||
<view class="login-btn"> | |||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | |||
@@ -14,6 +14,7 @@ | |||
.login-logo>image { | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 16rpx; | |||
} | |||
.login-btn { | |||
@@ -3,13 +3,12 @@ Page({ | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
user: { | |||
avatar: | |||
"http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" | |||
} | |||
// user: { | |||
// avatar: | |||
// "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" | |||
// } | |||
}, | |||
navigateTo() { | |||
console.log("object"); | |||
wx.navigateTo({ | |||
url: `/pages/login/index` | |||
}); | |||