Authored by huangyi

Merge branch 'feature/wheel-surf' of http://git.yoho.cn/fe/yoho-activitys into feature/wheel-surf

... ... @@ -62,6 +62,13 @@ export default class Resource extends React.Component {
query = queryString.parse(url.split('?')[1]);
delete query['openby:yohobuy'];
// fix 中文编码
Object.keys(query).map(qk => {
if (/[\u4e00-\u9fa5]/.test(query[qk])) {
query[qk] = encodeURIComponent(query[qk]);
}
});
return `${domain}?${queryString.stringify(query)}`;
};
... ...
... ... @@ -176,6 +176,12 @@ export default class wheelSurf extends PureComponent {
delete query['openby:yohobuy'];
// fix 中文编码
Object.keys(query).map(qk => {
if (/[\u4e00-\u9fa5]/.test(query[qk])) {
query[qk] = encodeURIComponent(query[qk]);
}
});
conf[key] = `${url}?${queryString.stringify(query)}`;
});
};
... ... @@ -403,13 +409,13 @@ export default class wheelSurf extends PureComponent {
return (
<div className="home-wrap">
<img className="main-bg" src={conf.main_bg}/>
<img className="main-bg" src={`${conf.main_bg}?imageMogr2/format/jpg`}/>
{conf.rule_btn_bg ? (<a data-type="other" data-url={conf.rule_url} onClick={this.jump}>
<img className="rule-btn" src={conf.rule_btn_bg}/>
<img className="rule-btn" src={`${conf.rule_btn_bg}?imageslim`}/>
</a>) : ''}
{conf.share_btn_bg && yaSDK.env === 'app' ? (<img onClick={this.shareInApp} className="share-btn" src={conf.share_btn_bg}/>): ''}
<img className="wheel-bg" id="rotateWheel" src={conf.wheel_bg}/>
<img onClick={()=>{this.start()}} className="start-btn-bg" src={conf.prize_btn_bg}/>
<img className="wheel-bg" id="rotateWheel" src={`${conf.wheel_bg}?imageslim`}/>
<img onClick={()=>{this.start()}} className="start-btn-bg" src={`${conf.prize_btn_bg}?imageslim`}/>
{
isLogin && showRemain ?
(<div className="tips">
... ... @@ -420,14 +426,14 @@ export default class wheelSurf extends PureComponent {
<BottomButton links={links} login={isLogin}/>
<Resource code={conf.bottomContentCode}/>
{slowEnding ? (<img className="prize-hit-bg transition" src={conf.win_prize_bg}/>) : ''}
{slowEnding ? (<img className="prize-hit-bg transition" src={`${conf.win_prize_bg}?imageslim`}/>) : ''}
{startEnded ? (
<div className="got-tip">
<div className="prize-tip">{this.state.gotDesc}</div>
<span onClick={this.setCanStart} className="try-again">确定</span>
</div>
) : ''}
{slowEnding ? (<img className="prize-hit-start-bg" src={conf.prize_btn_bg}/>) : ''}
{slowEnding ? (<img className="prize-hit-start-bg" src={`${conf.prize_btn_bg}?imageslim`}/>) : ''}
{
this.state.showTipModal ? <TipModal tip={this.state.modalTip} btnText={this.state.modalBtnText} confirm={() => {this.confirm()}} /> : ''
}
... ...
... ... @@ -6,6 +6,7 @@ import * as config from '../../../../config';
import wx from 'weixin-js-sdk';
import TipModal from '../components/tip-modal';
import dayjs from 'dayjs';
import LazyLoad from 'react-lazy-load';
export default class Prize extends PureComponent {
constructor(props) {
... ... @@ -69,13 +70,12 @@ export default class Prize extends PureComponent {
let {showModal, modalTip, modalBtnText, pending} = this.state;
let backUrl = `${document.location.protocol}//${document.location.host}${config.routerPath[config.currentApp]}/home.html?actId=${yaSDK.getQueryObj().actId}`;
console.log(backUrl)
let couponLink = 'https://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}';
let redEnvelopeLink = 'https://activity.yoho.cn/feature/3221.html?title=我的红包&openby:yohobuy={"action":"go.mineredpackage"}';
this.state.prizes.map(prize => {
prize.createTime = dayjs(new Date(prize.createTime).getTime()).format('YYYY-MM-DD HH:mm');
});
let fmtTime = time => {
return dayjs(new Date(time).getTime()).format('YYYY-MM-DD HH:mm');
};
return (
pending ? '' :
... ... @@ -86,10 +86,12 @@ export default class Prize extends PureComponent {
return (
<div className="prize-item" key={prize.id}>
<div className="item-top">
<img src={prize.img} className="prize-img"/>
<LazyLoad offset={1000}>
<img src={`${prize.img}?imageView2/2/w/200/h/140`} className="prize-img"/>
</LazyLoad>
<div className="prize-info">
<div className="prize-name">{prize.name}</div>
<div className="got-time">中奖时间:{prize.createTime}</div>
<div className="got-time">中奖时间:{fmtTime(prize.createTime)}</div>
</div>
</div>
<div className="item-bottom">
... ...
... ... @@ -78,8 +78,62 @@
}
</style>
<div id="root"></div>
<script async="" src="//cdn.yoho.cn/yas-jssdk/2.4.18/yas.js"></script>
<script>
var _hmt = _hmt || [];
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.4.18/yas.js', '_yas'));
function queryString() {
var vars = {},
hash,
i;
var hashes = window.location.search.slice(1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
return vars;
}
function getCookie(Name) {
var search = Name + "="
var value = "";
if (document.cookie.length > 0) {
sd = document.cookie.indexOf(search);
if (sd!= -1) {
sd += search.length;
end = document.cookie.indexOf(";", sd);
if (end == -1)
end = document.cookie.length;
//unescape() 函数可对通过 escape() 编码的字符串进行解码。
value=unescape(document.cookie.substring(sd, end))
}
}
return value;
}
var uid = getCookie('uid') || queryString().uid || 0;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.4.18', 'yohobuy_m', uid, '', '');
}
(function() {
var hm = document.createElement('script');
... ...
... ... @@ -71,7 +71,7 @@
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.3",
"webpack-merge": "^4.1.4",
"yoho-activity-sdk": "1.0.8"
"yoho-activity-sdk": "1.0.9"
},
"author": "陈峰 <feng.chen@yoho.cn>",
"license": "ISC",
... ...
... ... @@ -33,7 +33,7 @@ let plugins = [
return new HtmlWebpackPlugin({
filename: title + '.html',
template: './index.ejs',
title,
title: appHtmls[title],
inject: true,
})
}));
... ...
... ... @@ -6218,6 +6218,6 @@ yargs@^7.0.0:
y18n "^3.2.1"
yargs-parser "^5.0.0"
yoho-activity-sdk@1.0.8:
version "1.0.8"
resolved "http://npm.yohops.com/yoho-activity-sdk/-/yoho-activity-sdk-1.0.8.tgz#e78bb0dbf25c22e97dd6aa283e1e4fc27659c154"
yoho-activity-sdk@1.0.9:
version "1.0.9"
resolved "http://npm.yohops.com/yoho-activity-sdk/-/yoho-activity-sdk-1.0.9.tgz#96ad94b9d4d1aaf3405326b5eeedc2a0230c61f7"
... ...