Authored by lijing

瀑布流图片展示bug

... ... @@ -570,3 +570,16 @@ exports.changeDate = function(req, res, next) {
res.json(result);
}).catch(next);
};
exports.getAbleTime = function(req, res, next) {
let params = {
activityType: req.query.activityType,
activityId: req.query.activityId,
isFront: req.query.isFront || req.cookies.isFront
};
trendModel.getAbleTime(params).then((result) => {
res.json(result);
}).catch(next);
};
\ No newline at end of file
... ...
... ... @@ -25,6 +25,11 @@ const _MYDHm = (day) => {
return moment(day, 'YYYY/MM/DD').format('YYYY年MM月DD日 HH:mm');
};
// 月日时分
const _MDHm = (day) => {
return moment(day, 'YYYY/MM/DD').format('MM月DD日 HH:mm');
};
// 格式年月日2
const _formatDay2 = (day) => {
return moment(day, 'YYYY/MM/DD').format('YY年MM月DD日');
... ... @@ -583,7 +588,7 @@ const getTimeList = (params) => {
time: _HM(new Date(item * 1000)),
originTime: item,
use: result.data.timeMap[item],
date: _MYDHm(new Date(item * 1000)),
date: _MDHm(new Date(item * 1000)),
});
}
resu.appointNum = result.data.appointNum;
... ... @@ -693,6 +698,8 @@ const packageDetail = (params) => {
free: result[0].data.isFree === 1,
price: result[0].data.price,
img: result[0].data.image,
limit: result[0].data.styleNumber,
styleId: result[0].data.styleList
};
resu.isAppointment = result[0].data.isAppointment === 1;
resu.content = result[0].data.detail;
... ... @@ -833,6 +840,7 @@ const chosenTime = (params) => {
let resu = {
dateList: [],
needAdv: params.activityType === '3',
hide: params.activityType === '1',
};
let build = [];
... ... @@ -1254,6 +1262,17 @@ const changeDate = (params) => {
});
};
// 获取可用时间
const getAbleTime = (params) => {
return service.get('ActivityConfigController/getAppointTime4Activity', {
activityType: params.activityType,
activityId: params.activityId,
isFront: params.isFront
}).then(result => {
return result;
});
};
module.exports = {
store,
articleDetail,
... ... @@ -1279,5 +1298,6 @@ module.exports = {
cutter,
delOrder,
changeDate,
kids
kids,
getAbleTime
};
... ...
... ... @@ -191,6 +191,7 @@ router.get('/trend/need-know', trend.needKnow);
// 获取时间列表
router.get('/trend/getTimeList', trend.getTimeList);
router.get('/trend/getAbleTime', trend.getAbleTime);
// 增加预约订单
router.get('/trend/addOrder', trend.addOrder);
... ...
... ... @@ -111,7 +111,7 @@
</div>
</div>
<div class="textarea">
<textarea class="cookie" id="note">添加备注(选填)</textarea>
<textarea class="cookie disabled" id="note">添加备注(选填)</textarea>
</div>
</div>
<div class="need-know">
... ...
<div class="trend-c">
<p class="date-tip"><span class="icon-pic tip"></span>如更换{{#if needAdv}}顾问{{else}}套餐{{/ if}}请重新选择</p>
<p class="date-tip {{#if hide}}hide{{/if}}"><span class="icon-pic tip"></span>如更换{{#if needAdv}}顾问{{else}}套餐{{/ if}}请重新选择</p>
<div class="side-main">
<div class="time-nav wrapper clearfix">
<ul class="nav-ul">
... ...
... ... @@ -14,6 +14,8 @@
<p>{{summary}}</p>
</div>
</div>
<input class="limit" type="hidden" value="{{limit}}" />
<input class="styleid" type="hidden" value="{{styleId}}" />
{{/ detail}}
<div class="content content-padding">{{{content}}}</div>
{{#if isAppointment}}
... ...
... ... @@ -2,7 +2,8 @@ require('../common');
var tip = require('../plugin/tip'),
IScroll = require('yoho-iscroll'),
diaLog = require('../plugin/dialog'),
Swiper = require('yoho-swiper');
Swiper = require('yoho-swiper'),
moment = require('moment');
var $num = $('.num'),
$navUl = $('.nav-ul');
... ... @@ -95,10 +96,13 @@ $(
$('.swiper-slide img').each(
function() {
if ($(this).height() > w_height) {
$(this).css('max-height', '100%');
$(this).css('top', '0');
$(this).css('height', '90%');
$(this).css('width', 'auto');
var newTop = (w_height - $(this).height()) / 2;
$(this).css('margin-top', newTop + 'px');
} else {
$(this).css('margin-top', '-' + $(this).height()/2 + 'px');
var newTop = (w_height - $(this).height()) / 2;
$(this).css('margin-top', newTop + 'px');
}
}
);
... ... @@ -113,6 +117,7 @@ $(
var boxWidth = box.eq(0).width();
var num = 2;
var boxArr = [];
var maxHeight = 0;
box.each(function(index, value) {
var boxHeight = box.eq(index).height();
if (index < num) {
... ... @@ -126,8 +131,11 @@ $(
'left': box.eq(minBoxIndex).position().left
});
boxArr[minBoxIndex] += box.eq(index).height();
var pullHeight = minBoxHeight + box.eq(index).height();
$('.pull-pic-list').css('height', pullHeight + 'px');
var newHeight = $(this).position().top + box.eq(index).height();
if (newHeight > maxHeight) {
maxHeight = newHeight;
}
$('.pull-pic-list').css('height', maxHeight + 'px');
}
});
}
... ... @@ -284,6 +292,9 @@ $(
$('.chosen-cutter').val(window.cookie('chosenCutter'));
$('.chosen-adviser').val(window.cookie('chosenAdviser'));
$('.chosen-class').val(window.cookie('chosenClass'));
if (window.cookie('chosenClass')) {
getAbleTime();
}
if (!window.cookie('chosenCutter') && window.cookie('chosenPackage')) {
$('.chosen-cutter').val('不预约发型师');
}
... ... @@ -325,7 +336,7 @@ $(
$('.textarea textarea').on('focus', function() {
if ($(this).val() === '添加备注(选填)') {
$(this).val('');
$(this).val('').removeClass('disabled');
}
});
... ... @@ -343,6 +354,8 @@ $(
}
if ($('.package-detail').length > 0) {
window.setCookie('chosenPackage', $('.package-detail').find('.name').text());
window.setCookie('packageLimit', $('.package-detail').find('.limit').val());
window.setCookie('packageStyle', $('.package-detail').find('.styleid').val());
}
// 立即预约按钮
... ... @@ -565,7 +578,7 @@ function autoScroll (thisPo) {
$navUl.find('.nav-item:eq(' + thisPo + ')').addClass('active').siblings('li').removeClass('active');
if (thisPo >= 2) {
// 倒数三个不触发效果
if ((sNum - thisPo) > 3) {
if ((sNum - thisPo) >= 3) {
myScroll.scrollTo((0 - (thisPo - 2) * sWidth), 0, 400);
}
}
... ... @@ -782,6 +795,33 @@ function limitInp (obj, limit, show) {
}
}
function getAbleTime() {
$.ajax({
url: '/activity/trend/getAbleTime',
data: {
activityType: window.queryString.typeStatus,
activityId: window.cookie('packageId')
},
success: function(result) {
if (result.code === 200) {
if (result.data) {
$('.chosen-time').val(_formatDay(new Date(result.data * 1000))).addClass('disabled');
$('.chosen-time').parents('a').attr('href', 'javascript:void(0)');
}
} else {
tip.show('网络断开了~~~');
}
},
error: function() {
tip.show('网络断开了~~~');
}
});
}
function _formatDay(day) {
return moment(day).format('MM月DD日 HH:mm');
};
// 清除cookie
function clearCookieArr (type) {
switch (type) {
... ... @@ -812,6 +852,7 @@ function clearCookieArr (type) {
window.setCookie('limitPerson', '');
window.setCookie('packageLimit', '');
window.setCookie('packageStyle', '');
window.setCookie('chosenClass', '');
break;
}
}
... ...
... ... @@ -12,6 +12,14 @@
background-color: #ebebeb;
padding-bottom: 88px;
input.disabled {
color: #aaa;
}
textarea.disabled{
color: #aaa;
}
img {
width: 100%;
}
... ... @@ -986,11 +994,7 @@
padding: 0;
img {
position: absolute;
width: 700px;
left: 50%;
margin-left: -350px;
top: 50%;
width: 90%;
height: auto;
}
}
... ...