Authored by 陈轩

Merge remote-tracking branch 'origin/release/5.1' into release/5.1

@@ -17,7 +17,7 @@ const shopIndex = (req, res) => { @@ -17,7 +17,7 @@ const shopIndex = (req, res) => {
17 }) 17 })
18 }; 18 };
19 } else { 19 } else {
20 - uid = crypto.encryption('', req.query.uid + ''), 20 + uid = crypto.encryption('', req.query.uid + '');
21 parameter = { 21 parameter = {
22 appVersion: true, 22 appVersion: true,
23 uid: uid 23 uid: uid
@@ -20,7 +20,7 @@ const shopList = (uid, tabName) => { @@ -20,7 +20,7 @@ const shopList = (uid, tabName) => {
20 }).then((result) => { 20 }).then((result) => {
21 if (result && result.code === 200) { 21 if (result && result.code === 200) {
22 _.forEach(result.data, function(data) { 22 _.forEach(result.data, function(data) {
23 - let href = '//m.yohobuy.com/product/index/brand?shop_id=' + data.shopsId + '&openby: yohobuy={"action":"go.shop","params":{"shop_id":"' 23 + let href = '//m.yohobuy.com/product/index/brand?shop_id=' + data.shopsId + '&openby:yohobuy={"action":"go.shop","params":{"shop_id":"'
24 + data.shopsId + '","shop_template_type":"' + data.shopTemplateType + '","shop_name":"' + data.shopName + '"}}'; 24 + data.shopsId + '","shop_template_type":"' + data.shopTemplateType + '","shop_name":"' + data.shopName + '"}}';
25 25
26 data.isFavorite = data.isFavorite === 'Y'; 26 data.isFavorite = data.isFavorite === 'Y';
@@ -4,12 +4,9 @@ @@ -4,12 +4,9 @@
4 {{> resources/banner-top}} 4 {{> resources/banner-top}}
5 {{/ bannerTop}} 5 {{/ bannerTop}}
6 6
7 - <div class="shop-nav nav">  
8 - </div> 7 + <div class="shop-nav nav"></div>
9 8
10 - <div class="shop-list">  
11 -  
12 - </div> 9 + <div class="shop-list"></div>
13 {{/ shopCollect}} 10 {{/ shopCollect}}
14 <input type="hidden" name="app_version" value="{{appVersion}}"> 11 <input type="hidden" name="app_version" value="{{appVersion}}">
15 <input type="hidden" name="uid" value="{{uid}}"> 12 <input type="hidden" name="uid" value="{{uid}}">
@@ -3,15 +3,19 @@ const path = require('path'); @@ -3,15 +3,19 @@ const path = require('path');
3 3
4 const changeFiles = { 4 const changeFiles = {
5 js: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .js$', {silent: true}).stdout, 5 js: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .js$', {silent: true}).stdout,
6 - css: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .css$', {silent: true}).stdout 6 + css: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .css$', {silent: true}).stdout,
  7 + vue: shelljs.exec('git diff --cached --name-only --diff-filter=ACM | grep .vue$', {silent: true}).stdout,
7 }; 8 };
  9 +
8 const lintPath = { 10 const lintPath = {
9 js: path.resolve('./node_modules/.bin/eslint'), 11 js: path.resolve('./node_modules/.bin/eslint'),
10 css: path.resolve('./node_modules/.bin/stylelint') 12 css: path.resolve('./node_modules/.bin/stylelint')
11 }; 13 };
12 const lintResult = { 14 const lintResult = {
13 js: {}, 15 js: {},
14 - css: {} 16 + css: {},
  17 + vueScript: {},
  18 + vueStyle: {}
15 }; 19 };
16 20
17 const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀 21 const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀
@@ -28,9 +32,17 @@ if (changeFiles.js) { @@ -28,9 +32,17 @@ if (changeFiles.js) {
28 32
29 if (changeFiles.css) { 33 if (changeFiles.css) {
30 changeFiles.css = changeFiles.css.replace(/\n/g, ' '); 34 changeFiles.css = changeFiles.css.replace(/\n/g, ' ');
31 - lintResult.css = shelljs.exec(`${lintPath.css}${ext} --config .stylelintrc ${changeFiles.css}`); 35 + lintResult.css = shelljs.exec(`${lintPath.css}${ext} --syntax scss --config .stylelintrc ${changeFiles.css}`);
  36 +}
  37 +
  38 +if (changeFiles.vue) {
  39 + changeFiles.vue = changeFiles.vue.replace(/\n/g, ' ');
  40 + lintResult.vueScript = shelljs.exec(`${lintPath.js}${ext} -c .eslintrc --cache --fix ${changeFiles.vue}`);
  41 + lintResult.vueStyle = shelljs.exec(`${lintPath.css}${ext} --syntax scss --extract --config .stylelintrc ${changeFiles.vue}`); // eslint-disable-line
32 } 42 }
33 43
34 -if (lintResult.js.code || lintResult.css.code) {  
35 - process.exit(lintResult.js.code || lintResult.css.code); // eslint-disable-line 44 +const errorCode = lintResult.js.code || lintResult.css.code || lintResult.vueScript.code || lintResult.vueStyle.code;
  45 +
  46 +if (errorCode) {
  47 + process.exit(errorCode); // eslint-disable-line
36 } 48 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </div> 8 </div>
9 9
10 <div class="shop-tile"> 10 <div class="shop-tile">
11 - <img src="{{logoUrl}}"></img> 11 + <img class="lazy" data-original="{{image logoUrl 110 70}}"></img>
12 <p> 12 <p>
13 <span class="shop-name">{{shopName}}</span><br> 13 <span class="shop-name">{{shopName}}</span><br>
14 <span class="giving">{{words}}</span> 14 <span class="giving">{{words}}</span>
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </div> 17 </div>
18 18
19 <div class="info-content"> 19 <div class="info-content">
20 - <img class="content" src="{{bannerUrl}}"></img> 20 + <img class="lazy content" data-original="{{image bannerUrl 690 175}}"></img>
21 </div> 21 </div>
22 </a> 22 </a>
23 </div> 23 </div>
@@ -4,7 +4,8 @@ @@ -4,7 +4,8 @@
4 4
5 var $ = require('yoho-jquery'), 5 var $ = require('yoho-jquery'),
6 Swiper = require('yoho-swiper'), 6 Swiper = require('yoho-swiper'),
7 - tip = require('../plugin/tip'); 7 + tip = require('../plugin/tip'),
  8 + lazyLoad = require('yoho-jquery-lazyload');
8 9
9 var searching, 10 var searching,
10 shopId, 11 shopId,
@@ -76,6 +77,8 @@ function shopListData(tabName, stoping) { @@ -76,6 +77,8 @@ function shopListData(tabName, stoping) {
76 77
77 $('.shop-list').html(list); 78 $('.shop-list').html(list);
78 79
  80 + lazyLoad($('img.lazy'));
  81 +
79 stoping = false; 82 stoping = false;
80 83
81 84