|
@@ -207,6 +207,30 @@ const isEmpty = (value) => { |
|
@@ -207,6 +207,30 @@ const isEmpty = (value) => { |
207
|
(Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0);
|
207
|
(Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0);
|
208
|
};
|
208
|
};
|
209
|
|
209
|
|
|
|
210
|
+const getHotBrands = (brandList) => {
|
|
|
211
|
+ let hotBrands = [],
|
|
|
212
|
+ i = 20;
|
|
|
213
|
+
|
|
|
214
|
+ if (brandList) {
|
|
|
215
|
+ for (let j = 0; j < brandList.length; j++) {
|
|
|
216
|
+ if (brandList[j].is_hot === 'Y') {
|
|
|
217
|
+ hotBrands.push({
|
|
|
218
|
+ id: 'pp-' + brandList[j].id,
|
|
|
219
|
+ name: 'pp[]',
|
|
|
220
|
+ value: brandList[j].id,
|
|
|
221
|
+ text: brandList[j].brand_name
|
|
|
222
|
+ });
|
|
|
223
|
+ i--;
|
|
|
224
|
+ }
|
|
|
225
|
+ if (i <= 0) {
|
|
|
226
|
+ break;
|
|
|
227
|
+ }
|
|
|
228
|
+ }
|
|
|
229
|
+ }
|
|
|
230
|
+
|
|
|
231
|
+ return hotBrands;
|
|
|
232
|
+};
|
|
|
233
|
+
|
210
|
/**
|
234
|
/**
|
211
|
* 联动取地区信息
|
235
|
* 联动取地区信息
|
212
|
*/
|
236
|
*/
|
|
@@ -215,7 +239,7 @@ const getProviceCityInfo = (parentId, checkValue) => { |
|
@@ -215,7 +239,7 @@ const getProviceCityInfo = (parentId, checkValue) => { |
215
|
let addressInfo = yield userApi.getProviceCityInfo(parentId),
|
239
|
let addressInfo = yield userApi.getProviceCityInfo(parentId),
|
216
|
res = [{value: 0}],
|
240
|
res = [{value: 0}],
|
217
|
defaultText;
|
241
|
defaultText;
|
218
|
-
|
242
|
+
|
219
|
if (parentId.length === 2) {
|
243
|
if (parentId.length === 2) {
|
220
|
defaultText = '请选择省份';
|
244
|
defaultText = '请选择省份';
|
221
|
} else if (parentId.length === 4) {
|
245
|
} else if (parentId.length === 4) {
|
|
@@ -382,12 +406,9 @@ const getUserInfo = (channel, uid) => { |
|
@@ -382,12 +406,9 @@ const getUserInfo = (channel, uid) => { |
382
|
|
406
|
|
383
|
if (result[3].code === 200) {
|
407
|
if (result[3].code === 200) {
|
384
|
let contactInfo = result[3].data || '',
|
408
|
let contactInfo = result[3].data || '',
|
385
|
- areaCode = contactInfo.areaCode || '',
|
|
|
386
|
- prov;
|
409
|
+ areaCode;
|
387
|
|
410
|
|
388
|
- // getProviceCityInfo(0, areaCode.substr(0, 2)).then(result => {
|
|
|
389
|
- // console.info(result);
|
|
|
390
|
- // });
|
411
|
+ getProviceCityInfo(0, areaCode.substr(0, 2));
|
391
|
|
412
|
|
392
|
finalResult.contactInfo = {
|
413
|
finalResult.contactInfo = {
|
393
|
subTitle: '联系信息',
|
414
|
subTitle: '联系信息',
|
|
@@ -396,15 +417,18 @@ const getUserInfo = (channel, uid) => { |
|
@@ -396,15 +417,18 @@ const getUserInfo = (channel, uid) => { |
396
|
labelText: '来自:',
|
417
|
labelText: '来自:',
|
397
|
selects: [
|
418
|
selects: [
|
398
|
{
|
419
|
{
|
399
|
- key: 'province',
|
420
|
+ key: 'province'
|
|
|
421
|
+
|
400
|
// options: getProviceCityInfo(0, areaCode.substr(0, 2))
|
422
|
// options: getProviceCityInfo(0, areaCode.substr(0, 2))
|
401
|
},
|
423
|
},
|
402
|
{
|
424
|
{
|
403
|
- key: 'city',
|
425
|
+ key: 'city'
|
|
|
426
|
+
|
404
|
// options: getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4))
|
427
|
// options: getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4))
|
405
|
},
|
428
|
},
|
406
|
{
|
429
|
{
|
407
|
- key: 'areaCode',
|
430
|
+ key: 'areaCode'
|
|
|
431
|
+
|
408
|
// options: getProviceCityInfo(areaCode.substr(0, 4), areaCode)
|
432
|
// options: getProviceCityInfo(areaCode.substr(0, 4), areaCode)
|
409
|
}
|
433
|
}
|
410
|
]
|
434
|
]
|
|
@@ -495,7 +519,7 @@ const getUserInfo = (channel, uid) => { |
|
@@ -495,7 +519,7 @@ const getUserInfo = (channel, uid) => { |
495
|
|
519
|
|
496
|
for (let i; i < brandArr.length; i++) {
|
520
|
for (let i; i < brandArr.length; i++) {
|
497
|
for (let j; j < brandList.length; j++) {
|
521
|
for (let j; j < brandList.length; j++) {
|
498
|
- if (brandList.id == brandArr[i]) {
|
522
|
+ if (brandList.id === brandArr[i]) {
|
499
|
favBrands.push({
|
523
|
favBrands.push({
|
500
|
name: brandList.brand_name,
|
524
|
name: brandList.brand_name,
|
501
|
id: 'brand-' . brandList.id
|
525
|
id: 'brand-' . brandList.id
|
|
@@ -508,7 +532,7 @@ const getUserInfo = (channel, uid) => { |
|
@@ -508,7 +532,7 @@ const getUserInfo = (channel, uid) => { |
508
|
finalResult.favorite = {
|
532
|
finalResult.favorite = {
|
509
|
subTitle: '喜爱品牌',
|
533
|
subTitle: '喜爱品牌',
|
510
|
submitId: 'favorite-brand',
|
534
|
submitId: 'favorite-brand',
|
511
|
- likebrand: (likeBrandStr.substr(0, 1) == ',') ? likeBrandStr : ',' + likeBrandStr,
|
535
|
+ likebrand: (likeBrandStr.substr(0, 1) === ',') ? likeBrandStr : ',' + likeBrandStr,
|
512
|
favoriteBrands: favBrands,
|
536
|
favoriteBrands: favBrands,
|
513
|
hotBrands: hotBrands
|
537
|
hotBrands: hotBrands
|
514
|
};
|
538
|
};
|
|
@@ -520,30 +544,6 @@ const getUserInfo = (channel, uid) => { |
|
@@ -520,30 +544,6 @@ const getUserInfo = (channel, uid) => { |
520
|
});
|
544
|
});
|
521
|
};
|
545
|
};
|
522
|
|
546
|
|
523
|
-const getHotBrands = (brandList) => {
|
|
|
524
|
- let hotBrands = [],
|
|
|
525
|
- i = 20;
|
|
|
526
|
-
|
|
|
527
|
- if (brandList) {
|
|
|
528
|
- for (let j = 0; j < brandList.length; j++) {
|
|
|
529
|
- if (brandList[j].is_hot == 'Y') {
|
|
|
530
|
- hotBrands.push({
|
|
|
531
|
- id: 'pp-' + brandList[j].id,
|
|
|
532
|
- name: 'pp[]',
|
|
|
533
|
- value: brandList[j].id,
|
|
|
534
|
- text: brandList[j].brand_name
|
|
|
535
|
- });
|
|
|
536
|
- i--;
|
|
|
537
|
- }
|
|
|
538
|
- if (i <= 0) {
|
|
|
539
|
- break;
|
|
|
540
|
- }
|
|
|
541
|
- }
|
|
|
542
|
- }
|
|
|
543
|
-
|
|
|
544
|
- return hotBrands;
|
|
|
545
|
-};
|
|
|
546
|
-
|
|
|
547
|
const editUserInfo = (req, uid) => {
|
547
|
const editUserInfo = (req, uid) => {
|
548
|
let userInfo = {},
|
548
|
let userInfo = {},
|
549
|
respData;
|
549
|
respData;
|
|
@@ -621,10 +621,10 @@ const editUserHabitsInfo = (req, uid) => { |
|
@@ -621,10 +621,10 @@ const editUserHabitsInfo = (req, uid) => { |
621
|
|
621
|
|
622
|
return respData;
|
622
|
return respData;
|
623
|
}
|
623
|
}
|
624
|
-
|
|
|
625
|
- return co(function*() {
|
624
|
+
|
|
|
625
|
+ return co(function*() {
|
626
|
respData = yield userApi.editUserHabitsInfo(habitsInfo);
|
626
|
respData = yield userApi.editUserHabitsInfo(habitsInfo);
|
627
|
-
|
627
|
+
|
628
|
return respData;
|
628
|
return respData;
|
629
|
})();
|
629
|
})();
|
630
|
};
|
630
|
};
|
|
@@ -643,10 +643,10 @@ const editUserLikeBrand = (req, uid) => { |
|
@@ -643,10 +643,10 @@ const editUserLikeBrand = (req, uid) => { |
643
|
};
|
643
|
};
|
644
|
|
644
|
|
645
|
return respData;
|
645
|
return respData;
|
646
|
- }
|
|
|
647
|
- return co(function*() {
|
646
|
+ }
|
|
|
647
|
+ return co(function*() {
|
648
|
respData = yield userApi.editUserLikeBrand(uid, brand);
|
648
|
respData = yield userApi.editUserLikeBrand(uid, brand);
|
649
|
-
|
649
|
+
|
650
|
return respData;
|
650
|
return respData;
|
651
|
})();
|
651
|
})();
|
652
|
};
|
652
|
};
|