Authored by 李奇

yas上报添加

@@ -62,6 +62,13 @@ export default class Resource extends React.Component { @@ -62,6 +62,13 @@ export default class Resource extends React.Component {
62 query = queryString.parse(url.split('?')[1]); 62 query = queryString.parse(url.split('?')[1]);
63 63
64 delete query['openby:yohobuy']; 64 delete query['openby:yohobuy'];
  65 +
  66 + // fix 中文编码
  67 + Object.keys(query).map(qk => {
  68 + if (/[\u4e00-\u9fa5]/.test(query[qk])) {
  69 + query[qk] = encodeURIComponent(query[qk]);
  70 + }
  71 + });
65 72
66 return `${domain}?${queryString.stringify(query)}`; 73 return `${domain}?${queryString.stringify(query)}`;
67 }; 74 };
@@ -176,6 +176,12 @@ export default class wheelSurf extends PureComponent { @@ -176,6 +176,12 @@ export default class wheelSurf extends PureComponent {
176 176
177 delete query['openby:yohobuy']; 177 delete query['openby:yohobuy'];
178 178
  179 + // fix 中文编码
  180 + Object.keys(query).map(qk => {
  181 + if (/[\u4e00-\u9fa5]/.test(query[qk])) {
  182 + query[qk] = encodeURIComponent(query[qk]);
  183 + }
  184 + });
179 conf[key] = `${url}?${queryString.stringify(query)}`; 185 conf[key] = `${url}?${queryString.stringify(query)}`;
180 }); 186 });
181 }; 187 };
@@ -403,7 +409,7 @@ export default class wheelSurf extends PureComponent { @@ -403,7 +409,7 @@ export default class wheelSurf extends PureComponent {
403 409
404 return ( 410 return (
405 <div className="home-wrap"> 411 <div className="home-wrap">
406 - <img className="main-bg" src={conf.main_bg}/> 412 + <img className="main-bg" src={`${conf.main_bg}?imageMogr2/format/jpg`}/>
407 {conf.rule_btn_bg ? (<a data-type="other" data-url={conf.rule_url} onClick={this.jump}> 413 {conf.rule_btn_bg ? (<a data-type="other" data-url={conf.rule_url} onClick={this.jump}>
408 <img className="rule-btn" src={conf.rule_btn_bg}/> 414 <img className="rule-btn" src={conf.rule_btn_bg}/>
409 </a>) : ''} 415 </a>) : ''}
@@ -69,7 +69,6 @@ export default class Prize extends PureComponent { @@ -69,7 +69,6 @@ export default class Prize extends PureComponent {
69 let {showModal, modalTip, modalBtnText, pending} = this.state; 69 let {showModal, modalTip, modalBtnText, pending} = this.state;
70 let backUrl = `${document.location.protocol}//${document.location.host}${config.routerPath[config.currentApp]}/home.html?actId=${yaSDK.getQueryObj().actId}`; 70 let backUrl = `${document.location.protocol}//${document.location.host}${config.routerPath[config.currentApp]}/home.html?actId=${yaSDK.getQueryObj().actId}`;
71 71
72 - console.log(backUrl)  
73 let couponLink = 'https://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}'; 72 let couponLink = 'https://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}';
74 let redEnvelopeLink = 'https://activity.yoho.cn/feature/3221.html?title=我的红包&openby:yohobuy={"action":"go.mineredpackage"}'; 73 let redEnvelopeLink = 'https://activity.yoho.cn/feature/3221.html?title=我的红包&openby:yohobuy={"action":"go.mineredpackage"}';
75 74
@@ -78,8 +78,43 @@ @@ -78,8 +78,43 @@
78 } 78 }
79 </style> 79 </style>
80 <div id="root"></div> 80 <div id="root"></div>
  81 +<script async="" src="//cdn.yoho.cn/yas-jssdk/2.4.18/yas.js"></script>
81 <script> 82 <script>
82 var _hmt = _hmt || []; 83 var _hmt = _hmt || [];
  84 +
  85 + (function(w, d, s, j, f) {
  86 + var a = d.createElement(s);
  87 + var m = d.getElementsByTagName(s)[0];
  88 +
  89 + w.YohoAcquisitionObject = f;
  90 +
  91 + w[f] = function() {
  92 + w[f].p = arguments;
  93 + };
  94 +
  95 + a.async = 1;
  96 + a.src = j;
  97 + m.parentNode.insertBefore(a, m);
  98 + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.4.18/yas.js', '_yas'));
  99 +
  100 + function queryString() {
  101 + var vars = {},
  102 + hash,
  103 + i;
  104 + var hashes = window.location.search.slice(1).split('&');
  105 +
  106 + for (i = 0; i < hashes.length; i++) {
  107 + hash = hashes[i].split('=');
  108 + vars[hash[0]] = hash[1];
  109 + }
  110 + return vars;
  111 + }
  112 +
  113 + var uid = queryString().uid || 0;
  114 + window._ozuid = uid; // 暴露ozuid
  115 + if (window._yas) {
  116 + window._yas(1 * new Date(), '2.4.18', 'yohobuy_m', uid, '', '');
  117 + }
83 118
84 (function() { 119 (function() {
85 var hm = document.createElement('script'); 120 var hm = document.createElement('script');