Authored by huangyi

活动sdk init

... ... @@ -366,7 +366,7 @@
/*!****************************!*\
!*** ./src/public/base.js ***!
\****************************/
/*! no static exports found */function(e,o,r){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=l(r(/*! babel-runtime/core-js/json/stringify */"./node_modules/babel-runtime/core-js/json/stringify.js")),t=l(r(/*! ../utils/jsonp */"./src/utils/jsonp.js")),s=l(r(/*! ../utils/cookie */"./src/utils/cookie.js")),i=r(/*! ../utils/common */"./src/utils/common.js"),u=l(r(/*! promise-polyfill */"./node_modules/promise-polyfill/src/index.js"));function l(e){return e&&e.__esModule?e:{default:e}}var c="";o.default={env:function(){var e=window.__wxjs_environment;return c=!e&&navigator.userAgent.match(/yohobuy/i)?(document.addEventListener("deviceready",function(){}),"app"):!e&&navigator.userAgent.match(/miniProgram/i)||"miniprogram"===e?"miniprogram":"https://www.yohobuy.com"===location.origin?"pc":"h5"},loginUrl:function(){var e=void 0,o=location.href.split("?")[0];return e="http://m.yohobuy.com/signin.html?refer="+encodeURIComponent(o),"app"===c?(o=function(e){var o={},r=void 0,n=void 0,t=void 0;if((r=((e=(e||"").split("?"))[1]||"").split("&"))&&r.length)for(t=0;t<r.length;t++)o[(n=r[t].split("="))[0]]=n[1];return{path:e[0],query:o}}(o),/Android/i.test(navigator.userAgent||"")?(e.indexOf("?")<0&&(e+="?appLogin=1"),0<=location.href.indexOf("&openby")&&(e=e.substring(0,e.indexOf("&openby"))),e+="&"):(0<=location.href.indexOf("#openby")&&(e=e.substring(0,e.indexOf("#openby"))),e+="#"),e+="openby:yohobuy="+(0,n.default)({action:"go.weblogin",params:{priority:"N",jumpurl:{url:o.path,param:o.query},needlogout:"Y"}})):"pc"===c?e="https://www.yoho/signin.html?refer="+encodeURIComponent(location.href)+'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'+o.replace(/\//g,"\\/")+'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}':"miniprogram"===c&&(e="/pages/userCenter/userCenter"),e},getUid:function(){return new u.default(function(r){if("h5"===c||"pc"===c)(0,t.default)("https://m.yohobuy.com/passport/login/user").then(function(e){var o=0;200===e.code&&(o=Number(e.data)),r(o)});else{var e=Number(s.default.cookie("app_uid"))||Number((0,i.getQueryObj)().uid)||0;r(e)}})}}},"./src/public/goto.js":
/*! no static exports found */function(e,o,r){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=l(r(/*! babel-runtime/core-js/json/stringify */"./node_modules/babel-runtime/core-js/json/stringify.js")),t=l(r(/*! ../utils/jsonp */"./src/utils/jsonp.js")),s=l(r(/*! ../utils/cookie */"./src/utils/cookie.js")),i=r(/*! ../utils/common */"./src/utils/common.js"),u=l(r(/*! promise-polyfill */"./node_modules/promise-polyfill/src/index.js"));function l(e){return e&&e.__esModule?e:{default:e}}var c="";o.default={env:function(){var e=window.__wxjs_environment;return c=!e&&navigator.userAgent.match(/yohobuy/i)?(document.addEventListener("deviceready",function(){}),"app"):!e&&navigator.userAgent.match(/miniProgram/i)||"miniprogram"===e?"miniprogram":"https://www.yohobuy.com"===location.origin?"pc":"h5"},loginUrl:function(){var e=void 0,o=location.href;return e="http://m.yohobuy.com/signin.html?refer="+encodeURIComponent(o),"app"===c?(o=function(e){var o={},r=void 0,n=void 0,t=void 0;if((r=((e=(e||"").split("?"))[1]||"").split("&"))&&r.length)for(t=0;t<r.length;t++)o[(n=r[t].split("="))[0]]=n[1];return{path:e[0],query:o}}(o),/Android/i.test(navigator.userAgent||"")?(e.indexOf("?")<0&&(e+="?appLogin=1"),0<=location.href.indexOf("&openby")&&(e=e.substring(0,e.indexOf("&openby"))),e+="&"):(0<=location.href.indexOf("#openby")&&(e=e.substring(0,e.indexOf("#openby"))),e+="#"),e+="openby:yohobuy="+(0,n.default)({action:"go.weblogin",params:{priority:"N",jumpurl:{url:o.path,param:o.query},needlogout:"Y"}})):"pc"===c?e="https://www.yoho/signin.html?refer="+encodeURIComponent(location.href):"miniprogram"===c&&(e="/pages/userCenter/userCenter"),e},getUid:function(){return new u.default(function(r){if("h5"===c||"pc"===c)(0,t.default)("https://m.yohobuy.com/passport/login/user").then(function(e){var o=0;200===e.code&&(o=Number(e.data)),r(o)});else{var e=Number(s.default.cookie("app_uid"))||Number((0,i.getQueryObj)().uid)||0;r(e)}})}}},"./src/public/goto.js":
/*!****************************!*\
!*** ./src/public/goto.js ***!
\****************************/
... ...
... ... @@ -7,17 +7,21 @@
<title>Title</title>
</head>
<body>
<div id="aaa">232323</div>
<div class="auth">1111111</div>
<button id="aaa">232323</button>
<button class="auth">1111111</button>
<a class="auth" href="http://www.baidu.com">123123</a>
<script src="../build/sdk.js"></script>
<div id="uid"></div>
<div id="url"></div>
<script src="http://ad.yoho.cn/build/sdk.js"></script>
<script>
window.yo_sdk.auth();
document.getElementById('aaa').onclick = function (event) {
window.yo_sdk.getUid().then(function(uid){
console.log(uid);
document.getElementById('uid').innerText = uid;
})
}
document.getElementById('url').innerText = location.href;
</script>
</body>
</html>
... ...
... ... @@ -44,7 +44,7 @@ export default {
},
//url
loginUrl: function () {
let url, refer = location.href.split('?')[0];
let url, refer = location.href;
url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer);
if (env === 'app') {
refer = parseUrl(refer);
... ... @@ -74,7 +74,7 @@ export default {
}
});
} else if (env === 'pc') {
url = 'https://www.yoho/signin.html?refer=' + encodeURIComponent(location.href) + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + refer.replace(/\//g, '\\/') + '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}';
url = 'https://www.yoho/signin.html?refer=' + encodeURIComponent(location.href);
} else if (env === 'miniprogram') {
url = '/pages/userCenter/userCenter'
}
... ...