@@ -1,7 +1,7 @@ | |||||
var config = { | var config = { | ||||
name: "富茂", | |||||
name: "富茂科技", | |||||
url: "https://ciformall.youlane.cn/C/api", | url: "https://ciformall.youlane.cn/C/api", | ||||
//url: "http://fd1a0cab.ngrok.io/C/api", | |||||
// url: "http://fd1a0cab.ngrok.io/C/api", | |||||
api: { | api: { | ||||
/** | /** | ||||
* 接口用途:login | * 接口用途:login | ||||
@@ -120,7 +120,14 @@ var config = { | |||||
/** | /** | ||||
* banner详情页面 | * banner详情页面 | ||||
*/ | */ | ||||
bannerDetail: "/wxCampaign/findById" | |||||
bannerDetail: "/wxCampaign/findById", | |||||
/** | |||||
* 授权个人信息 | |||||
* 和授权手机号 | |||||
* 和login页面 | |||||
* 页面的图标 | |||||
*/ | |||||
marketicon:'/mall/getAppIcon' | |||||
}, | }, | ||||
weapp: { | weapp: { | ||||
@@ -132,7 +132,7 @@ Page({ | |||||
console.log(that.data.couponChannelId); | console.log(that.data.couponChannelId); | ||||
console.log(that.data.couponId); | console.log(that.data.couponId); | ||||
console.log("我即将要跳转到用户手机号授权的页面"); | console.log("我即将要跳转到用户手机号授权的页面"); | ||||
if (err.code == "3002") { | |||||
if (err.code == "3001") { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: "领取达到上限", | title: "领取达到上限", | ||||
image: "./../../../assets/img/fail.png", | image: "./../../../assets/img/fail.png", | ||||
@@ -140,6 +140,30 @@ Page({ | |||||
mask: false | 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") { | if (err.code == "4003") { | ||||
wx.showToast({ | wx.showToast({ | ||||
title: "卡券已作废", | title: "卡券已作废", | ||||
@@ -1,11 +1,11 @@ | |||||
var config = require('../../config/config.js'); | |||||
var config = require("../../config/config.js"); | |||||
const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
var app = getApp(); | var app = getApp(); | ||||
Page({ | Page({ | ||||
data: { | data: { | ||||
canIUse: wx.canIUse('button.open-type.getPhoneNumber'), | |||||
canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | |||||
couponChannelId: "", | couponChannelId: "", | ||||
couponId:"" | |||||
couponId: "" | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | var that = this; | ||||
@@ -13,41 +13,59 @@ Page({ | |||||
that.setData({ | that.setData({ | ||||
couponChannelId: options.couponChannelId, | couponChannelId: options.couponChannelId, | ||||
couponId: options.couponId | 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) { | getPhoneNumber: function(e) { | ||||
var that = this; | var that = this; | ||||
var iv = e.detail.iv; | var iv = e.detail.iv; | ||||
var encryptedData = e.detail.encryptedData; | var encryptedData = e.detail.encryptedData; | ||||
Http.post({ | 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-body"> | ||||
<view class="login-logo"> | <view class="login-logo"> | ||||
<image src="../../assets/img/logo.png"></image> | |||||
<image src="{{mallImgUrl}}"></image> | |||||
</view> | </view> | ||||
<view class="login-btn"> | <view class="login-btn"> | ||||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | <!-- <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(); | var app = getApp(); | ||||
const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
Page({ | Page({ | ||||
data: { | data: { | ||||
canIUse: wx.canIUse('button.open-type.getUserInfo') | |||||
canIUse: wx.canIUse("button.open-type.getUserInfo") | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | 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) { | bindGetUserInfo: function(e) { | ||||
console.log(e); | console.log(e); | ||||
var iv = e.detail.iv; | var iv = e.detail.iv; | ||||
var encryptedData = e.detail.encryptedData; | var encryptedData = e.detail.encryptedData; | ||||
console.log(iv) | |||||
console.log(encryptedData) | |||||
console.log(iv); | |||||
console.log(encryptedData); | |||||
Http.post({ | 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); | console.log(res); | ||||
//返回主页 | //返回主页 | ||||
wx.switchTab({ | wx.switchTab({ | ||||
url: '/pages/index/index', | |||||
}) | |||||
}, function(error) { | |||||
url: "/pages/index/index" | |||||
}); | |||||
}, | |||||
function(error) { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: '请授权个人信息', | |||||
title: "请授权个人信息", | |||||
icon: "none" | 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-body"> | ||||
<view class="login-logo"> | <view class="login-logo"> | ||||
<image src="../../assets/img/logo.png"></image> | |||||
<image src="{{mallImgUrl}}"></image> | |||||
</view> | </view> | ||||
<view class="login-btn"> | <view class="login-btn"> | ||||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | <!-- <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({ | 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({ | wx.navigateBack({ | ||||
delta: 1 | delta: 1 | ||||
}) | |||||
}); | |||||
}, | }, | ||||
onLoad() { | 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-body"> | ||||
<view class="login-logo"> | <view class="login-logo"> | ||||
<image src="../../assets/img/logo.png"></image> | |||||
<image src="{{mallImgUrl}}"></image> | |||||
</view> | </view> | ||||
<view class="login-btn"> | <view class="login-btn"> | ||||
<!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | <!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | ||||
@@ -14,6 +14,7 @@ | |||||
.login-logo>image { | .login-logo>image { | ||||
width: 100%; | width: 100%; | ||||
height: 100%; | height: 100%; | ||||
border-radius: 16rpx; | |||||
} | } | ||||
.login-btn { | .login-btn { | ||||
@@ -3,13 +3,12 @@ Page({ | |||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | 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() { | navigateTo() { | ||||
console.log("object"); | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/login/index` | url: `/pages/login/index` | ||||
}); | }); | ||||