Authored by 陈峰

Merge branch 'release/6.7.9' into 'master'

Release/6.7.9



See merge request !1575
@@ -73,6 +73,7 @@ class featureModel extends global.yoho.BaseModel { @@ -73,6 +73,7 @@ class featureModel extends global.yoho.BaseModel {
73 lefTopImg: value.lefTopImg, 73 lefTopImg: value.lefTopImg,
74 rigTopImg: value.rigTopImg, 74 rigTopImg: value.rigTopImg,
75 showPrdName: value.showPrdName, 75 showPrdName: value.showPrdName,
  76 + priceFontColor: value.priceFontColor,
76 showSalePrice: value.showSalePrice, 77 showSalePrice: value.showSalePrice,
77 salePriceBgColor: value.salePriceBgColor, 78 salePriceBgColor: value.salePriceBgColor,
78 fontColor: value.fontColor, 79 fontColor: value.fontColor,
@@ -141,7 +142,7 @@ class featureModel extends global.yoho.BaseModel { @@ -141,7 +142,7 @@ class featureModel extends global.yoho.BaseModel {
141 data: { 142 data: {
142 method: 'app.collage.productList.page', 143 method: 'app.collage.productList.page',
143 activityId: activityId, 144 activityId: activityId,
144 - limit: 10 145 + limit: 20
145 }, 146 },
146 param: { 147 param: {
147 cache: true 148 cache: true
@@ -193,6 +194,7 @@ class featureModel extends global.yoho.BaseModel { @@ -193,6 +194,7 @@ class featureModel extends global.yoho.BaseModel {
193 return; 194 return;
194 } 195 }
195 data = data.data; 196 data = data.data;
  197 +
196 if (data && data.floors) { 198 if (data && data.floors) {
197 data.floors.forEach(f => { 199 data.floors.forEach(f => {
198 let componentArr = []; 200 let componentArr = [];
@@ -207,8 +209,6 @@ class featureModel extends global.yoho.BaseModel { @@ -207,8 +209,6 @@ class featureModel extends global.yoho.BaseModel {
207 209
208 componentArr.push(f.component[0]); 210 componentArr.push(f.component[0]);
209 211
210 - // sknsArr.push(self._getProductBySkns(f.component[0], self.ctx));  
211 -  
212 f.component[0].newStyle = _.get(f, 'component[0].newStyle') === '1'; 212 f.component[0].newStyle = _.get(f, 'component[0].newStyle') === '1';
213 } 213 }
214 214
@@ -233,12 +233,9 @@ class featureModel extends global.yoho.BaseModel { @@ -233,12 +233,9 @@ class featureModel extends global.yoho.BaseModel {
233 233
234 if (componentType === 'swiperSkns') { 234 if (componentType === 'swiperSkns') {
235 componentArr.push(f.component[0]); 235 componentArr.push(f.component[0]);
236 -  
237 - // sknsArr.push(self._getProductBySkns(f.component[0], self.ctx));  
238 } 236 }
239 237
240 if (componentType === 'collageSkns') { 238 if (componentType === 'collageSkns') {
241 - // componentArr.push(f.component[0]);  
242 sknsArr.push(self._getCollageProductList(f.component[0], self.ctx)); 239 sknsArr.push(self._getCollageProductList(f.component[0], self.ctx));
243 } 240 }
244 241
@@ -259,6 +256,8 @@ class featureModel extends global.yoho.BaseModel { @@ -259,6 +256,8 @@ class featureModel extends global.yoho.BaseModel {
259 f.param.bgimg = ''; 256 f.param.bgimg = '';
260 } 257 }
261 258
  259 + let set = new Set();
  260 +
262 _.forEach(f.component, component => { 261 _.forEach(f.component, component => {
263 if (component.url && component.url.indexOf('go.productDetail') !== -1) { 262 if (component.url && component.url.indexOf('go.productDetail') !== -1) {
264 263
@@ -276,8 +275,19 @@ class featureModel extends global.yoho.BaseModel { @@ -276,8 +275,19 @@ class featureModel extends global.yoho.BaseModel {
276 if (component.type === 'skn') { 275 if (component.type === 'skn') {
277 componentArr.push(component); 276 componentArr.push(component);
278 } 277 }
  278 +
  279 + component.type && set.add(component.type);
279 }); 280 });
280 281
  282 + // 楼层背景图特殊处理,不推荐使用(新需求强烈要求接口给新楼层标识)
  283 + // 原背景图用作撑开楼层,部分覆盖组件覆盖其上,非覆盖组件显示在背景图下
  284 + if (['shop-skn'].indexOf(_.sortBy([...set]).join('-')) > -1) {
  285 + if (f.param.bgimg) {
  286 + f.param._bgimgFill = f.param.bgimg;
  287 + f.param.bgimg = '';
  288 + }
  289 + }
  290 +
281 if (componentArr.length) { 291 if (componentArr.length) {
282 sknsArr.push(self._getProductBySkns(componentArr, self.ctx)); 292 sknsArr.push(self._getProductBySkns(componentArr, self.ctx));
283 } 293 }
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 {{#isEqualOr type '' 'common_floor' 'fix'}} 28 {{#isEqualOr type '' 'common_floor' 'fix'}}
29 {{! 普通楼层 顶悬浮}} 29 {{! 普通楼层 顶悬浮}}
30 <div {{#if param.anchorname}} id="{{param.anchorname}}" {{/if}} {{#if param.tabname}} tabname="{{param.tabname}}" {{/if}} 30 <div {{#if param.anchorname}} id="{{param.anchorname}}" {{/if}} {{#if param.tabname}} tabname="{{param.tabname}}" {{/if}}
31 - {{#if id}} data-id="{{id}}" {{/if}} class="floor clearfix {{type}} {{#if hide}}hide{{/if}}" style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}"> 31 + {{#if id}} data-id="{{id}}" {{/if}} class="floor clearfix {{type}} {{#if hide}}hide{{/if}}" style="{{#if param.bgcolor}}background-color:{{param.bgcolor}};{{/if}}{{#if param._bgimgFill}}background-image: url({{param._bgimgFill}});{{/if}}">
32 {{#if param.bgimg}} 32 {{#if param.bgimg}}
33 {{#isLazyLoad type @index}} 33 {{#isLazyLoad type @index}}
34 <img class="lazy" data-original="{{imageslim param.bgimg}}"> 34 <img class="lazy" data-original="{{imageslim param.bgimg}}">
@@ -134,7 +134,9 @@ @@ -134,7 +134,9 @@
134 {{! 商品}} 134 {{! 商品}}
135 {{#defaultPros}} 135 {{#defaultPros}}
136 <div class="product-container single-item3"> 136 <div class="product-container single-item3">
137 - {{> feature/product-old-item}} 137 + {{#isEqualOr ../newStyle '1'}}
  138 + {{> feature/product-new-item}} {{^}} {{> feature/product-old-item}}
  139 + {{/isEqualOr}}
138 </div> 140 </div>
139 {{/defaultPros}} 141 {{/defaultPros}}
140 {{/isEqualOr}} 142 {{/isEqualOr}}
@@ -8,10 +8,10 @@ @@ -8,10 +8,10 @@
8 <img class="rigtopimg lazy" data-original="{{image2 conf.rigTopImg q=85}}"> 8 <img class="rigtopimg lazy" data-original="{{image2 conf.rigTopImg q=85}}">
9 {{/if}} 9 {{/if}}
10 <img class="product-detail-img product-detail-img-new lazy" data-original="{{image2 productimg q=85}}"> 10 <img class="product-detail-img product-detail-img-new lazy" data-original="{{image2 productimg q=85}}">
  11 + <a class="new-brand-name {{#isEqualOr conf.showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href="{{brandurl}}">
  12 + <span class="brand-name" {{#if conf.fontColor}} style="color:{{conf.fontColor}};" {{/if}}>{{brandname}}</span>
  13 + </a>
11 </div> 14 </div>
12 - <a class="new-brand-name {{#isEqualOr conf.showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href="{{brandurl}}">  
13 - <span class="brand-name" {{#if conf.fontColor}} style="color:{{conf.fontColor}};" {{/if}}>{{brandname}}</span>  
14 - </a>  
15 </a> 15 </a>
16 {{#if conf.brandImg}} 16 {{#if conf.brandImg}}
17 <a class="second-part"> 17 <a class="second-part">
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 <li class="side-swiper-item" data-skn="{{productSkn}}"> 5 <li class="side-swiper-item" data-skn="{{productSkn}}">
6 <a href="{{producturl}}"> 6 <a href="{{producturl}}">
7 <div class="img-box"> 7 <div class="img-box">
  8 + <div class="collage-num">{{peopleNum}}人成团</div>
8 {{#if ../lefTopImg}} 9 {{#if ../lefTopImg}}
9 <img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=85}}"> 10 <img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=85}}">
10 {{/if}} 11 {{/if}}
@@ -15,10 +16,10 @@ @@ -15,10 +16,10 @@
15 </div> 16 </div>
16 <div class="goods-info"> 17 <div class="goods-info">
17 <div class="info-middle"> 18 <div class="info-middle">
18 - <div class="pro-price" style="{{#if ../priceFontColor}}color:{{../priceFontColor}};{{/if}}"> 19 + <div class="pro-price center" style="{{#if ../salePriceBgColor}}background:{{../salePriceBgColor}};{{/if}}{{#if ../priceFontColor}}color:{{../priceFontColor}};{{/if}}">
19 <span class="sale-price"{{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>¥{{collagePrice}}</span> 20 <span class="sale-price"{{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>¥{{collagePrice}}</span>
20 {{#if marketPrice}} 21 {{#if marketPrice}}
21 - <span class="market-price" {{#if ../fontColor}} style="color:{{../fontColor}};"{{/if}}>¥{{marketPrice}}</span> 22 + <span class="market-price grey" {{#if ../fontColor}} style="color:{{../fontColor}};"{{/if}}>¥{{marketPrice}}</span>
22 {{/if}} 23 {{/if}}
23 </div> 24 </div>
24 25
@@ -12,24 +12,26 @@ @@ -12,24 +12,26 @@
12 <img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=85}}"> 12 <img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=85}}">
13 {{/if}} 13 {{/if}}
14 <img class="goods-pic lazy" data-original="{{image2 productimg q=85}}" alt="goods"> 14 <img class="goods-pic lazy" data-original="{{image2 productimg q=85}}" alt="goods">
  15 +
  16 + {{#isEqualOr ../showBrandUrl '1'}}
  17 + <a class="brand-name brand-name-cover" href="{{brandurl}}">
  18 + <span {{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>{{brandname}}</span>
  19 + </a>
  20 + {{/isEqualOr}}
15 </div> 21 </div>
16 <div class="goods-info"> 22 <div class="goods-info">
17 - <div class="info-middle">  
18 - {{#isEqualOr ../showSalePrice '1'}}  
19 - <div class="pro-price" style="{{#if ../salePriceBgColor}}background:{{../salePriceBgColor}};{{/if}}{{#if ../priceFontColor}}color:{{../priceFontColor}};{{/if}}">  
20 - <span class="sale-price"{{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>¥{{saleprice}}</span>  
21 - {{#if marketprice}}  
22 - <span class="market-price" {{#if ../fontColor}} style="color:{{../fontColor}};"{{/if}}>¥{{marketprice}}</span>  
23 - {{/if}}  
24 - </div>  
25 - {{/isEqualOr}} 23 + {{#isEqualOr ../showSalePrice '1'}}
  24 + <div class="pro-price {{#if ../brandImg}}pro-price-cover{{/if}}" style="{{#if ../salePriceBgColor}}background:{{../salePriceBgColor}};{{/if}}{{#if ../priceFontColor}}color:{{../priceFontColor}};{{/if}}">
  25 + <span class="sale-price"{{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>¥{{saleprice}}</span>
  26 + {{#if marketprice}}
  27 + <span class="market-price" {{#if ../fontColor}} style="color:{{../fontColor}};"{{/if}}>¥{{marketprice}}</span>
  28 + {{/if}}
  29 + </div>
  30 + {{/isEqualOr}}
26 31
27 - {{#isEqualOr ../showBrandUrl '1'}}  
28 - <a class="brand-name" href="{{brandurl}}">  
29 - <span {{#if ../fontColor}} style="color:{{../fontColor}};" {{/if}}>{{brandname}}</span>  
30 - </a>  
31 - {{/isEqualOr}}  
32 - </div> 32 + {{#if ../brandImg}}
  33 + <img class="brand-img" src="{{image2 ../brandImg q=85}}">
  34 + {{/if}}
33 </div> 35 </div>
34 </a> 36 </a>
35 </li> 37 </li>
@@ -134,7 +134,7 @@ class newHome extends global.yoho.BaseModel { @@ -134,7 +134,7 @@ class newHome extends global.yoho.BaseModel {
134 async checkCs(uid) { 134 async checkCs(uid) {
135 let isWechatService = false; // 是否是微信客服 135 let isWechatService = false; // 是否是微信客服
136 136
137 - if (uid !== null || uid !== undefined) { 137 + if (uid !== null || uid !== void(0)) {
138 // 校验是客服还是用户 y则是客服 138 // 校验是客服还是用户 y则是客服
139 let ret = await this.get({ 139 let ret = await this.get({
140 data: { 140 data: {
1 { 1 {
2 "name": "yohobuywap-node", 2 "name": "yohobuywap-node",
3 - "version": "6.7.22", 3 + "version": "6.7.23",
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": {
@@ -16,7 +16,7 @@ $('.submitWxAccount').click(function() { @@ -16,7 +16,7 @@ $('.submitWxAccount').click(function() {
16 method: 'POST', 16 method: 'POST',
17 url: '/activity/red-envelope/submitWxCode', 17 url: '/activity/red-envelope/submitWxCode',
18 data: { 18 data: {
19 - userUid: parseInt($('#uid')[0].value), 19 + userUid: parseInt($('#uid')[0].value, 10),
20 userCode 20 userCode
21 }, 21 },
22 success: function(data) { 22 success: function(data) {
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 height: 100%; 83 height: 100%;
84 min-height: 440px; 84 min-height: 440px;
85 margin: 0 auto; 85 margin: 0 auto;
86 - padding: 33px; 86 + padding: 24px;
87 background: url("img/activity/red-envelope/txt-bg.png") no-repeat; 87 background: url("img/activity/red-envelope/txt-bg.png") no-repeat;
88 background-size: contain; 88 background-size: contain;
89 position: relative; 89 position: relative;
@@ -6,3 +6,33 @@ @@ -6,3 +6,33 @@
6 @import "scss/feature/shop"; 6 @import "scss/feature/shop";
7 @import "scss/feature/bottom"; 7 @import "scss/feature/bottom";
8 @import "scss/feature/timed-cut"; 8 @import "scss/feature/timed-cut";
  9 +
  10 +/* stylelint-disable */
  11 +.common_floor {
  12 + background-size: 100%;
  13 + background-repeat: no-repeat;
  14 +
  15 + img[src=""],
  16 + img:not([src]) {
  17 + opacity: 0;
  18 + }
  19 +
  20 + &.clearfix {
  21 + *zoom: 1;
  22 +
  23 + &:before,
  24 + &:after {
  25 + content: "";
  26 + display: table;
  27 + }
  28 +
  29 + &:after {
  30 + clear: both;
  31 + }
  32 + }
  33 +
  34 + .single-item3:nth-of-type(3n+1) {
  35 + margin-left: 20px;
  36 + }
  37 +}
  38 +/* stylelint-enable */
1 -/* stylelint-disable */  
2 -.common_floor {  
3 - &.clearfix {  
4 - *zoom: 1;  
5 -  
6 - &:before,  
7 - &:after {  
8 - content: "";  
9 - display: table;  
10 - }  
11 -  
12 - &:after {  
13 - clear: both;  
14 - }  
15 - }  
16 -  
17 - .single-item3:nth-of-type(3n+1) {  
18 - margin-left: 20px;  
19 - }  
20 -}  
21 -/* stylelint-enable */  
22 -  
23 .product-container { 1 .product-container {
24 overflow: hidden; 2 overflow: hidden;
25 padding: 0 20px 10px; 3 padding: 0 20px 10px;
@@ -102,7 +80,8 @@ @@ -102,7 +80,8 @@
102 float: left; 80 float: left;
103 81
104 .feature-product-info { 82 .feature-product-info {
105 - margin: 16px 10px 16px 0; 83 + margin: 16px 10px 0 0;
  84 + position: relative;
106 } 85 }
107 } 86 }
108 87
@@ -360,12 +339,13 @@ @@ -360,12 +339,13 @@
360 &:after { 339 &:after {
361 content: ""; 340 content: "";
362 display: block; 341 display: block;
363 - margin-top: -70px; 342 + margin-top: -88px;
364 } 343 }
365 344
366 ul { 345 ul {
367 - padding: 25px 0 100px 26px; 346 + padding: 14px 0 100px 20px;
368 white-space: nowrap; 347 white-space: nowrap;
  348 + font-size: 0;
369 } 349 }
370 350
371 .side-swiper-content { 351 .side-swiper-content {
@@ -374,8 +354,8 @@ @@ -374,8 +354,8 @@
374 354
375 .side-swiper-item { 355 .side-swiper-item {
376 display: inline-block; 356 display: inline-block;
377 - width: 153px;  
378 - margin-right: 26px; 357 + width: 160px;
  358 + margin-right: 20px;
379 border-radius: 5px; 359 border-radius: 5px;
380 vertical-align: top; 360 vertical-align: top;
381 361
@@ -385,7 +365,7 @@ @@ -385,7 +365,7 @@
385 } 365 }
386 366
387 .img-box { 367 .img-box {
388 - height: 206px; 368 + height: 216px;
389 position: relative; 369 position: relative;
390 } 370 }
391 371
@@ -395,6 +375,30 @@ @@ -395,6 +375,30 @@
395 display: block; 375 display: block;
396 } 376 }
397 377
  378 + .collage-num {
  379 + height: 30px;
  380 + line-height: 32px;
  381 + font-size: 10px;
  382 + border-radius: 16px;
  383 + background-color: #f00;
  384 + color: #fff;
  385 + position: absolute;
  386 + bottom: 0;
  387 + padding: 0 20px;
  388 + z-index: 2;
  389 +
  390 + &:before {
  391 + content: "";
  392 + width: 20px;
  393 + position: absolute;
  394 + left: 0;
  395 + top: 0;
  396 + bottom: 0;
  397 + background-color: #f00;
  398 + z-index: -1;
  399 + }
  400 + }
  401 +
398 .leftopimg, 402 .leftopimg,
399 .rigtopimg { 403 .rigtopimg {
400 height: auto; 404 height: auto;
@@ -412,21 +416,39 @@ @@ -412,21 +416,39 @@
412 right: 0; 416 right: 0;
413 } 417 }
414 418
  419 + .goods-info {
  420 + position: relative;
  421 +
  422 + .pro-price-cover {
  423 + width: 100%;
  424 + position: absolute;
  425 + top: 0;
  426 + }
  427 + }
  428 +
415 .pro-price { 429 .pro-price {
416 - text-align: center;  
417 color: #444; 430 color: #444;
418 padding: 6px; 431 padding: 6px;
419 - font-size: 26px; 432 + font-size: 24px;
  433 + font-weight: 700;
  434 +
  435 + &.center {
  436 + text-align: center;
  437 + }
420 438
421 > span { 439 > span {
422 display: inline-block; 440 display: inline-block;
423 } 441 }
  442 +
  443 + .grey {
  444 + color: #bebebe;
  445 + }
424 } 446 }
425 447
426 .market-price { 448 .market-price {
427 - color: #bebebe;  
428 - margin-left: 6px;  
429 - font-size: 20px; 449 + margin-left: 4px;
  450 + font-size: 16px;
  451 + font-weight: 400;
430 text-decoration: line-through; 452 text-decoration: line-through;
431 } 453 }
432 454
@@ -442,6 +464,18 @@ @@ -442,6 +464,18 @@
442 color: #444; 464 color: #444;
443 } 465 }
444 466
  467 + .brand-name-cover {
  468 + position: absolute;
  469 + width: 100%;
  470 + bottom: 0;
  471 + background-color: #272829;
  472 + padding: 5px 0;
  473 + line-height: 30px;
  474 + font-size: 18px;
  475 + color: #fff;
  476 + z-index: 20;
  477 + }
  478 +
445 .join-num { 479 .join-num {
446 font-size: 22px; 480 font-size: 22px;
447 color: #bebebe; 481 color: #bebebe;
@@ -116,6 +116,11 @@ button { @@ -116,6 +116,11 @@ button {
116 background-size: 132px !important; 116 background-size: 132px !important;
117 } 117 }
118 118
  119 +img[src=""],
  120 +img:not([src]) {
  121 + opacity: 0;
  122 +}
  123 +
119 /* rich-tip */ 124 /* rich-tip */
120 .yoho-order-bg { 125 .yoho-order-bg {
121 position: fixed; 126 position: fixed;
@@ -34,11 +34,11 @@ const _numberValid = (option) => { @@ -34,11 +34,11 @@ const _numberValid = (option) => {
34 const value = option.value; 34 const value = option.value;
35 35
36 // 设置默认值 36 // 设置默认值
37 - option.require = option.require === undefined ? false : option.require;  
38 - option.integer = option.integer === undefined ? false : option.integer;  
39 - option.empty = option.empty === undefined ? true : option.empty; 37 + option.require = option.require === void(0) ? false : option.require;
  38 + option.integer = option.integer === void(0) ? false : option.integer;
  39 + option.empty = option.empty === void(0) ? true : option.empty;
40 40
41 - if (value === undefined) { 41 + if (value === void(0)) {
42 if (option.require === true) { 42 if (option.require === true) {
43 throw _errJson(`${option.param} 参数是必须的`); 43 throw _errJson(`${option.param} 参数是必须的`);
44 } else { 44 } else {
@@ -55,20 +55,20 @@ const _numberValid = (option) => { @@ -55,20 +55,20 @@ const _numberValid = (option) => {
55 if (option.empty === false) { 55 if (option.empty === false) {
56 throw _errJson(`${option.param} 参数不能为空字符串`); 56 throw _errJson(`${option.param} 参数不能为空字符串`);
57 } else { 57 } else {
58 - return undefined; 58 + return void(0);
59 } 59 }
60 } 60 }
61 61
62 const numValue = Number(value); 62 const numValue = Number(value);
63 63
64 if (!Number.isNaN(numValue) && Math.abs(numValue) !== Infinity) { 64 if (!Number.isNaN(numValue) && Math.abs(numValue) !== Infinity) {
65 - if (option.equal !== undefined) { 65 + if (option.equal !== void(0)) {
66 if (numValue !== option.equal) { 66 if (numValue !== option.equal) {
67 throw _errJson(`${option.param} 参数必须等于 ${option.equal}`); 67 throw _errJson(`${option.param} 参数必须等于 ${option.equal}`);
68 } 68 }
69 return numValue; 69 return numValue;
70 } 70 }
71 - if (option.equalArr !== undefined) { 71 + if (option.equalArr !== void(0)) {
72 let result = false; 72 let result = false;
73 73
74 for (let item of option.equalArr) { 74 for (let item of option.equalArr) {
@@ -89,12 +89,12 @@ const _numberValid = (option) => { @@ -89,12 +89,12 @@ const _numberValid = (option) => {
89 throw _errJson(`${option.param} 参数必须是整数`); 89 throw _errJson(`${option.param} 参数必须是整数`);
90 } 90 }
91 } 91 }
92 - if (option.smaller !== undefined) { 92 + if (option.smaller !== void(0)) {
93 if (!numValue < option.smaller) { 93 if (!numValue < option.smaller) {
94 throw _errJson(`${option.param} 参数必须小于 ${option.smaller}`); 94 throw _errJson(`${option.param} 参数必须小于 ${option.smaller}`);
95 } 95 }
96 } 96 }
97 - if (option.bigger !== undefined) { 97 + if (option.bigger !== void(0)) {
98 if (!numValue > option.bigger) { 98 if (!numValue > option.bigger) {
99 throw _errJson(`${option.param} 参数必须大于 ${option.bigger}`); 99 throw _errJson(`${option.param} 参数必须大于 ${option.bigger}`);
100 } 100 }
@@ -124,7 +124,7 @@ const _stringValid = (option) => { @@ -124,7 +124,7 @@ const _stringValid = (option) => {
124 option.require = option.require || false; 124 option.require = option.require || false;
125 option.empty = option.empty || true; 125 option.empty = option.empty || true;
126 126
127 - if (value === undefined) { 127 + if (value === void(0)) {
128 if (option.require === true) { 128 if (option.require === true) {
129 throw _errJson(`${option.param} 参数是必须的`); 129 throw _errJson(`${option.param} 参数是必须的`);
130 } else { 130 } else {
@@ -144,12 +144,12 @@ const _stringValid = (option) => { @@ -144,12 +144,12 @@ const _stringValid = (option) => {
144 throw _errJson(`${option.param} 参数不能为空`); 144 throw _errJson(`${option.param} 参数不能为空`);
145 } else { 145 } else {
146 if (option.emptyFilter === true) { 146 if (option.emptyFilter === true) {
147 - return undefined; 147 + return void(0);
148 } 148 }
149 return strValue; 149 return strValue;
150 } 150 }
151 } 151 }
152 - if (option.regex !== undefined) { 152 + if (option.regex !== void(0)) {
153 switch (option.regex) { 153 switch (option.regex) {
154 case 'phone': 154 case 'phone':
155 if (!/^1[0-9]{10}$/.test(strValue)) { 155 if (!/^1[0-9]{10}$/.test(strValue)) {
@@ -168,12 +168,12 @@ const _stringValid = (option) => { @@ -168,12 +168,12 @@ const _stringValid = (option) => {
168 } 168 }
169 return strValue; 169 return strValue;
170 } 170 }
171 - if (option.end !== undefined) { 171 + if (option.end !== void(0)) {
172 if (!strValue.length < option.end) { 172 if (!strValue.length < option.end) {
173 throw _errJson(`${option.param} 参数长度必须小于 ${option.end}`); 173 throw _errJson(`${option.param} 参数长度必须小于 ${option.end}`);
174 } 174 }
175 } 175 }
176 - if (option.start !== undefined) { 176 + if (option.start !== void(0)) {
177 if (!strValue.length > option.start) { 177 if (!strValue.length > option.start) {
178 throw _errJson(`${option.param} 参数长度必须大于 ${option.start}`); 178 throw _errJson(`${option.param} 参数长度必须大于 ${option.start}`);
179 } 179 }
@@ -197,7 +197,7 @@ const _booleanValid = (option) => { @@ -197,7 +197,7 @@ const _booleanValid = (option) => {
197 option.require = option.require || false; 197 option.require = option.require || false;
198 option.empty = option.empty || true; 198 option.empty = option.empty || true;
199 199
200 - if (value === undefined) { 200 + if (value === void(0)) {
201 if (option.require === true) { 201 if (option.require === true) {
202 throw _errJson(`${option.param} 参数是必须的`); 202 throw _errJson(`${option.param} 参数是必须的`);
203 } else { 203 } else {
@@ -210,7 +210,7 @@ const _booleanValid = (option) => { @@ -210,7 +210,7 @@ const _booleanValid = (option) => {
210 throw _errJson(`${option.param} 参数不能为空`); 210 throw _errJson(`${option.param} 参数不能为空`);
211 } else { 211 } else {
212 if (option.emptyFilter === true) { 212 if (option.emptyFilter === true) {
213 - return undefined; 213 + return void(0);
214 } 214 }
215 return value; 215 return value;
216 } 216 }
@@ -229,7 +229,7 @@ const _objectValid = (option) => { @@ -229,7 +229,7 @@ const _objectValid = (option) => {
229 option.require = option.require || false; 229 option.require = option.require || false;
230 option.empty = option.empty || true; 230 option.empty = option.empty || true;
231 231
232 - if (value === undefined || value === null) { 232 + if (value === void(0) || value === null) {
233 if (option.require === true) { 233 if (option.require === true) {
234 throw _errJson(`${option.param} 参数是必须的`); 234 throw _errJson(`${option.param} 参数是必须的`);
235 } else { 235 } else {
@@ -268,28 +268,30 @@ const valid = (data, option) => { @@ -268,28 +268,30 @@ const valid = (data, option) => {
268 switch (opt.type) { 268 switch (opt.type) {
269 case 'number': 269 case 'number':
270 data[item] = _numberValid(opt); 270 data[item] = _numberValid(opt);
271 - if (data[item] === undefined) { 271 + if (data[item] === void(0)) {
272 delete data[item]; 272 delete data[item];
273 } 273 }
274 break; 274 break;
275 case 'string': 275 case 'string':
276 data[item] = _stringValid(opt); 276 data[item] = _stringValid(opt);
277 - if (data[item] === undefined) { 277 + if (data[item] === void(0)) {
278 delete data[item]; 278 delete data[item];
279 } 279 }
280 break; 280 break;
281 case 'boolean': 281 case 'boolean':
282 data[item] = _booleanValid(opt); 282 data[item] = _booleanValid(opt);
283 - if (data[item] === undefined) { 283 + if (data[item] === void(0)) {
284 delete data[item]; 284 delete data[item];
285 } 285 }
286 break; 286 break;
287 case 'object': 287 case 'object':
288 data[item] = _objectValid(opt); 288 data[item] = _objectValid(opt);
289 - if (data[item] === undefined) { 289 + if (data[item] === void(0)) {
290 delete data[item]; 290 delete data[item];
291 } 291 }
292 break; 292 break;
  293 + default:
  294 + break;
293 } 295 }
294 }); 296 });
295 297