Authored by zhangxiaoru

Merge branch 'feature/family' of git.yoho.cn:fe/yohobuywap-node into feature/family

... ... @@ -3,7 +3,6 @@
const _ = require('lodash');
const moment = require('moment');
const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const family = global.yoho.FamilyAPI;
const service = global.yoho.ServiceAPI;
const resourcesProcess = require(`${global.utils}/resources-process`);
... ... @@ -510,9 +509,9 @@ class familyModel extends global.yoho.BaseModel {
result[0].data.qrcodeLink = helpers.urlFormat('/home/user/qrcode', {
token: _.get(result[0], 'data.uid', null) ?
crypto.encryption('yoho9646yoho9646', _.get(result, 'data.uid', null) + '') : '',
icon: _.get(result[0], 'data.head_ico', ''),
uname: _.get(result[0], 'data.nickname', ''),
vip: _.get(result[0], 'data.vip_info.cur_level')
icon: _.get(result[0], 'data.headIco', ''),
uname: _.get(result[0], 'data.nickName', ''),
vip: 0 // 从family进入二维码,暂时显示0
});
resu = camelCase(result[0].data);
}
... ... @@ -548,6 +547,7 @@ class familyModel extends global.yoho.BaseModel {
id: params.id
},
param: {
cache: true,
code: 200
}
};
... ...
... ... @@ -114,10 +114,10 @@
<div class="ok">完成</div>
</div>
<div class="swiper-list">
<div class="swiper-container">
<div class="swiper-container" id="province-c">
<div class="swiper-wrapper" id="province"></div>
</div>
<div class="swiper-container">
<div class="swiper-container" id="city-c">
<div class="swiper-wrapper" id="city"></div>
</div>
<div class="swiper-line"></div>
... ...
import 'home/family-userInfo.page.css';
import 'home/family/city-swiper.css';
import CitySwiper from './family/city-swiper';
import CitySwiper from 'plugin/city-swiper';
import $ from 'yoho-jquery';
import Page from 'yoho-page';
import tip from 'plugin/tip';
... ... @@ -34,10 +34,10 @@ class UserInfo extends Page {
cityRender
};
this.init();
this.CityId = 0;
this.province = this.selector.$provinceText.text();
this.city = this.selector.$cityText.text();
this.init();
}
init() {
... ... @@ -54,6 +54,7 @@ class UserInfo extends Page {
}
});
this.defaultPic();
this.getCity();
}
bindEvents() {
... ... @@ -67,9 +68,14 @@ class UserInfo extends Page {
userPic() {
if (yoho.isApp) {
yoho.ready(function() {
yoho.ready(() => {
yoho.invokeMethod('go.setAvatar', {}, (data) => {
console.log(data);
if (data) {
let reg = /(\w*){mode}(.*){width}(.*){height}(.*)/g;
data = data.replace(reg, '$12$2100$3100$4');
this.selector.$userAvatar.css('background-image', `url(${data})`);
}
});
});
}
... ... @@ -86,8 +92,8 @@ class UserInfo extends Page {
this.province = $provinceActive.text();
this.city = $cityActive.text();
$chosenCityText = `<span class="province-text">${this.province}</span>&nbsp;
<span class="city-text">${this.city}</span>`;
$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();
}
... ... @@ -141,7 +147,6 @@ class UserInfo extends Page {
if (this.CityId === 0) {
this.selector.$province.append(this.view.cityRender(result));
new CitySwiper({
swiperNum: 2, // swiper列数
lineNum: 5, // 每列行数
centeredSlides: true, // 剧中显示
hidePartingLine: false // 隐藏两条分割线
... ...
... ... @@ -12,6 +12,8 @@ class CitySwiper extends Page {
$swiperLine: $('.city-swiper .swiper-line'),
$swiperList: $('.city-swiper .swiper-list')
};
this.provinceSwiper = '';
this.citySwiper = '';
this.init(data);
}
... ... @@ -19,19 +21,17 @@ class CitySwiper extends Page {
let swiperParams = this.swiperParams(data);
this.setStyle(data);
new Swiper('.city-swiper .swiper-container', swiperParams);
this.provinceSwiper = new Swiper('.city-swiper #province-c', swiperParams);
this.citySwiper = new Swiper('.city-swiper #city-c', swiperParams);
}
setStyle(data) {
let wWidth = $(window).width();
let swiperWidth = wWidth / data.swiperNum || 1;
let lineHeight = this.selector.$swiperList.height() / data.lineNum;
let lineTop = lineHeight / 2;
if (data.hidePartingLine) {
this.selector.$swiperLine.hide();
}
this.selector.$swiper.css('width', `${swiperWidth}px`);
this.selector.$swiperLine.css('height', `${lineHeight}px`);
this.selector.$swiperLine.css('margin-top', `-${lineTop}px`);
}
... ... @@ -52,6 +52,9 @@ class CitySwiper extends Page {
this.emit('citySwiperCb', $thisSwiper);
},
onSlideChangeEnd: (swiper) => {
if ($(swiper.container[0]).index() === 0) {
this.citySwiper.slideTo(0, 1000, false); // 重选省份时,城市设置为第一个
}
$thisSwiper = swiper.activeIndex;
$thisSwiper = $(swiper.slides[`${$thisSwiper}`]);
this.emit('citySwiperCb', $thisSwiper);
... ...
... ... @@ -72,7 +72,7 @@ let functions = {
if (!yoho.isLogin()) {
let preInfo = `${sku}_${skn}_${buyNum}`;
let actCkOpthn = {
path: '/',
path: '/product',
expires: 1
};
... ...
... ... @@ -35,6 +35,7 @@
}
.swiper-container {
width: 50%;
height: 360px;
float: left;
}
... ...