Commit e88bab69 authored by lijiongliang's avatar lijiongliang

页面修改

parent 28abc381
This diff is collapsed.
......@@ -34,7 +34,8 @@
data() {
return {
tab: "index",
page: 1
page: 1,
scene: null // 二维码携带参数
}
},
computed: {
......@@ -92,18 +93,18 @@
}
let opts = {
url: '/app/user/check/move/code',
method: 'post'
method: 'post'
}
that.http.httpTokenRequest(opts, param).then(
res => {
if (res.data.code == 200) {
if (res.data.data.bindFlag) {
that.gotoMoveCar(scene)
} else {
that.gotoBindMoveCar(scene)
res => {
if (res.data.code == 200) {
if (res.data.data.bindFlag) {
that.gotoMoveCar(scene)
} else {
that.gotoBindMoveCar(scene)
}
}
}
})
})
} else {
uni.showToast({
title: '扫码失败',
......@@ -150,35 +151,38 @@
});
},
wechatLogin() {
wx.login({
success: (res) => {
this.wechatSession(res.code)
}
})
wx.login({
success: (res) => {
this.wechatSession(res.code)
}
})
},
//获取session_key
async wechatSession(code) {
let that = this
let param = {
code: code,
}
let opts = { url: '/xcx/code/session', method: 'post' }
await that.http.httpRequest(opts, param).then(res => {
if (res.data.code == 200) {
that.openid = res.data.data.openid
uni.setStorageSync('openid', that.openid);
}
})
let that = this
let param = {
code: code,
}
let opts = {
url: '/xcx/code/session',
method: 'post'
}
await that.http.httpRequest(opts, param).then(res => {
if (res.data.code == 200) {
that.openid = res.data.data.openid
uni.setStorageSync('openid', that.openid);
}
})
},
},
onLoad(option) {
// 静默授权获取openid
let openid = uni.getStorageSync('openid');
if(!openid) {
this.wechatLogin()
let openid = uni.getStorageSync('openid');
if (!openid) {
this.wechatLogin()
}
let that = this
if (option && option.index) {
that.$nextTick(() => {
......@@ -190,9 +194,11 @@
that.$refs.myTab.current = i;
});
}
let token = uni.getStorageSync('userToken')
if(!token){
console.log(option,uni.getStorageSync('scene'),22222222222)
let token = uni.getStorageSync('userToken')
if (!token) {
let ptKey = plugin.getPtKey();
if (ptKey) {
uni.showLoading({
......@@ -201,18 +207,21 @@
plugin.isvObfuscator({
url: 'https://wxapplogin2.m.jd.com/cgi-bin/login/isv/isvObfuscator'
}).then(res => {
let {
let {
token,
message
} = res;
if (!token) {
uni.navigateTo({
url:"/pages/login/index/index"
})
uni.hideLoading()
uni.showToast({
title: `京东登录失败:${message}`,
icon: 'none',
duration: 2000
});
// uni.showToast({
// title: `京东登录失败:${message}`,
// icon: 'none',
// duration: 2000
// });
} else {
let opts = {
url: '/xcx/login',
......@@ -221,17 +230,40 @@
let openid = uni.getStorageSync('openid')
that.http.httpTokenRequest(opts, {
token: token,
openid:openid
openid: openid
}).then(res => {
if (res.data.code == 200) {
let token = res.data.data.token
uni.setStorageSync('userToken',token)
uni.setStorageSync('userToken', token)
uni.hideLoading()
uni.showToast({
title: "登录成功",
icon: 'none',
duration: 2000
});
// 判断是否扫码进入
that.scene = uni.getStorageSync('scene')
if (that.scene) {
//获取二维码携带的参数
//扫码后得到的参数
that.http.httpTokenRequest({
url: '/app/user/check/move/code',
method: 'post'
}, {
code: that.scene
}).then(res => {
if (res.data.code == 200) {
if (res.data.data.bindFlag) {
that.gotoMoveCar(that.scene);
} else {
that.gotoBindMoveCar(that.scene);
}
uni.removeStorageSync('scene')
}
})
}
}
})
}
......@@ -239,6 +271,35 @@
}).catch(err => {
console.log('err', err)
})
}else{
// 判断是否扫码进入
if (option && option.scene) {
uni.setStorageSync('scene', decodeURIComponent(option.scene))
uni.navigateTo({
url:"/pages/login/index/index"
})
}
}
}else{
// 判断是否扫码进入
if (option && option.scene) {
//获取二维码携带的参数
//扫码后得到的参数
that.scene = decodeURIComponent(option.scene)
that.http.httpTokenRequest({
url: '/app/user/check/move/code',
method: 'post'
}, {
code: that.scene
}).then(res => {
if (res.data.code == 200) {
if (res.data.data.bindFlag) {
that.gotoMoveCar(that.scene);
} else {
that.gotoBindMoveCar(that.scene);
}
}
})
}
}
......
......@@ -62,6 +62,7 @@
</template>
<script>
let plugin = requirePlugin('loginPlugin');
export default {
data() {
return {
......@@ -71,11 +72,12 @@ export default {
icon: require("@/static/my/my01.png"),
title: "我的订单",
url: "/pagesD/pages/personal/myJdOrder"
},{
icon: require("@/static/my/my12.png"),
title: "我的地址",
url: "/pagesD/pages/personal/myAddress"
},
// {
// icon: require("@/static/my/my12.png"),
// title: "我的地址",
// url: "/pagesD/pages/personal/myAddress"
// },
{
icon: require("@/static/my/my8.png"),
title: "使用帮助",
......@@ -133,10 +135,12 @@ export default {
uni.removeStorageSync('userToken')
uni.removeStorageSync('xcxIndexPath')
// uni.removeStorageSync('openid')
uni.reLaunch({
url: '/pages/main'
});
plugin.logout().then((res) => {
console.jdLoginLog(res, 'logoutres');
uni.reLaunch({
url: '/pages/main'
});
});
}
})
......@@ -488,7 +492,7 @@ export default {
background: rgba(0, 0, 0, .1);
}
.list__item:nth-of-type(3) {
.list__item:nth-of-type(2) {
.list__left {
image {
width: 29rpx;
......@@ -498,7 +502,7 @@ export default {
}
}
.list__item:nth-of-type(4) {
.list__item:nth-of-type(3) {
.list__left {
image {
width: 28rpx;
......@@ -508,7 +512,7 @@ export default {
}
}
.list__item:nth-of-type(5) {
.list__item:nth-of-type(4) {
.list__left {
image {
width: 28rpx;
......
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