Commit e88bab69 authored by lijiongliang's avatar lijiongliang

页面修改

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