Authored by 李靖

修改城市,common.js

... ... @@ -91,7 +91,7 @@ exports.userInfo = (req, res, next) => {
};
req.ctx(family).userInfo(params).then(result => {
res.render('family/userInfo', Object.assign(responseData, result));
res.render('family/user-info', Object.assign(responseData, result));
}).catch(next);
};
... ... @@ -102,7 +102,9 @@ exports.modify = (req, res, next) => {
gender: req.query.gender,
birthday: req.query.birthday,
height: req.query.height,
weight: req.query.weight
weight: req.query.weight,
province: req.query.province,
city: req.query.city
};
req.ctx(family).modify(params).then((result) => {
... ... @@ -133,7 +135,7 @@ exports.coinMall = (req, res) => {
localCss: true
};
res.render('family/coinMall', Object.assign(responseData, ''));
res.render('family/coin-mall', Object.assign(responseData, ''));
};
exports.getList = (req, res, next) => {
... ...
... ... @@ -687,13 +687,13 @@ class familyModel extends global.yoho.BaseModel {
modify(params) {
return family.get('user/updateUserInfo.json', {
uid: params.uid,
nick_name: params.nickName,
nickName: params.nickName,
gender: params.gender,
birthday: params.birthday,
height: params.height,
weight: params.weight
}, {
code: 200
weight: params.weight,
province: params.province,
city: params.city
}).then(result => {
return result;
});
... ...
... ... @@ -21,10 +21,12 @@
<div class="list-item">
<div class="title">性别</div>
<div class="main">
<select class="inp gender modify">
<option value="{{genderId}}">{{gender}}</option>
<option value="{{otherGenderId}}">{{otherGender}}</option>
</select>
<div class="select-c">
<select class="inp gender modify">
<option value="{{genderId}}">{{gender}}&nbsp;&nbsp;&nbsp;</option>
<option value="{{otherGenderId}}">{{otherGender}}&nbsp;&nbsp;&nbsp;</option>
</select>
</div>
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -44,7 +46,7 @@
<div id="chosen-city" class="list-item">
<div class="title">城市</div>
<div class="main">
<span class="inp">江苏 南京</span>
<span class="inp"><span class="province-text">{{province}}</span>&nbsp;<span class="city-text">{{city}}</span></span>
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -102,7 +104,7 @@
</div>
</div>
</div>
<div id="yoho-footer" class="foot-tip yoho-footer">
<div class="foot-tip">
<div class="pic"></div>
<p>如果你还使用了我们的其他产品(Yoho!Buy有货、Yoho!Now和 mars)修改个人信息时将同步。</p>
</div>
... ...
... ... @@ -12,9 +12,9 @@ const isTest = process.env.NODE_ENV === 'test';
const domains = {
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
singleApi: 'http://api-test2.yohops.com:9999/',
api: 'http://api-test2.yohops.com:9999/',
service: 'http://service-test2.yohops.com:9999/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
... ... @@ -136,12 +136,13 @@ if (isProduction) {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
global: 'http://api-global.yohobuy.com',
store: 'http://openstore.yohobuy.com', // 线上域名尚未确定
store: 'http://openstore.yohobuy.com',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/',
imSocket: 'wss://imsocket.yohobuy.com:443',
imCs: 'https://imhttp.yohobuy.com/api',
platformApi: 'http://api.platform.yohoops.org'
platformApi: 'http://api.platform.yohoops.org',
family: '' // 线上域名尚未确定
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ... @@ -211,7 +212,8 @@ if (isProduction) {
singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/',
imSocket: process.env.TEST_IM_SOCKET || 'ws://socket.yohobuy.com:10240',
imCs: process.env.TEST_IM_CS || 'http://im.yohobuy.com/api',
platformApi: 'http://192.168.102.48:8088/'
platformApi: 'http://192.168.102.48:8088/',
family: 'http://192.168.103.98:8026//yoho-family/'
},
memcache: {
master: ['127.0.0.1:12111'],
... ...
... ... @@ -15079,9 +15079,9 @@
"dev": true
},
"yoho-node-lib": {
"version": "0.3.1",
"resolved": "http://npm.yoho.cn/yoho-node-lib/-/yoho-node-lib-0.3.1.tgz",
"integrity": "sha512-yGqyQvGrQXhVdhVWw5nD3UJqEjHjpht+198ettvEXCejtEzG7MUHw94l9VE+hPG1mteqXrw+r4b3KrCPSpPQYA==",
"version": "0.3.3",
"resolved": "http://npm.yoho.cn/yoho-node-lib/-/yoho-node-lib-0.3.3.tgz",
"integrity": "sha512-4nj6YpMB1Wgq+DSIM4+dIA5JUkRLheIy7uA3w1vhbfZHI1YGWSNwVM3ZXbPxZmZe7S7Ex1ijQx/CSp/UfDEp7Q==",
"requires": {
"handlebars": "4.0.10",
"lodash": "4.17.4",
... ...
... ... @@ -73,7 +73,7 @@
"xml2js": "^0.4.17",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.3.1",
"yoho-node-lib": "^0.3.3",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...
... ... @@ -27,6 +27,7 @@ class IconMall extends Page {
this.type = 'now';
this.loading = false;
this.end = false;
this.fixTop = this.selector.$tabFixed.offset().top;
this.init();
}
... ... @@ -61,18 +62,20 @@ class IconMall extends Page {
}
}).then(result => {
if (result && result.list.length > 0) {
let $result = $(this.view.tabRender(result));
if (this.type === 'now') {
this.selector.$yohonowTab.append(this.view.tabRender(result));
this.selector.$yohonowTab.append($result);
}
if (this.type === 'mars') {
this.selector.$marsTab.append(this.view.tabRender(result));
this.selector.$marsTab.append($result);
}
this.loading = false;
lazyLoad($result.find('img.lazy'));
} else {
this.end = true;
tip.show('没有更多数据了~~~');
}
lazyLoad($('img.lazy'));
}).catch(error => {
console.error(error);
});
... ... @@ -80,10 +83,9 @@ class IconMall extends Page {
scroll() {
$(window).scroll(() => {
let $fixTop = this.selector.$tabFixed.offset().top;
let $scrollTop = $(window).scrollTop();
if ($scrollTop >= $fixTop) {
if ($scrollTop >= this.fixTop) {
this.selector.$tabFixed.find('.tab').addClass('fixed');
} else {
this.selector.$tabFixed.find('.tab').removeClass('fixed');
... ... @@ -110,6 +112,8 @@ class IconMall extends Page {
let $this = $(e.currentTarget);
let $thisId = $this.attr('id');
this.selector.$yohonowTab.empty();
this.selector.$marsTab.empty();
$(`#${$thisId}-tab`).show().siblings('.tab-item-c').hide();
this.selector.$coinMallC.removeAttr('id');
this.selector.$coinMallC.attr('id', $thisId);
... ...
... ... @@ -23,7 +23,9 @@ class UserInfo extends Page {
$province: $('#province'),
$city: $('#city'),
$cancelBtn: $('.swiper-header .cancel'),
$okBtn: $('.swiper-header .ok')
$okBtn: $('.swiper-header .ok'),
$provinceText: $('.province-text'),
$cityText: $('.city-text')
};
this.view = {
... ... @@ -32,11 +34,15 @@ class UserInfo extends Page {
this.init();
this.CityId = 0;
this.province = this.selector.$provinceText.text();
this.city = this.selector.$cityText.text();
}
init() {
this.bindEvents();
this.on('citySwiperCb', (event, data) => { // 返回选中的slide对象
// city-swiper的回调函数
this.on('citySwiperCb', (event, data) => { // data是返回选中的slide
let $data = $(data);
let $parent = $data.parents('.swiper-wrapper');
... ... @@ -53,6 +59,7 @@ class UserInfo extends Page {
this.selector.$modifyInp.on('blur', this.modifyInp.bind(this));
this.selector.$cancelBtn.on('click', this.cancelFun.bind(this));
this.selector.$okBtn.on('click', this.okFun.bind(this));
this.selector.$chosenCity.on('DOMNodeInserted', this.modifyInp.bind(this));
}
cancelFun() {
... ... @@ -62,9 +69,13 @@ class UserInfo extends Page {
okFun() {
let $provinceActive = $('#province .swiper-slide-active');
let $cityActive = $('#city .swiper-slide-active');
let $chosenCityText = `${$provinceActive.text()} ${$cityActive.text()}`;
let $chosenCityText = '';
this.selector.$chosenCity.find('.inp').text($chosenCityText);
this.province = $provinceActive.text();
this.city = $cityActive.text();
$chosenCityText = `<span class="province-text">${this.province}</span>&nbsp;
<span class="city-text">${this.city}</span>`;
this.selector.$chosenCity.find('.inp').html($chosenCityText);
this.selector.$citySwiper.hide();
}
... ... @@ -87,7 +98,9 @@ class UserInfo extends Page {
gender: this.selector.$gender.val(),
birthday: this.selector.$birthday.val(),
height: this.selector.$height.val(),
weight: this.selector.$weight.val()
weight: this.selector.$weight.val(),
province: this.province,
city: this.city,
},
}).then(result => {
if (result && result.code === 200) {
... ...
... ... @@ -9,15 +9,15 @@ select {
background: 0;
}
.family-user-info {
input::-webkit-clear-button {
display: none;
}
input::-webkit-clear-button {
width: 0;
}
input::-webkit-calendar-picker-indicator {
display: none;
}
input::-webkit-calendar-picker-indicator {
width: 0;
}
.family-user-info {
.info-list {
padding-left: 30px;
background-color: #fff;
... ... @@ -92,10 +92,21 @@ select {
.date-c {
position: absolute;
top: 10px;
right: -20px;
width: 300px;
white-space: nowrap;
overflow: hidden;
direction: rtl;
}
.select-c {
position: absolute;
top: 10px;
right: 20px;
width: 205px;
width: 40px;
white-space: nowrap;
overflow: hidden;
direction: rtl;
}
.pic {
... ... @@ -127,6 +138,7 @@ select {
.foot-tip {
background-color: #f0f0f0 !important;
margin-top: 80px;
.pic {
background-image: resolve("home/family/foot.png");
... ...