Commit 37156ead authored by 肖健's avatar 肖健

绑定京东账号

parent 599ff6e1
......@@ -69,7 +69,14 @@
};
},
methods: {
goJdLogin(){
let returnPage= '/pages/main';
uni.navigateTo({
url:"/pages/login/index/index"
})
},
getPrice() {
let that = this
let token = uni.getStorageSync('userToken');
if (!token) {
uni.navigateTo({
......@@ -81,20 +88,36 @@
url: '/app/user/info',
method: 'get'
}
this.http.httpTokenRequest(opts, {}).then(res => {
that.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
let freeMoveFlag = res.data.data.freeMoveFlag
if (freeMoveFlag) {
uni.showToast({
title: "您的免费领取次数已用完",
icon: 'none',
duration: 2000,
});
} else {
//跳转到领取优惠卷页面
uni.navigateTo({
url: '/pagesA/pages/index/getPrice?orderId=' + this.freeCode.id
let bindPin = res.data.data.bindPin
if(!bindPin) {
uni.showModal({
title: "未绑定账号",
content: "您没有绑定京东账号,请绑定后再领取",
success:function(res){
if (res.confirm) {
that.goJdLogin()
}
}
});
// if (freeMoveFlag) {
// uni.showToast({
// title: "您的免费领取次数已用完",
// icon: 'none',
// duration: 2000,
// success:function(){
// }
// });
// } else {
// //跳转到领取优惠卷页面
// uni.navigateTo({
// url: '/pagesA/pages/index/getPrice?orderId=' + this.freeCode.id
// });
// }
}
}
})
......
export let config = {
appid: 1814,
returnPage: undefined,
returnPage: '/pages/main',
pageType: undefined,
isLogout: 1,
noWXinfo: 1,
......
......@@ -44,7 +44,6 @@ export default {
})
},
onShow: function () {
console.log(plugin.getPtKey(),1111111)
uni.hideHomeButton()
if(this.tab == 'personal'){
this.$refs.personal.getUserInfo();
......@@ -59,18 +58,11 @@ export default {
}
},
methods: {
goLogin(){
let returnPage= '/pages/main';
uni.navigateTo({
url:"/pages/login/index/index?returnPage="+returnPage
})
},
tabChange(index) {
let that = this
switch (index) {
case 0:
this.tab = 'index'
this.goLogin()
break;
case 1:
this.tab = 'moveCar'
......@@ -153,17 +145,49 @@ export default {
}
},
onLoad(option) {
let that = this
if(option && option.index){
this.$nextTick(() => {
that.$nextTick(() => {
let i = parseInt(option.index);
if(!i){
i= 0;
}
this.tabChange(i)
this.$refs.myTab.current = i;
that.tabChange(i)
that.$refs.myTab.current = i;
});
}
let ptKey = plugin.getPtKey();
if(ptKey) {
plugin.isvObfuscator({url:'https://wxapplogin2.m.jd.com/cgi-bin/login/isv/isvObfuscator'}).then(res=>{
let { token, message } = res;
if(!token) {
uni.showToast({
title: `京东登录失败:${message}`,
icon: 'none',
duration: 2000
});
} else {
let opts = {
url: '/app/user/bind/jd',
method: 'post'
}
that.http.httpTokenRequest(opts, {'token' : token}).then(res => {
if (res.data.code == 200) {
uni.showToast({
title: "京东账号绑定成功",
icon: 'none',
duration: 1000
});
}
})
}
}).catch(err=>{
console.log('err',err)
})
}
},
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment