Authored by 李靖

Merge branch 'master' into feature/trendRecode

Showing 52 changed files with 1462 additions and 370 deletions
@@ -4,4 +4,4 @@ coverage @@ -4,4 +4,4 @@ coverage
4 public/static/js-sdk 4 public/static/js-sdk
5 public/static/yas-jssdk 5 public/static/yas-jssdk
6 public/js/home/jquery.upload.js 6 public/js/home/jquery.upload.js
7 -public/js/activity/live/yas_live_data.js 7 +public/js/activity/live
  1 +'use strict';
  2 +
  3 +const questionModel = require('../models/question');
  4 +const headerModel = require('../../../doraemon/models/header'); // 头部model
  5 +
  6 +exports.list = (req, res, next) => {
  7 + req.ctx(questionModel).getQuestionList().then(result => {
  8 + res.render('question/list', {
  9 + title: '调研中心',
  10 + module: '3party',
  11 + page: 'question-list',
  12 + pageHeader: headerModel.setNav({
  13 + navTitle: '调研中心'
  14 + }),
  15 + list: result,
  16 + isApp: req.yoho.isApp,
  17 + localCss: true
  18 + });
  19 + }).catch(next);
  20 +};
  21 +
  22 +exports.check = (req, res, next) => {
  23 + let params = req.body;
  24 +
  25 + params.uid = req.user.uid || params.uid;
  26 +
  27 + if (!params.uid) {
  28 + return res.send({code: 400, message: '请先登录!'});
  29 + }
  30 +
  31 + req.ctx(questionModel).getQuestionStatus(params).then(result => {
  32 + res.send(result);
  33 + }).catch(next);
  34 +};
  35 +
  36 +exports.submit = (req, res, next) => {
  37 + let params = req.body;
  38 +
  39 + params.uid = req.user.uid || params.uid;
  40 +
  41 + if (!params.uid) {
  42 + return res.send({code: 400, message: '请先登录!'});
  43 + }
  44 +
  45 + // 标识问卷来源
  46 + if (req.yoho.isApp) {
  47 + params.sourceType = 'APP';
  48 + } else if (req.yoho.mobile) {
  49 + params.sourceType = 'H5';
  50 + } else {
  51 + params.sourceType = 'PC';
  52 + }
  53 +
  54 + req.ctx(questionModel).submitQuestion(params).then(result => {
  55 + res.send(result);
  56 + }).catch(next);
  57 +};
  58 +
  59 +
  60 +
  61 +exports.detail = (req, res, next) => {
  62 + let id = parseInt(`0${req.params.id}`, 10);
  63 +
  64 + req.ctx(questionModel).getQuestionDetail(id, req.user.uid).then(result => {
  65 + if (result && result.detail && req.yoho.isApp) {
  66 + result.detail.uid = req.user.uid;
  67 + }
  68 +
  69 + res.render('question/detail', Object.assign(result, {
  70 + title: 'YOHO!调研中心',
  71 + module: '3party',
  72 + page: 'question-detail',
  73 + pageHeader: headerModel.setNav({
  74 + navTitle: 'YOHO!调研中心'
  75 + }),
  76 + isApp: req.yoho.isApp,
  77 + localCss: true
  78 + }));
  79 + }).catch(next);
  80 +};
  1 +/**
  2 + * question model
  3 + * @author: yyq<yanqing.yang@yoho.cn>
  4 + * @date: 2017/05/23
  5 + */
  6 +
  7 +const _ = require('lodash');
  8 +
  9 +module.exports = class extends global.yoho.BaseModel {
  10 + constructor(ctx) {
  11 + super(ctx);
  12 + }
  13 + getQuestionList() {
  14 + return this.get({
  15 + url: 'activity/question/questionList',
  16 + api: global.yoho.ServiceAPI
  17 + }).then(result => {
  18 + let list = _.get(result, 'data.rows', []);
  19 +
  20 + _.forEach(list, (value, key) => {
  21 + value.index = key + 1;
  22 +
  23 + if (!_.get(value, 'share.imgUrl', '')) {
  24 + _.set(value, 'share.imgUrl', 'http://img11.static.yhbimg.com/sns/2017/05/25/14/0177e28a98f73417ae1a2a146aa2670dd2.png'); // eslint-disable-line
  25 + }
  26 + });
  27 +
  28 + return list;
  29 + });
  30 + }
  31 + getQuestionStatus(params) {
  32 + return this.get({
  33 + url: '/activity/question/questionValidate',
  34 + data: params,
  35 + api: global.yoho.ServiceAPI
  36 + });
  37 + }
  38 + getQuestionDetail(id, uid) {
  39 + return Promise.all([
  40 + this.get({
  41 + url: '/activity/question/questionValidate',
  42 + data: {id: id, uid: uid},
  43 + api: global.yoho.ServiceAPI
  44 + }),
  45 + this.get({
  46 + url: 'activity/question/questionDetail',
  47 + data: {id: id},
  48 + api: global.yoho.ServiceAPI
  49 + })
  50 + ]).then(result => {
  51 + let resData = {};
  52 +
  53 + if (_.get(result, '[0].code', '') === 200) {
  54 + let data = _.get(result, '[1].data', {});
  55 +
  56 + if (data.questions) {
  57 + _.forEach(data.questions, value => {
  58 + if (+value.questionType === 3) {
  59 + value.questionContents = _.fill(Array(value.fillBlankNum || 1), true);
  60 + }
  61 + });
  62 + }
  63 +
  64 + if (!_.isEmpty(data)) {
  65 + resData.detail = data;
  66 + }
  67 + } else {
  68 + resData.errText = _.get(result, '[0].message', '哟,本次调研已经飞走了,请移步其他调研呗!');
  69 + }
  70 +
  71 + return resData;
  72 + });
  73 + }
  74 + submitQuestion(info) {
  75 + return this.post({
  76 + url: '/activity/question/submitQuestions',
  77 + data: info,
  78 + api: global.yoho.ServiceAPI
  79 + });
  80 + }
  81 +};
@@ -10,7 +10,9 @@ const router = require('express').Router(); // eslint-disable-line @@ -10,7 +10,9 @@ const router = require('express').Router(); // eslint-disable-line
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const ads = require(`${cRoot}/ads`); 11 const ads = require(`${cRoot}/ads`);
12 const check = require(`${cRoot}/check`); 12 const check = require(`${cRoot}/check`);
  13 +const question = require(`${cRoot}/question`);
13 const validateCode = require('../passport/controllers/validateCode'); 14 const validateCode = require('../passport/controllers/validateCode');
  15 +const auth = require('../../doraemon/middleware/auth');
14 16
15 // routers 17 // routers
16 18
@@ -18,4 +20,10 @@ router.get('/ads', ads.index); @@ -18,4 +20,10 @@ router.get('/ads', ads.index);
18 router.get('/check', validateCode.load, check.index); 20 router.get('/check', validateCode.load, check.index);
19 router.post('/check/submit', validateCode.check, check.submit); 21 router.post('/check/submit', validateCode.check, check.submit);
20 22
  23 +
  24 +router.get('/questionnaire', auth, question.list);
  25 +router.post('/questionnaire/check', question.check);
  26 +router.post('/questionnaire/submit', question.submit);
  27 +router.get('/questionnaire/:id', auth, question.detail);
  28 +
