Authored by 李靖

Merge branch 'master' into feature/trendRecode

Showing 52 changed files with 1462 additions and 370 deletions
... ... @@ -4,4 +4,4 @@ coverage
public/static/js-sdk
public/static/yas-jssdk
public/js/home/jquery.upload.js
public/js/activity/live/yas_live_data.js
public/js/activity/live
... ...
'use strict';
const questionModel = require('../models/question');
const headerModel = require('../../../doraemon/models/header'); // 头部model
exports.list = (req, res, next) => {
req.ctx(questionModel).getQuestionList().then(result => {
res.render('question/list', {
title: '调研中心',
module: '3party',
page: 'question-list',
pageHeader: headerModel.setNav({
navTitle: '调研中心'
}),
list: result,
isApp: req.yoho.isApp,
localCss: true
});
}).catch(next);
};
exports.check = (req, res, next) => {
let params = req.body;
params.uid = req.user.uid || params.uid;
if (!params.uid) {
return res.send({code: 400, message: '请先登录!'});
}
req.ctx(questionModel).getQuestionStatus(params).then(result => {
res.send(result);
}).catch(next);
};
exports.submit = (req, res, next) => {
let params = req.body;
params.uid = req.user.uid || params.uid;
if (!params.uid) {
return res.send({code: 400, message: '请先登录!'});
}
// 标识问卷来源
if (req.yoho.isApp) {
params.sourceType = 'APP';
} else if (req.yoho.mobile) {
params.sourceType = 'H5';
} else {
params.sourceType = 'PC';
}
req.ctx(questionModel).submitQuestion(params).then(result => {
res.send(result);
}).catch(next);
};
exports.detail = (req, res, next) => {
let id = parseInt(`0${req.params.id}`, 10);
req.ctx(questionModel).getQuestionDetail(id, req.user.uid).then(result => {
if (result && result.detail && req.yoho.isApp) {
result.detail.uid = req.user.uid;
}
res.render('question/detail', Object.assign(result, {
title: 'YOHO!调研中心',
module: '3party',
page: 'question-detail',
pageHeader: headerModel.setNav({
navTitle: 'YOHO!调研中心'
}),
isApp: req.yoho.isApp,
localCss: true
}));
}).catch(next);
};
... ...
/**
* question model
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/05/23
*/
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getQuestionList() {
return this.get({
url: 'activity/question/questionList',
api: global.yoho.ServiceAPI
}).then(result => {
let list = _.get(result, 'data.rows', []);
_.forEach(list, (value, key) => {
value.index = key + 1;
if (!_.get(value, 'share.imgUrl', '')) {
_.set(value, 'share.imgUrl', 'http://img11.static.yhbimg.com/sns/2017/05/25/14/0177e28a98f73417ae1a2a146aa2670dd2.png'); // eslint-disable-line
}
});
return list;
});
}
getQuestionStatus(params) {
return this.get({
url: '/activity/question/questionValidate',
data: params,
api: global.yoho.ServiceAPI
});
}
getQuestionDetail(id, uid) {
return Promise.all([
this.get({
url: '/activity/question/questionValidate',
data: {id: id, uid: uid},
api: global.yoho.ServiceAPI
}),
this.get({
url: 'activity/question/questionDetail',
data: {id: id},
api: global.yoho.ServiceAPI
})
]).then(result => {
let resData = {};
if (_.get(result, '[0].code', '') === 200) {
let data = _.get(result, '[1].data', {});
if (data.questions) {
_.forEach(data.questions, value => {
if (+value.questionType === 3) {
value.questionContents = _.fill(Array(value.fillBlankNum || 1), true);
}
});
}
if (!_.isEmpty(data)) {
resData.detail = data;
}
} else {
resData.errText = _.get(result, '[0].message', '哟,本次调研已经飞走了,请移步其他调研呗!');
}
return resData;
});
}
submitQuestion(info) {
return this.post({
url: '/activity/question/submitQuestions',
data: info,
api: global.yoho.ServiceAPI
});
}
};
... ...
... ... @@ -10,7 +10,9 @@ const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const ads = require(`${cRoot}/ads`);
const check = require(`${cRoot}/check`);
const question = require(`${cRoot}/question`);
const validateCode = require('../passport/controllers/validateCode');
const auth = require('../../doraemon/middleware/auth');
// routers
... ... @@ -18,4 +20,10 @@ router.get('/ads', ads.index);
router.get('/check', validateCode.load, check.index);
router.post('/check/submit', validateCode.check, check.submit);
router.get('/questionnaire', auth, question.list);
router.post('/questionnaire/check', question.check);
router.post('/questionnaire/submit', question.submit);
router.get('/questionnaire/:id', auth, question.detail);
module.exports = router;
... ...
<div class="qs-detail-page">
{{# detail}}
<div class="error-tip"></div>
<div class="detail-wrap">
<p class="sub-title">{{title}}</p>
<p class="guide-tip">{{description}}</p>
<div id="qs-wrap" class="qs-wrap" data-id="{{id}}" data-cid="{{uid}}" data-title="{{share.title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">
{{# questions}}
<dl class="qs-item" data-index="{{questionIndex}}" data-type="{{questionType}}">
<dt>{{questionTitle}}</dt>
{{#isEqualOr questionType 1}}
{{# questionContents}}
<dd class="radio-option" data-index="{{@index}}">
<span class="iconfont">&#xe6ea;</span>
<div class="option-box">{{{option}}}</div>
{{#if addon}}
<input type="text">
{{/if}}
</dd>
{{/ questionContents}}
{{/isEqualOr}}
{{#isEqualOr questionType 2}}
{{# questionContents}}
<dd class="check-option" data-index="{{@index}}">
<span class="iconfont">&#xe6ea;</span>
<div class="option-box">{{{option}}}</div>
{{#if addon}}
<input type="text">
{{/if}}
</dd>
{{/ questionContents}}
{{/isEqualOr}}
{{#isEqualOr questionType 3}}
{{# questionContents}}
<dd><textarea class="text-input"></textarea></dd>
{{/ questionContents}}
{{/isEqualOr}}
</dl>
{{/ questions}}
</div>
<div class="submit">
<button class="submit-btn">提交</button>
</div>
</div>
{{/ detail}}
<div class="qs-err">
<p class="err-text">{{{errText}}}</p>
<a href="/3party/questionnaire">去做问卷</a>
</div>
<div id="tip-dialog" class="tip-dialog hide">
<div class="dg-wrap">
<div class="dg-content"><p>您的问卷还没有成功提交哦!<br>是否立刻返回!</p></div>
<div class="dg-btns clearfix">
<span class="back-btn">返回</span>
<span class="close-btn continue-btn">继续填写</span>
</div>
</div>
</div>
</div>
... ...
<div class="qs-list-page">
{{#if list}}
<ul id="qs-list" class="qs-list">
{{#each list}}
<li data-id="{{id}}" data-title="{{title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">{{index}}.{{title}}</li>
{{/each}}
</ul>
{{/if}}
<div id="tip-dialog" class="tip-dialog hide">
<div class="dg-wrap">
<div class="dg-content"></div>
<div class="dg-btns sure-btns clearfix hide">
<span class="close-btn sure-btn">确定</span>
</div>
<div class="dg-btns share-btns clearfix">
<span class="close-btn cancel-btn">取消</span>
<span class="share-btn">分享问卷</span>
</div>
</div>
</div>
</div>
... ...
... ... @@ -9,13 +9,21 @@ exports.index = function(req, res, next) {
if (!result) {
return next();
}
let title = req.query.title || result.name || '专题活动';
// 唤起 APP 的路径
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${req.query.share_id}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${req.query.share_id}"},"title":"${title}","url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
res.render('feature/index', {
module: 'activity',
page: 'feature',
title: result.name || 'Yoho!Buy有货',
title: title,
content: result,
activity_id: req.params.code,
isFeature: true
isFeature: true,
loadJs: [{
src: global.yoho.config.jsSdk
}]
});
}).catch(next);
};
... ...
... ... @@ -17,7 +17,8 @@ exports.productLst = function(req, res, next) {
uid: uid,
udid: udid,
yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1,
limit: req.query.limit
limit: req.query.limit,
gender: req.query.gender
}, req.query));
} else {
let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
... ...
... ... @@ -24,6 +24,11 @@ let _getProduct = function(o) {
};
};
const gender = {
1: '1,3',
2: '2,3'
};
module.exports = {
productLst: function(params) {
return api.get('', Object.assign({
... ... @@ -47,7 +52,9 @@ module.exports = {
udid: params.udid || 0,
yh_channel: params.yh_channel,
limit: params.limit,
need_filter: 'null'
need_filter: 'null',
rec_pos: '100008',
gender: params.gender || gender[params.yh_channel]
}, {
cache: true
}).then(res => {
... ...
... ... @@ -22,9 +22,9 @@
style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=75}}">
<img class="lazy" data-original="{{imageslim param.bgimg}}">
{{else}}
<img src="{{image2 param.bgimg q=75}}">
<img src="{{imageslim param.bgimg}}">
{{/isLazyLoad}}
{{/if}}
{{#component}}
... ... @@ -34,7 +34,7 @@
{{#if modalImg}}
<div class="modal">
<span class="modal-close"></span>
<img class="modal-img lazy" data-original="{{image2 modalImg q=75}}">
<img class="modal-img lazy" data-original="{{imageslim modalImg}}">
</div>
{{/if}}
{{/isEqualOr}}
... ... @@ -66,7 +66,7 @@
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=75}}">
<img src="{{imageslim src}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
... ... @@ -88,7 +88,7 @@
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=75}}) repeat;background-size:100%;"{{/if}}>
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{imageslim proBgImg}}) repeat;background-size:100%;"{{/if}}>
<div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
{{#unless defaultPros.length}}
{{#if searchCondition.item}}
... ... @@ -103,9 +103,9 @@
<div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
<a class="first-part product-detail" href='{{producturl}}'>
<div class="product-detail-imgbox">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=75}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=75}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{image2 productimg q=75}}">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{imageslim ../lefTopImg}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{imageslim ../rigTopImg}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{imageslim productimg}}">
</div>
{{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
<div class="product-detail-text">
... ... @@ -128,7 +128,7 @@
<div class="brand-div">
<span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
</div>
<img class="brand-img lazy" data-original="{{image2 ../brandImg q=75}}">
<img class="brand-img lazy" data-original="{{imageslim ../brandImg}}">
</a>
{{/if}}
</div>
... ... @@ -137,8 +137,8 @@
<div class="feature-product-info novisible">
<a class="first-part product-detail" href=''>
<div class="product-detail-imgbox">
{{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=75}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=75}}">{{/if}}
{{#if lefTopImg}}<img class="leftopimg" src="{{imageslim lefTopImg}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{imageslim rigTopImg}}">{{/if}}
<img class="product-detail-img" src="">
</div>
{{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
... ... @@ -161,7 +161,7 @@
<div class="brand-div">
<span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
</div>
<img class="brand-img" src="{{image2 brandImg q=75}}">
<img class="brand-img" src="{{imageslim brandImg}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -15,6 +15,10 @@ let configFile = `
{
"appID": "EX33S4LRW7.com.yoho.buy",
"paths": [ "*" ]
},
{
"appID": "FP8T8KM2NE.com.yoho.buy.c3",
"paths": [ "*" ]
}
]
}
... ...
... ... @@ -71,9 +71,10 @@ exports.orderEnsure = (req, res, next) => {
];
/* tar note 170426 品众去除 */
// if (_.isUndefined(req.cookies._isNewUser)) {
// allPromise.push(orderModel.isNewUser(uid));
// }
/* tar note 170601 品众代码恢复 */
if (_.isUndefined(req.cookies._isNewUser)) {
allPromise.push(orderModel.isNewUser(uid));
}
return Promise.all(allPromise).then(result => {
let order = result[0];
... ... @@ -81,15 +82,16 @@ exports.orderEnsure = (req, res, next) => {
let address = result[2];
/* tar note 170426 品众去除 */
// let isNewUser = result[3];
// if (!_.isUndefined(isNewUser)) {
// if (isNewUser) {
// res.cookie('_isNewUser', true, actCkOpthn);
// } else {
// res.cookie('_isNewUser', false, actCkOpthn);
// }
// }
/* tar note 170601 品众代码恢复 */
let isNewUser = result[3];
if (!_.isUndefined(isNewUser)) {
if (isNewUser) {
res.cookie('_isNewUser', true, actCkOpthn);
} else {
res.cookie('_isNewUser', false, actCkOpthn);
}
}
if (order.cartUrl) {
logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`);
... ...
... ... @@ -107,7 +107,7 @@ const tools = {
nonce_str: common.nonceStr(),
body: '有货订单号:' + params.orderCode,
out_trade_no: 'YOHOBuy_' + params.orderCode,
total_fee: _.parseInt(params.totalFee * 100),
total_fee: Math.round(params.totalFee * 100),
trade_type: 'JSAPI',
time_start: moment().format('YYYYMMDDHHmmss'),
time_expire: moment().add(2, 'hours').format('YYYYMMDDHHmmss'),
... ...
... ... @@ -117,6 +117,7 @@ router.get('/passport/reg/index', validateCode.load, reg.index);
router.post('/passport/reg/verifymobile', validateCode.check, reg.sendCodeBusyBoy, reg.verifyMobile);
router.get('/passport/reg/code', reg.guardStep(2), reg.code);
router.post('/passport/reg/sendcode', reg.guardStep(2), reg.sendCodeBusyBoy, reg.sendCode);
router.post('/passport/reg/sendcodeagain', reg.guardStep(2), reg.sendCodeBusyBoy, reg.sendCode);
router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode);
router.get('/passport/reg/password', reg.guardStep(3), reg.password);
router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword);
... ...
... ... @@ -39,7 +39,6 @@
{{/ goodsSubtitle}}
<div class="price-date">
<div class="goods-price data-bind">
<h1 class="current-price"></h1>
<h1 class="previous-price"></h1>
... ... @@ -47,13 +46,13 @@
<button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button>
<button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button>
<button class="got-limit-sale data-got-code data-bind">已获取限购码</button>
{{#if periodOfMarket}}
<div class="period-of-market">
<h1>上市期:</h1>
<h1 >{{periodOfMarket}}</h1>
</div>
{{/if}}
</div>
{{#if periodOfMarket}}
<div class="period-of-market">
<h1>上市期:</h1>
<h1 >{{periodOfMarket}}</h1>
</div>
{{/if}}
<div class="price-date data-bind">
<div class="student-price">
... ...
... ... @@ -52,14 +52,13 @@
<button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button>
<button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button>
<button class="got-limit-sale data-got-code data-bind">已获取限购码</button>
{{#if periodOfMarket}}
<div class="period-of-market">
<h1>上市期:</h1>
<h1 >{{periodOfMarket}}</h1>
</div>
{{/if}}
</div>
{{#if periodOfMarket}}
<div class="period-of-market">
<h1>上市期:</h1>
<h1 >{{periodOfMarket}}</h1>
</div>
{{/if}}
{{!--占位: 学生价/会员价--}}
<div id="placeholder-pricedata"></div>
... ...
... ... @@ -16,14 +16,16 @@
{{/within}}
{{/if}}
</a>
{{#ifor isGood four}}
{{#if showProductInfo}}
<div class="item-info">
<div class="text">{{text}}</div>
<div class="name">{{name}}</div>
<div class="price">{{salesPrice}}</div>
</div>
{{/if}}
{{/ifor}}
{{#if showProductInfo}}
{{#ifor isGood four}}
{{#unless parent.noShowProductInfo}}
<div class="item-info">
<div class="text">{{text}}</div>
<div class="name">{{name}}</div>
<div class="price">{{salesPrice}}</div>
</div>
{{/unless}}
{{/ifor}}
{{/if}}
</div>
... ...
... ... @@ -51,7 +51,7 @@
{{#isEqual module_type 'SingleImage'}}
<div class="items-s1 clearfix">
{{#each ../pics}}
{{> reds-shop/item index=@../index single=true}}
{{> reds-shop/item index=@../index single=true parent=../..}}
{{/each}}
</div>
{{#if ../isModuleMargin}}
... ... @@ -61,7 +61,7 @@
{{#isEqual module_type 'DoubleImage'}}
<div class="items-s2 clearfix">
{{#each ../pics}}
{{> reds-shop/item index=@../index double=true}}
{{> reds-shop/item index=@../index double=true parent=../..}}
{{/each}}
</div>
{{#if ../isModuleMargin}}
... ... @@ -71,7 +71,7 @@
{{#isEqual module_type 'TripleImage'}}
<div class="{{#isEqual ../displayType 1}}items-3-3{{/isEqual}}{{#isEqual ../displayType 2}}items-3-3 items-small{{/isEqual}}{{#isEqual ../displayType 3}}items-3-2 items-3-2-right{{/isEqual}}{{#isEqual ../displayType 4}}items-3-2 items-3-2-left{{/isEqual}} clearfix">
{{#each ../pics}}
{{> reds-shop/item index=@../index triple=true}}
{{> reds-shop/item index=@../index triple=true parent=../..}}
{{/each}}
</div>
{{#if ../isModuleMargin}}
... ...
... ... @@ -3,8 +3,8 @@
<!--im 头部-->
<header class="yoho-header chat-header">
<a id="js-back" href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
<div class="title">智能小YO</div>
<div class="header-right"><span data-action="change-human">人工客服</span></div>
<div class="title"><i class="chat-status"></i><span class="js-service-txt">正在连接...</span></div>
<div class="header-right"></div>
</header>
<!--网络连接失败-->
<div class="connection-failed hide">
... ... @@ -16,7 +16,7 @@
</div>
<div class="fake-img-wrap">
<img src="#" alt="">
</div>
</div>
<!--im footer-->
<footer id="chat-footer">
<div id="chat-send-box" class="table">
... ... @@ -71,4 +71,4 @@
imSocket: "{{imSocket}}",
imCs: "{{imCs}}",
};
</script>
\ No newline at end of file
</script>
... ...
... ... @@ -28,4 +28,12 @@
<span>400-889-9646</span>
<i class="arr-ico iconfont">&#xe604;</i>
</a>
<a class="list clearfix" href="/3party/questionnaire">
<i class="questionnaire-ico icon"></i>
<div>
<p class="title">调研中心</p>
<p class="tip">一起来参与,赢取更多惊喜!</p>
</div>
<i class="arr-ico iconfont">&#xe604;</i>
</a>
</div>
... ...
... ... @@ -25,7 +25,7 @@ const domains = {
module.exports = {
app: 'h5',
appVersion: '5.7.0', // 调用api的版本
appVersion: '5.7.1', // 调用api的版本
port: 6001,
siteUrl: '//m.yohobuy.com',
assetUrl: '//127.0.0.1:5001',
... ...
... ... @@ -51,6 +51,7 @@ module.exports = () => {
yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') ||
(req.query.appVersion && req.query.appVersion !== 'false') ||
req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || '');
yoho.isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('User-Agent') || ''); // eslint-disable-line
yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
yoho.isWeibo = ua.indexOf('weibo') !== -1;
yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || '');
... ...
... ... @@ -26,7 +26,7 @@
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
if (isWechat) {
document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', '');
(function () { if (typeof (WeixinJSBridge) == "undefined") { document.addEventListener("WeixinJSBridgeReady", function (a) { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (b) { }) }, 0) }) } else { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (a) { }) }, 0) } })();
(function(){function setWechatSize(){if(typeof WeixinJSBridge!=="undefined"&&WeixinJSBridge.invoke){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(){})}}if(typeof WeixinJSBridge!=="undefined"){setTimeout(setWechatSize,0)}else{document.addEventListener("WeixinJSBridgeReady",function(){setTimeout(setWechatSize,0)})};}());
}
</script>
... ... @@ -124,9 +124,6 @@
{{#loadJs}}
<script type="text/javascript" src="{{src}}"></script>
{{/loadJs}}
{{#isFeature}}
<script type="text/javascript" src="//cdn.yoho.cn/js-sdk/1.2.2/jssdk.js"></script>
{{/isFeature}}
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
... ...
... ... @@ -76,7 +76,8 @@
}());
{{!--/* tar add 170426 品众代码去除 */--}}
{{!--window._fxcmd = window._fxcmd || [];
{{!--/* tar add 170601 品众代码恢复 */--}}
window._fxcmd = window._fxcmd || [];
_fxcmd.sid = 'bb3b16fa1106a6ab8619da0095755f32';
_fxcmd.trackAll = false;
// 参数配置(可选)...
... ... @@ -89,7 +90,7 @@
_pzfx.src = '//static.w3t.cn/fx/1/1/fx.js';
var sc = document.getElementsByTagName('script')[0];
sc.parentNode.insertBefore(_pzfx,sc);
}, 1000);--}}
}, 1000);
</script>
... ...
{
"name": "m-yohobuy-node",
"version": "5.7.2",
"version": "5.7.11",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -103,7 +103,7 @@
"yoho-fastclick": "^1.0.6",
"yoho-hammer": "^2.0.7",
"yoho-iscroll": "^5.2.0",
"yoho-jquery": "^2.2.4",
"yoho-jquery": "^1.12.4",
"yoho-jquery-lazyload": "^1.9.12",
"yoho-jquery-qrcode": "^0.14.0",
"yoho-mlellipsis": "0.0.3",
... ...
... ... @@ -4,7 +4,7 @@ const path = require('path');
const info = {
host: '127.0.0.1',
port: 5001,
publicPath: 'http://127.0.0.1:5001'
publicPath: 'http://127.0.0.1:5001/'
};
try {
... ...
require('3party/question-detail.page.css');
let $ = require('yoho-jquery'),
yoho = require('yoho-app'),
tipDg = require('plugin/tip'),
share = require('common/share');
let question = {
$base: $('#qs-wrap'),
init: function() {
let that = this;
this.$errTip = $('.error-tip');
this.$item = $('.qs-item', this.$base);
this.startTime = Date.parse(new Date()) / 1000;
if (this.$base.length) {
let data = this.$base.data();
this.shareInfo = {
title: data.title,
link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
desc: data.desc,
imgUrl: data.img
};
// 设置分享信息
share(this.shareInfo);
// 设置app页面信息及分享信息
if (yoho.isApp) {
yoho.ready(function() {
yoho.invokeMethod('get.pageType', {
pageType: 'questionnaire'
});
yoho.invokeMethod('set.shareInfo', that.shareInfo);
});
}
}
this.bindEvent();
},
bindEvent: function() {
let that = this;
this.$base.on('click', '.radio-option', function() {
let $this = $(this);
if (!$this.hasClass('on')) {
$this.siblings('.on').removeClass('on');
$this.addClass('on');
}
}).on('click', '.check-option', function() {
let $this = $(this);
if ($this.hasClass('on')) {
$this.removeClass('on');
} else {
$this.addClass('on');
}
}).on('click', 'input', function(e) {
if (e && e.stopPropagation) {
e.stopPropagation();
} else {
window.event.cancelBubble = true;
}
});
$('.submit-btn').click(function() {
that.saveAnswers(that.packAnswersInfo());
});
},
packAnswersInfo: function() {
let that = this;
let answer = [];
let $errDom;
this.$item.each(function() {
if ($errDom) {
return;
}
let $this = $(this);
let data = $this.data();
let ans = [];
let errText = '';
if (+data.type === 3) {
$this.find('.text-input').each(function() {
let val = $.trim($(this).val());
if (val) {
ans.push({
questionIndex: data.index,
answerIndex: ans.length,
addon: val
});
}
if (val.length > 400) {
errText = '输入内容过长';
}
});
} else {
$this.find('.on').each(function() {
let $that = $(this),
$input = $that.find('input'),
a = {
questionIndex: data.index,
answerIndex: $that.data('index')
};
if ($input && $input.length) {
a.addon = $input.val();
}
ans.push(a);
});
if (data.type === '1') {
ans.length = 1;
}
}
if (errText || !ans.length) {
$errDom = $this;
if (!errText) {
errText = +data.type === 3 ? '请填写一条回答' : '请选择一个选项';
}
that.showError(errText, $errDom);
} else {
answer = $.merge(answer, ans);
}
});
if ($errDom) {
return [];
} else {
return answer;
}
},
showError: function(tip, $errDom) {
let that = this;
this.$errTip.html(tip);
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(function() {
that.$errTip.empty();
}, 5000);
if ($errDom) {
let offTop = $errDom.offset().top,
errHeight = this.$errTip.outerHeight();
$('html,body').animate({scrollTop: offTop - errHeight}, 500);
}
},
saveAnswers: function(info) {
if (!info || !info.length) {
return;
}
$.ajax({
type: 'POST',
url: '/3party/questionnaire/submit',
data: {
id: this.$base.data('id'),
uid: this.$base.data('cid'),
startTime: this.startTime,
endTime: Date.parse(new Date()) / 1000,
frontAnswers: JSON.stringify(info)
}
}).then(function(data) {
if (data.code === 200) {
tipDg.show('调查问卷已成功提交,感谢您的帮助!');
setTimeout(function() {
if (yoho.isApp) {
yoho.invokeMethod('go.back');
} else {
window.history.go(-1);
}
}, 2000);
} else {
tipDg.show(data.message || '网络出了点问题~');
}
});
}
};
let tipDialog = {
$base: $('#tip-dialog'),
init: function() {
var that = this;
this.$base.on('click', '.close-btn', function() {
that.hide();
});
this.$base.on('click', '.back-btn', function() {
window.history.go(-1);
});
},
show: function() {
this.$base.removeClass('hide');
},
hide: function() {
this.$base.addClass('hide');
}
};
tipDialog.init();
question.init();
if (question.$base.length) {
$('.nav-back').removeAttr('href').click(function() {
tipDialog.show();
});
} else if (yoho.isApp) {
$('.qs-err a').removeAttr('href').click(function() {
yoho.invokeMethod('go.back');
});
}
... ...
'use strict';
require('3party/question-list.page.css');
let $ = require('yoho-jquery'),
yoho = require('yoho-app');
const DETAIL_URI = 'http://m.yohobuy.com/3party/questionnaire';
require('../common');
let qs = window.queryString;
function getQuestionStatus(reqData, cb) {
if (qs.uid) {
reqData.uid = qs.uid;
}
$.ajax({
type: 'POST',
url: '/3party/questionnaire/check',
data: reqData
}).then(function(data) {
if (cb && typeof cb === 'function') {
return cb(data);
}
});
}
function jumpQuestionDetail(data) {
let href;
if (qs && qs.uid && yoho.isApp) {
href = DETAIL_URI + '/' + data.id + '?uid=' + qs.uid;
} else {
href = DETAIL_URI + '/' + data.id;
}
if (yoho && yoho.isApp) {
let link = yoho.parseUrl(href);
yoho.goH5(href, JSON.stringify({
action: 'go.h5',
params: {
islogin: 'N',
type: 14,
updateflag: Date.now() + '',
url: link.path,
param: link.query
}
}));
} else {
window.location.href = href;
}
}
let tipDialog = {
$base: $('#tip-dialog'),
init: function() {
let that = this;
this.$content = $('.dg-content', this.$base);
this.$sureBtns = $('.sure-btns', this.$base);
this.$shareBtns = $('.share-btns', this.$base);
this.$base.on('click', '.close-btn', function() {
that.hide();
});
this.$base.on('click', '.share-btn', function() {
if (that.share && typeof that.share === 'function') {
that.share();
} else {
that.hide();
}
});
},
show: function(info) {
this.share = false;
if (typeof info === 'object') {
this.$content.html(info.content);
this.$sureBtns.addClass('hide');
this.$shareBtns.removeClass('hide');
} else if (typeof info === 'string') {
this.$content.html('<p>' + info + '</p>');
this.$sureBtns.removeClass('hide');
this.$shareBtns.addClass('hide');
} else {
return;
}
this.$base.removeClass('hide');
},
hide: function() {
this.$base.addClass('hide');
}
};
tipDialog.init();
let $list = $('#qs-list');
$list.on('click', 'li', function() {
let data = $(this).data();
if (!data.id) {
return;
}
getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
if (resData.code === 200) {
jumpQuestionDetail(data);
} else if (resData.code === 206) {
if (yoho && yoho.isApp) {
yoho.invokeMethod('go.showShareAlert', {
title: data.title,
link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
desc: data.desc,
imgUrl: data.img
});
} else {
tipDialog.show('调查问卷已成功提交,<br>感谢您的帮助!');
}
} else if (resData.message) {
if (yoho && yoho.isApp) {
yoho.goH5(DETAIL_URI + '/0');
} else {
window.location.href = DETAIL_URI + '/0';
}
}
});
});
if ($list.children().length === 1) {
let data = $list.children().first().data();
getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
if (resData.code === 200) {
jumpQuestionDetail(data);
}
});
}
... ...
... ... @@ -4,26 +4,26 @@
* 直播或重播页面上方浮动的下载提示
* 用于跳转到对应的app页面或进入下载页面
*/
let is_wechat = false; //是否在微信中
let is_weibo = false; //是否在微博中
let is_ios = false; //是否是ios
let is_android = false; //是否是android
let is_pod = false;
let is_pc = false;
let $btn_download; //下载按钮
let $btn_close; //关闭按钮
let $download_head_wrapper; //下载div最外部分
let $download_head; //下载div fixed部分
let $download_msg; //在微信中点击下载弹出的提示部分
//let app_ios = 'mtmv://lives?id=6141903674538004481';
let app_ios = 'yohoefashion4In1://'; //ios的scheme
let app_android = 'yohoefashion4In1://'; //android的scheme
let download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址
let download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址
let queryArr = []; //地址栏参数
let date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面
var is_wechat = false; //是否在微信中
var is_weibo = false; //是否在微博中
var is_ios = false; //是否是ios
var is_android = false; //是否是android
var is_pod = false;
var is_pc = false;
var $btn_download; //下载按钮
var $btn_close; //关闭按钮
var $download_head_wrapper; //下载div最外部分
var $download_head; //下载div fixed部分
var $download_msg; //在微信中点击下载弹出的提示部分
//var app_ios = 'mtmv://lives?id=6141903674538004481';
var app_ios = 'yohoefashion4In1://'; //ios的scheme
var app_android = 'yohoefashion4In1://'; //android的scheme
var download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址
var download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址
var queryArr = []; //地址栏参数
var date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面
/**
* 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为
... ... @@ -32,8 +32,8 @@ let date_start; //銝蝸嚗鈭恣蝞歲頧
* @param link 对应的下载地址
*/
function openAppOrLink(app, link) {
let ifrSrc;
let ifr;
var ifrSrc;
var ifr;
if (is_android) {
//安卓基本上打不开app,只能打开下载地址。。。
date_start = new Date();
... ... @@ -46,8 +46,8 @@ function openAppOrLink(app, link) {
document.body.appendChild(ifr);
setTimeout(function() {
let date_end = new Date();
/*let p = document.createElement('p');
var date_end = new Date();
/*var p = document.createElement('p');
p.innerHTML = date_end - date_start
document.body.appendChild(p);*/
if (date_end.getTime() - date_start.getTime() < 1300) {
... ... @@ -69,7 +69,7 @@ function openAppOrLink(app, link) {
if (!is_pod) {
document.location.href = app;
setTimeout(function() {
let date_end = new Date();
var date_end = new Date();
if (!is_pod) {
if (date_end.getTime() - date_start.getTime() < 1200) {
document.location.href = link;
... ... @@ -80,7 +80,7 @@ function openAppOrLink(app, link) {
} else {
document.location.href = app;
setTimeout(function() {
let date_end = new Date();
var date_end = new Date();
if (is_pod) {
//$('.live-app-desc p').eq(0).text(date_end.getTime() - date_start.getTime());
if (date_end.getTime() - date_start.getTime() < 2003) {
... ... @@ -103,8 +103,8 @@ function openAppOrLink(app, link) {
document.body.appendChild(ifr);
setTimeout(function() {
let date_end = new Date();
/*let p = document.createElement('p');
var date_end = new Date();
/*var p = document.createElement('p');
p.innerHTML = date_end - date_start
document.body.appendChild(p);*/
//alert(date_end.getTime() - date_start.getTime());
... ... @@ -137,7 +137,7 @@ function get_download_link() {
* @returns {boolean}
*/
function check_supperUniversalLink() {
let osversion = navigator.userAgent.match(/iPhone OS (\d*)/);
var osversion = navigator.userAgent.match(/iPhone OS (\d*)/);
//console.log(osversion && osversion[1]);
return osversion && osversion[1];
/*if (osversion && osversion[1] >= 9) {
... ... @@ -166,10 +166,10 @@ function show_download_msg() {
* @constructor
*/
function ManageQueryString() {
let loc = document.location.href;
let variables = '';
let variableArr = [];
let finalArr = [];
var loc = document.location.href;
var variables = '';
var variableArr = [];
var finalArr = [];
if (loc.indexOf('?') > 0) {
variables = loc.split('?')[1];
... ... @@ -179,8 +179,8 @@ function ManageQueryString() {
variableArr = variables.split('&');
}
for (let i = 0; i < variableArr.length; i++) {
let obj = {};
for (var i = 0; i < variableArr.length; i++) {
var obj = {};
obj.name = variableArr[i].split('=')[0];
obj.value = variableArr[i].split('=')[1];
finalArr.push(obj);
... ... @@ -197,8 +197,8 @@ function ManageQueryString() {
*/
function getQueryString(arr, name) {
if (arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
let obj = arr[i];
for (var i = 0; i < arr.length; i++) {
var obj = arr[i];
if (obj.name == name) {
return obj.value;
}
... ... @@ -207,7 +207,7 @@ function getQueryString(arr, name) {
}
function check_sys_open() {
let download_type = '';
var download_type = '';
if (is_android) {
download_type = 'android';
openAppOrLink(app_android, download_android);
... ... @@ -227,11 +227,11 @@ function check_sys_open() {
$(document).ready(function() {
let location = document.location.href;
var location = document.location.href;
queryArr = ManageQueryString();
let is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app
var is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app
let agent = navigator.userAgent.toLowerCase();
var agent = navigator.userAgent.toLowerCase();
//判断环境
if (agent.match(/android/i) == 'android') {
... ... @@ -283,7 +283,7 @@ $(document).ready(function() {
$download_msg = $('.live-app-download-msg'); //提示在浏览器中打开
$btn_download.on('click', function() { //点击下载按钮
let download_type = '';
var download_type = '';
if (is_android) {
download_type = 'android';
openAppOrLink(app_android, download_android);
... ...
... ... @@ -9,19 +9,19 @@ global.msg_obj = [
'{"avatar": "http://img01.yohoboys.com/contentimg/2016/06/15/14/012b97d00097fd444bd8f830ed2e8fe54e.jpg", "cmd": 5, "msg": "别和小编太较真", "name": "YOHO_187****1007", "room": 19177}'
];
let replay_msg = [];
var replay_msg = [];
(function() {
for (let i = 0; i < 300; i++) {
let time = 5 + i * 2;
let rand = Math.floor(Math.random() * 2);
let msg = '';
for (var i = 0; i < 300; i++) {
var time = 5 + i * 2;
var rand = Math.floor(Math.random() * 2);
var msg = '';
if (rand === 1) {
msg = '{"createtime":' + time + ',"avatar":"","name":"\u8c2d\u660e\u4e54' + i + '","msg":"测试消息测试消息测试消息测试消息测试消息测试消息' + i + '","cmd":"5"}'
} else {
msg = '{"createtime":' + time + ',"avatar":"http:\/\/avatar.jpg","name":"测试登录' + i + '","msg":"","cmd":"4"}';
}
let j = JSON.parse(msg);
var j = JSON.parse(msg);
replay_msg.push(j);
}
})();
... ...
// 初始化config信息
let _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号
var _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号
$.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
if (json && json !== '') {
let _appId = json.appId.toString();
let _timestamp = json.timestamp;
let _nonceStr = json.nonceStr.toString();
let _signature = json.signature.toString();
var _appId = json.appId.toString();
var _timestamp = json.timestamp;
var _nonceStr = json.nonceStr.toString();
var _signature = json.signature.toString();
window.wx.config({
debug: true,
... ... @@ -59,11 +59,11 @@ $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#
function share() {
window.wx.ready(function() {
// 构造分享信息
let shareTitle = $('#shareTitle').val();
let shareImg = $('#shareImg').val();
let shareDesc = $('#shareDesc').val();
let shareLink = $('#shareLink').val();
let shareData = {
var shareTitle = $('#shareTitle').val();
var shareImg = $('#shareImg').val();
var shareDesc = $('#shareDesc').val();
var shareLink = $('#shareLink').val();
var shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
... ...
... ... @@ -3,12 +3,12 @@
* 用于处理一些统计数据
*/
let live_data_type = [
var live_data_type = [
'M_LIVE_DOWNLOAD_APP_TOP',
'M_LIVE_DOWNLOAD_APP_CENTER',
'M_LIVE_PLAYBUTTON_CLICK',
'M_LIVE_SHARE'];
let play_count = 0;
var play_count = 0;
function send_data(obj) {
console.log(obj);
... ... @@ -18,21 +18,21 @@ function send_data(obj) {
}
function get_live_data() {
let data_prefix = 'YOHOBOYS';
var data_prefix = 'YOHOBOYS';
if (document.location.hostname.indexOf('boy') > 0) {
data_prefix = 'YOHOBOYS';
} else if (document.location.hostname.indexOf('girl') > 0) {
data_prefix = 'YOHOGIRLS';
}
let data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0];
let data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1];
var data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0];
var data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1];
console.log(data_type, data_value);
if (data_type != 0 && data_prefix != '') {
let data_type_str = data_prefix + live_data_type[data_type - 1];
let obj = {};
var data_type_str = data_prefix + live_data_type[data_type - 1];
var obj = {};
obj.type = data_type_str;
if (data_value != 0) {
... ...
... ... @@ -13,44 +13,44 @@
* manage_replay_chat_msg ===> 通过requestAnimationFrame每帧调用用于判断是否可以展示重播消息和点赞
* replay_barrage_callback_handler ===> 由video的各个事件中调取的callback方法
*/
let prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
let requestAnimationFrame = window.requestAnimationFrame;
let cancelAnimationFrame = window.cancelAnimationFrame;
let site_url = STATIC_RESOURCE_PATH;
let $btn_play;
let video_width = 375;
let video_height = 667;
let video_id = 'yoho_live'; //视频video标签id
let is_live = true; //是否是直播,根据地址栏参数可以判断
let get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口
let get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕
let query_arr = []; //地址栏参数数组
let link_type = 'webksocket'; //连接类型
let live_ws; //websocket
let heart_beat_interval; //心跳计时器
let live_time_interval; //播放时间计时器
let live_duration = 0; //播放时间计数器
let now_like_nums = 0; //当前点赞数
let $live_like_pannel; //点赞div,用于存放小脸动画
let is_animate = false; //用于控制动画的频率
let replay_video;
let replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕
let replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟
let replay_chat_arr = []; //用于存储重播弹幕obj
let replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数
let is_replay_chat_loading = false; //是否正在调取接口
let can_seek = true; //
let replay_per_like = 0; //平均每秒增加的点赞数
let replay_per_request_like = 0; //平均每帧增加的点赞数(大概)
let replay_video_duration = 0; //重播视频
let replay_now_like = 0; //当前重播的点赞数
let is_wating = false;
let test_count = 99;
let CMD = {
var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
var requestAnimationFrame = window.requestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame;
var site_url = STATIC_RESOURCE_PATH;
var $btn_play;
var video_width = 375;
var video_height = 667;
var video_id = 'yoho_live'; //视频video标签id
var is_live = true; //是否是直播,根据地址栏参数可以判断
var get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口
var get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕
var query_arr = []; //地址栏参数数组
var link_type = 'webksocket'; //连接类型
var live_ws; //websocket
var heart_beat_interval; //心跳计时器
var live_time_interval; //播放时间计时器
var live_duration = 0; //播放时间计数器
var now_like_nums = 0; //当前点赞数
var $live_like_pannel; //点赞div,用于存放小脸动画
var is_animate = false; //用于控制动画的频率
var replay_video;
var replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕
var replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟
var replay_chat_arr = []; //用于存储重播弹幕obj
var replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数
var is_replay_chat_loading = false; //是否正在调取接口
var can_seek = true; //
var replay_per_like = 0; //平均每秒增加的点赞数
var replay_per_request_like = 0; //平均每帧增加的点赞数(大概)
var replay_video_duration = 0; //重播视频
var replay_now_like = 0; //当前重播的点赞数
var is_wating = false;
var test_count = 99;
var CMD = {
LOGIN: 1, //客户端发送登录消息
SEND_MESSAGE: 2, //客户端发送消息
LOGOUT: 3, //客户端发送退出消息
... ... @@ -66,11 +66,11 @@ let CMD = {
};
function set_duration () {
let video = $('.video_player').find('video')[0];
let duration;
let durationH;
let durationM;
let durationS;
var video = $('.video_player').find('video')[0];
var duration;
var durationH;
var durationM;
var durationS;
if (video) {
video.addEventListener('loadedmetadata', function() {
... ... @@ -103,16 +103,16 @@ function set_duration () {
*/
function init_play_button() {
global.$btn_play = $btn_play = $('.live-video-play-button a');
let video_source = $('#video_container').attr('data-video');
var video_source = $('#video_container').attr('data-video');
$btn_play.on('click', function() {
$('#live-watermark').removeClass('hide');
if (live_type === 1 || live_type === 3) {
if ($('#' + video_id)[0] == undefined) {
get_chat_info(); //获取弹幕信息
let _is_ios = true;
let _is_wechat = false;
let agent = navigator.userAgent.toLowerCase();
var _is_ios = true;
var _is_wechat = false;
var agent = navigator.userAgent.toLowerCase();
//判断环境
if (agent.match(/android/i) == 'android') {
_is_ios = false;
... ... @@ -130,20 +130,20 @@ function init_play_button() {
$('.live-video-cover').hide(); //隐藏封面
$('.live-app-download-head-wrap').hide(); //隐藏头部
let temp_height = $(window).height();
let temp_width = $(document).width();
var temp_height = $(window).height();
var temp_width = $(document).width();
if (temp_width > 540) {
temp_width = 540;
}
let scale = 17.1 / 20;
var scale = 17.1 / 20;
// if (temp_height > 30.15 * scale * (temp_width / 320 * 20)) {
// temp_height = 30.15 * scale + 'rem';
// } else {
// temp_height = temp_height + 'px'
// }
let v_width = temp_width + 'px';
let v_height = 32.575 * scale + 'rem';
var v_width = temp_width + 'px';
var v_height = 32.575 * scale + 'rem';
$('.live-loading-container').show(); //显示loading
init_video(video_source, _is_wechat, _is_ios, '100%', '100%');
... ... @@ -271,7 +271,7 @@ function get_chat_info() {
* @param type 参数类型:websocket,tcp,用于获取不同协议的服务器地址
*/
function get_websocket_server(type) {
let param = type;
var param = type;
$.ajax({
url: get_socket_server_url,
data: {
... ... @@ -282,11 +282,11 @@ function get_websocket_server(type) {
success: function(data) {
console.log(data);
if (data.code === 200) {
let arr = data.data[0].split(':');
let ip = arr[0];
let port = arr[1];
let protocol = 'ws'
// let protocol = location.protocol === 'https:' ? 'wss' :'ws'
var arr = data.data[0].split(':');
var ip = arr[0];
var port = arr[1];
var protocol = 'ws'
// var protocol = location.protocol === 'https:' ? 'wss' :'ws'
if (is_live) {
... ... @@ -304,7 +304,7 @@ function get_websocket_server(type) {
* @param port
*/
function link_to_websocket_server(ip, port) {
let path = ip + ':' + port;
var path = ip + ':' + port;
live_ws = new WebSocket(path);
live_ws.onopen = function(event) {
... ... @@ -328,7 +328,7 @@ function link_to_websocket_server(ip, port) {
live_ws.onmessage = function(event) {
if (event.data) {
let msg_obj = JSON.parse(event.data);
var msg_obj = JSON.parse(event.data);
console.log(msg_obj, msg_obj.cmd);
switch (msg_obj.cmd) {
case 4:
... ... @@ -365,7 +365,7 @@ function get_replay_chat_barrage(start_time, duration) {
replay_new_start_time = start_time;
}
is_replay_chat_loading = true;
let ajax = $.ajax({
var ajax = $.ajax({
url: get_replay_chat_url,
data: {
id: live_room,
... ... @@ -403,7 +403,7 @@ function get_replay_chat_barrage(start_time, duration) {
});
//用于测试
/* let test_arr = test_replay(start_time, duration);
/* var test_arr = test_replay(start_time, duration);
test_arr.forEach(function (obj) {
replay_chat_arr.push(obj);
});
... ... @@ -418,7 +418,7 @@ function get_replay_chat_barrage(start_time, duration) {
* 开始
*/
function set_replay_chat_frame() {
let element = $('#live_chat_ul');
var element = $('#live_chat_ul');
requestAnimationFrame(manage_replay_chat_msg);
}
... ... @@ -430,7 +430,7 @@ function manage_replay_chat_msg() {
if (replay_video != undefined) {
if (!replay_video.paused && !is_wating) {
let time = parseInt(replay_video.currentTime);
var time = parseInt(replay_video.currentTime);
if (!isNaN(replay_video.duration) && replay_video.duration != 0) {
if (replay_video_duration === 0) {
replay_video_duration = replay_video.duration;
... ... @@ -448,20 +448,20 @@ function manage_replay_chat_msg() {
if (replay_now_like - now_like_nums >= 1) {
now_like_nums = parseInt(replay_now_like);
let msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}';
let msg_obj = JSON.parse(msg);
var msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}';
var msg_obj = JSON.parse(msg);
insert_like(msg_obj);
}
} else if (replay_video.currentTime < 10) {
let msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}';
let msg_obj = JSON.parse(msg);
var msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}';
var msg_obj = JSON.parse(msg);
insert_like(msg_obj);
}
}
if (replay_chat_arr.length > 0) {
let obj = replay_chat_arr[0];
var obj = replay_chat_arr[0];
if (obj.create_time <= time) {
if (obj.cmd == 5) {
insert_msg(obj)
... ... @@ -542,7 +542,7 @@ function replay_barrage_callback_handler(time, v_type) {
* @returns {string}
*/
function get_cmd(cmd) {
let result = '';
var result = '';
switch (cmd) {
case 1:
result = '{"cmd":' + cmd + ',"uid":"","name":"","avatar":"","room":' + live_room + '}';
... ... @@ -570,10 +570,10 @@ function send_heart_beat() {
*/
function insert_msg(obj) {
let $ul = $('#live_chat_ul');
let msg_html
var $ul = $('#live_chat_ul');
var msg_html
if (obj.avatar == '' || obj.avatar == undefined) {
let rand = Math.floor(Math.random() * 5) + 1;
var rand = Math.floor(Math.random() * 5) + 1;
// obj.avatar = site_url + '/img/activity/live/live/head_' + rand + '.png';
msg_html = '<div class="live-item2"><div class="live-item2-head">' +
... ... @@ -606,7 +606,7 @@ function insert_msg(obj) {
'</div>' +
'</div>';
}
let li = document.createElement('li');
var li = document.createElement('li');
li.innerHTML = msg_html;
if ($ul.children().length >= 4) {
$ul.find('li').eq(0).remove();
... ... @@ -620,9 +620,9 @@ function insert_msg(obj) {
*/
function insert_user(obj) {
if (obj.name.length > 1) {
let $ul = $('#live_chat_ul');
let msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>';
let li = document.createElement('li');
var $ul = $('#live_chat_ul');
var msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>';
var li = document.createElement('li');
li.innerHTML = msg_html;
if ($ul.children().length >= 4) {
$ul.find('li').eq(0).remove();
... ... @@ -638,7 +638,7 @@ function insert_user(obj) {
* @param obj
*/
function insert_like(obj) {
let num = obj.msg.toString();
var num = obj.msg.toString();
if (num.indexOf('万') < 0) {
num = parseInt(num);
... ... @@ -651,15 +651,15 @@ function insert_like(obj) {
} else {
if (!is_animate) {
is_animate = true;
let like_rand = Math.floor(Math.random() * 3) + 1;
let img_rand = Math.floor(Math.random() * 5) + 1;
let img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png';
let id = 'js_keyframes_' + Math.random();
let like_class = 'like-icon' + ' scroll_animate_' + like_rand;
let msg_html = '<img src="' + img_path + '">';
var like_rand = Math.floor(Math.random() * 3) + 1;
var img_rand = Math.floor(Math.random() * 5) + 1;
var img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png';
var id = 'js_keyframes_' + Math.random();
var like_class = 'like-icon' + ' scroll_animate_' + like_rand;
var msg_html = '<img src="' + img_path + '">';
let anim_div = document.createElement('div');
var anim_div = document.createElement('div');
anim_div.id = id;
anim_div.className = like_class;
anim_div.innerHTML = msg_html;
... ... @@ -695,9 +695,9 @@ function insert_audience(obj) {
* @param obj
*/
function insert_end(obj) {
let user_num = obj.audienceNums.toString();
let like_num = obj.likeNums.toString();
let video_len = obj.videoLen.toString();
var user_num = obj.audienceNums.toString();
var like_num = obj.likeNums.toString();
var video_len = obj.videoLen.toString();
if (user_num.indexOf('万') < 0) {
user_num = parseInt(user_num);
... ... @@ -715,7 +715,7 @@ function insert_end(obj) {
like_num = (like_num / 10000).toFixed(1) + '万';
}
let video = $('#' + video_id)[0];
var video = $('#' + video_id)[0];
if (video) {
setTimeout(function() {
video.pause();
... ... @@ -724,7 +724,7 @@ function insert_end(obj) {
}
live_ws.close();
clearInterval(live_time_interval);
let $liveEnd = $('#live-state-end');
var $liveEnd = $('#live-state-end');
$liveEnd.show();
$liveEnd.find('.audience .val').text(user_num);
$liveEnd.find('.duration .val').text(video_len);
... ... @@ -751,7 +751,7 @@ function receive_init(obj) {
*/
function get_live_time() {
if (live_start_time) {
let date = new Date();
var date = new Date();
live_duration = parseInt(date.getTime() / 1000) - live_start_time;
console.log('live_duration=' + live_duration);
$('#live_time').text(get_time_text(live_duration));
... ... @@ -765,10 +765,10 @@ function get_live_time() {
* @returns {string}
*/
function get_time_text(time) {
let time_text = '00:00:00';
let sec;
let min;
let hour;
var time_text = '00:00:00';
var sec;
var min;
var hour;
if (time < 0) {
time = 0;
}
... ... @@ -794,7 +794,7 @@ function get_time_text(time) {
} else {
hour = hour + ':';
}
let rests = time % 3600;
var rests = time % 3600;
min = (rests - rests % 60) / 60;
if (min < 10) {
min = '0' + min;
... ... @@ -826,10 +826,10 @@ function set_interval_time() {
* requestAnimationFrame
*/
function init_request_animation_frames() {
let lastTime = 0;
let prefix;
var lastTime = 0;
var prefix;
//通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式
for (let i = 0; i < prefixes.length; i++) {
for (var i = 0; i < prefixes.length; i++) {
if (requestAnimationFrame && cancelAnimationFrame) {
break;
}
... ... @@ -841,10 +841,10 @@ function init_request_animation_frames() {
//如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout
if (!requestAnimationFrame || !cancelAnimationFrame) {
requestAnimationFrame = function(callback) {
let currTime = new Date().getTime();
var currTime = new Date().getTime();
//为了使setTimteout的尽可能的接近每秒60帧的效果
let timeToCall = Math.max(0, 16 - (currTime - lastTime));
let id = window.setTimeout(function() {
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
... ... @@ -893,8 +893,8 @@ $(document).ready(function() {
});
global.test = function test() { //测试弹幕样式
let rand = Math.floor(Math.random() * msg_obj.length);
let obj = JSON.parse(msg_obj[rand].toString());
var rand = Math.floor(Math.random() * msg_obj.length);
var obj = JSON.parse(msg_obj[rand].toString());
switch (obj.cmd) {
case 4:
insert_user(obj);
... ... @@ -906,21 +906,21 @@ global.test = function test() { //测试弹幕样式
}
global.test_like = function test_like() {
let rand = Math.floor(Math.random() * 5);
var rand = Math.floor(Math.random() * 5);
test_count += rand;
let obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}';
let obj = JSON.parse(obj_text);
var obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}';
var obj = JSON.parse(obj_text);
insert_like(obj);
}
global.test_replay = function test_replay(starttime, timeinterval) {
let start = starttime - live_start_time;
let end = start + timeinterval;
let test_arr = [];
var start = starttime - live_start_time;
var end = start + timeinterval;
var test_arr = [];
if (replay_msg.length > 0) {
for (let i = 0; i < replay_msg.length; i++) {
let obj = replay_msg[i];
let create_time = parseInt(obj.createtime);
for (var i = 0; i < replay_msg.length; i++) {
var obj = replay_msg[i];
var create_time = parseInt(obj.createtime);
if (create_time >= start && create_time <= end) {
test_arr.push(obj);
}
... ...
... ... @@ -2,7 +2,7 @@
* Created by qiujun on 16/6/5.
*/
let info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' +
var info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' +
'<div style="margin-top:10px;"></div>' +
'<img width="640px" h="640px" "style="margin:0 auto;border:0;display:block;" class="lazy" src="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" data-original="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" style="display: block;">' +
'<span style="color:#B2AAA4;">▲游戏设施长这样!</span>' +
... ...
... ... @@ -6,15 +6,15 @@
*/
let share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296';
let share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
let share_facebook_url = 'https://www.facebook.com/sharer/sharer.php';
let share_twitter_url = 'http://twitter.com/intent/tweet';
let true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png';
let fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png';
let true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png';
let fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png';
let touch_timeout;
var share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296';
var share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
var share_facebook_url = 'https://www.facebook.com/sharer/sharer.php';
var share_twitter_url = 'http://twitter.com/intent/tweet';
var true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png';
var fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png';
var true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png';
var fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png';
var touch_timeout;
$(document).ready(function() {
// init_share_button();
... ... @@ -28,16 +28,16 @@
* 分享按钮
*/
function init_share_button() {
let $btn_share_sina = $('.live-share-button-sina a');
let $btn_share_qzone = $('.live-share-button-qzone a');
let $btn_share_facebook = $('.live-share-button-facebook a');
let $btn_share_twitter = $('.live-share-button-twitter a');
let local_url = document.location.href;
let protocol = document.location.protocol;
let share_url = '';
let share_img = $('#share').attr('cover');
let share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL ';
let share_title_qzone = document.title + ' | 来自YOHO!';
var $btn_share_sina = $('.live-share-button-sina a');
var $btn_share_qzone = $('.live-share-button-qzone a');
var $btn_share_facebook = $('.live-share-button-facebook a');
var $btn_share_twitter = $('.live-share-button-twitter a');
var local_url = document.location.href;
var protocol = document.location.protocol;
var share_url = '';
var share_img = $('#share').attr('cover');
var share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL ';
var share_title_qzone = document.title + ' | 来自YOHO!';
if (share_img.indexOf('http') < 0 && share_img.indexOf('https') < 0) {
share_img = protocol + share_img;
... ... @@ -77,8 +77,8 @@
* 由于微信不能同时识别两个二维码,所以按一个二维码的同时把另外一个二维码给换成点击的二维码的图片
*/
function check_qr_touch() {
let $clz_img = $('#qr_clz img');
let $girl_img = $('#qr_girl img');
var $clz_img = $('#qr_clz img');
var $girl_img = $('#qr_girl img');
$clz_img.on('touchstart', function() {
$clz_img.attr('src', true_yoho_img);
... ...
... ... @@ -3,7 +3,7 @@
* Created by qiujun on 16/05/24
* 一个所谓的video插件(伪)
*/
let _defaults = {
var _defaults = {
video_id: 'yoho_video',
islive: false, //是否是直播
width: '100%',
... ... @@ -19,8 +19,8 @@ let _defaults = {
is_ios: true
};
let that; //用于引用this
let video_src;
var that; //用于引用this
var video_src;
function YohoVideo($ele, options) { //构造函数
this.$ele = $ele;
... ... @@ -39,15 +39,15 @@ YohoVideo.prototype = {
this.bindEvent(); //初始化视频各个事件
},
innserVideoHtml: function() {
let _options = this._options;
var _options = this._options;
this._width = _options.width || '100%';
this._height = _options.height || '100%';
let _preload = _options.preload || false;
let _autoplay = _options.autoplay || false;
let _controls = _options.controls || false;
let _poster = _options.poster || false;
let _loop = _options.loop || false;
let _src = _options.src || '';
var _preload = _options.preload || false;
var _autoplay = _options.autoplay || false;
var _controls = _options.controls || false;
var _poster = _options.poster || false;
var _loop = _options.loop || false;
var _src = _options.src || '';
this._loading_div = _options.loading_div || '.live-video-loading';
this._video_id = _options.video_id || 'yoho_video';
this._islive = _options.islive || false;
... ... @@ -55,13 +55,13 @@ YohoVideo.prototype = {
this._is_ios = _options.is_ios || true;
//console.log(_width,_height,_preload,_autoplay,_controls,_poster,_loop,_src);
/*let video = document.createElement('video');
/*var video = document.createElement('video');
video.id = this._video_id;
video.setAttribute('webkit-playsinline',true);*/
video_src = _src;
let _attributes = '';
let _styles = '';
let _source = '';
var _attributes = '';
var _styles = '';
var _source = '';
if (this._height != undefined) {
_styles += ' height:' + this._height + ';';
//video.style.height = _height;
... ... @@ -95,11 +95,11 @@ YohoVideo.prototype = {
//video.src = _src;
}
let _source_html = '';
var _source_html = '';
//console.log(this._islive);
if (!this._islive || this._islive) {
let _len = _src.length - _src.lastIndexOf('.');
let _type = _src.substr(_src.lastIndexOf('.') + 1, _len);
var _len = _src.length - _src.lastIndexOf('.');
var _type = _src.substr(_src.lastIndexOf('.') + 1, _len);
if (_type === 'm3u8') {
_type = 'application/x-mpegurl';
} else {
... ... @@ -107,22 +107,22 @@ YohoVideo.prototype = {
}
_source_html = '<source src="' + _src + '" type="' + _type + '">';
/*let source = document.createElement('source');
/*var source = document.createElement('source');
source.src = _src;
source.type = _type;
video.appendChild(source);*/
}
let _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' +
var _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' +
_source_html +
'</video>';
//console.log(_video_html);
this.$ele.html(_video_html);
let video = $('#' + this._video_id)[0];
var video = $('#' + this._video_id)[0];
video.allowFullScreen = false;
if (this._islive || _type == 'application/x-mpegurl') {
if (video.hasChildNodes()) {
let source_node = video.childNodes[0];
var source_node = video.childNodes[0];
video.removeChild(source_node);
video.src = _src;
video.play();
... ... @@ -135,9 +135,9 @@ YohoVideo.prototype = {
//this.$ele.append(video);
},
exitFull: function() { //退出全屏
let _video = $('#' + this._video_id)[0];
var _video = $('#' + this._video_id)[0];
//let _video = this._video;
//var _video = this._video;
//alert(_video.exitFullscreen || _video.msExitFullscreen || _video.oRequestFullscreen || _video.webkitCancelFullScreen || _video.webkitExitFullscreen);
if (_video.exitFullScreen) {
_video.exitFullScreen();
... ... @@ -152,27 +152,27 @@ YohoVideo.prototype = {
}
},
bindEvent: function() {
let _video = $('#' + this._video_id)[0];
var _video = $('#' + this._video_id)[0];
_video.isFullscreen = false;
_video.scrollLeft = 0;
_video.scrollTop = 0;
//console.log(this._width,this._height);
_video.scrollWidth = this._width;
_video.scrollHeight = this._height;
// _video.scrollWidth = this._width;
// _video.scrollHeight = this._height;
//let _video = this._video;
//var _video = this._video;
console.log('video=', _video);
let _msg_pannel = $(this._loading_div);
let _msg = _msg_pannel.find('p');
let _progress_count = 0;
var _msg_pannel = $(this._loading_div);
var _msg = _msg_pannel.find('p');
var _progress_count = 0;
let _error_count = 0;
var _error_count = 0;
//networkState:0.此元素未初始化 1.正常但没有使用网络 2.正在下载数据 3.没有找到资源
//readyState:
// 1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA
let media_events = {
var media_events = {
LOAD_START: 'loadstart',
PROGRESS: 'progress',
SUSPEND: 'suspend',
... ...
... ... @@ -22,7 +22,7 @@ class ActController extends Controller {
lazyLoad($('img.lazy'));
this.more = new GetMore();
this.more.on('more', this.doMore.bind(this));
this.page = 1;
this.page = 5;
this.loading = false;
global.jQuery = $;
}
... ...
... ... @@ -327,14 +327,15 @@ function submitOrder() {
}
/* tar add 170426 品众代码去除 */
// if (window._fxcmd) {
// window._fxcmd.push(['trackOrder', {
// oid: res.data.order_code,
// otp: res.data.order_amount,
// u_info: cookie.get('_UID'),
// u_type: cookie.get('_isNewUser') ? 1 : 0
// }, []]);
// }
/* tar note 170601 品众代码恢复 */
if (window._fxcmd) {
window._fxcmd.push(['trackOrder', {
oid: res.data.order_code,
otp: res.data.order_amount,
u_info: cookie.get('_UID'),
u_type: cookie.get('_isNewUser') ? 1 : 0
}, []]);
}
cookie.remove(['order-info', 'activity-info']);
window.location.href = url;
... ...
... ... @@ -146,42 +146,56 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) {
});
}
// 微信支付
function callpay(orderCode) {
/**
* 获取微信支付数据
* @param {*} orderCode
*/
function getWechatPayData(orderCode) {
let jsApiParameters;
$.ajax({
type: 'GET',
url: '/cart/index/new/pay',
data: {
order_code: orderCode,
payment: '22_platform',
},
dataType: 'json',
success: function(res) {
if (res.code === 200) {
jsApiParameters = res.data.jsApiParameters;
jsApiCall(orderCode, jsApiParameters);
} else {
tip.show('微信支付调取失败');
}
},
error: function() {
tip.show('请刷新本页面,完成微信支付');
},
complete: function() {
$loadingToast.addClass('hide');
}
});
}
// 微信支付
function callpay(orderCode) {
$loadingToast.removeClass('hide');
if (typeof WeixinJSBridge === 'undefined') {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
document.addEventListener('WeixinJSBridgeReady', function() {
getWechatPayData(orderCode);
}, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
document.attachEvent('WeixinJSBridgeReady', function() {
getWechatPayData(orderCode);
});
document.attachEvent('onWeixinJSBridgeReady', function() {
getWechatPayData(orderCode);
});
}
} else {
$.ajax({
type: 'GET',
url: '/cart/index/new/pay',
data: {
order_code: orderCode,
payment: '22_platform',
},
dataType: 'json',
success: function(res) {
if (res.code === 200) {
jsApiParameters = res.data.jsApiParameters;
jsApiCall(orderCode, jsApiParameters);
} else {
tip.show('微信支付调取失败');
}
},
error: function() {
tip.show('请刷新本页面,完成微信支付');
},
complete: function() {
$loadingToast.addClass('hide');
}
});
getWechatPayData(orderCode);
}
}
... ...
... ... @@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调
// 隐藏筛选界面
function hideFilter() {
setTimeout(function() {
$filter.addClass('hide');
$filter && $filter.addClass('hide');
}, 301);
}
// 显示筛选界面
function showFilter() {
$filter.removeClass('hide');
$filter && $filter.removeClass('hide');
}
// 一级菜单点击时背景高亮
... ...
... ... @@ -11,6 +11,7 @@ import {time} from './time';
import {api} from './store';
import {RatingView, LeaveMSGView, OrderListView } from './view';
import tip from 'plugin/tip';
import dialog from 'plugin/dialog';
let FastClick = require('yoho-fastclick');
... ... @@ -112,7 +113,6 @@ let chat = {
const self = this;
cmEntity.encryptedUid = encryptedUid;
self.fetchHistoryMsg().always(function() {
... ... @@ -167,7 +167,7 @@ let chat = {
onOpen: $.noop,
sendFailCallback: function() {
self._sysInfo('<p>连接断开,请尝试<span class="blue">重连</span></p>')
.one('click', function() {
.one('touchend', function() {
self.connect();
});
},
... ... @@ -184,8 +184,49 @@ let chat = {
*/
bindEvents: function() {
let self = this;
let $dialog;
this.$chat
.on('click.Queue.quit', '[data-trigger=quit-queue]', function() {
dialog.showDialog({
dialogText: '确认结束排队吗?',
hasFooter: {
leftBtnText: '继续等待',
rightBtnText: '结束排队'
}
}, function() {
cmEntity.type = socketConf.recType.QUIT_QUEUE;
socket.send(JSON.stringify(cmEntity));
dialog.hideDialog();
});
$dialog = $('.dialog-wrapper .dialog-box');
$dialog.css({
background: 'hsla(100, 100%, 100%, 1)'
});
})
.on('click.Chat.end', '[data-trigger=end-chat]', function() {
dialog.showDialog({
dialogText: '确认结束本次服务吗?',
hasFooter: {
leftBtnText: '继续咨询',
rightBtnText: '结束服务'
}
}, function() {
cmEntity.type = socketConf.recType.USER_END_CHAT;
socket.send(JSON.stringify(cmEntity));
dialog.hideDialog();
});
$dialog = $('.dialog-wrapper .dialog-box');
$dialog.css({
background: 'hsla(100, 100%, 100%, 1)'
});
})
.on('click.Chat.end', '[data-action=re-connect]', function() {
self.connect();
})
.on('click.Rating.toggle', '[data-trigger=rating]', function() {
if (self.canEvalute) {
self.ratingView.toggle();
... ... @@ -268,12 +309,14 @@ let chat = {
conversationId: cmEntity.conversationId,
});
}).on('rating-success', function(e, data) {
const state = (window.socket || {}).readyState;
self._sysInfo(`您对我们的服务评价为:${data}`);
self.canEvalute = false;
cmEntity.type = socketConf.recType.EVALUTE_SUCCESS;
socket.send(JSON.stringify(cmEntity));
// resizeFooter();
if (state === WebSocket.OPEN) {
socket.send(JSON.stringify(cmEntity));
}
});
... ... @@ -322,12 +365,12 @@ let chat = {
disconnect(content) {
let self = this;
self.renderHeader('offline');
this.canLeaveMSG = true;
this.$chat.toggleClass('online', false);
this.toggleMenu(false);
this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`)
.one('click', function() {
.one('touchend', function() {
self.connect();
});
},
... ... @@ -576,6 +619,7 @@ let chat = {
// ------------------------------------------
// 用户进入
case allTypes.ENTER:
this.renderHeader('robot');
chatMessage.newContent && this._sysInfo(chatMessage.newContent);
break;
... ... @@ -590,6 +634,11 @@ let chat = {
this._sysInfo(chatMessage.content);
break;
case allTypes.QUIT_QUEUE:
this.renderHeader('robot');
this._sysInfo(chatMessage.content);
break;
// 客服邀请评价
case allTypes.EVAL_INVITE:
this._sysInfo('<p data-trigger="rating">请对我们的服务进行<span class="blue">评价</span></p>');
... ... @@ -636,7 +685,6 @@ let chat = {
*/
_manualState(state, cmEntity) { // eslint-disable-line
const self = this;
const $chatHeader = self.$header;
const $chat = self.$chat;
const sysInfo = self._sysInfo.bind(this);
const chatMessage = cmEntity.chatMessage;
... ... @@ -670,12 +718,13 @@ let chat = {
// state 1: 排队中
function inQueue() {
self.renderHeader('queue');
whetherLeaveMsg(cmEntity);
}
// state 2: 人工客服进入
function linkSuccess() {
$chatHeader.find('.js-service-txt').text('YOHO客服');
self.renderHeader('human');
$chat
.toggleClass('online', true)
... ... @@ -825,7 +874,7 @@ let chat = {
},
switchService: function(type) {
this.renderHeader(type);
this.renderHeader(`switch-${type}`);
if (type === 'human') {
cmEntity.type = socketConf.recType.MANUAL_SERVICE;
... ... @@ -843,9 +892,25 @@ let chat = {
title: '智能小YO',
right: '<span data-action="change-human">人工客服</span>'
},
queue: {
title: '<i class="chat-status"></i><span class="js-service-txt">队列中...</span>',
right: '<span data-trigger="quit-queue">结束排队</span>'
},
human: {
title: '<i class="chat-status"></i><span class="js-service-txt">YOHO客服</span>',
right: '<span data-trigger="end-chat">结束服务</span>'
},
offline: {
title: '<i class="chat-status"></i><span class="js-service-txt">YOHO客服</span>',
right: '<span data-action="re-connect">重新连接</span>'
},
'switch-robot': {
title: '<i class="chat-status"></i><span class="js-service-txt">正在连接...</span>',
right: '<span class="chat-rating-trigger" data-trigger="rating">评价</span>'
right: '<span></span>'
},
'switch-human': {
title: '<i class="chat-status"></i><span class="js-service-txt">连接人工...</span>',
right: ''
}
};
... ...
... ... @@ -62,12 +62,11 @@ function sendMsg(msg) {
socket.send(msg);
} else {
sendFailCallback();
console.log('The socket is not open.');
}
}
module.exports = {
init: socketInit,
send: sendMsg
send: sendMsg,
};
... ...
... ... @@ -28,10 +28,12 @@ let config = {
TRANSFER_REQ: 10006, // 收到他人的转移的请求
TRANS_REQ_ANSWER: 10007, // 收到他人对自己转移请求的反馈
SUC_DISTRIBUTE: 10009, // 客服管理员收到会话分配成功的回执
CS_CHATTING: 5000000, // 客服管理员收到会话分配成功的回执
CS_CHATTING: 5000000, // 客服管理员收到会话分配成功的回执
IN_QUNEUE: 777777, // 队列中发送消息后收到的反馈
OFFLINE: 999999999, // 断线
OP_LEAVE: 999999998 // 对方离开
QUIT_QUEUE: 888881, // 排队中退申请退出队列
USER_END_CHAT: 888882, // 用户结束会话
OFFLINE: 999999999, // 断线
OP_LEAVE: 999999998 // 对方离开
},
conversationMessage: {
... ...
body {
background: #f0f0f0;
}
.nav-home {
display: none !important;
}
.qs-detail-page {
font-size: 28px;
$borderColor: #ececec;
.error-tip {
width: 100%;
background-color: #ff7e82;
color: #fff;
padding-left: 30px;
line-height: 50px;
position: fixed;
top: 0;
left: 0;
z-index: 1;
}
.sub-title {
line-height: 2;
padding: 14px 20px;
background: #fff;
border-bottom: 1px solid $borderColor;
text-align: center;
}
.guide-tip {
line-height: 2;
padding: 0 30px;
color: #555;
}
.qs-item {
background: #fff;
margin-bottom: 30px;
padding-left: 30px;
border-top: 1px solid $borderColor;
border-bottom: 1px solid $borderColor;
> * {
line-height: 60px;
padding: 10px 0;
}
> dd {
border-top: 1px solid $borderColor;
color: #b4b4b4;
input {
width: calc(100% - 60px);
height: 50px;
margin-left: 34px;
border: 0;
border: 1px solid $borderColor;
color: #444;
}
&.on {
color: #444;
}
}
textarea {
width: calc(100% - 26px);
height: 100px;
resize: none;
border: 1px solid #ddd;
display: block;
color: #444;
}
.iconfont {
display: inline-block;
width: 34px;
height: 34px;
line-height: 34px;
border: 1px solid #b4b4b4;
vertical-align: middle;
font-size: 18px;
text-align: center;
color: #fff;
position: absolute;
margin-top: 13px;
}
.option-box {
padding-left: 40px;
img {
display: inline-block;
vertical-align: middle;
}
}
.radio-option .iconfont {
border-radius: 17px;
overflow: hidden;
}
.on .iconfont {
border-color: #444;
background-color: #444;
}
}
.submit {
padding: 0 20px;
.submit-btn {
width: 100%;
height: 80px;
background: #3e3e3e;
color: #fff;
border: 0;
border-radius: 4px;
margin-bottom: 20px;
outline: none;
}
}
.detail-wrap + .qs-err {
display: none;
}
.qs-err {
&:before {
content: "";
width: 300px;
height: 190px;
background: resolve("3party/qs-lose.jpg") no-repeat;
display: block;
margin: 120px auto 0;
background-size: 100%;
}
.err-text {
width: 56%;
line-height: 1.5;
color: #444;
margin: 0 auto;
padding-bottom: 50px;
display: block;
text-align: center;
}
a {
width: 60%;
height: 80px;
line-height: 80px;
margin: 0 auto;
background: #3e3e3e;
color: #fff;
display: block;
text-align: center;
border-radius: 4px;
}
}
.tip-dialog {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 10;
&:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
z-index: -1;
}
.dg-wrap {
width: 70%;
background: #fff;
border-radius: 6px;
position: absolute;
left: 15%;
top: 50%;
margin-top: -95px;
}
.dg-content {
height: 140px;
line-height: 140px;
> p {
width: 100%;
line-height: 1.4;
display: inline-block;
text-align: center;
vertical-align: middle;
}
}
.dg-btns {
border-top: 1px solid #efefef;
> * {
width: 50%;
line-height: 60px;
text-align: center;
display: block;
float: left;
cursor: pointer;
box-sizing: border-box;
}
}
.continue-btn {
border-left: 1px solid #efefef;
box-sizing: border-box;
color: #d90005;
}
}
}
... ...
.nav-home {
display: none !important;
}
.qs-list-page {
font-size: 28px;
$borderColor: #ececec;
.qs-list {
line-height: 90px;
color: #444;
padding-left: 30px;
border-bottom: 1px solid $borderColor;
> li {
border-top: 1px solid $borderColor;
}
}
.tip-dialog {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 10;
&:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
z-index: -1;
}
.dg-wrap {
width: 70%;
background: #fff;
border-radius: 6px;
position: absolute;
left: 15%;
top: 50%;
margin-top: -95px;
}
.dg-content {
height: 140px;
line-height: 140px;
> p {
width: 100%;
line-height: 1.4;
display: inline-block;
text-align: center;
vertical-align: middle;
}
}
.dg-btns {
border-top: 1px solid #efefef;
> * {
width: 50%;
line-height: 60px;
text-align: center;
display: block;
float: left;
cursor: pointer;
}
}
.dg-btns .sure-btn {
width: 100%;
}
.share-btn {
border-left: 1px solid #efefef;
box-sizing: border-box;
color: #d90005;
}
}
}
... ...
... ... @@ -568,9 +568,12 @@ $basicBtnC: #eb0313;
}
.period-of-market {
float: right;
color: #d0021b;
padding: 0 30px;
background-color: #fff;
line-height: 54px;
color: #b0b0b0;
font-size: 24px;
border-bottom: 1px solid #e0e0e0;
h1 {
display: inline-block;
... ...
... ... @@ -124,6 +124,13 @@
margin: 30px 20px;
}
.questionnaire-ico {
background-image: url("/service/chat/questionnaire-ico.png");
width: 60px;
height: 60px;
margin: 30px 20px;
}
.arr-ico {
line-height: 120px;
color: #e1e1e1;
... ...
... ... @@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
finalDetail.push({
relatedReco: {
isApp: isApp,
goods: goodsData,
moreNum: goodsData.length - 2 > 0 ? goodsData.length - 2 : 0
goods: goodsData
}
});
}
... ... @@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
_.forEach(finalDetail, (value, key) => {
if (value.relatedReco) {
_.forEach(value.relatedReco.goods, (item, subKey) => {
if (goodsObj[item.id]) {
finalDetail[key].relatedReco.goods[subKey] = goodsObj[item.id];
let goodsIds = [];
_.forEach(value.relatedReco.goods, relatedGoods => {
goodsIds.push(relatedGoods.id);
});
goodsIds = _.uniq(goodsIds);
finalDetail[key].relatedReco.goods = [];
_.forEach(goodsIds, (item, subKey) => {
if (goodsObj[item]) {
finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
} else {
delete finalDetail[key].relatedReco.goods[subKey];
finalDetail[key].relatedReco.moreNum--;
}
});
let moreNum = _.get(finalDetail[key], 'relatedReco.goods.length', 0);
finalDetail[key].relatedReco.moreNum = moreNum - 2 > 0 ? moreNum - 2 : 0;
}
if (value.collocation) {
... ...
... ... @@ -143,6 +143,24 @@ module.exports = {
return '';
}
},
/**
* 图片质量调整
*/
imageslim: function(imageUrl) {
if (imageUrl && _.isString(imageUrl)) {
let urls = imageUrl.split('?');
let uri = urls[0];
if (uri.indexOf('http:') === 0) {
uri = uri.replace('http:', '');
}
return uri + '?imageslim';
} else {
return '';
}
},
isEqualOr: function() {
let args = Array.prototype.slice.call(arguments);
let v1 = args[0];
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 11:02:31
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-02 11:09:37
* @Last Modified time: 2017-05-26 16:42:29
*/
/* 红人店铺数据处理 */
... ... @@ -34,7 +34,8 @@ const _linkhandle = (linkParent) => {
switch (parseInt(linkParent.linkType, 10)) {
case 0:
return helpers.urlFormat('', {
filter_poolId: linkParent.resource
filter_poolId: linkParent.resource,
title: linkParent.text
}, 'list');
case 1:
return helpers.urlFormat('/product/' + linkParent.resource + '.html');
... ... @@ -56,7 +57,7 @@ const _picsHandle = (moduleData) => {
let pics = [];
_.forEach(_.get(moduleData, 'data', []), value => {
let showProductInfo = false;
let showProductInfo = true;
if (_.has(value, 'showProductInfo')) {
showProductInfo = value.showProductInfo;
... ... @@ -325,12 +326,18 @@ const pushGoodsInfo = (decorators, goodsList) => {
_.forEach(_.get(value, 'pics', []), (subValue, subKey) => {
let hasGoods = _.get(goodsObj, `${subValue.skn}.default_images`, false);
if (!hasGoods) {
decorators[key].noShowProductInfo = true;
}
if (subValue.skn && hasGoods) {
let salesPrice = _.get(goodsObj, `${subValue.skn}.sales_price`, '');
let marketPrice = _.get(goodsObj, `${subValue.skn}.market_price`, '');
let imageSrc = _.get(goodsObj, `${subValue.skn}.default_images`, '');
decorators[key].pics[subKey].showProductInfo = salesPrice !== 0;
if (salesPrice === 0) {
decorators[key].noShowProductInfo = true;
}
decorators[key].pics[subKey].name = _.get(goodsObj, `${subValue.skn}.product_name`, '');
decorators[key].pics[subKey].salesPrice = salesPrice ? '¥' + salesPrice : '';
decorators[key].pics[subKey].marketPrice = marketPrice ? '¥' + marketPrice : '';
... ...