Authored by 陈轩

Merge remote-tracking branch 'origin/feature/live' into feature/live

... ... @@ -14,9 +14,14 @@ const _formatTime = (timestamp, b) => {
let diff = moment.duration(startTime.clone().startOf('day') - now.startOf('day')).days();
switch (diff) {
case 0: date = b ? '[预告]' : '[今天]'; break;
case 1: date = b ? '[预告明日]' : '[明天]'; break;
default: null;
case 0:
date = b ? '[预告]' : '[今天]';
break;
case 1:
date = b ? '[预告明日]' : '[明天]';
break;
default:
null;
}
return startTime.format(`${date}${time}`);
... ... @@ -40,7 +45,7 @@ const _getBestList = () => {
code: 200,
cache: false
}).then(result => {
let list = result.data || [];
let list = result && result.data || [];
for (let item of list) {
switch (item.living) {
... ... @@ -59,7 +64,7 @@ const _getBestList = () => {
// 格式化时间
item.starting_time = _formatTime(item.starting_time * 1000, true);
}
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -69,7 +74,7 @@ const _getLivingList = () => {
code: 200,
cache: false
}).then(result => {
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -79,12 +84,12 @@ const _getPrelivingList = () => {
code: 200,
cache: false
}).then(result => {
let list = result.data || [];
let list = result && result.data || [];
for (let item of list) {
item.starting_time = _formatTime(item.starting_time * 1000);
}
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -94,7 +99,7 @@ const _getRecordList = () => {
code: 200,
cache: false
}).then(result => {
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -106,12 +111,12 @@ const getAllList = () => {
// 获取 回放视屏 信息
const fetchReplayInfo = (videoID) => {
let url = 'v1/living/detail';
let data = {video_id: videoID};
let options = {cache: true};
let data = { video_id: videoID };
let options = { cache: true };
return liveAPI.get(url, data, options)
.then(result => {
if (result.data) {
if (result && result.data) {
let d = result.data;
d.logo = helpers.image(d.logo, 70, 70);
... ... @@ -126,18 +131,18 @@ const fetchReplayInfo = (videoID) => {
d.atEnd = false;
}
return result;
return result || {};
});
};
// 获取 直播视屏 信息
const fetchLiveInfo = (roomID) => {
let url = 'v1/living/detail';
let data = {room_id: roomID};
let data = { room_id: roomID };
return liveAPI.get(url, data)
.then(result => {
if (result.data) {
if (result && result.data) {
let d = result.data;
d.logo = helpers.image(d.logo, 70, 70);
... ... @@ -152,7 +157,7 @@ const fetchLiveInfo = (roomID) => {
d.atEnd = d.living === 2;
}
return result;
return result || {};
});
};
... ... @@ -166,7 +171,7 @@ const fetchInfo = (id, isReplay) => {
// 获取 直播 弹幕 host
const getBarrageHost = (type) => {
return liveAPI.get('v1/system/gethosts', {type});
return liveAPI.get('v1/system/gethosts', { type });
};
const getReplyBarrage = (videoID, startTime, timeInterval) => {
... ... @@ -176,7 +181,7 @@ const getReplyBarrage = (videoID, startTime, timeInterval) => {
timeInterval,
video_id: videoID
};
const options = {cache: true};
const options = { cache: true };
return liveAPI.get(url, data, options);
};
... ...
... ... @@ -18,7 +18,7 @@
<div class="live-rec">
{{#best}}
<div class="rec-child">
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"{{living}}","room":"{{room_id}}"}}'>
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"{{living}}","room":"{{room_id}}","bgpic":"{{pic}}"}}'>
<img class="rec-pic" src="{{image pic 320 320}}" alt="直播预览">
{{#if now_living}}
<p class="living">直播</p>
... ... @@ -53,7 +53,7 @@
</div>
</header>
<section>
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"1","room":"{{room_id}}"}}'>
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"1","room":"{{room_id}}","bgpic":"{{pic}}"}}'>
<img class="main-bg" src="{{image pic 640 640}}" alt="正在直播">
<p class="main-living">直播</p>
<p class="main-intro">{{title}}</p>
... ... @@ -73,7 +73,7 @@
<ul class="list">
{{#pre}}
<li class="pre-list">
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"0","room":"{{room_id}}"}}'>
<a href='http://m.yohobuy.com/activity/live/{{room_id}}?openby:yohobuy={"action":"go.videolive", "params":{"type":"0","room":"{{room_id}}","bgpic":"{{pic}}"}}'>
<img class="pre-pic" src="{{image pic 150 150}}" alt="直播预览图">
<p class="pre-icon">预告</p>
<p class="pre-time">{{starting_time}}</p>
... ... @@ -100,7 +100,7 @@
</div>
</header>
<section>
<a href='http://m.yohobuy.com/activity/live/replay/{{video_id}}?openby:yohobuy={"action":"go.videoreplay", "params":{"videoid":"{{video_id}}"}}'>
<a href='http://m.yohobuy.com/activity/live/replay/{{video_id}}?openby:yohobuy={"action":"go.videoreplay", "params":{"videoid":"{{video_id}}","bgpic":"{{pic}}"}}'>
<div class="record-icon"></div>
<img class="main-bg" src="{{image pic 640 640}}" alt="精彩回放">
<p class="main-living">回放</p>
... ...
... ... @@ -59,8 +59,8 @@
{{#if titleFloor}}
{{> resources/title-floor}}
{{/if}}
{{! 标题楼层}}
{{#if threePicture}}
{{> resources/three-picture}}
{{! 直播楼层}}
{{#if livePicture}}
{{> resources/live-picture}}
{{/if}}
{{/content}}
... ...
... ... @@ -16,8 +16,8 @@ module.exports = {
domains: {
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/'
},
subDomains: {
... ...
... ... @@ -18,7 +18,7 @@
(function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
</script>
{{#if devEnv}}
<link rel="stylesheet" href="//localhost:5001/css/index.css">
<link rel="stylesheet" href="//127.0.0.1:5001/css/index.css">
{{^}}
<link rel="stylesheet" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css">
{{/if}}
... ... @@ -41,8 +41,8 @@
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
{{/wechatShare}}
{{#if devEnv}}
<script src="//localhost:5001/libs.js"></script>
<script src="//localhost:5001/{{module}}.{{page}}.js"></script>
<script src="//127.0.0.1:5001/libs.js"></script>
<script src="//127.0.0.1:5001/{{module}}.{{page}}.js"></script>
{{^}}
<script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/libs.js"></script>
<script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>
... ...
{{> resources/title-floor}}
{{> resources/three-picture}}
... ...
{{#data}}
<div class="three-picture clearfix">
{{#data}}
{{#list}}
<a href="{{url}}">
<img src="{{image src 210 280}}">
</a>
{{/data}}
{{/list}}
</div>
{{/data}}
... ...
... ... @@ -138,7 +138,7 @@ function get_download_link() {
*/
function check_supperUniversalLink() {
var osversion = navigator.userAgent.match(/iPhone OS (\d*)/);
console.log(osversion && osversion[1]);
//console.log(osversion && osversion[1]);
return osversion && osversion[1];
/*if (osversion && osversion[1] >= 9) {
return true;
... ... @@ -311,7 +311,7 @@ $(document).ready(function() {
});
module.exports = (function(){
module.exports = (function() {
global.openAppOrLink = openAppOrLink;
global.get_download_link = get_download_link;
global.check_supperUniversalLink = check_supperUniversalLink;
... ... @@ -319,4 +319,4 @@ module.exports = (function(){
global.ManageQueryString = ManageQueryString;
global.getQueryString = getQueryString;
global.check_sys_open = check_sys_open;
})();
})();
\ No newline at end of file
... ...