21 module.exports = router; 29 module.exports = router;
  1 +<div class="qs-detail-page">
  2 + {{# detail}}
  3 + <div class="error-tip"></div>
  4 + <div class="detail-wrap">
  5 + <p class="sub-title">{{title}}</p>
  6 + <p class="guide-tip">{{description}}</p>
  7 +
  8 + <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}}">
  9 + {{# questions}}
  10 + <dl class="qs-item" data-index="{{questionIndex}}" data-type="{{questionType}}">
  11 + <dt>{{questionTitle}}</dt>
  12 + {{#isEqualOr questionType 1}}
  13 + {{# questionContents}}
  14 + <dd class="radio-option" data-index="{{@index}}">
  15 + <span class="iconfont">&#xe6ea;</span>
  16 + <div class="option-box">{{{option}}}</div>
  17 + {{#if addon}}
  18 + <input type="text">
  19 + {{/if}}
  20 + </dd>
  21 + {{/ questionContents}}
  22 + {{/isEqualOr}}
  23 +
  24 + {{#isEqualOr questionType 2}}
  25 + {{# questionContents}}
  26 + <dd class="check-option" data-index="{{@index}}">
  27 + <span class="iconfont">&#xe6ea;</span>
  28 + <div class="option-box">{{{option}}}</div>
  29 + {{#if addon}}
  30 + <input type="text">
  31 + {{/if}}
  32 + </dd>
  33 + {{/ questionContents}}
  34 + {{/isEqualOr}}
  35 +
  36 + {{#isEqualOr questionType 3}}
  37 + {{# questionContents}}
  38 + <dd><textarea class="text-input"></textarea></dd>
  39 + {{/ questionContents}}
  40 + {{/isEqualOr}}
  41 + </dl>
  42 + {{/ questions}}
  43 + </div>
  44 +
  45 + <div class="submit">
  46 + <button class="submit-btn">提交</button>
  47 + </div>
  48 + </div>
  49 + {{/ detail}}
  50 +
  51 + <div class="qs-err">
  52 + <p class="err-text">{{{errText}}}</p>
  53 + <a href="/3party/questionnaire">去做问卷</a>
  54 + </div>
  55 +
  56 + <div id="tip-dialog" class="tip-dialog hide">
  57 + <div class="dg-wrap">
  58 + <div class="dg-content"><p>您的问卷还没有成功提交哦!<br>是否立刻返回!</p></div>
  59 + <div class="dg-btns clearfix">
  60 + <span class="back-btn">返回</span>
  61 + <span class="close-btn continue-btn">继续填写</span>
  62 + </div>
  63 + </div>
  64 + </div>
  65 +</div>
  1 +<div class="qs-list-page">
  2 + {{#if list}}
  3 + <ul id="qs-list" class="qs-list">
  4 + {{#each list}}
  5 + <li data-id="{{id}}" data-title="{{title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">{{index}}.{{title}}</li>
  6 + {{/each}}
  7 + </ul>
  8 + {{/if}}
  9 +
  10 + <div id="tip-dialog" class="tip-dialog hide">
  11 + <div class="dg-wrap">
  12 + <div class="dg-content"></div>
  13 + <div class="dg-btns sure-btns clearfix hide">
  14 + <span class="close-btn sure-btn">确定</span>
  15 + </div>
  16 + <div class="dg-btns share-btns clearfix">
  17 + <span class="close-btn cancel-btn">取消</span>
  18 + <span class="share-btn">分享问卷</span>
  19 + </div>
  20 + </div>
  21 + </div>
  22 +</div>
@@ -9,13 +9,21 @@ exports.index = function(req, res, next) { @@ -9,13 +9,21 @@ exports.index = function(req, res, next) {
9 if (!result) { 9 if (!result) {
10 return next(); 10 return next();
11 } 11 }
  12 + let title = req.query.title || result.name || '专题活动';
  13 +
  14 + // 唤起 APP 的路径
  15 + 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"}}`;
  16 +
12 res.render('feature/index', { 17 res.render('feature/index', {
13 module: 'activity', 18 module: 'activity',
14 page: 'feature', 19 page: 'feature',
15 - title: result.name || 'Yoho!Buy有货', 20 + title: title,
16 content: result, 21 content: result,
17 activity_id: req.params.code, 22 activity_id: req.params.code,
18 - isFeature: true 23 + isFeature: true,
  24 + loadJs: [{
  25 + src: global.yoho.config.jsSdk
  26 + }]
19 }); 27 });
20 }).catch(next); 28 }).catch(next);
21 }; 29 };
@@ -17,7 +17,8 @@ exports.productLst = function(req, res, next) { @@ -17,7 +17,8 @@ exports.productLst = function(req, res, next) {
17 uid: uid, 17 uid: uid,
18 udid: udid, 18 udid: udid,
19 yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1, 19 yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1,
20 - limit: req.query.limit 20 + limit: req.query.limit,
  21 + gender: req.query.gender
21 }, req.query)); 22 }, req.query));
22 } else { 23 } else {
23 let keys = ['sort', 'misort', 'msort', 'gender', 'brand'], 24 let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
@@ -24,6 +24,11 @@ let _getProduct = function(o) { @@ -24,6 +24,11 @@ let _getProduct = function(o) {
24 }; 24 };
25 }; 25 };
26 26
  27 +const gender = {
  28 + 1: '1,3',
  29 + 2: '2,3'
  30 +};
  31 +
27 module.exports = { 32 module.exports = {
28 productLst: function(params) { 33 productLst: function(params) {
29 return api.get('', Object.assign({ 34 return api.get('', Object.assign({
@@ -47,7 +52,9 @@ module.exports = { @@ -47,7 +52,9 @@ module.exports = {
47 udid: params.udid || 0, 52 udid: params.udid || 0,
48 yh_channel: params.yh_channel, 53 yh_channel: params.yh_channel,
49 limit: params.limit, 54 limit: params.limit,
50 - need_filter: 'null' 55 + need_filter: 'null',
  56 + rec_pos: '100008',
  57 + gender: params.gender || gender[params.yh_channel]
51 }, { 58 }, {
52 cache: true 59 cache: true
53 }).then(res => { 60 }).then(res => {
@@ -22,9 +22,9 @@ @@ -22,9 +22,9 @@
22 style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}"> 22 style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
23 {{#if param.bgimg}} 23 {{#if param.bgimg}}
24 {{#isLazyLoad type @index}} 24 {{#isLazyLoad type @index}}
25 - <img class="lazy" data-original="{{image2 param.bgimg q=75}}"> 25 + <img class="lazy" data-original="{{imageslim param.bgimg}}">
26 {{else}} 26 {{else}}
27 - <img src="{{image2 param.bgimg q=75}}"> 27 + <img src="{{imageslim param.bgimg}}">
28 {{/isLazyLoad}} 28 {{/isLazyLoad}}
29 {{/if}} 29 {{/if}}
30 {{#component}} 30 {{#component}}
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 {{#if modalImg}} 34 {{#if modalImg}}
35 <div class="modal"> 35 <div class="modal">
36 <span class="modal-close"></span> 36 <span class="modal-close"></span>
37 - <img class="modal-img lazy" data-original="{{image2 modalImg q=75}}"> 37 + <img class="modal-img lazy" data-original="{{imageslim modalImg}}">
38 </div> 38 </div>
39 {{/if}} 39 {{/if}}
40 {{/isEqualOr}} 40 {{/isEqualOr}}
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 <div class="swiper-wrapper"> 66 <div class="swiper-wrapper">
67 {{#list}} 67 {{#list}}
68 <div class="swiper-slide" style="{{styleFormat this percent=1}}"> 68 <div class="swiper-slide" style="{{styleFormat this percent=1}}">
69 - <img src="{{image2 src q=75}}"> 69 + <img src="{{imageslim src}}">
70 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a> 70 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
71 </div> 71 </div>
72 {{/list}} 72 {{/list}}
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 88
89 {{#isEqualOr type 'productGroup'}} 89 {{#isEqualOr type 'productGroup'}}
90 {{! 商品池}} 90 {{! 商品池}}
91 - <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=75}}) repeat;background-size:100%;"{{/if}}> 91 + <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{imageslim proBgImg}}) repeat;background-size:100%;"{{/if}}>
92 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}" 92 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
93 {{#unless defaultPros.length}} 93 {{#unless defaultPros.length}}
94 {{#if searchCondition.item}} 94 {{#if searchCondition.item}}
@@ -103,9 +103,9 @@ @@ -103,9 +103,9 @@
103 <div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}"> 103 <div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
104 <a class="first-part product-detail" href='{{producturl}}'> 104 <a class="first-part product-detail" href='{{producturl}}'>
105 <div class="product-detail-imgbox"> 105 <div class="product-detail-imgbox">
106 - {{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=75}}">{{/if}}  
107 - {{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=75}}">{{/if}}  
108 - <img class="product-detail-img lazy" data-original="{{image2 productimg q=75}}"> 106 + {{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{imageslim ../lefTopImg}}">{{/if}}
  107 + {{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{imageslim ../rigTopImg}}">{{/if}}
  108 + <img class="product-detail-img lazy" data-original="{{imageslim productimg}}">
109 </div> 109 </div>
110 {{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}} 110 {{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
111 <div class="product-detail-text"> 111 <div class="product-detail-text">
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 <div class="brand-div"> 128 <div class="brand-div">
129 <span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span> 129 <span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
130 </div> 130 </div>
131 - <img class="brand-img lazy" data-original="{{image2 ../brandImg q=75}}"> 131 + <img class="brand-img lazy" data-original="{{imageslim ../brandImg}}">
132 </a> 132 </a>
133 {{/if}} 133 {{/if}}
134 </div> 134 </div>
@@ -137,8 +137,8 @@ @@ -137,8 +137,8 @@
137 <div class="feature-product-info novisible"> 137 <div class="feature-product-info novisible">
138 <a class="first-part product-detail" href=''> 138 <a class="first-part product-detail" href=''>
139 <div class="product-detail-imgbox"> 139 <div class="product-detail-imgbox">
140 - {{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=75}}">{{/if}}  
141 - {{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=75}}">{{/if}} 140 + {{#if lefTopImg}}<img class="leftopimg" src="{{imageslim lefTopImg}}">{{/if}}
  141 + {{#if rigTopImg}}<img class="rigtopimg" src="{{imageslim rigTopImg}}">{{/if}}
142 <img class="product-detail-img" src=""> 142 <img class="product-detail-img" src="">
143 </div> 143 </div>
144 {{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}} 144 {{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
@@ -161,7 +161,7 @@ @@ -161,7 +161,7 @@
161 <div class="brand-div"> 161 <div class="brand-div">
162 <span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span> 162 <span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
163 </div> 163 </div>
164 - <img class="brand-img" src="{{image2 brandImg q=75}}"> 164 + <img class="brand-img" src="{{imageslim brandImg}}">
165 </a> 165 </a>
166 {{/if}} 166 {{/if}}
167 </div> 167 </div>
@@ -15,6 +15,10 @@ let configFile = ` @@ -15,6 +15,10 @@ let configFile = `
15 { 15 {
16 "appID": "EX33S4LRW7.com.yoho.buy", 16 "appID": "EX33S4LRW7.com.yoho.buy",
17 "paths": [ "*" ] 17 "paths": [ "*" ]
  18 + },
  19 + {
  20 + "appID": "FP8T8KM2NE.com.yoho.buy.c3",
  21 + "paths": [ "*" ]
18 } 22 }
19 ] 23 ]
20 } 24 }
@@ -71,9 +71,10 @@ exports.orderEnsure = (req, res, next) => { @@ -71,9 +71,10 @@ exports.orderEnsure = (req, res, next) => {
71 ]; 71 ];
72 72
73 /* tar note 170426 品众去除 */ 73 /* tar note 170426 品众去除 */
74 - // if (_.isUndefined(req.cookies._isNewUser)) {  
75 - // allPromise.push(orderModel.isNewUser(uid));  
76 - // } 74 + /* tar note 170601 品众代码恢复 */
  75 + if (_.isUndefined(req.cookies._isNewUser)) {
  76 + allPromise.push(orderModel.isNewUser(uid));
  77 + }
77 78
78 return Promise.all(allPromise).then(result => { 79 return Promise.all(allPromise).then(result => {
79 let order = result[0]; 80 let order = result[0];
@@ -81,15 +82,16 @@ exports.orderEnsure = (req, res, next) => { @@ -81,15 +82,16 @@ exports.orderEnsure = (req, res, next) => {
81 let address = result[2]; 82 let address = result[2];
82 83
83 /* tar note 170426 品众去除 */ 84 /* tar note 170426 品众去除 */
84 - // let isNewUser = result[3];  
85 -  
86 - // if (!_.isUndefined(isNewUser)) {  
87 - // if (isNewUser) {  
88 - // res.cookie('_isNewUser', true, actCkOpthn);  
89 - // } else {  
90 - // res.cookie('_isNewUser', false, actCkOpthn);  
91 - // }  
92 - // } 85 + /* tar note 170601 品众代码恢复 */
  86 + let isNewUser = result[3];
  87 +
  88 + if (!_.isUndefined(isNewUser)) {
  89 + if (isNewUser) {
  90 + res.cookie('_isNewUser', true, actCkOpthn);
  91 + } else {
  92 + res.cookie('_isNewUser', false, actCkOpthn);
  93 + }
  94 + }
93 95
94 if (order.cartUrl) { 96 if (order.cartUrl) {
95 logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`); 97 logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`);
@@ -107,7 +107,7 @@ const tools = { @@ -107,7 +107,7 @@ const tools = {
107 nonce_str: common.nonceStr(), 107 nonce_str: common.nonceStr(),
108 body: '有货订单号:' + params.orderCode, 108 body: '有货订单号:' + params.orderCode,
109 out_trade_no: 'YOHOBuy_' + params.orderCode, 109 out_trade_no: 'YOHOBuy_' + params.orderCode,
110 - total_fee: _.parseInt(params.totalFee * 100), 110 + total_fee: Math.round(params.totalFee * 100),
111 trade_type: 'JSAPI', 111 trade_type: 'JSAPI',
112 time_start: moment().format('YYYYMMDDHHmmss'), 112 time_start: moment().format('YYYYMMDDHHmmss'),
113 time_expire: moment().add(2, 'hours').format('YYYYMMDDHHmmss'), 113 time_expire: moment().add(2, 'hours').format('YYYYMMDDHHmmss'),
@@ -117,6 +117,7 @@ router.get('/passport/reg/index', validateCode.load, reg.index); @@ -117,6 +117,7 @@ router.get('/passport/reg/index', validateCode.load, reg.index);
117 router.post('/passport/reg/verifymobile', validateCode.check, reg.sendCodeBusyBoy, reg.verifyMobile); 117 router.post('/passport/reg/verifymobile', validateCode.check, reg.sendCodeBusyBoy, reg.verifyMobile);
118 router.get('/passport/reg/code', reg.guardStep(2), reg.code); 118 router.get('/passport/reg/code', reg.guardStep(2), reg.code);
119 router.post('/passport/reg/sendcode', reg.guardStep(2), reg.sendCodeBusyBoy, reg.sendCode); 119 router.post('/passport/reg/sendcode', reg.guardStep(2), reg.sendCodeBusyBoy, reg.sendCode);
  120 +router.post('/passport/reg/sendcodeagain', reg.guardStep(2), reg.sendCodeBusyBoy, reg.sendCode);
120 router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode); 121 router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode);
121 router.get('/passport/reg/password', reg.guardStep(3), reg.password); 122 router.get('/passport/reg/password', reg.guardStep(3), reg.password);
122 router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword); 123 router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword);
@@ -39,7 +39,6 @@ @@ -39,7 +39,6 @@
39 {{/ goodsSubtitle}} 39 {{/ goodsSubtitle}}
40 40
41 <div class="price-date"> 41 <div class="price-date">
42 -  
43 <div class="goods-price data-bind"> 42 <div class="goods-price data-bind">
44 <h1 class="current-price"></h1> 43 <h1 class="current-price"></h1>
45 <h1 class="previous-price"></h1> 44 <h1 class="previous-price"></h1>
@@ -47,13 +46,13 @@ @@ -47,13 +46,13 @@
47 <button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button> 46 <button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button>
48 <button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button> 47 <button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button>
49 <button class="got-limit-sale data-got-code data-bind">已获取限购码</button> 48 <button class="got-limit-sale data-got-code data-bind">已获取限购码</button>
50 - {{#if periodOfMarket}}  
51 - <div class="period-of-market">  
52 - <h1>上市期:</h1>  
53 - <h1 >{{periodOfMarket}}</h1>  
54 - </div>  
55 - {{/if}}  
56 </div> 49 </div>
  50 + {{#if periodOfMarket}}
  51 + <div class="period-of-market">
  52 + <h1>上市期:</h1>
  53 + <h1 >{{periodOfMarket}}</h1>
  54 + </div>
  55 + {{/if}}
57 56
58 <div class="price-date data-bind"> 57 <div class="price-date data-bind">
59 <div class="student-price"> 58 <div class="student-price">
@@ -52,14 +52,13 @@ @@ -52,14 +52,13 @@
52 <button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button> 52 <button class="limit-sale data-can-get-limit-code data-bind" id='limit-sale'>获取限购码</button>
53 <button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button> 53 <button class="got-limit-sale data-code-empty data-bind">限购码已被抢光</button>
54 <button class="got-limit-sale data-got-code data-bind">已获取限购码</button> 54 <button class="got-limit-sale data-got-code data-bind">已获取限购码</button>
55 -  
56 - {{#if periodOfMarket}}  
57 - <div class="period-of-market">  
58 - <h1>上市期:</h1>  
59 - <h1 >{{periodOfMarket}}</h1>  
60 - </div>  
61 - {{/if}}  
62 </div> 55 </div>
  56 + {{#if periodOfMarket}}
  57 + <div class="period-of-market">
  58 + <h1>上市期:</h1>
  59 + <h1 >{{periodOfMarket}}</h1>
  60 + </div>
  61 + {{/if}}
63 62
64 {{!--占位: 学生价/会员价--}} 63 {{!--占位: 学生价/会员价--}}
65 <div id="placeholder-pricedata"></div> 64 <div id="placeholder-pricedata"></div>
@@ -16,14 +16,16 @@ @@ -16,14 +16,16 @@
16 {{/within}} 16 {{/within}}
17 {{/if}} 17 {{/if}}
18 </a> 18 </a>
19 -  
20 - {{#ifor isGood four}}  
21 - {{#if showProductInfo}}  
22 - <div class="item-info">  
23 - <div class="text">{{text}}</div>  
24 - <div class="name">{{name}}</div>  
25 - <div class="price">{{salesPrice}}</div>  
26 - </div>  
27 - {{/if}}  
28 - {{/ifor}} 19 +
  20 + {{#if showProductInfo}}
  21 + {{#ifor isGood four}}
  22 + {{#unless parent.noShowProductInfo}}
  23 + <div class="item-info">
  24 + <div class="text">{{text}}</div>
  25 + <div class="name">{{name}}</div>
  26 + <div class="price">{{salesPrice}}</div>
  27 + </div>
  28 + {{/unless}}
  29 + {{/ifor}}
  30 + {{/if}}
29 </div> 31 </div>
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 {{#isEqual module_type 'SingleImage'}} 51 {{#isEqual module_type 'SingleImage'}}
52 <div class="items-s1 clearfix"> 52 <div class="items-s1 clearfix">
53 {{#each ../pics}} 53 {{#each ../pics}}
54 - {{> reds-shop/item index=@../index single=true}} 54 + {{> reds-shop/item index=@../index single=true parent=../..}}
55 {{/each}} 55 {{/each}}
56 </div> 56 </div>
57 {{#if ../isModuleMargin}} 57 {{#if ../isModuleMargin}}
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 {{#isEqual module_type 'DoubleImage'}} 61 {{#isEqual module_type 'DoubleImage'}}
62 <div class="items-s2 clearfix"> 62 <div class="items-s2 clearfix">
63 {{#each ../pics}} 63 {{#each ../pics}}
64 - {{> reds-shop/item index=@../index double=true}} 64 + {{> reds-shop/item index=@../index double=true parent=../..}}
65 {{/each}} 65 {{/each}}
66 </div> 66 </div>
67 {{#if ../isModuleMargin}} 67 {{#if ../isModuleMargin}}
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 {{#isEqual module_type 'TripleImage'}} 71 {{#isEqual module_type 'TripleImage'}}
72 <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"> 72 <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">
73 {{#each ../pics}} 73 {{#each ../pics}}
74 - {{> reds-shop/item index=@../index triple=true}} 74 + {{> reds-shop/item index=@../index triple=true parent=../..}}
75 {{/each}} 75 {{/each}}
76 </div> 76 </div>
77 {{#if ../isModuleMargin}} 77 {{#if ../isModuleMargin}}
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 <!--im 头部--> 3 <!--im 头部-->
4 <header class="yoho-header chat-header"> 4 <header class="yoho-header chat-header">
5 <a id="js-back" href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a> 5 <a id="js-back" href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
6 - <div class="title">智能小YO</div>  
7 - <div class="header-right"><span data-action="change-human">人工客服</span></div> 6 + <div class="title"><i class="chat-status"></i><span class="js-service-txt">正在连接...</span></div>
  7 + <div class="header-right"></div>
8 </header> 8 </header>
9 <!--网络连接失败--> 9 <!--网络连接失败-->
10 <div class="connection-failed hide"> 10 <div class="connection-failed hide">
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 </div> 16 </div>
17 <div class="fake-img-wrap"> 17 <div class="fake-img-wrap">
18 <img src="#" alt=""> 18 <img src="#" alt="">
19 - </div> 19 + </div>
20 <!--im footer--> 20 <!--im footer-->
21 <footer id="chat-footer"> 21 <footer id="chat-footer">
22 <div id="chat-send-box" class="table"> 22 <div id="chat-send-box" class="table">
@@ -71,4 +71,4 @@ @@ -71,4 +71,4 @@
71 imSocket: "{{imSocket}}", 71 imSocket: "{{imSocket}}",
72 imCs: "{{imCs}}", 72 imCs: "{{imCs}}",
73 }; 73 };
74 -</script>  
  74 +</script>
@@ -28,4 +28,12 @@ @@ -28,4 +28,12 @@
28 <span>400-889-9646</span> 28 <span>400-889-9646</span>
29 <i class="arr-ico iconfont">&#xe604;</i> 29 <i class="arr-ico iconfont">&#xe604;</i>
30 </a> 30 </a>
  31 + <a class="list clearfix" href="/3party/questionnaire">
  32 + <i class="questionnaire-ico icon"></i>
  33 + <div>
  34 + <p class="title">调研中心</p>
  35 + <p class="tip">一起来参与,赢取更多惊喜!</p>
  36 + </div>
  37 + <i class="arr-ico iconfont">&#xe604;</i>
  38 + </a>
31 </div> 39 </div>
@@ -25,7 +25,7 @@ const domains = { @@ -25,7 +25,7 @@ const domains = {
25 25
26 module.exports = { 26 module.exports = {
27 app: 'h5', 27 app: 'h5',
28 - appVersion: '5.7.0', // 调用api的版本 28 + appVersion: '5.7.1', // 调用api的版本
29 port: 6001, 29 port: 6001,
30 siteUrl: '//m.yohobuy.com', 30 siteUrl: '//m.yohobuy.com',
31 assetUrl: '//127.0.0.1:5001', 31 assetUrl: '//127.0.0.1:5001',
@@ -51,6 +51,7 @@ module.exports = () => { @@ -51,6 +51,7 @@ module.exports = () => {
51 yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') || 51 yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') ||
52 (req.query.appVersion && req.query.appVersion !== 'false') || 52 (req.query.appVersion && req.query.appVersion !== 'false') ||
53 req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || ''); 53 req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || '');
  54 + 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
54 yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); 55 yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
55 yoho.isWeibo = ua.indexOf('weibo') !== -1; 56 yoho.isWeibo = ua.indexOf('weibo') !== -1;
56 yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); 57 yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || '');
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 var isWechat = /micromessenger/i.test(navigator.userAgent || ''); 26 var isWechat = /micromessenger/i.test(navigator.userAgent || '');
27 if (isWechat) { 27 if (isWechat) {
28 document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', ''); 28 document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', '');
29 - (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) } })(); 29 + (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)})};}());
30 } 30 }
31 </script> 31 </script>
32 32
@@ -124,9 +124,6 @@ @@ -124,9 +124,6 @@
124 {{#loadJs}} 124 {{#loadJs}}
125 <script type="text/javascript" src="{{src}}"></script> 125 <script type="text/javascript" src="{{src}}"></script>
126 {{/loadJs}} 126 {{/loadJs}}
127 - {{#isFeature}}  
128 - <script type="text/javascript" src="//cdn.yoho.cn/js-sdk/1.2.2/jssdk.js"></script>  
129 - {{/isFeature}}  
130 {{#unless devEnv}} 127 {{#unless devEnv}}
131 {{> analysis}} 128 {{> analysis}}
132 {{/unless}} 129 {{/unless}}
@@ -76,7 +76,8 @@ @@ -76,7 +76,8 @@
76 }()); 76 }());
77 77
78 {{!--/* tar add 170426 品众代码去除 */--}} 78 {{!--/* tar add 170426 品众代码去除 */--}}
79 - {{!--window._fxcmd = window._fxcmd || []; 79 + {{!--/* tar add 170601 品众代码恢复 */--}}
  80 + window._fxcmd = window._fxcmd || [];
80 _fxcmd.sid = 'bb3b16fa1106a6ab8619da0095755f32'; 81 _fxcmd.sid = 'bb3b16fa1106a6ab8619da0095755f32';
81 _fxcmd.trackAll = false; 82 _fxcmd.trackAll = false;
82 // 参数配置(可选)... 83 // 参数配置(可选)...
@@ -89,7 +90,7 @@ @@ -89,7 +90,7 @@
89 _pzfx.src = '//static.w3t.cn/fx/1/1/fx.js'; 90 _pzfx.src = '//static.w3t.cn/fx/1/1/fx.js';
90 var sc = document.getElementsByTagName('script')[0]; 91 var sc = document.getElementsByTagName('script')[0];
91 sc.parentNode.insertBefore(_pzfx,sc); 92 sc.parentNode.insertBefore(_pzfx,sc);
92 - }, 1000);--}} 93 + }, 1000);
93 94
94 95
95 </script> 96 </script>
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.7.2", 3 + "version": "5.7.11",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 "yoho-fastclick": "^1.0.6", 103 "yoho-fastclick": "^1.0.6",
104 "yoho-hammer": "^2.0.7", 104 "yoho-hammer": "^2.0.7",
105 "yoho-iscroll": "^5.2.0", 105 "yoho-iscroll": "^5.2.0",
106 - "yoho-jquery": "^2.2.4", 106 + "yoho-jquery": "^1.12.4",
107 "yoho-jquery-lazyload": "^1.9.12", 107 "yoho-jquery-lazyload": "^1.9.12",
108 "yoho-jquery-qrcode": "^0.14.0", 108 "yoho-jquery-qrcode": "^0.14.0",
109 "yoho-mlellipsis": "0.0.3", 109 "yoho-mlellipsis": "0.0.3",
@@ -4,7 +4,7 @@ const path = require('path'); @@ -4,7 +4,7 @@ const path = require('path');
4 const info = { 4 const info = {
5 host: '127.0.0.1', 5 host: '127.0.0.1',
6 port: 5001, 6 port: 5001,
7 - publicPath: 'http://127.0.0.1:5001' 7 + publicPath: 'http://127.0.0.1:5001/'
8 }; 8 };
9 9
10 try { 10 try {
  1 +require('3party/question-detail.page.css');
  2 +
  3 +let $ = require('yoho-jquery'),
  4 + yoho = require('yoho-app'),
  5 + tipDg = require('plugin/tip'),
  6 + share = require('common/share');
  7 +
  8 +let question = {
  9 + $base: $('#qs-wrap'),
  10 + init: function() {
  11 + let that = this;
  12 +
  13 + this.$errTip = $('.error-tip');
  14 + this.$item = $('.qs-item', this.$base);
  15 + this.startTime = Date.parse(new Date()) / 1000;
  16 +
  17 + if (this.$base.length) {
  18 + let data = this.$base.data();
  19 +
  20 + this.shareInfo = {
  21 + title: data.title,
  22 + link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
  23 + desc: data.desc,
  24 + imgUrl: data.img
  25 + };
  26 +
  27 + // 设置分享信息
  28 + share(this.shareInfo);
  29 +
  30 + // 设置app页面信息及分享信息
  31 + if (yoho.isApp) {
  32 + yoho.ready(function() {
  33 + yoho.invokeMethod('get.pageType', {
  34 + pageType: 'questionnaire'
  35 + });
  36 + yoho.invokeMethod('set.shareInfo', that.shareInfo);
  37 + });
  38 + }
  39 + }
  40 +
  41 + this.bindEvent();
  42 + },
  43 + bindEvent: function() {
  44 + let that = this;
  45 +
  46 + this.$base.on('click', '.radio-option', function() {
  47 + let $this = $(this);
  48 +
  49 + if (!$this.hasClass('on')) {
  50 + $this.siblings('.on').removeClass('on');
  51 + $this.addClass('on');
  52 + }
  53 + }).on('click', '.check-option', function() {
  54 + let $this = $(this);
  55 +
  56 + if ($this.hasClass('on')) {
  57 + $this.removeClass('on');
  58 + } else {
  59 + $this.addClass('on');
  60 + }
  61 + }).on('click', 'input', function(e) {
  62 + if (e && e.stopPropagation) {
  63 + e.stopPropagation();
  64 + } else {
  65 + window.event.cancelBubble = true;
  66 + }
  67 + });
  68 + $('.submit-btn').click(function() {
  69 + that.saveAnswers(that.packAnswersInfo());
  70 + });
  71 + },
  72 + packAnswersInfo: function() {
  73 + let that = this;
  74 + let answer = [];
  75 + let $errDom;
  76 +
  77 + this.$item.each(function() {
  78 + if ($errDom) {
  79 + return;
  80 + }
  81 +
  82 + let $this = $(this);
  83 + let data = $this.data();
  84 + let ans = [];
  85 + let errText = '';
  86 +
  87 + if (+data.type === 3) {
  88 + $this.find('.text-input').each(function() {
  89 + let val = $.trim($(this).val());
  90 +
  91 + if (val) {
  92 + ans.push({
  93 + questionIndex: data.index,
  94 + answerIndex: ans.length,
  95 + addon: val
  96 + });
  97 + }
  98 +
  99 + if (val.length > 400) {
  100 + errText = '输入内容过长';
  101 + }
  102 +
  103 +
  104 + });
  105 + } else {
  106 + $this.find('.on').each(function() {
  107 + let $that = $(this),
  108 + $input = $that.find('input'),
  109 + a = {
  110 + questionIndex: data.index,
  111 + answerIndex: $that.data('index')
  112 + };
  113 +
  114 + if ($input && $input.length) {
  115 + a.addon = $input.val();
  116 + }
  117 +
  118 + ans.push(a);
  119 + });
  120 +
  121 + if (data.type === '1') {
  122 + ans.length = 1;
  123 + }
  124 + }
  125 +
  126 + if (errText || !ans.length) {
  127 + $errDom = $this;
  128 +
  129 + if (!errText) {
  130 + errText = +data.type === 3 ? '请填写一条回答' : '请选择一个选项';
  131 + }
  132 +
  133 + that.showError(errText, $errDom);
  134 + } else {
  135 + answer = $.merge(answer, ans);
  136 + }
  137 + });
  138 +
  139 + if ($errDom) {
  140 + return [];
  141 + } else {
  142 + return answer;
  143 + }
  144 + },
  145 + showError: function(tip, $errDom) {
  146 + let that = this;
  147 +
  148 + this.$errTip.html(tip);
  149 +
  150 + if (this.timer) {
  151 + clearTimeout(this.timer);
  152 + }
  153 +
  154 + this.timer = setTimeout(function() {
  155 + that.$errTip.empty();
  156 + }, 5000);
  157 +
  158 + if ($errDom) {
  159 + let offTop = $errDom.offset().top,
  160 + errHeight = this.$errTip.outerHeight();
  161 +
  162 + $('html,body').animate({scrollTop: offTop - errHeight}, 500);
  163 + }
  164 + },
  165 + saveAnswers: function(info) {
  166 + if (!info || !info.length) {
  167 + return;
  168 + }
  169 +
  170 + $.ajax({
  171 + type: 'POST',
  172 + url: '/3party/questionnaire/submit',
  173 + data: {
  174 + id: this.$base.data('id'),
  175 + uid: this.$base.data('cid'),
  176 + startTime: this.startTime,
  177 + endTime: Date.parse(new Date()) / 1000,
  178 + frontAnswers: JSON.stringify(info)
  179 + }
  180 + }).then(function(data) {
  181 + if (data.code === 200) {
  182 + tipDg.show('调查问卷已成功提交,感谢您的帮助!');
  183 +
  184 + setTimeout(function() {
  185 + if (yoho.isApp) {
  186 + yoho.invokeMethod('go.back');
  187 + } else {
  188 + window.history.go(-1);
  189 + }
  190 + }, 2000);
  191 + } else {
  192 + tipDg.show(data.message || '网络出了点问题~');
  193 + }
  194 + });
  195 + }
  196 +};
  197 +
  198 +let tipDialog = {
  199 + $base: $('#tip-dialog'),
  200 + init: function() {
  201 + var that = this;
  202 +
  203 + this.$base.on('click', '.close-btn', function() {
  204 + that.hide();
  205 + });
  206 + this.$base.on('click', '.back-btn', function() {
  207 + window.history.go(-1);
  208 + });
  209 + },
  210 + show: function() {
  211 + this.$base.removeClass('hide');
  212 + },
  213 + hide: function() {
  214 + this.$base.addClass('hide');
  215 + }
  216 +};
  217 +
  218 +tipDialog.init();
  219 +question.init();
  220 +
  221 +if (question.$base.length) {
  222 + $('.nav-back').removeAttr('href').click(function() {
  223 + tipDialog.show();
  224 + });
  225 +} else if (yoho.isApp) {
  226 + $('.qs-err a').removeAttr('href').click(function() {
  227 + yoho.invokeMethod('go.back');
  228 + });
  229 +}
  230 +
  1 +'use strict';
  2 +require('3party/question-list.page.css');
  3 +
  4 +let $ = require('yoho-jquery'),
  5 + yoho = require('yoho-app');
  6 +
  7 +const DETAIL_URI = 'http://m.yohobuy.com/3party/questionnaire';
  8 +
  9 +require('../common');
  10 +
  11 +let qs = window.queryString;
  12 +
  13 +function getQuestionStatus(reqData, cb) {
  14 + if (qs.uid) {
  15 + reqData.uid = qs.uid;
  16 + }
  17 +
  18 + $.ajax({
  19 + type: 'POST',
  20 + url: '/3party/questionnaire/check',
  21 + data: reqData
  22 + }).then(function(data) {
  23 + if (cb && typeof cb === 'function') {
  24 + return cb(data);
  25 + }
  26 + });
  27 +}
  28 +
  29 +function jumpQuestionDetail(data) {
  30 + let href;
  31 +
  32 + if (qs && qs.uid && yoho.isApp) {
  33 + href = DETAIL_URI + '/' + data.id + '?uid=' + qs.uid;
  34 + } else {
  35 + href = DETAIL_URI + '/' + data.id;
  36 + }
  37 +
  38 + if (yoho && yoho.isApp) {
  39 + let link = yoho.parseUrl(href);
  40 +
  41 + yoho.goH5(href, JSON.stringify({
  42 + action: 'go.h5',
  43 + params: {
  44 + islogin: 'N',
  45 + type: 14,
  46 + updateflag: Date.now() + '',
  47 + url: link.path,
  48 + param: link.query
  49 + }
  50 + }));
  51 + } else {
  52 + window.location.href = href;
  53 + }
  54 +}
  55 +
  56 +let tipDialog = {
  57 + $base: $('#tip-dialog'),
  58 + init: function() {
  59 + let that = this;
  60 +
  61 + this.$content = $('.dg-content', this.$base);
  62 + this.$sureBtns = $('.sure-btns', this.$base);
  63 + this.$shareBtns = $('.share-btns', this.$base);
  64 +
  65 + this.$base.on('click', '.close-btn', function() {
  66 + that.hide();
  67 + });
  68 + this.$base.on('click', '.share-btn', function() {
  69 + if (that.share && typeof that.share === 'function') {
  70 + that.share();
  71 + } else {
  72 + that.hide();
  73 + }
  74 + });
  75 + },
  76 + show: function(info) {
  77 + this.share = false;
  78 +
  79 + if (typeof info === 'object') {
  80 + this.$content.html(info.content);
  81 + this.$sureBtns.addClass('hide');
  82 + this.$shareBtns.removeClass('hide');
  83 + } else if (typeof info === 'string') {
  84 + this.$content.html('<p>' + info + '</p>');
  85 + this.$sureBtns.removeClass('hide');
  86 + this.$shareBtns.addClass('hide');
  87 + } else {
  88 + return;
  89 + }
  90 +
  91 + this.$base.removeClass('hide');
  92 + },
  93 + hide: function() {
  94 + this.$base.addClass('hide');
  95 + }
  96 +};
  97 +
  98 +tipDialog.init();
  99 +
  100 +let $list = $('#qs-list');
  101 +
  102 +$list.on('click', 'li', function() {
  103 + let data = $(this).data();
  104 +
  105 + if (!data.id) {
  106 + return;
  107 + }
  108 +
  109 + getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
  110 + if (resData.code === 200) {
  111 + jumpQuestionDetail(data);
  112 + } else if (resData.code === 206) {
  113 + if (yoho && yoho.isApp) {
  114 + yoho.invokeMethod('go.showShareAlert', {
  115 + title: data.title,
  116 + link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
  117 + desc: data.desc,
  118 + imgUrl: data.img
  119 + });
  120 + } else {
  121 + tipDialog.show('调查问卷已成功提交,<br>感谢您的帮助!');
  122 + }
  123 + } else if (resData.message) {
  124 + if (yoho && yoho.isApp) {
  125 + yoho.goH5(DETAIL_URI + '/0');
  126 + } else {
  127 + window.location.href = DETAIL_URI + '/0';
  128 + }
  129 + }
  130 + });
  131 +});
  132 +
  133 +if ($list.children().length === 1) {
  134 + let data = $list.children().first().data();
  135 +
  136 + getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
  137 + if (resData.code === 200) {
  138 + jumpQuestionDetail(data);
  139 + }
  140 + });
  141 +}
@@ -4,26 +4,26 @@ @@ -4,26 +4,26 @@
4 * 直播或重播页面上方浮动的下载提示 4 * 直播或重播页面上方浮动的下载提示
5 * 用于跳转到对应的app页面或进入下载页面 5 * 用于跳转到对应的app页面或进入下载页面
6 */ 6 */
7 -let is_wechat = false; //是否在微信中  
8 -let is_weibo = false; //是否在微博中  
9 -  
10 -let is_ios = false; //是否是ios  
11 -let is_android = false; //是否是android  
12 -let is_pod = false;  
13 -let is_pc = false;  
14 -let $btn_download; //下载按钮  
15 -let $btn_close; //关闭按钮  
16 -let $download_head_wrapper; //下载div最外部分  
17 -let $download_head; //下载div fixed部分  
18 -let $download_msg; //在微信中点击下载弹出的提示部分  
19 -  
20 -//let app_ios = 'mtmv://lives?id=6141903674538004481';  
21 -let app_ios = 'yohoefashion4In1://'; //ios的scheme  
22 -let app_android = 'yohoefashion4In1://'; //android的scheme  
23 -let download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址  
24 -let download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址  
25 -let queryArr = []; //地址栏参数  
26 -let date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面 7 +var is_wechat = false; //是否在微信中
  8 +var is_weibo = false; //是否在微博中
  9 +
  10 +var is_ios = false; //是否是ios
  11 +var is_android = false; //是否是android
  12 +var is_pod = false;
  13 +var is_pc = false;
  14 +var $btn_download; //下载按钮
  15 +var $btn_close; //关闭按钮
  16 +var $download_head_wrapper; //下载div最外部分
  17 +var $download_head; //下载div fixed部分
  18 +var $download_msg; //在微信中点击下载弹出的提示部分
  19 +
  20 +//var app_ios = 'mtmv://lives?id=6141903674538004481';
  21 +var app_ios = 'yohoefashion4In1://'; //ios的scheme
  22 +var app_android = 'yohoefashion4In1://'; //android的scheme
  23 +var download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址
  24 +var download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址
  25 +var queryArr = []; //地址栏参数
  26 +var date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面
27 27
28 /** 28 /**
29 * 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为 29 * 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为
@@ -32,8 +32,8 @@ let date_start; //銝蝸嚗鈭恣蝞歲頧 @@ -32,8 +32,8 @@ let date_start; //銝蝸嚗鈭恣蝞歲頧
32 * @param link 对应的下载地址 32 * @param link 对应的下载地址
33 */ 33 */
34 function openAppOrLink(app, link) { 34 function openAppOrLink(app, link) {
35 - let ifrSrc;  
36 - let ifr; 35 + var ifrSrc;
  36 + var ifr;
37 if (is_android) { 37 if (is_android) {
38 //安卓基本上打不开app,只能打开下载地址。。。 38 //安卓基本上打不开app,只能打开下载地址。。。
39 date_start = new Date(); 39 date_start = new Date();
@@ -46,8 +46,8 @@ function openAppOrLink(app, link) { @@ -46,8 +46,8 @@ function openAppOrLink(app, link) {
46 document.body.appendChild(ifr); 46 document.body.appendChild(ifr);
47 47
48 setTimeout(function() { 48 setTimeout(function() {
49 - let date_end = new Date();  
50 - /*let p = document.createElement('p'); 49 + var date_end = new Date();
  50 + /*var p = document.createElement('p');
51 p.innerHTML = date_end - date_start 51 p.innerHTML = date_end - date_start
52 document.body.appendChild(p);*/ 52 document.body.appendChild(p);*/
53 if (date_end.getTime() - date_start.getTime() < 1300) { 53 if (date_end.getTime() - date_start.getTime() < 1300) {
@@ -69,7 +69,7 @@ function openAppOrLink(app, link) { @@ -69,7 +69,7 @@ function openAppOrLink(app, link) {
69 if (!is_pod) { 69 if (!is_pod) {
70 document.location.href = app; 70 document.location.href = app;
71 setTimeout(function() { 71 setTimeout(function() {
72 - let date_end = new Date(); 72 + var date_end = new Date();
73 if (!is_pod) { 73 if (!is_pod) {
74 if (date_end.getTime() - date_start.getTime() < 1200) { 74 if (date_end.getTime() - date_start.getTime() < 1200) {
75 document.location.href = link; 75 document.location.href = link;
@@ -80,7 +80,7 @@ function openAppOrLink(app, link) { @@ -80,7 +80,7 @@ function openAppOrLink(app, link) {
80 } else { 80 } else {
81 document.location.href = app; 81 document.location.href = app;
82 setTimeout(function() { 82 setTimeout(function() {
83 - let date_end = new Date(); 83 + var date_end = new Date();
84 if (is_pod) { 84 if (is_pod) {
85 //$('.live-app-desc p').eq(0).text(date_end.getTime() - date_start.getTime()); 85 //$('.live-app-desc p').eq(0).text(date_end.getTime() - date_start.getTime());
86 if (date_end.getTime() - date_start.getTime() < 2003) { 86 if (date_end.getTime() - date_start.getTime() < 2003) {
@@ -103,8 +103,8 @@ function openAppOrLink(app, link) { @@ -103,8 +103,8 @@ function openAppOrLink(app, link) {
103 document.body.appendChild(ifr); 103 document.body.appendChild(ifr);
104 104
105 setTimeout(function() { 105 setTimeout(function() {
106 - let date_end = new Date();  
107 - /*let p = document.createElement('p'); 106 + var date_end = new Date();
  107 + /*var p = document.createElement('p');
108 p.innerHTML = date_end - date_start 108 p.innerHTML = date_end - date_start
109 document.body.appendChild(p);*/ 109 document.body.appendChild(p);*/
110 //alert(date_end.getTime() - date_start.getTime()); 110 //alert(date_end.getTime() - date_start.getTime());
@@ -137,7 +137,7 @@ function get_download_link() { @@ -137,7 +137,7 @@ function get_download_link() {
137 * @returns {boolean} 137 * @returns {boolean}
138 */ 138 */
139 function check_supperUniversalLink() { 139 function check_supperUniversalLink() {
140 - let osversion = navigator.userAgent.match(/iPhone OS (\d*)/); 140 + var osversion = navigator.userAgent.match(/iPhone OS (\d*)/);
141 //console.log(osversion && osversion[1]); 141 //console.log(osversion && osversion[1]);
142 return osversion && osversion[1]; 142 return osversion && osversion[1];
143 /*if (osversion && osversion[1] >= 9) { 143 /*if (osversion && osversion[1] >= 9) {
@@ -166,10 +166,10 @@ function show_download_msg() { @@ -166,10 +166,10 @@ function show_download_msg() {
166 * @constructor 166 * @constructor
167 */ 167 */
168 function ManageQueryString() { 168 function ManageQueryString() {
169 - let loc = document.location.href;  
170 - let variables = '';  
171 - let variableArr = [];  
172 - let finalArr = []; 169 + var loc = document.location.href;
  170 + var variables = '';
  171 + var variableArr = [];
  172 + var finalArr = [];
173 173
174 if (loc.indexOf('?') > 0) { 174 if (loc.indexOf('?') > 0) {
175 variables = loc.split('?')[1]; 175 variables = loc.split('?')[1];
@@ -179,8 +179,8 @@ function ManageQueryString() { @@ -179,8 +179,8 @@ function ManageQueryString() {
179 variableArr = variables.split('&'); 179 variableArr = variables.split('&');
180 } 180 }
181 181
182 - for (let i = 0; i < variableArr.length; i++) {  
183 - let obj = {}; 182 + for (var i = 0; i < variableArr.length; i++) {
  183 + var obj = {};
184 obj.name = variableArr[i].split('=')[0]; 184 obj.name = variableArr[i].split('=')[0];
185 obj.value = variableArr[i].split('=')[1]; 185 obj.value = variableArr[i].split('=')[1];
186 finalArr.push(obj); 186 finalArr.push(obj);
@@ -197,8 +197,8 @@ function ManageQueryString() { @@ -197,8 +197,8 @@ function ManageQueryString() {
197 */ 197 */
198 function getQueryString(arr, name) { 198 function getQueryString(arr, name) {
199 if (arr.length > 0) { 199 if (arr.length > 0) {
200 - for (let i = 0; i < arr.length; i++) {  
201 - let obj = arr[i]; 200 + for (var i = 0; i < arr.length; i++) {
  201 + var obj = arr[i];
202 if (obj.name == name) { 202 if (obj.name == name) {
203 return obj.value; 203 return obj.value;
204 } 204 }
@@ -207,7 +207,7 @@ function getQueryString(arr, name) { @@ -207,7 +207,7 @@ function getQueryString(arr, name) {
207 } 207 }
208 208
209 function check_sys_open() { 209 function check_sys_open() {
210 - let download_type = ''; 210 + var download_type = '';
211 if (is_android) { 211 if (is_android) {
212 download_type = 'android'; 212 download_type = 'android';
213 openAppOrLink(app_android, download_android); 213 openAppOrLink(app_android, download_android);
@@ -227,11 +227,11 @@ function check_sys_open() { @@ -227,11 +227,11 @@ function check_sys_open() {
227 $(document).ready(function() { 227 $(document).ready(function() {
228 228
229 229
230 - let location = document.location.href; 230 + var location = document.location.href;
231 queryArr = ManageQueryString(); 231 queryArr = ManageQueryString();
232 - let is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app 232 + var is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app
233 233
234 - let agent = navigator.userAgent.toLowerCase(); 234 + var agent = navigator.userAgent.toLowerCase();
235 235
236 //判断环境 236 //判断环境
237 if (agent.match(/android/i) == 'android') { 237 if (agent.match(/android/i) == 'android') {
@@ -283,7 +283,7 @@ $(document).ready(function() { @@ -283,7 +283,7 @@ $(document).ready(function() {
283 $download_msg = $('.live-app-download-msg'); //提示在浏览器中打开 283 $download_msg = $('.live-app-download-msg'); //提示在浏览器中打开
284 284
285 $btn_download.on('click', function() { //点击下载按钮 285 $btn_download.on('click', function() { //点击下载按钮
286 - let download_type = ''; 286 + var download_type = '';
287 if (is_android) { 287 if (is_android) {
288 download_type = 'android'; 288 download_type = 'android';
289 openAppOrLink(app_android, download_android); 289 openAppOrLink(app_android, download_android);
@@ -9,19 +9,19 @@ global.msg_obj = [ @@ -9,19 +9,19 @@ global.msg_obj = [
9 '{"avatar": "http://img01.yohoboys.com/contentimg/2016/06/15/14/012b97d00097fd444bd8f830ed2e8fe54e.jpg", "cmd": 5, "msg": "别和小编太较真", "name": "YOHO_187****1007", "room": 19177}' 9 '{"avatar": "http://img01.yohoboys.com/contentimg/2016/06/15/14/012b97d00097fd444bd8f830ed2e8fe54e.jpg", "cmd": 5, "msg": "别和小编太较真", "name": "YOHO_187****1007", "room": 19177}'
10 ]; 10 ];
11 11
12 -let replay_msg = []; 12 +var replay_msg = [];
13 13
14 (function() { 14 (function() {
15 - for (let i = 0; i < 300; i++) {  
16 - let time = 5 + i * 2;  
17 - let rand = Math.floor(Math.random() * 2);  
18 - let msg = ''; 15 + for (var i = 0; i < 300; i++) {
  16 + var time = 5 + i * 2;
  17 + var rand = Math.floor(Math.random() * 2);
  18 + var msg = '';
19 if (rand === 1) { 19 if (rand === 1) {
20 msg = '{"createtime":' + time + ',"avatar":"","name":"\u8c2d\u660e\u4e54' + i + '","msg":"测试消息测试消息测试消息测试消息测试消息测试消息' + i + '","cmd":"5"}' 20 msg = '{"createtime":' + time + ',"avatar":"","name":"\u8c2d\u660e\u4e54' + i + '","msg":"测试消息测试消息测试消息测试消息测试消息测试消息' + i + '","cmd":"5"}'
21 } else { 21 } else {
22 msg = '{"createtime":' + time + ',"avatar":"http:\/\/avatar.jpg","name":"测试登录' + i + '","msg":"","cmd":"4"}'; 22 msg = '{"createtime":' + time + ',"avatar":"http:\/\/avatar.jpg","name":"测试登录' + i + '","msg":"","cmd":"4"}';
23 } 23 }
24 - let j = JSON.parse(msg); 24 + var j = JSON.parse(msg);
25 replay_msg.push(j); 25 replay_msg.push(j);
26 } 26 }
27 })(); 27 })();
1 // 初始化config信息 1 // 初始化config信息
2 -let _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号 2 +var _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号
3 3
4 $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) { 4 $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
5 if (json && json !== '') { 5 if (json && json !== '') {
6 - let _appId = json.appId.toString();  
7 - let _timestamp = json.timestamp;  
8 - let _nonceStr = json.nonceStr.toString();  
9 - let _signature = json.signature.toString(); 6 + var _appId = json.appId.toString();
  7 + var _timestamp = json.timestamp;
  8 + var _nonceStr = json.nonceStr.toString();
  9 + var _signature = json.signature.toString();
10 10
11 window.wx.config({ 11 window.wx.config({
12 debug: true, 12 debug: true,
@@ -59,11 +59,11 @@ $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('# @@ -59,11 +59,11 @@ $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#
59 function share() { 59 function share() {
60 window.wx.ready(function() { 60 window.wx.ready(function() {
61 // 构造分享信息 61 // 构造分享信息
62 - let shareTitle = $('#shareTitle').val();  
63 - let shareImg = $('#shareImg').val();  
64 - let shareDesc = $('#shareDesc').val();  
65 - let shareLink = $('#shareLink').val();  
66 - let shareData = { 62 + var shareTitle = $('#shareTitle').val();
  63 + var shareImg = $('#shareImg').val();
  64 + var shareDesc = $('#shareDesc').val();
  65 + var shareLink = $('#shareLink').val();
  66 + var shareData = {
67 title: shareTitle, 67 title: shareTitle,
68 desc: shareDesc, 68 desc: shareDesc,
69 imgUrl: shareImg, 69 imgUrl: shareImg,
@@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
3 * 用于处理一些统计数据 3 * 用于处理一些统计数据
4 */ 4 */
5 5
6 -let live_data_type = [ 6 +var live_data_type = [
7 'M_LIVE_DOWNLOAD_APP_TOP', 7 'M_LIVE_DOWNLOAD_APP_TOP',
8 'M_LIVE_DOWNLOAD_APP_CENTER', 8 'M_LIVE_DOWNLOAD_APP_CENTER',
9 'M_LIVE_PLAYBUTTON_CLICK', 9 'M_LIVE_PLAYBUTTON_CLICK',
10 'M_LIVE_SHARE']; 10 'M_LIVE_SHARE'];
11 -let play_count = 0; 11 +var play_count = 0;
12 12
13 function send_data(obj) { 13 function send_data(obj) {
14 console.log(obj); 14 console.log(obj);
@@ -18,21 +18,21 @@ function send_data(obj) { @@ -18,21 +18,21 @@ function send_data(obj) {
18 } 18 }
19 19
20 function get_live_data() { 20 function get_live_data() {
21 - let data_prefix = 'YOHOBOYS'; 21 + var data_prefix = 'YOHOBOYS';
22 22
23 if (document.location.hostname.indexOf('boy') > 0) { 23 if (document.location.hostname.indexOf('boy') > 0) {
24 data_prefix = 'YOHOBOYS'; 24 data_prefix = 'YOHOBOYS';
25 } else if (document.location.hostname.indexOf('girl') > 0) { 25 } else if (document.location.hostname.indexOf('girl') > 0) {
26 data_prefix = 'YOHOGIRLS'; 26 data_prefix = 'YOHOGIRLS';
27 } 27 }
28 - let data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0];  
29 - let data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1]; 28 + var data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0];
  29 + var data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1];
30 30
31 console.log(data_type, data_value); 31 console.log(data_type, data_value);
32 32
33 if (data_type != 0 && data_prefix != '') { 33 if (data_type != 0 && data_prefix != '') {
34 - let data_type_str = data_prefix + live_data_type[data_type - 1];  
35 - let obj = {}; 34 + var data_type_str = data_prefix + live_data_type[data_type - 1];
  35 + var obj = {};
36 36
37 obj.type = data_type_str; 37 obj.type = data_type_str;
38 if (data_value != 0) { 38 if (data_value != 0) {
@@ -13,44 +13,44 @@ @@ -13,44 +13,44 @@
13 * manage_replay_chat_msg ===> 通过requestAnimationFrame每帧调用用于判断是否可以展示重播消息和点赞 13 * manage_replay_chat_msg ===> 通过requestAnimationFrame每帧调用用于判断是否可以展示重播消息和点赞
14 * replay_barrage_callback_handler ===> 由video的各个事件中调取的callback方法 14 * replay_barrage_callback_handler ===> 由video的各个事件中调取的callback方法
15 */ 15 */
16 -let prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀  
17 -let requestAnimationFrame = window.requestAnimationFrame;  
18 -let cancelAnimationFrame = window.cancelAnimationFrame;  
19 -  
20 -let site_url = STATIC_RESOURCE_PATH;  
21 -let $btn_play;  
22 -let video_width = 375;  
23 -let video_height = 667;  
24 -let video_id = 'yoho_live'; //视频video标签id  
25 -let is_live = true; //是否是直播,根据地址栏参数可以判断  
26 -let get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口  
27 -let get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕  
28 -let query_arr = []; //地址栏参数数组  
29 -let link_type = 'webksocket'; //连接类型  
30 -let live_ws; //websocket  
31 -let heart_beat_interval; //心跳计时器  
32 -let live_time_interval; //播放时间计时器  
33 -let live_duration = 0; //播放时间计数器  
34 -let now_like_nums = 0; //当前点赞数  
35 -let $live_like_pannel; //点赞div,用于存放小脸动画  
36 -let is_animate = false; //用于控制动画的频率  
37 -  
38 -let replay_video;  
39 -let replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕  
40 -let replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟  
41 -let replay_chat_arr = []; //用于存储重播弹幕obj  
42 -let replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数  
43 -let is_replay_chat_loading = false; //是否正在调取接口  
44 -let can_seek = true; //  
45 -let replay_per_like = 0; //平均每秒增加的点赞数  
46 -let replay_per_request_like = 0; //平均每帧增加的点赞数(大概)  
47 -let replay_video_duration = 0; //重播视频  
48 -let replay_now_like = 0; //当前重播的点赞数  
49 -let is_wating = false;  
50 -  
51 -let test_count = 99;  
52 -  
53 -let CMD = { 16 +var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
  17 +var requestAnimationFrame = window.requestAnimationFrame;
  18 +var cancelAnimationFrame = window.cancelAnimationFrame;
  19 +
  20 +var site_url = STATIC_RESOURCE_PATH;
  21 +var $btn_play;
  22 +var video_width = 375;
  23 +var video_height = 667;
  24 +var video_id = 'yoho_live'; //视频video标签id
  25 +var is_live = true; //是否是直播,根据地址栏参数可以判断
  26 +var get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口
  27 +var get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕
  28 +var query_arr = []; //地址栏参数数组
  29 +var link_type = 'webksocket'; //连接类型
  30 +var live_ws; //websocket
  31 +var heart_beat_interval; //心跳计时器
  32 +var live_time_interval; //播放时间计时器
  33 +var live_duration = 0; //播放时间计数器
  34 +var now_like_nums = 0; //当前点赞数
  35 +var $live_like_pannel; //点赞div,用于存放小脸动画
  36 +var is_animate = false; //用于控制动画的频率
  37 +
  38 +var replay_video;
  39 +var replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕
  40 +var replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟
  41 +var replay_chat_arr = []; //用于存储重播弹幕obj
  42 +var replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数
  43 +var is_replay_chat_loading = false; //是否正在调取接口
  44 +var can_seek = true; //
  45 +var replay_per_like = 0; //平均每秒增加的点赞数
  46 +var replay_per_request_like = 0; //平均每帧增加的点赞数(大概)
  47 +var replay_video_duration = 0; //重播视频
  48 +var replay_now_like = 0; //当前重播的点赞数
  49 +var is_wating = false;
  50 +
  51 +var test_count = 99;
  52 +
  53 +var CMD = {
54 LOGIN: 1, //客户端发送登录消息 54 LOGIN: 1, //客户端发送登录消息
55 SEND_MESSAGE: 2, //客户端发送消息 55 SEND_MESSAGE: 2, //客户端发送消息
56 LOGOUT: 3, //客户端发送退出消息 56 LOGOUT: 3, //客户端发送退出消息
@@ -66,11 +66,11 @@ let CMD = { @@ -66,11 +66,11 @@ let CMD = {
66 }; 66 };
67 67
68 function set_duration () { 68 function set_duration () {
69 - let video = $('.video_player').find('video')[0];  
70 - let duration;  
71 - let durationH;  
72 - let durationM;  
73 - let durationS; 69 + var video = $('.video_player').find('video')[0];
  70 + var duration;
  71 + var durationH;
  72 + var durationM;
  73 + var durationS;
74 74
75 if (video) { 75 if (video) {
76 video.addEventListener('loadedmetadata', function() { 76 video.addEventListener('loadedmetadata', function() {
@@ -103,16 +103,16 @@ function set_duration () { @@ -103,16 +103,16 @@ function set_duration () {
103 */ 103 */
104 function init_play_button() { 104 function init_play_button() {
105 global.$btn_play = $btn_play = $('.live-video-play-button a'); 105 global.$btn_play = $btn_play = $('.live-video-play-button a');
106 - let video_source = $('#video_container').attr('data-video'); 106 + var video_source = $('#video_container').attr('data-video');
107 $btn_play.on('click', function() { 107 $btn_play.on('click', function() {
108 $('#live-watermark').removeClass('hide'); 108 $('#live-watermark').removeClass('hide');
109 if (live_type === 1 || live_type === 3) { 109 if (live_type === 1 || live_type === 3) {
110 if ($('#' + video_id)[0] == undefined) { 110 if ($('#' + video_id)[0] == undefined) {
111 get_chat_info(); //获取弹幕信息 111 get_chat_info(); //获取弹幕信息
112 112
113 - let _is_ios = true;  
114 - let _is_wechat = false;  
115 - let agent = navigator.userAgent.toLowerCase(); 113 + var _is_ios = true;
  114 + var _is_wechat = false;
  115 + var agent = navigator.userAgent.toLowerCase();
116 //判断环境 116 //判断环境
117 if (agent.match(/android/i) == 'android') { 117 if (agent.match(/android/i) == 'android') {
118 _is_ios = false; 118 _is_ios = false;
@@ -130,20 +130,20 @@ function init_play_button() { @@ -130,20 +130,20 @@ function init_play_button() {
130 $('.live-video-cover').hide(); //隐藏封面 130 $('.live-video-cover').hide(); //隐藏封面
131 $('.live-app-download-head-wrap').hide(); //隐藏头部 131 $('.live-app-download-head-wrap').hide(); //隐藏头部
132 132
133 - let temp_height = $(window).height();  
134 - let temp_width = $(document).width(); 133 + var temp_height = $(window).height();
  134 + var temp_width = $(document).width();
135 if (temp_width > 540) { 135 if (temp_width > 540) {
136 temp_width = 540; 136 temp_width = 540;
137 } 137 }
138 - let scale = 17.1 / 20; 138 + var scale = 17.1 / 20;
139 // if (temp_height > 30.15 * scale * (temp_width / 320 * 20)) { 139 // if (temp_height > 30.15 * scale * (temp_width / 320 * 20)) {
140 // temp_height = 30.15 * scale + 'rem'; 140 // temp_height = 30.15 * scale + 'rem';
141 // } else { 141 // } else {
142 // temp_height = temp_height + 'px' 142 // temp_height = temp_height + 'px'
143 // } 143 // }
144 144
145 - let v_width = temp_width + 'px';  
146 - let v_height = 32.575 * scale + 'rem'; 145 + var v_width = temp_width + 'px';
  146 + var v_height = 32.575 * scale + 'rem';
147 $('.live-loading-container').show(); //显示loading 147 $('.live-loading-container').show(); //显示loading
148 init_video(video_source, _is_wechat, _is_ios, '100%', '100%'); 148 init_video(video_source, _is_wechat, _is_ios, '100%', '100%');
149 149
@@ -271,7 +271,7 @@ function get_chat_info() { @@ -271,7 +271,7 @@ function get_chat_info() {
271 * @param type 参数类型:websocket,tcp,用于获取不同协议的服务器地址 271 * @param type 参数类型:websocket,tcp,用于获取不同协议的服务器地址
272 */ 272 */
273 function get_websocket_server(type) { 273 function get_websocket_server(type) {
274 - let param = type; 274 + var param = type;
275 $.ajax({ 275 $.ajax({
276 url: get_socket_server_url, 276 url: get_socket_server_url,
277 data: { 277 data: {
@@ -282,11 +282,11 @@ function get_websocket_server(type) { @@ -282,11 +282,11 @@ function get_websocket_server(type) {
282 success: function(data) { 282 success: function(data) {
283 console.log(data); 283 console.log(data);
284 if (data.code === 200) { 284 if (data.code === 200) {
285 - let arr = data.data[0].split(':');  
286 - let ip = arr[0];  
287 - let port = arr[1];  
288 - let protocol = 'ws'  
289 - // let protocol = location.protocol === 'https:' ? 'wss' :'ws' 285 + var arr = data.data[0].split(':');
  286 + var ip = arr[0];
  287 + var port = arr[1];
  288 + var protocol = 'ws'
  289 + // var protocol = location.protocol === 'https:' ? 'wss' :'ws'
290 290
291 if (is_live) { 291 if (is_live) {
292 292
@@ -304,7 +304,7 @@ function get_websocket_server(type) { @@ -304,7 +304,7 @@ function get_websocket_server(type) {
304 * @param port 304 * @param port
305 */ 305 */
306 function link_to_websocket_server(ip, port) { 306 function link_to_websocket_server(ip, port) {
307 - let path = ip + ':' + port; 307 + var path = ip + ':' + port;
308 live_ws = new WebSocket(path); 308 live_ws = new WebSocket(path);
309 309
310 live_ws.onopen = function(event) { 310 live_ws.onopen = function(event) {
@@ -328,7 +328,7 @@ function link_to_websocket_server(ip, port) { @@ -328,7 +328,7 @@ function link_to_websocket_server(ip, port) {
328 328
329 live_ws.onmessage = function(event) { 329 live_ws.onmessage = function(event) {
330 if (event.data) { 330 if (event.data) {
331 - let msg_obj = JSON.parse(event.data); 331 + var msg_obj = JSON.parse(event.data);
332 console.log(msg_obj, msg_obj.cmd); 332 console.log(msg_obj, msg_obj.cmd);
333 switch (msg_obj.cmd) { 333 switch (msg_obj.cmd) {
334 case 4: 334 case 4:
@@ -365,7 +365,7 @@ function get_replay_chat_barrage(start_time, duration) { @@ -365,7 +365,7 @@ function get_replay_chat_barrage(start_time, duration) {
365 replay_new_start_time = start_time; 365 replay_new_start_time = start_time;
366 } 366 }
367 is_replay_chat_loading = true; 367 is_replay_chat_loading = true;
368 - let ajax = $.ajax({ 368 + var ajax = $.ajax({
369 url: get_replay_chat_url, 369 url: get_replay_chat_url,
370 data: { 370 data: {
371 id: live_room, 371 id: live_room,
@@ -403,7 +403,7 @@ function get_replay_chat_barrage(start_time, duration) { @@ -403,7 +403,7 @@ function get_replay_chat_barrage(start_time, duration) {
403 }); 403 });
404 404
405 //用于测试 405 //用于测试
406 - /* let test_arr = test_replay(start_time, duration); 406 + /* var test_arr = test_replay(start_time, duration);
407 test_arr.forEach(function (obj) { 407 test_arr.forEach(function (obj) {
408 replay_chat_arr.push(obj); 408 replay_chat_arr.push(obj);
409 }); 409 });
@@ -418,7 +418,7 @@ function get_replay_chat_barrage(start_time, duration) { @@ -418,7 +418,7 @@ function get_replay_chat_barrage(start_time, duration) {
418 * 开始 418 * 开始
419 */ 419 */
420 function set_replay_chat_frame() { 420 function set_replay_chat_frame() {
421 - let element = $('#live_chat_ul'); 421 + var element = $('#live_chat_ul');
422 requestAnimationFrame(manage_replay_chat_msg); 422 requestAnimationFrame(manage_replay_chat_msg);
423 } 423 }
424 424
@@ -430,7 +430,7 @@ function manage_replay_chat_msg() { @@ -430,7 +430,7 @@ function manage_replay_chat_msg() {
430 430
431 if (replay_video != undefined) { 431 if (replay_video != undefined) {
432 if (!replay_video.paused && !is_wating) { 432 if (!replay_video.paused && !is_wating) {
433 - let time = parseInt(replay_video.currentTime); 433 + var time = parseInt(replay_video.currentTime);
434 if (!isNaN(replay_video.duration) && replay_video.duration != 0) { 434 if (!isNaN(replay_video.duration) && replay_video.duration != 0) {
435 if (replay_video_duration === 0) { 435 if (replay_video_duration === 0) {
436 replay_video_duration = replay_video.duration; 436 replay_video_duration = replay_video.duration;
@@ -448,20 +448,20 @@ function manage_replay_chat_msg() { @@ -448,20 +448,20 @@ function manage_replay_chat_msg() {
448 448
449 if (replay_now_like - now_like_nums >= 1) { 449 if (replay_now_like - now_like_nums >= 1) {
450 now_like_nums = parseInt(replay_now_like); 450 now_like_nums = parseInt(replay_now_like);
451 - let msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}';  
452 - let msg_obj = JSON.parse(msg); 451 + var msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}';
  452 + var msg_obj = JSON.parse(msg);
453 insert_like(msg_obj); 453 insert_like(msg_obj);
454 } 454 }
455 } else if (replay_video.currentTime < 10) { 455 } else if (replay_video.currentTime < 10) {
456 - let msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}';  
457 - let msg_obj = JSON.parse(msg); 456 + var msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}';
  457 + var msg_obj = JSON.parse(msg);
458 insert_like(msg_obj); 458 insert_like(msg_obj);
459 } 459 }
460 460
461 } 461 }
462 462
463 if (replay_chat_arr.length > 0) { 463 if (replay_chat_arr.length > 0) {
464 - let obj = replay_chat_arr[0]; 464 + var obj = replay_chat_arr[0];
465 if (obj.create_time <= time) { 465 if (obj.create_time <= time) {
466 if (obj.cmd == 5) { 466 if (obj.cmd == 5) {
467 insert_msg(obj) 467 insert_msg(obj)
@@ -542,7 +542,7 @@ function replay_barrage_callback_handler(time, v_type) { @@ -542,7 +542,7 @@ function replay_barrage_callback_handler(time, v_type) {
542 * @returns {string} 542 * @returns {string}
543 */ 543 */
544 function get_cmd(cmd) { 544 function get_cmd(cmd) {
545 - let result = ''; 545 + var result = '';
546 switch (cmd) { 546 switch (cmd) {
547 case 1: 547 case 1:
548 result = '{"cmd":' + cmd + ',"uid":"","name":"","avatar":"","room":' + live_room + '}'; 548 result = '{"cmd":' + cmd + ',"uid":"","name":"","avatar":"","room":' + live_room + '}';
@@ -570,10 +570,10 @@ function send_heart_beat() { @@ -570,10 +570,10 @@ function send_heart_beat() {
570 */ 570 */
571 571
572 function insert_msg(obj) { 572 function insert_msg(obj) {
573 - let $ul = $('#live_chat_ul');  
574 - let msg_html 573 + var $ul = $('#live_chat_ul');
  574 + var msg_html
575 if (obj.avatar == '' || obj.avatar == undefined) { 575 if (obj.avatar == '' || obj.avatar == undefined) {
576 - let rand = Math.floor(Math.random() * 5) + 1; 576 + var rand = Math.floor(Math.random() * 5) + 1;
577 // obj.avatar = site_url + '/img/activity/live/live/head_' + rand + '.png'; 577 // obj.avatar = site_url + '/img/activity/live/live/head_' + rand + '.png';
578 578
579 msg_html = '<div class="live-item2"><div class="live-item2-head">' + 579 msg_html = '<div class="live-item2"><div class="live-item2-head">' +
@@ -606,7 +606,7 @@ function insert_msg(obj) { @@ -606,7 +606,7 @@ function insert_msg(obj) {
606 '</div>' + 606 '</div>' +
607 '</div>'; 607 '</div>';
608 } 608 }
609 - let li = document.createElement('li'); 609 + var li = document.createElement('li');
610 li.innerHTML = msg_html; 610 li.innerHTML = msg_html;
611 if ($ul.children().length >= 4) { 611 if ($ul.children().length >= 4) {
612 $ul.find('li').eq(0).remove(); 612 $ul.find('li').eq(0).remove();
@@ -620,9 +620,9 @@ function insert_msg(obj) { @@ -620,9 +620,9 @@ function insert_msg(obj) {
620 */ 620 */
621 function insert_user(obj) { 621 function insert_user(obj) {
622 if (obj.name.length > 1) { 622 if (obj.name.length > 1) {
623 - let $ul = $('#live_chat_ul');  
624 - let msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>';  
625 - let li = document.createElement('li'); 623 + var $ul = $('#live_chat_ul');
  624 + var msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>';
  625 + var li = document.createElement('li');
626 li.innerHTML = msg_html; 626 li.innerHTML = msg_html;
627 if ($ul.children().length >= 4) { 627 if ($ul.children().length >= 4) {
628 $ul.find('li').eq(0).remove(); 628 $ul.find('li').eq(0).remove();
@@ -638,7 +638,7 @@ function insert_user(obj) { @@ -638,7 +638,7 @@ function insert_user(obj) {
638 * @param obj 638 * @param obj
639 */ 639 */
640 function insert_like(obj) { 640 function insert_like(obj) {
641 - let num = obj.msg.toString(); 641 + var num = obj.msg.toString();
642 642
643 if (num.indexOf('万') < 0) { 643 if (num.indexOf('万') < 0) {
644 num = parseInt(num); 644 num = parseInt(num);
@@ -651,15 +651,15 @@ function insert_like(obj) { @@ -651,15 +651,15 @@ function insert_like(obj) {
651 } else { 651 } else {
652 if (!is_animate) { 652 if (!is_animate) {
653 is_animate = true; 653 is_animate = true;
654 - let like_rand = Math.floor(Math.random() * 3) + 1;  
655 - let img_rand = Math.floor(Math.random() * 5) + 1;  
656 - let img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png';  
657 - let id = 'js_keyframes_' + Math.random();  
658 - let like_class = 'like-icon' + ' scroll_animate_' + like_rand;  
659 - let msg_html = '<img src="' + img_path + '">'; 654 + var like_rand = Math.floor(Math.random() * 3) + 1;
  655 + var img_rand = Math.floor(Math.random() * 5) + 1;
  656 + var img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png';
  657 + var id = 'js_keyframes_' + Math.random();
  658 + var like_class = 'like-icon' + ' scroll_animate_' + like_rand;
  659 + var msg_html = '<img src="' + img_path + '">';
660 660
661 661
662 - let anim_div = document.createElement('div'); 662 + var anim_div = document.createElement('div');
663 anim_div.id = id; 663 anim_div.id = id;
664 anim_div.className = like_class; 664 anim_div.className = like_class;
665 anim_div.innerHTML = msg_html; 665 anim_div.innerHTML = msg_html;
@@ -695,9 +695,9 @@ function insert_audience(obj) { @@ -695,9 +695,9 @@ function insert_audience(obj) {
695 * @param obj 695 * @param obj
696 */ 696 */
697 function insert_end(obj) { 697 function insert_end(obj) {
698 - let user_num = obj.audienceNums.toString();  
699 - let like_num = obj.likeNums.toString();  
700 - let video_len = obj.videoLen.toString(); 698 + var user_num = obj.audienceNums.toString();
  699 + var like_num = obj.likeNums.toString();
  700 + var video_len = obj.videoLen.toString();
701 701
702 if (user_num.indexOf('万') < 0) { 702 if (user_num.indexOf('万') < 0) {
703 user_num = parseInt(user_num); 703 user_num = parseInt(user_num);
@@ -715,7 +715,7 @@ function insert_end(obj) { @@ -715,7 +715,7 @@ function insert_end(obj) {
715 like_num = (like_num / 10000).toFixed(1) + '万'; 715 like_num = (like_num / 10000).toFixed(1) + '万';
716 } 716 }
717 717
718 - let video = $('#' + video_id)[0]; 718 + var video = $('#' + video_id)[0];
719 if (video) { 719 if (video) {
720 setTimeout(function() { 720 setTimeout(function() {
721 video.pause(); 721 video.pause();
@@ -724,7 +724,7 @@ function insert_end(obj) { @@ -724,7 +724,7 @@ function insert_end(obj) {
724 } 724 }
725 live_ws.close(); 725 live_ws.close();
726 clearInterval(live_time_interval); 726 clearInterval(live_time_interval);
727 - let $liveEnd = $('#live-state-end'); 727 + var $liveEnd = $('#live-state-end');
728 $liveEnd.show(); 728 $liveEnd.show();
729 $liveEnd.find('.audience .val').text(user_num); 729 $liveEnd.find('.audience .val').text(user_num);
730 $liveEnd.find('.duration .val').text(video_len); 730 $liveEnd.find('.duration .val').text(video_len);
@@ -751,7 +751,7 @@ function receive_init(obj) { @@ -751,7 +751,7 @@ function receive_init(obj) {
751 */ 751 */
752 function get_live_time() { 752 function get_live_time() {
753 if (live_start_time) { 753 if (live_start_time) {
754 - let date = new Date(); 754 + var date = new Date();
755 live_duration = parseInt(date.getTime() / 1000) - live_start_time; 755 live_duration = parseInt(date.getTime() / 1000) - live_start_time;
756 console.log('live_duration=' + live_duration); 756 console.log('live_duration=' + live_duration);
757 $('#live_time').text(get_time_text(live_duration)); 757 $('#live_time').text(get_time_text(live_duration));
@@ -765,10 +765,10 @@ function get_live_time() { @@ -765,10 +765,10 @@ function get_live_time() {
765 * @returns {string} 765 * @returns {string}
766 */ 766 */
767 function get_time_text(time) { 767 function get_time_text(time) {
768 - let time_text = '00:00:00';  
769 - let sec;  
770 - let min;  
771 - let hour; 768 + var time_text = '00:00:00';
  769 + var sec;
  770 + var min;
  771 + var hour;
772 if (time < 0) { 772 if (time < 0) {
773 time = 0; 773 time = 0;
774 } 774 }
@@ -794,7 +794,7 @@ function get_time_text(time) { @@ -794,7 +794,7 @@ function get_time_text(time) {
794 } else { 794 } else {
795 hour = hour + ':'; 795 hour = hour + ':';
796 } 796 }
797 - let rests = time % 3600; 797 + var rests = time % 3600;
798 min = (rests - rests % 60) / 60; 798 min = (rests - rests % 60) / 60;
799 if (min < 10) { 799 if (min < 10) {
800 min = '0' + min; 800 min = '0' + min;
@@ -826,10 +826,10 @@ function set_interval_time() { @@ -826,10 +826,10 @@ function set_interval_time() {
826 * requestAnimationFrame 826 * requestAnimationFrame
827 */ 827 */
828 function init_request_animation_frames() { 828 function init_request_animation_frames() {
829 - let lastTime = 0;  
830 - let prefix; 829 + var lastTime = 0;
  830 + var prefix;
831 //通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式 831 //通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式
832 - for (let i = 0; i < prefixes.length; i++) { 832 + for (var i = 0; i < prefixes.length; i++) {
833 if (requestAnimationFrame && cancelAnimationFrame) { 833 if (requestAnimationFrame && cancelAnimationFrame) {
834 break; 834 break;
835 } 835 }
@@ -841,10 +841,10 @@ function init_request_animation_frames() { @@ -841,10 +841,10 @@ function init_request_animation_frames() {
841 //如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout 841 //如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout
842 if (!requestAnimationFrame || !cancelAnimationFrame) { 842 if (!requestAnimationFrame || !cancelAnimationFrame) {
843 requestAnimationFrame = function(callback) { 843 requestAnimationFrame = function(callback) {
844 - let currTime = new Date().getTime(); 844 + var currTime = new Date().getTime();
845 //为了使setTimteout的尽可能的接近每秒60帧的效果 845 //为了使setTimteout的尽可能的接近每秒60帧的效果
846 - let timeToCall = Math.max(0, 16 - (currTime - lastTime));  
847 - let id = window.setTimeout(function() { 846 + var timeToCall = Math.max(0, 16 - (currTime - lastTime));
  847 + var id = window.setTimeout(function() {
848 callback(currTime + timeToCall); 848 callback(currTime + timeToCall);
849 }, timeToCall); 849 }, timeToCall);
850 lastTime = currTime + timeToCall; 850 lastTime = currTime + timeToCall;
@@ -893,8 +893,8 @@ $(document).ready(function() { @@ -893,8 +893,8 @@ $(document).ready(function() {
893 }); 893 });
894 894
895 global.test = function test() { //测试弹幕样式 895 global.test = function test() { //测试弹幕样式
896 - let rand = Math.floor(Math.random() * msg_obj.length);  
897 - let obj = JSON.parse(msg_obj[rand].toString()); 896 + var rand = Math.floor(Math.random() * msg_obj.length);
  897 + var obj = JSON.parse(msg_obj[rand].toString());
898 switch (obj.cmd) { 898 switch (obj.cmd) {
899 case 4: 899 case 4:
900 insert_user(obj); 900 insert_user(obj);
@@ -906,21 +906,21 @@ global.test = function test() { //测试弹幕样式 @@ -906,21 +906,21 @@ global.test = function test() { //测试弹幕样式
906 } 906 }
907 907
908 global.test_like = function test_like() { 908 global.test_like = function test_like() {
909 - let rand = Math.floor(Math.random() * 5); 909 + var rand = Math.floor(Math.random() * 5);
910 test_count += rand; 910 test_count += rand;
911 - let obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}';  
912 - let obj = JSON.parse(obj_text); 911 + var obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}';
  912 + var obj = JSON.parse(obj_text);
913 insert_like(obj); 913 insert_like(obj);
914 } 914 }
915 915
916 global.test_replay = function test_replay(starttime, timeinterval) { 916 global.test_replay = function test_replay(starttime, timeinterval) {
917 - let start = starttime - live_start_time;  
918 - let end = start + timeinterval;  
919 - let test_arr = []; 917 + var start = starttime - live_start_time;
  918 + var end = start + timeinterval;
  919 + var test_arr = [];
920 if (replay_msg.length > 0) { 920 if (replay_msg.length > 0) {
921 - for (let i = 0; i < replay_msg.length; i++) {  
922 - let obj = replay_msg[i];  
923 - let create_time = parseInt(obj.createtime); 921 + for (var i = 0; i < replay_msg.length; i++) {
  922 + var obj = replay_msg[i];
  923 + var create_time = parseInt(obj.createtime);
924 if (create_time >= start && create_time <= end) { 924 if (create_time >= start && create_time <= end) {
925 test_arr.push(obj); 925 test_arr.push(obj);
926 } 926 }
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * Created by qiujun on 16/6/5. 2 * Created by qiujun on 16/6/5.
3 */ 3 */
4 4
5 -let info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' + 5 +var info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' +
6 '<div style="margin-top:10px;"></div>' + 6 '<div style="margin-top:10px;"></div>' +
7 '<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;">' + 7 '<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;">' +
8 '<span style="color:#B2AAA4;">▲游戏设施长这样!</span>' + 8 '<span style="color:#B2AAA4;">▲游戏设施长这样!</span>' +
@@ -6,15 +6,15 @@ @@ -6,15 +6,15 @@
6 */ 6 */
7 7
8 8
9 - let share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296';  
10 - let share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';  
11 - let share_facebook_url = 'https://www.facebook.com/sharer/sharer.php';  
12 - let share_twitter_url = 'http://twitter.com/intent/tweet';  
13 - let true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png';  
14 - let fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png';  
15 - let true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png';  
16 - let fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png';  
17 - let touch_timeout; 9 + var share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296';
  10 + var share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
  11 + var share_facebook_url = 'https://www.facebook.com/sharer/sharer.php';
  12 + var share_twitter_url = 'http://twitter.com/intent/tweet';
  13 + var true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png';
  14 + var fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png';
  15 + var true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png';
  16 + var fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png';
  17 + var touch_timeout;
18 18
19 $(document).ready(function() { 19 $(document).ready(function() {
20 // init_share_button(); 20 // init_share_button();
@@ -28,16 +28,16 @@ @@ -28,16 +28,16 @@
28 * 分享按钮 28 * 分享按钮
29 */ 29 */
30 function init_share_button() { 30 function init_share_button() {
31 - let $btn_share_sina = $('.live-share-button-sina a');  
32 - let $btn_share_qzone = $('.live-share-button-qzone a');  
33 - let $btn_share_facebook = $('.live-share-button-facebook a');  
34 - let $btn_share_twitter = $('.live-share-button-twitter a');  
35 - let local_url = document.location.href;  
36 - let protocol = document.location.protocol;  
37 - let share_url = '';  
38 - let share_img = $('#share').attr('cover');  
39 - let share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL ';  
40 - let share_title_qzone = document.title + ' | 来自YOHO!'; 31 + var $btn_share_sina = $('.live-share-button-sina a');
  32 + var $btn_share_qzone = $('.live-share-button-qzone a');
  33 + var $btn_share_facebook = $('.live-share-button-facebook a');
  34 + var $btn_share_twitter = $('.live-share-button-twitter a');
  35 + var local_url = document.location.href;
  36 + var protocol = document.location.protocol;
  37 + var share_url = '';
  38 + var share_img = $('#share').attr('cover');
  39 + var share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL ';
  40 + var share_title_qzone = document.title + ' | 来自YOHO!';
41 41
42 if (share_img.indexOf('http') < 0 && share_img.indexOf('https') < 0) { 42 if (share_img.indexOf('http') < 0 && share_img.indexOf('https') < 0) {
43 share_img = protocol + share_img; 43 share_img = protocol + share_img;
@@ -77,8 +77,8 @@ @@ -77,8 +77,8 @@
77 * 由于微信不能同时识别两个二维码,所以按一个二维码的同时把另外一个二维码给换成点击的二维码的图片 77 * 由于微信不能同时识别两个二维码,所以按一个二维码的同时把另外一个二维码给换成点击的二维码的图片
78 */ 78 */
79 function check_qr_touch() { 79 function check_qr_touch() {
80 - let $clz_img = $('#qr_clz img');  
81 - let $girl_img = $('#qr_girl img'); 80 + var $clz_img = $('#qr_clz img');
  81 + var $girl_img = $('#qr_girl img');
82 82
83 $clz_img.on('touchstart', function() { 83 $clz_img.on('touchstart', function() {
84 $clz_img.attr('src', true_yoho_img); 84 $clz_img.attr('src', true_yoho_img);
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * Created by qiujun on 16/05/24 3 * Created by qiujun on 16/05/24
4 * 一个所谓的video插件(伪) 4 * 一个所谓的video插件(伪)
5 */ 5 */
6 -let _defaults = { 6 +var _defaults = {
7 video_id: 'yoho_video', 7 video_id: 'yoho_video',
8 islive: false, //是否是直播 8 islive: false, //是否是直播
9 width: '100%', 9 width: '100%',
@@ -19,8 +19,8 @@ let _defaults = { @@ -19,8 +19,8 @@ let _defaults = {
19 is_ios: true 19 is_ios: true
20 }; 20 };
21 21
22 -let that; //用于引用this  
23 -let video_src; 22 +var that; //用于引用this
  23 +var video_src;
24 24
25 function YohoVideo($ele, options) { //构造函数 25 function YohoVideo($ele, options) { //构造函数
26 this.$ele = $ele; 26 this.$ele = $ele;
@@ -39,15 +39,15 @@ YohoVideo.prototype = { @@ -39,15 +39,15 @@ YohoVideo.prototype = {
39 this.bindEvent(); //初始化视频各个事件 39 this.bindEvent(); //初始化视频各个事件
40 }, 40 },
41 innserVideoHtml: function() { 41 innserVideoHtml: function() {
42 - let _options = this._options; 42 + var _options = this._options;
43 this._width = _options.width || '100%'; 43 this._width = _options.width || '100%';
44 this._height = _options.height || '100%'; 44 this._height = _options.height || '100%';
45 - let _preload = _options.preload || false;  
46 - let _autoplay = _options.autoplay || false;  
47 - let _controls = _options.controls || false;  
48 - let _poster = _options.poster || false;  
49 - let _loop = _options.loop || false;  
50 - let _src = _options.src || ''; 45 + var _preload = _options.preload || false;
  46 + var _autoplay = _options.autoplay || false;
  47 + var _controls = _options.controls || false;
  48 + var _poster = _options.poster || false;
  49 + var _loop = _options.loop || false;
  50 + var _src = _options.src || '';
51 this._loading_div = _options.loading_div || '.live-video-loading'; 51 this._loading_div = _options.loading_div || '.live-video-loading';
52 this._video_id = _options.video_id || 'yoho_video'; 52 this._video_id = _options.video_id || 'yoho_video';
53 this._islive = _options.islive || false; 53 this._islive = _options.islive || false;
@@ -55,13 +55,13 @@ YohoVideo.prototype = { @@ -55,13 +55,13 @@ YohoVideo.prototype = {
55 this._is_ios = _options.is_ios || true; 55 this._is_ios = _options.is_ios || true;
56 56
57 //console.log(_width,_height,_preload,_autoplay,_controls,_poster,_loop,_src); 57 //console.log(_width,_height,_preload,_autoplay,_controls,_poster,_loop,_src);
58 - /*let video = document.createElement('video'); 58 + /*var video = document.createElement('video');
59 video.id = this._video_id; 59 video.id = this._video_id;
60 video.setAttribute('webkit-playsinline',true);*/ 60 video.setAttribute('webkit-playsinline',true);*/
61 video_src = _src; 61 video_src = _src;
62 - let _attributes = '';  
63 - let _styles = '';  
64 - let _source = ''; 62 + var _attributes = '';
  63 + var _styles = '';
  64 + var _source = '';
65 if (this._height != undefined) { 65 if (this._height != undefined) {
66 _styles += ' height:' + this._height + ';'; 66 _styles += ' height:' + this._height + ';';
67 //video.style.height = _height; 67 //video.style.height = _height;
@@ -95,11 +95,11 @@ YohoVideo.prototype = { @@ -95,11 +95,11 @@ YohoVideo.prototype = {
95 //video.src = _src; 95 //video.src = _src;
96 } 96 }
97 97
98 - let _source_html = ''; 98 + var _source_html = '';
99 //console.log(this._islive); 99 //console.log(this._islive);
100 if (!this._islive || this._islive) { 100 if (!this._islive || this._islive) {
101 - let _len = _src.length - _src.lastIndexOf('.');  
102 - let _type = _src.substr(_src.lastIndexOf('.') + 1, _len); 101 + var _len = _src.length - _src.lastIndexOf('.');
  102 + var _type = _src.substr(_src.lastIndexOf('.') + 1, _len);
103 if (_type === 'm3u8') { 103 if (_type === 'm3u8') {
104 _type = 'application/x-mpegurl'; 104 _type = 'application/x-mpegurl';
105 } else { 105 } else {
@@ -107,22 +107,22 @@ YohoVideo.prototype = { @@ -107,22 +107,22 @@ YohoVideo.prototype = {
107 } 107 }
108 _source_html = '<source src="' + _src + '" type="' + _type + '">'; 108 _source_html = '<source src="' + _src + '" type="' + _type + '">';
109 109
110 - /*let source = document.createElement('source'); 110 + /*var source = document.createElement('source');
111 source.src = _src; 111 source.src = _src;
112 source.type = _type; 112 source.type = _type;
113 video.appendChild(source);*/ 113 video.appendChild(source);*/
114 } 114 }
115 115
116 - let _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' + 116 + var _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' +
117 _source_html + 117 _source_html +
118 '</video>'; 118 '</video>';
119 //console.log(_video_html); 119 //console.log(_video_html);
120 this.$ele.html(_video_html); 120 this.$ele.html(_video_html);
121 - let video = $('#' + this._video_id)[0]; 121 + var video = $('#' + this._video_id)[0];
122 video.allowFullScreen = false; 122 video.allowFullScreen = false;
123 if (this._islive || _type == 'application/x-mpegurl') { 123 if (this._islive || _type == 'application/x-mpegurl') {
124 if (video.hasChildNodes()) { 124 if (video.hasChildNodes()) {
125 - let source_node = video.childNodes[0]; 125 + var source_node = video.childNodes[0];
126 video.removeChild(source_node); 126 video.removeChild(source_node);
127 video.src = _src; 127 video.src = _src;
128 video.play(); 128 video.play();
@@ -135,9 +135,9 @@ YohoVideo.prototype = { @@ -135,9 +135,9 @@ YohoVideo.prototype = {
135 //this.$ele.append(video); 135 //this.$ele.append(video);
136 }, 136 },
137 exitFull: function() { //退出全屏 137 exitFull: function() { //退出全屏
138 - let _video = $('#' + this._video_id)[0]; 138 + var _video = $('#' + this._video_id)[0];
139 139
140 - //let _video = this._video; 140 + //var _video = this._video;
141 //alert(_video.exitFullscreen || _video.msExitFullscreen || _video.oRequestFullscreen || _video.webkitCancelFullScreen || _video.webkitExitFullscreen); 141 //alert(_video.exitFullscreen || _video.msExitFullscreen || _video.oRequestFullscreen || _video.webkitCancelFullScreen || _video.webkitExitFullscreen);
142 if (_video.exitFullScreen) { 142 if (_video.exitFullScreen) {
143 _video.exitFullScreen(); 143 _video.exitFullScreen();
@@ -152,27 +152,27 @@ YohoVideo.prototype = { @@ -152,27 +152,27 @@ YohoVideo.prototype = {
152 } 152 }
153 }, 153 },
154 bindEvent: function() { 154 bindEvent: function() {
155 - let _video = $('#' + this._video_id)[0]; 155 + var _video = $('#' + this._video_id)[0];
156 _video.isFullscreen = false; 156 _video.isFullscreen = false;
157 _video.scrollLeft = 0; 157 _video.scrollLeft = 0;
158 _video.scrollTop = 0; 158 _video.scrollTop = 0;
159 //console.log(this._width,this._height); 159 //console.log(this._width,this._height);
160 - _video.scrollWidth = this._width;  
161 - _video.scrollHeight = this._height; 160 + // _video.scrollWidth = this._width;
  161 + // _video.scrollHeight = this._height;
162 162
163 - //let _video = this._video; 163 + //var _video = this._video;
164 console.log('video=', _video); 164 console.log('video=', _video);
165 - let _msg_pannel = $(this._loading_div);  
166 - let _msg = _msg_pannel.find('p');  
167 - let _progress_count = 0; 165 + var _msg_pannel = $(this._loading_div);
  166 + var _msg = _msg_pannel.find('p');
  167 + var _progress_count = 0;
168 168
169 - let _error_count = 0; 169 + var _error_count = 0;
170 170
171 //networkState:0.此元素未初始化 1.正常但没有使用网络 2.正在下载数据 3.没有找到资源 171 //networkState:0.此元素未初始化 1.正常但没有使用网络 2.正在下载数据 3.没有找到资源
172 //readyState: 172 //readyState:
173 // 1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA 173 // 1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA
174 174
175 - let media_events = { 175 + var media_events = {
176 LOAD_START: 'loadstart', 176 LOAD_START: 'loadstart',
177 PROGRESS: 'progress', 177 PROGRESS: 'progress',
178 SUSPEND: 'suspend', 178 SUSPEND: 'suspend',
@@ -22,7 +22,7 @@ class ActController extends Controller { @@ -22,7 +22,7 @@ class ActController extends Controller {
22 lazyLoad($('img.lazy')); 22 lazyLoad($('img.lazy'));
23 this.more = new GetMore(); 23 this.more = new GetMore();
24 this.more.on('more', this.doMore.bind(this)); 24 this.more.on('more', this.doMore.bind(this));
25 - this.page = 1; 25 + this.page = 5;
26 this.loading = false; 26 this.loading = false;
27 global.jQuery = $; 27 global.jQuery = $;
28 } 28 }
@@ -327,14 +327,15 @@ function submitOrder() { @@ -327,14 +327,15 @@ function submitOrder() {
327 } 327 }
328 328
329 /* tar add 170426 品众代码去除 */ 329 /* tar add 170426 品众代码去除 */
330 - // if (window._fxcmd) {  
331 - // window._fxcmd.push(['trackOrder', {  
332 - // oid: res.data.order_code,  
333 - // otp: res.data.order_amount,  
334 - // u_info: cookie.get('_UID'),  
335 - // u_type: cookie.get('_isNewUser') ? 1 : 0  
336 - // }, []]);  
337 - // } 330 + /* tar note 170601 品众代码恢复 */
  331 + if (window._fxcmd) {
  332 + window._fxcmd.push(['trackOrder', {
  333 + oid: res.data.order_code,
  334 + otp: res.data.order_amount,
  335 + u_info: cookie.get('_UID'),
  336 + u_type: cookie.get('_isNewUser') ? 1 : 0
  337 + }, []]);
  338 + }
338 339
339 cookie.remove(['order-info', 'activity-info']); 340 cookie.remove(['order-info', 'activity-info']);
340 window.location.href = url; 341 window.location.href = url;
@@ -146,42 +146,56 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) { @@ -146,42 +146,56 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) {
146 }); 146 });
147 } 147 }
148 148
149 -// 微信支付  
150 -function callpay(orderCode) { 149 +/**
  150 + * 获取微信支付数据
  151 + * @param {*} orderCode
  152 + */
  153 +function getWechatPayData(orderCode) {
151 let jsApiParameters; 154 let jsApiParameters;
152 155
  156 + $.ajax({
  157 + type: 'GET',
  158 + url: '/cart/index/new/pay',
  159 + data: {
  160 + order_code: orderCode,
  161 + payment: '22_platform',
  162 + },
  163 + dataType: 'json',
  164 + success: function(res) {
  165 + if (res.code === 200) {
  166 + jsApiParameters = res.data.jsApiParameters;
  167 + jsApiCall(orderCode, jsApiParameters);
  168 + } else {
  169 + tip.show('微信支付调取失败');
  170 + }
  171 + },
  172 + error: function() {
  173 + tip.show('请刷新本页面,完成微信支付');
  174 + },
  175 + complete: function() {
  176 + $loadingToast.addClass('hide');
  177 + }
  178 + });
  179 +}
  180 +
  181 +// 微信支付
  182 +function callpay(orderCode) {
153 $loadingToast.removeClass('hide'); 183 $loadingToast.removeClass('hide');
154 if (typeof WeixinJSBridge === 'undefined') { 184 if (typeof WeixinJSBridge === 'undefined') {
155 if (document.addEventListener) { 185 if (document.addEventListener) {
156 - document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); 186 + document.addEventListener('WeixinJSBridgeReady', function() {
  187 + getWechatPayData(orderCode);
  188 + }, false);
157 } else if (document.attachEvent) { 189 } else if (document.attachEvent) {
158 - document.attachEvent('WeixinJSBridgeReady', jsApiCall);  
159 - document.attachEvent('onWeixinJSBridgeReady', jsApiCall); 190 + document.attachEvent('WeixinJSBridgeReady', function() {
  191 + getWechatPayData(orderCode);
  192 + });
  193 + document.attachEvent('onWeixinJSBridgeReady', function() {
  194 + getWechatPayData(orderCode);
  195 + });
160 } 196 }
161 } else { 197 } else {
162 - $.ajax({  
163 - type: 'GET',  
164 - url: '/cart/index/new/pay',  
165 - data: {  
166 - order_code: orderCode,  
167 - payment: '22_platform',  
168 - },  
169 - dataType: 'json',  
170 - success: function(res) {  
171 - if (res.code === 200) {  
172 - jsApiParameters = res.data.jsApiParameters;  
173 - jsApiCall(orderCode, jsApiParameters);  
174 - } else {  
175 - tip.show('微信支付调取失败');  
176 - }  
177 - },  
178 - error: function() {  
179 - tip.show('请刷新本页面,完成微信支付');  
180 - },  
181 - complete: function() {  
182 - $loadingToast.addClass('hide');  
183 - }  
184 - }); 198 + getWechatPayData(orderCode);
185 } 199 }
186 } 200 }
187 201
@@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调 @@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调
15 // 隐藏筛选界面 15 // 隐藏筛选界面
16 function hideFilter() { 16 function hideFilter() {
17 setTimeout(function() { 17 setTimeout(function() {
18 - $filter.addClass('hide'); 18 + $filter && $filter.addClass('hide');
19 }, 301); 19 }, 301);
20 } 20 }
21 21
22 // 显示筛选界面 22 // 显示筛选界面
23 function showFilter() { 23 function showFilter() {
24 - $filter.removeClass('hide'); 24 + $filter && $filter.removeClass('hide');
25 } 25 }
26 26
27 // 一级菜单点击时背景高亮 27 // 一级菜单点击时背景高亮
@@ -11,6 +11,7 @@ import {time} from './time'; @@ -11,6 +11,7 @@ import {time} from './time';
11 import {api} from './store'; 11 import {api} from './store';
12 import {RatingView, LeaveMSGView, OrderListView } from './view'; 12 import {RatingView, LeaveMSGView, OrderListView } from './view';
13 import tip from 'plugin/tip'; 13 import tip from 'plugin/tip';
  14 +import dialog from 'plugin/dialog';
14 15
15 let FastClick = require('yoho-fastclick'); 16 let FastClick = require('yoho-fastclick');
16 17
@@ -112,7 +113,6 @@ let chat = { @@ -112,7 +113,6 @@ let chat = {
112 113
113 const self = this; 114 const self = this;
114 115
115 -  
116 cmEntity.encryptedUid = encryptedUid; 116 cmEntity.encryptedUid = encryptedUid;
117 117
118 self.fetchHistoryMsg().always(function() { 118 self.fetchHistoryMsg().always(function() {
@@ -167,7 +167,7 @@ let chat = { @@ -167,7 +167,7 @@ let chat = {
167 onOpen: $.noop, 167 onOpen: $.noop,
168 sendFailCallback: function() { 168 sendFailCallback: function() {
169 self._sysInfo('<p>连接断开,请尝试<span class="blue">重连</span></p>') 169 self._sysInfo('<p>连接断开,请尝试<span class="blue">重连</span></p>')
170 - .one('click', function() { 170 + .one('touchend', function() {
171 self.connect(); 171 self.connect();
172 }); 172 });
173 }, 173 },
@@ -184,8 +184,49 @@ let chat = { @@ -184,8 +184,49 @@ let chat = {
184 */ 184 */
185 bindEvents: function() { 185 bindEvents: function() {
186 let self = this; 186 let self = this;
  187 + let $dialog;
187 188
188 this.$chat 189 this.$chat
  190 + .on('click.Queue.quit', '[data-trigger=quit-queue]', function() {
  191 + dialog.showDialog({
  192 + dialogText: '确认结束排队吗?',
  193 + hasFooter: {
  194 + leftBtnText: '继续等待',
  195 + rightBtnText: '结束排队'
  196 + }
  197 + }, function() {
  198 + cmEntity.type = socketConf.recType.QUIT_QUEUE;
  199 + socket.send(JSON.stringify(cmEntity));
  200 + dialog.hideDialog();
  201 + });
  202 +
  203 + $dialog = $('.dialog-wrapper .dialog-box');
  204 + $dialog.css({
  205 + background: 'hsla(100, 100%, 100%, 1)'
  206 + });
  207 +
  208 + })
  209 + .on('click.Chat.end', '[data-trigger=end-chat]', function() {
  210 + dialog.showDialog({
  211 + dialogText: '确认结束本次服务吗?',
  212 + hasFooter: {
  213 + leftBtnText: '继续咨询',
  214 + rightBtnText: '结束服务'
  215 + }
  216 + }, function() {
  217 + cmEntity.type = socketConf.recType.USER_END_CHAT;
  218 + socket.send(JSON.stringify(cmEntity));
  219 + dialog.hideDialog();
  220 + });
  221 +
  222 + $dialog = $('.dialog-wrapper .dialog-box');
  223 + $dialog.css({
  224 + background: 'hsla(100, 100%, 100%, 1)'
  225 + });
  226 + })
  227 + .on('click.Chat.end', '[data-action=re-connect]', function() {
  228 + self.connect();
  229 + })
189 .on('click.Rating.toggle', '[data-trigger=rating]', function() { 230 .on('click.Rating.toggle', '[data-trigger=rating]', function() {
190 if (self.canEvalute) { 231 if (self.canEvalute) {
191 self.ratingView.toggle(); 232 self.ratingView.toggle();
@@ -268,12 +309,14 @@ let chat = { @@ -268,12 +309,14 @@ let chat = {
268 conversationId: cmEntity.conversationId, 309 conversationId: cmEntity.conversationId,
269 }); 310 });
270 }).on('rating-success', function(e, data) { 311 }).on('rating-success', function(e, data) {
  312 + const state = (window.socket || {}).readyState;
  313 +
271 self._sysInfo(`您对我们的服务评价为:${data}`); 314 self._sysInfo(`您对我们的服务评价为:${data}`);
272 self.canEvalute = false; 315 self.canEvalute = false;
273 cmEntity.type = socketConf.recType.EVALUTE_SUCCESS; 316 cmEntity.type = socketConf.recType.EVALUTE_SUCCESS;
274 - socket.send(JSON.stringify(cmEntity));  
275 -  
276 - // resizeFooter(); 317 + if (state === WebSocket.OPEN) {
  318 + socket.send(JSON.stringify(cmEntity));
  319 + }
277 }); 320 });
278 321
279 322
@@ -322,12 +365,12 @@ let chat = { @@ -322,12 +365,12 @@ let chat = {
322 disconnect(content) { 365 disconnect(content) {
323 let self = this; 366 let self = this;
324 367
  368 + self.renderHeader('offline');
325 this.canLeaveMSG = true; 369 this.canLeaveMSG = true;
326 -  
327 this.$chat.toggleClass('online', false); 370 this.$chat.toggleClass('online', false);
328 this.toggleMenu(false); 371 this.toggleMenu(false);
329 this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`) 372 this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`)
330 - .one('click', function() { 373 + .one('touchend', function() {
331 self.connect(); 374 self.connect();
332 }); 375 });
333 }, 376 },
@@ -576,6 +619,7 @@ let chat = { @@ -576,6 +619,7 @@ let chat = {
576 // ------------------------------------------ 619 // ------------------------------------------
577 // 用户进入 620 // 用户进入
578 case allTypes.ENTER: 621 case allTypes.ENTER:
  622 + this.renderHeader('robot');
579 chatMessage.newContent && this._sysInfo(chatMessage.newContent); 623 chatMessage.newContent && this._sysInfo(chatMessage.newContent);
580 break; 624 break;
581 625
@@ -590,6 +634,11 @@ let chat = { @@ -590,6 +634,11 @@ let chat = {
590 this._sysInfo(chatMessage.content); 634 this._sysInfo(chatMessage.content);
591 break; 635 break;
592 636
  637 + case allTypes.QUIT_QUEUE:
  638 + this.renderHeader('robot');
  639 + this._sysInfo(chatMessage.content);
  640 + break;
  641 +
593 // 客服邀请评价 642 // 客服邀请评价
594 case allTypes.EVAL_INVITE: 643 case allTypes.EVAL_INVITE:
595 this._sysInfo('<p data-trigger="rating">请对我们的服务进行<span class="blue">评价</span></p>'); 644 this._sysInfo('<p data-trigger="rating">请对我们的服务进行<span class="blue">评价</span></p>');
@@ -636,7 +685,6 @@ let chat = { @@ -636,7 +685,6 @@ let chat = {
636 */ 685 */
637 _manualState(state, cmEntity) { // eslint-disable-line 686 _manualState(state, cmEntity) { // eslint-disable-line
638 const self = this; 687 const self = this;
639 - const $chatHeader = self.$header;  
640 const $chat = self.$chat; 688 const $chat = self.$chat;
641 const sysInfo = self._sysInfo.bind(this); 689 const sysInfo = self._sysInfo.bind(this);
642 const chatMessage = cmEntity.chatMessage; 690 const chatMessage = cmEntity.chatMessage;
@@ -670,12 +718,13 @@ let chat = { @@ -670,12 +718,13 @@ let chat = {
670 718
671 // state 1: 排队中 719 // state 1: 排队中
672 function inQueue() { 720 function inQueue() {
  721 + self.renderHeader('queue');
673 whetherLeaveMsg(cmEntity); 722 whetherLeaveMsg(cmEntity);
674 } 723 }
675 724
676 // state 2: 人工客服进入 725 // state 2: 人工客服进入
677 function linkSuccess() { 726 function linkSuccess() {
678 - $chatHeader.find('.js-service-txt').text('YOHO客服'); 727 + self.renderHeader('human');
679 728
680 $chat 729 $chat
681 .toggleClass('online', true) 730 .toggleClass('online', true)
@@ -825,7 +874,7 @@ let chat = { @@ -825,7 +874,7 @@ let chat = {
825 }, 874 },
826 875
827 switchService: function(type) { 876 switchService: function(type) {
828 - this.renderHeader(type); 877 + this.renderHeader(`switch-${type}`);
829 878
830 if (type === 'human') { 879 if (type === 'human') {
831 cmEntity.type = socketConf.recType.MANUAL_SERVICE; 880 cmEntity.type = socketConf.recType.MANUAL_SERVICE;
@@ -843,9 +892,25 @@ let chat = { @@ -843,9 +892,25 @@ let chat = {
843 title: '智能小YO', 892 title: '智能小YO',
844 right: '<span data-action="change-human">人工客服</span>' 893 right: '<span data-action="change-human">人工客服</span>'
845 }, 894 },
  895 + queue: {
  896 + title: '<i class="chat-status"></i><span class="js-service-txt">队列中...</span>',
  897 + right: '<span data-trigger="quit-queue">结束排队</span>'
  898 + },
846 human: { 899 human: {
  900 + title: '<i class="chat-status"></i><span class="js-service-txt">YOHO客服</span>',
  901 + right: '<span data-trigger="end-chat">结束服务</span>'
  902 + },
  903 + offline: {
  904 + title: '<i class="chat-status"></i><span class="js-service-txt">YOHO客服</span>',
  905 + right: '<span data-action="re-connect">重新连接</span>'
  906 + },
  907 + 'switch-robot': {
847 title: '<i class="chat-status"></i><span class="js-service-txt">正在连接...</span>', 908 title: '<i class="chat-status"></i><span class="js-service-txt">正在连接...</span>',
848 - right: '<span class="chat-rating-trigger" data-trigger="rating">评价</span>' 909 + right: '<span></span>'
  910 + },
  911 + 'switch-human': {
  912 + title: '<i class="chat-status"></i><span class="js-service-txt">连接人工...</span>',
  913 + right: ''
849 } 914 }
850 }; 915 };
851 916
@@ -62,12 +62,11 @@ function sendMsg(msg) { @@ -62,12 +62,11 @@ function sendMsg(msg) {
62 socket.send(msg); 62 socket.send(msg);
63 } else { 63 } else {
64 sendFailCallback(); 64 sendFailCallback();
65 - console.log('The socket is not open.');  
66 } 65 }
67 } 66 }
68 67
69 module.exports = { 68 module.exports = {
70 init: socketInit, 69 init: socketInit,
71 - send: sendMsg 70 + send: sendMsg,
72 }; 71 };
73 72
@@ -28,10 +28,12 @@ let config = { @@ -28,10 +28,12 @@ let config = {
28 TRANSFER_REQ: 10006, // 收到他人的转移的请求 28 TRANSFER_REQ: 10006, // 收到他人的转移的请求
29 TRANS_REQ_ANSWER: 10007, // 收到他人对自己转移请求的反馈 29 TRANS_REQ_ANSWER: 10007, // 收到他人对自己转移请求的反馈
30 SUC_DISTRIBUTE: 10009, // 客服管理员收到会话分配成功的回执 30 SUC_DISTRIBUTE: 10009, // 客服管理员收到会话分配成功的回执
31 - CS_CHATTING: 5000000, // 客服管理员收到会话分配成功的回执 31 + CS_CHATTING: 5000000, // 客服管理员收到会话分配成功的回执
32 IN_QUNEUE: 777777, // 队列中发送消息后收到的反馈 32 IN_QUNEUE: 777777, // 队列中发送消息后收到的反馈
33 - OFFLINE: 999999999, // 断线  
34 - OP_LEAVE: 999999998 // 对方离开 33 + QUIT_QUEUE: 888881, // 排队中退申请退出队列
  34 + USER_END_CHAT: 888882, // 用户结束会话
  35 + OFFLINE: 999999999, // 断线
  36 + OP_LEAVE: 999999998 // 对方离开
35 }, 37 },
36 38
37 conversationMessage: { 39 conversationMessage: {
  1 +body {
  2 + background: #f0f0f0;
  3 +}
  4 +
  5 +.nav-home {
  6 + display: none !important;
  7 +}
  8 +
  9 +.qs-detail-page {
  10 + font-size: 28px;
  11 + $borderColor: #ececec;
  12 +
  13 + .error-tip {
  14 + width: 100%;
  15 + background-color: #ff7e82;
  16 + color: #fff;
  17 + padding-left: 30px;
  18 + line-height: 50px;
  19 + position: fixed;
  20 + top: 0;
  21 + left: 0;
  22 + z-index: 1;
  23 + }
  24 +
  25 + .sub-title {
  26 + line-height: 2;
  27 + padding: 14px 20px;
  28 + background: #fff;
  29 + border-bottom: 1px solid $borderColor;
  30 + text-align: center;
  31 + }
  32 +
  33 + .guide-tip {
  34 + line-height: 2;
  35 + padding: 0 30px;
  36 + color: #555;
  37 + }
  38 +
  39 + .qs-item {
  40 + background: #fff;
  41 + margin-bottom: 30px;
  42 + padding-left: 30px;
  43 + border-top: 1px solid $borderColor;
  44 + border-bottom: 1px solid $borderColor;
  45 +
  46 + > * {
  47 + line-height: 60px;
  48 + padding: 10px 0;
  49 + }
  50 +
  51 + > dd {
  52 + border-top: 1px solid $borderColor;
  53 + color: #b4b4b4;
  54 +
  55 + input {
  56 + width: calc(100% - 60px);
  57 + height: 50px;
  58 + margin-left: 34px;
  59 + border: 0;
  60 + border: 1px solid $borderColor;
  61 + color: #444;
  62 + }
  63 +
  64 + &.on {
  65 + color: #444;
  66 + }
  67 + }
  68 +
  69 + textarea {
  70 + width: calc(100% - 26px);
  71 + height: 100px;
  72 + resize: none;
  73 + border: 1px solid #ddd;
  74 + display: block;
  75 + color: #444;
  76 + }
  77 +
  78 + .iconfont {
  79 + display: inline-block;
  80 + width: 34px;
  81 + height: 34px;
  82 + line-height: 34px;
  83 + border: 1px solid #b4b4b4;
  84 + vertical-align: middle;
  85 + font-size: 18px;
  86 + text-align: center;
  87 + color: #fff;
  88 + position: absolute;
  89 + margin-top: 13px;
  90 + }
  91 +
  92 + .option-box {
  93 + padding-left: 40px;
  94 +
  95 + img {
  96 + display: inline-block;
  97 + vertical-align: middle;
  98 + }
  99 + }
  100 +
  101 + .radio-option .iconfont {
  102 + border-radius: 17px;
  103 + overflow: hidden;
  104 + }
  105 +
  106 + .on .iconfont {
  107 + border-color: #444;
  108 + background-color: #444;
  109 + }
  110 + }
  111 +
  112 + .submit {
  113 + padding: 0 20px;
  114 +
  115 + .submit-btn {
  116 + width: 100%;
  117 + height: 80px;
  118 + background: #3e3e3e;
  119 + color: #fff;
  120 + border: 0;
  121 + border-radius: 4px;
  122 + margin-bottom: 20px;
  123 + outline: none;
  124 + }
  125 + }
  126 +
  127 + .detail-wrap + .qs-err {
  128 + display: none;
  129 + }
  130 +
  131 + .qs-err {
  132 + &:before {
  133 + content: "";
  134 + width: 300px;
  135 + height: 190px;
  136 + background: resolve("3party/qs-lose.jpg") no-repeat;
  137 + display: block;
  138 + margin: 120px auto 0;
  139 + background-size: 100%;
  140 + }
  141 +
  142 + .err-text {
  143 + width: 56%;
  144 + line-height: 1.5;
  145 + color: #444;
  146 + margin: 0 auto;
  147 + padding-bottom: 50px;
  148 + display: block;
  149 + text-align: center;
  150 + }
  151 +
  152 + a {
  153 + width: 60%;
  154 + height: 80px;
  155 + line-height: 80px;
  156 + margin: 0 auto;
  157 + background: #3e3e3e;
  158 + color: #fff;
  159 + display: block;
  160 + text-align: center;
  161 + border-radius: 4px;
  162 + }
  163 + }
  164 +
  165 + .tip-dialog {
  166 + width: 100%;
  167 + height: 100%;
  168 + position: fixed;
  169 + left: 0;
  170 + top: 0;
  171 + z-index: 10;
  172 +
  173 + &:before {
  174 + content: "";
  175 + position: absolute;
  176 + width: 100%;
  177 + height: 100%;
  178 + background-color: rgba(0, 0, 0, 0.4);
  179 + z-index: -1;
  180 + }
  181 +
  182 + .dg-wrap {
  183 + width: 70%;
  184 + background: #fff;
  185 + border-radius: 6px;
  186 + position: absolute;
  187 + left: 15%;
  188 + top: 50%;
  189 + margin-top: -95px;
  190 + }
  191 +
  192 + .dg-content {
  193 + height: 140px;
  194 + line-height: 140px;
  195 +
  196 + > p {
  197 + width: 100%;
  198 + line-height: 1.4;
  199 + display: inline-block;
  200 + text-align: center;
  201 + vertical-align: middle;
  202 + }
  203 + }
  204 +
  205 + .dg-btns {
  206 + border-top: 1px solid #efefef;
  207 +
  208 + > * {
  209 + width: 50%;
  210 + line-height: 60px;
  211 + text-align: center;
  212 + display: block;
  213 + float: left;
  214 + cursor: pointer;
  215 + box-sizing: border-box;
  216 + }
  217 + }
  218 +
  219 + .continue-btn {
  220 + border-left: 1px solid #efefef;
  221 + box-sizing: border-box;
  222 + color: #d90005;
  223 + }
  224 + }
  225 +}
  1 +.nav-home {
  2 + display: none !important;
  3 +}
  4 +
  5 +.qs-list-page {
  6 + font-size: 28px;
  7 + $borderColor: #ececec;
  8 +
  9 + .qs-list {
  10 + line-height: 90px;
  11 + color: #444;
  12 + padding-left: 30px;
  13 + border-bottom: 1px solid $borderColor;
  14 +
  15 + > li {
  16 + border-top: 1px solid $borderColor;
  17 + }
  18 + }
  19 +
  20 + .tip-dialog {
  21 + width: 100%;
  22 + height: 100%;
  23 + position: fixed;
  24 + left: 0;
  25 + top: 0;
  26 + z-index: 10;
  27 +
  28 + &:before {
  29 + content: "";
  30 + position: absolute;
  31 + width: 100%;
  32 + height: 100%;
  33 + background-color: rgba(0, 0, 0, 0.4);
  34 + z-index: -1;
  35 + }
  36 +
  37 + .dg-wrap {
  38 + width: 70%;
  39 + background: #fff;
  40 + border-radius: 6px;
  41 + position: absolute;
  42 + left: 15%;
  43 + top: 50%;
  44 + margin-top: -95px;
  45 + }
  46 +
  47 + .dg-content {
  48 + height: 140px;
  49 + line-height: 140px;
  50 +
  51 + > p {
  52 + width: 100%;
  53 + line-height: 1.4;
  54 + display: inline-block;
  55 + text-align: center;
  56 + vertical-align: middle;
  57 + }
  58 + }
  59 +
  60 + .dg-btns {
  61 + border-top: 1px solid #efefef;
  62 +
  63 + > * {
  64 + width: 50%;
  65 + line-height: 60px;
  66 + text-align: center;
  67 + display: block;
  68 + float: left;
  69 + cursor: pointer;
  70 + }
  71 + }
  72 +
  73 + .dg-btns .sure-btn {
  74 + width: 100%;
  75 + }
  76 +
  77 + .share-btn {
  78 + border-left: 1px solid #efefef;
  79 + box-sizing: border-box;
  80 + color: #d90005;
  81 + }
  82 + }
  83 +}
@@ -568,9 +568,12 @@ $basicBtnC: #eb0313; @@ -568,9 +568,12 @@ $basicBtnC: #eb0313;
568 } 568 }
569 569
570 .period-of-market { 570 .period-of-market {
571 - float: right;  
572 - color: #d0021b; 571 + padding: 0 30px;
  572 + background-color: #fff;
  573 + line-height: 54px;
  574 + color: #b0b0b0;
573 font-size: 24px; 575 font-size: 24px;
  576 + border-bottom: 1px solid #e0e0e0;
574 577
575 h1 { 578 h1 {
576 display: inline-block; 579 display: inline-block;
@@ -124,6 +124,13 @@ @@ -124,6 +124,13 @@
124 margin: 30px 20px; 124 margin: 30px 20px;
125 } 125 }
126 126
  127 + .questionnaire-ico {
  128 + background-image: url("/service/chat/questionnaire-ico.png");
  129 + width: 60px;
  130 + height: 60px;
  131 + margin: 30px 20px;
  132 + }
  133 +
127 .arr-ico { 134 .arr-ico {
128 line-height: 120px; 135 line-height: 120px;
129 color: #e1e1e1; 136 color: #e1e1e1;
@@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW @@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
313 finalDetail.push({ 313 finalDetail.push({
314 relatedReco: { 314 relatedReco: {
315 isApp: isApp, 315 isApp: isApp,
316 - goods: goodsData,  
317 - moreNum: goodsData.length - 2 > 0 ? goodsData.length - 2 : 0 316 + goods: goodsData
318 } 317 }
319 }); 318 });
320 } 319 }
@@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => { @@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
380 379
381 _.forEach(finalDetail, (value, key) => { 380 _.forEach(finalDetail, (value, key) => {
382 if (value.relatedReco) { 381 if (value.relatedReco) {
383 - _.forEach(value.relatedReco.goods, (item, subKey) => {  
384 - if (goodsObj[item.id]) {  
385 - finalDetail[key].relatedReco.goods[subKey] = goodsObj[item.id]; 382 + let goodsIds = [];
  383 +
  384 + _.forEach(value.relatedReco.goods, relatedGoods => {
  385 + goodsIds.push(relatedGoods.id);
  386 + });
  387 +
  388 + goodsIds = _.uniq(goodsIds);
  389 + finalDetail[key].relatedReco.goods = [];
  390 +
  391 + _.forEach(goodsIds, (item, subKey) => {
  392 + if (goodsObj[item]) {
  393 + finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
386 } else { 394 } else {
387 delete finalDetail[key].relatedReco.goods[subKey]; 395 delete finalDetail[key].relatedReco.goods[subKey];
388 - finalDetail[key].relatedReco.moreNum--;  
389 } 396 }
390 }); 397 });
  398 +
  399 + let moreNum = _.get(finalDetail[key], 'relatedReco.goods.length', 0);
  400 +
  401 + finalDetail[key].relatedReco.moreNum = moreNum - 2 > 0 ? moreNum - 2 : 0;
391 } 402 }
392 403
393 if (value.collocation) { 404 if (value.collocation) {
@@ -143,6 +143,24 @@ module.exports = { @@ -143,6 +143,24 @@ module.exports = {
143 return ''; 143 return '';
144 } 144 }
145 }, 145 },
  146 +
  147 + /**
  148 + * 图片质量调整
  149 + */
  150 + imageslim: function(imageUrl) {
  151 + if (imageUrl && _.isString(imageUrl)) {
  152 + let urls = imageUrl.split('?');
  153 + let uri = urls[0];
  154 +
  155 + if (uri.indexOf('http:') === 0) {
  156 + uri = uri.replace('http:', '');
  157 + }
  158 +
  159 + return uri + '?imageslim';
  160 + } else {
  161 + return '';
  162 + }
  163 + },
146 isEqualOr: function() { 164 isEqualOr: function() {
147 let args = Array.prototype.slice.call(arguments); 165 let args = Array.prototype.slice.call(arguments);
148 let v1 = args[0]; 166 let v1 = args[0];
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-23 11:02:31 3 * @Date: 2017-03-23 11:02:31
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-05-02 11:09:37 5 + * @Last Modified time: 2017-05-26 16:42:29
6 */ 6 */
7 /* 红人店铺数据处理 */ 7 /* 红人店铺数据处理 */
8 8
@@ -34,7 +34,8 @@ const _linkhandle = (linkParent) => { @@ -34,7 +34,8 @@ const _linkhandle = (linkParent) => {
34 switch (parseInt(linkParent.linkType, 10)) { 34 switch (parseInt(linkParent.linkType, 10)) {
35 case 0: 35 case 0:
36 return helpers.urlFormat('', { 36 return helpers.urlFormat('', {
37 - filter_poolId: linkParent.resource 37 + filter_poolId: linkParent.resource,
  38 + title: linkParent.text
38 }, 'list'); 39 }, 'list');
39 case 1: 40 case 1:
40 return helpers.urlFormat('/product/' + linkParent.resource + '.html'); 41 return helpers.urlFormat('/product/' + linkParent.resource + '.html');
@@ -56,7 +57,7 @@ const _picsHandle = (moduleData) => { @@ -56,7 +57,7 @@ const _picsHandle = (moduleData) => {
56 let pics = []; 57 let pics = [];
57 58
58 _.forEach(_.get(moduleData, 'data', []), value => { 59 _.forEach(_.get(moduleData, 'data', []), value => {
59 - let showProductInfo = false; 60 + let showProductInfo = true;
60 61
61 if (_.has(value, 'showProductInfo')) { 62 if (_.has(value, 'showProductInfo')) {
62 showProductInfo = value.showProductInfo; 63 showProductInfo = value.showProductInfo;
@@ -325,12 +326,18 @@ const pushGoodsInfo = (decorators, goodsList) => { @@ -325,12 +326,18 @@ const pushGoodsInfo = (decorators, goodsList) => {
325 _.forEach(_.get(value, 'pics', []), (subValue, subKey) => { 326 _.forEach(_.get(value, 'pics', []), (subValue, subKey) => {
326 let hasGoods = _.get(goodsObj, `${subValue.skn}.default_images`, false); 327 let hasGoods = _.get(goodsObj, `${subValue.skn}.default_images`, false);
327 328
  329 + if (!hasGoods) {
  330 + decorators[key].noShowProductInfo = true;
  331 + }
  332 +
328 if (subValue.skn && hasGoods) { 333 if (subValue.skn && hasGoods) {
329 let salesPrice = _.get(goodsObj, `${subValue.skn}.sales_price`, ''); 334 let salesPrice = _.get(goodsObj, `${subValue.skn}.sales_price`, '');
330 let marketPrice = _.get(goodsObj, `${subValue.skn}.market_price`, ''); 335 let marketPrice = _.get(goodsObj, `${subValue.skn}.market_price`, '');
331 let imageSrc = _.get(goodsObj, `${subValue.skn}.default_images`, ''); 336 let imageSrc = _.get(goodsObj, `${subValue.skn}.default_images`, '');
332 337
333 - decorators[key].pics[subKey].showProductInfo = salesPrice !== 0; 338 + if (salesPrice === 0) {
  339 + decorators[key].noShowProductInfo = true;
  340 + }
334 decorators[key].pics[subKey].name = _.get(goodsObj, `${subValue.skn}.product_name`, ''); 341 decorators[key].pics[subKey].name = _.get(goodsObj, `${subValue.skn}.product_name`, '');
335 decorators[key].pics[subKey].salesPrice = salesPrice ? '¥' + salesPrice : ''; 342 decorators[key].pics[subKey].salesPrice = salesPrice ? '¥' + salesPrice : '';
336 decorators[key].pics[subKey].marketPrice = marketPrice ? '¥' + marketPrice : ''; 343 decorators[key].pics[subKey].marketPrice = marketPrice ? '¥' + marketPrice : '';