Authored by yyq

fix third refer

... ... @@ -47,13 +47,22 @@ Vue.use(Bind);
yoho.auth = async(loginUrl) => {
let user = await sdk.getUser();
// let user = await sdk.getUser();
let user = '';
if (user && user.uid) {
return user;
} else {
cookie.set('third_backurl', location.href);
cookie.set('third_backurl', location.href, {
domain: '.yohobuy.com',
path: '/'
});
console.log(location.href)
setTimeout(() => {
location.href = loginUrl || `${location.origin}/xianyu/passport/login/taobao`;
}, 100);
return;
}
}
... ...
... ... @@ -87,6 +87,8 @@ export default {
this.canScan = true;
}
this.$yoho.auth();
this.fetchAppraiseAddressChangeNotice({orderCode: this.orderCode}).then(res => {
let isChanged = get(res, 'data.isChanged');
let isForceShow = get(res, 'data.isForceShow');
... ...
const _ = require('lodash');
const url = require('url');
const uuid = require('uuid');
const passport = require('passport');
const TaobaoStrategy = require('./passport-taobao');
... ... @@ -150,7 +149,7 @@ const login = {
if (result.code === 200) {
if (_.get(result, 'data.is_bind') === 'N') {
redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
redirectUrl = req.cookies.third_backurl ? req.cookies.third_backurl : homePage;
redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?';
redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`));
} else if (+_.get(result, 'data.uid') > 0) {
... ... @@ -160,7 +159,7 @@ const login = {
req,
res
}).finally(() => {
let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
let refer = req.cookies.third_backurl ? req.cookies.third_backurl : homePage;
return res.redirect(refer);
});
... ...