...
|
...
|
@@ -255,7 +255,7 @@ const getProviceCityInfo = (parentId, checkValue) => { |
|
|
text: addressInfo.data[i].caption
|
|
|
};
|
|
|
|
|
|
if (addressInfo.data[i].id === checkValue) {
|
|
|
if (!checkValue && addressInfo.data[i].id === checkValue) {
|
|
|
addressJson.isChecked = true;
|
|
|
}
|
|
|
res.push(addressJson);
|
...
|
...
|
@@ -268,16 +268,18 @@ const getProviceCityInfo = (parentId, checkValue) => { |
|
|
|
|
|
const getUserInfo = (channel, uid) => {
|
|
|
|
|
|
return api.all([
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
userApi.getUserInfo(uid),
|
|
|
userApi.getTipConfig(uid),
|
|
|
userApi.getUserContactInfo(uid),
|
|
|
userApi.getUserHabitsInfo(uid),
|
|
|
userApi.getUserLikeBrand(uid),
|
|
|
searchApi.get('/brand/list.json', {}, {cache: true})
|
|
|
return co(function*(){
|
|
|
|
|
|
let result = yield api.all([
|
|
|
headerModel.requestHeaderData(channel),
|
|
|
userApi.getUserInfo(uid),
|
|
|
userApi.getTipConfig(uid),
|
|
|
userApi.getUserContactInfo(uid),
|
|
|
userApi.getUserHabitsInfo(uid),
|
|
|
userApi.getUserLikeBrand(uid),
|
|
|
searchApi.get('/brand/list.json', {}, {cache: true})
|
|
|
]);
|
|
|
|
|
|
]).then(result => {
|
|
|
let finalResult = {},
|
|
|
headerData = {},
|
|
|
userInfo = {};
|
...
|
...
|
@@ -406,9 +408,21 @@ const getUserInfo = (channel, uid) => { |
|
|
|
|
|
if (result[3].code === 200) {
|
|
|
let contactInfo = result[3].data || '',
|
|
|
areaCode;
|
|
|
areaCode = result[3].data.area_code || '';
|
|
|
|
|
|
console.info(areaCode);
|
|
|
|
|
|
let proviceOpts = yield getProviceCityInfo(0, areaCode.substr(0, 2)),
|
|
|
cityOpts = [{value: 0, text: '请选择市'}],
|
|
|
areaOpts = [{value: 0, text: '请选择区县'}];
|
|
|
|
|
|
getProviceCityInfo(0, areaCode.substr(0, 2));
|
|
|
if (areaCode.length === 4) {
|
|
|
cityOpts = yield getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4));
|
|
|
}
|
|
|
|
|
|
if (areaCode.length > 4) {
|
|
|
areaOpts = yield getProviceCityInfo(areaCode.substr(0, 4), areaCode);
|
|
|
}
|
|
|
|
|
|
finalResult.contactInfo = {
|
|
|
subTitle: '联系信息',
|
...
|
...
|
@@ -417,19 +431,16 @@ const getUserInfo = (channel, uid) => { |
|
|
labelText: '来自:',
|
|
|
selects: [
|
|
|
{
|
|
|
key: 'province'
|
|
|
|
|
|
// options: getProviceCityInfo(0, areaCode.substr(0, 2))
|
|
|
key: 'province',
|
|
|
options: proviceOpts
|
|
|
},
|
|
|
{
|
|
|
key: 'city'
|
|
|
|
|
|
// options: getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4))
|
|
|
key: 'city',
|
|
|
options: cityOpts
|
|
|
},
|
|
|
{
|
|
|
key: 'areaCode'
|
|
|
|
|
|
// options: getProviceCityInfo(areaCode.substr(0, 4), areaCode)
|
|
|
key: 'areaCode',
|
|
|
options: areaOpts
|
|
|
}
|
|
|
]
|
|
|
},
|
...
|
...
|
@@ -466,6 +477,7 @@ const getUserInfo = (channel, uid) => { |
|
|
}]
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result[4].code === 200) {
|
...
|
...
|
@@ -541,7 +553,7 @@ const getUserInfo = (channel, uid) => { |
|
|
finalResult.headerData = headerData;
|
|
|
finalResult.meEditPage = true;
|
|
|
return finalResult;
|
|
|
});
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
const editUserInfo = (req, uid) => {
|
...
|
...
|
@@ -657,26 +669,52 @@ const isBrandName = (req) => { |
|
|
|
|
|
]).then(result => {
|
|
|
let brandList = result.data,
|
|
|
brandName = req.body.brandName;
|
|
|
brandName = req.body.brandName,
|
|
|
brandInfo = {},
|
|
|
flag = false;
|
|
|
|
|
|
if (brandList) {
|
|
|
for (let i = 0; i < brandList.length; i++) {
|
|
|
if (brandList[i].brand_name === brandName) {
|
|
|
// $ret['flag'] = true;
|
|
|
// $ret['data']['brandName'] = $brandName;
|
|
|
// $ret['data']['brandId'] = $value['id'];
|
|
|
flag = true;
|
|
|
brandInfo.brand_name = brandName;
|
|
|
brandInfo.id = brandList[i].id;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (flag) {
|
|
|
return {
|
|
|
code: 200,
|
|
|
message: '',
|
|
|
data: brandInfo
|
|
|
}
|
|
|
}else {
|
|
|
return {
|
|
|
code: 400,
|
|
|
message: '很抱歉,您要添加的品牌不在我们的品牌库中。',
|
|
|
data: ''
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getProviceList = (pid) => {
|
|
|
return co(function*() {
|
|
|
let proList = yield userApi.getProviceCityInfo(pid);
|
|
|
|
|
|
return proList.data;
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getUserInfo,
|
|
|
editUserInfo,
|
|
|
editUserContactInfo,
|
|
|
editUserHabitsInfo,
|
|
|
editUserLikeBrand,
|
|
|
getProviceList,
|
|
|
isBrandName
|
|
|
}; |
...
|
...
|
|