Authored by biao

update

... ... @@ -237,9 +237,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() {
$(this).removeClass('highlight');
});
$('.nav-home').on('touchstart', function() {
$('.homebuttom').toggleClass('none');
});
// $('.nav-home').on('touchstart', function() {
// $('.homebuttom').toggleClass('none');
// });
(function() {
var lastTime = 0,
... ... @@ -1745,6 +1745,10 @@ $sideNav.on('touchstart', 'li', function(e) {
}
});
$sideNav.on('touchmove', function(e) {
e.stopPropagation();
});
//返回一级导航,收起二级导航
$subNav.each(function() {
$(this).find('li').eq(0).on('touchstart', function() {
... ... @@ -3531,111 +3535,111 @@ $btnNext.on('touchstart', function() {
});
define("js/me/dialog", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){
/*
* @Description: dialog
* @Time: 2015/11/18
* @author: chenglong.wang
*/
var $ = require("jquery"),
Handlebars = require("handlebars"),
Hammer = require("hammer");
var $dialogWrapper,
dialogTpl,
dialogTemplate;
function getInstance() {
if (dialogTpl === undefined) {
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
'</div>';
dialogTemplate = Handlebars.compile(dialogTpl);
}
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
$('.dialog-wrapper').remove();
$('body').append($(dialogStr));
$dialogBox = $('.dialog-box');
$dialogWrapper = $('.dialog-wrapper');
dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));
// 显示
if (data.fast) {
$dialogWrapper.css({
display: 'block'
});
} else {
$dialogWrapper.fadeIn();
}
$dialogBox.css({
top: '50%',
marginTop: -($dialogBox.height() / 2)
});
//隐藏
if (data.autoHide) {
defaultHideDuraton = 1000;
if (data.autoHide > 1) {
defaultHideDuraton = data.autoHide;
}
setTimeout(function() {
$dialogWrapper.fadeOut();
}, defaultHideDuraton);
}
//禁止在dialog上可以上下滚动
$dialogWrapper.on('touchmove', function() {
return false;
});
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
if (typeof callbackForLeft === 'function') {
callbackForLeft();
}
$dialogWrapper.fadeOut();
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
}
// 防止出现点透问题
event.preventDefault();
event.srcEvent.stopPropagation();
});
};
exports.hideDialog = function() {
$('.dialog-wrapper').remove();
};
/*
* @Description: dialog
* @Time: 2015/11/18
* @author: chenglong.wang
*/
var $ = require("jquery"),
Handlebars = require("handlebars"),
Hammer = require("hammer");
var $dialogWrapper,
dialogTpl,
dialogTemplate;
function getInstance() {
if (dialogTpl === undefined) {
dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
'<div class="dialog-box">' +
'{{# hasHeader}}' +
'{{/ hasHeader}}' +
'<div class="dialog-content">{{dialogText}}</div>' +
'{{# hasFooter}}' +
'<div class="dialog-footer">' +
'{{# leftBtnText}}' +
'<span class="dialog-left-btn">{{.}}</span>' +
'{{/ leftBtnText}}' +
'{{# rightBtnText}}' +
'<span class="dialog-right-btn">{{.}}</span>' +
'{{/ rightBtnText}}' +
'</div>' +
'{{/ hasFooter}}' +
'</div>' +
'</div>';
dialogTemplate = Handlebars.compile(dialogTpl);
}
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
$('.dialog-wrapper').remove();
$('body').append($(dialogStr));
$dialogBox = $('.dialog-box');
$dialogWrapper = $('.dialog-wrapper');
dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));
// 显示
if (data.fast) {
$dialogWrapper.css({
display: 'block'
});
} else {
$dialogWrapper.fadeIn();
}
$dialogBox.css({
top: '50%',
marginTop: -($dialogBox.height() / 2)
});
//隐藏
if (data.autoHide) {
defaultHideDuraton = 1000;
if (data.autoHide > 1) {
defaultHideDuraton = data.autoHide;
}
setTimeout(function() {
$dialogWrapper.fadeOut();
}, defaultHideDuraton);
}
//禁止在dialog上可以上下滚动
$dialogWrapper.on('touchmove', function() {
return false;
});
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
if (typeof callbackForLeft === 'function') {
callbackForLeft();
}
$dialogWrapper.fadeOut();
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
}
// 防止出现点透问题
event.preventDefault();
event.srcEvent.stopPropagation();
});
};
exports.hideDialog = function() {
$('.dialog-wrapper').remove();
};
});
define("js/passport/bind/code", ["jquery"], function(require, exports, module){
... ... @@ -6828,440 +6832,440 @@ optHammer.on('tap', function(e) {
});
define("js/me/fav", ["jquery","hammer","swiper","handlebars","source-map","index"], function(require, exports, module){
/**
* 个人中心--收藏
* @author: chenglong<chenglong.wang@yoho.cn>
* @date: 2015/11/12
*/
var $ = require("jquery"),
Hammer = require("hammer"),
Swiper = require("swiper");
var diaLog = require("js/me/dialog");
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content > .fav-type'),
swiperObj = {},
favTabHammer,
favContentHammer,
$loadMore = $('.fav-load-more'),
$brandLoadMore = $('.fav-brand-load-more'),
winH = $(window).height(),
footerH = $('#yoho-footer').height(),
$favProductList = $('.fav-product-list'),
$favBrandList = $('.fav-brand-swiper-wrapper'),
pageId = 1,
brandPageId = 1, //收藏品牌的当前页数
lockId = true,
brandLockId = true, //收藏品牌是否可下拉加载更多
brandTab = false; //当前是否停留在收藏品牌页
function showFavTab(index) {
$navLi.filter('.active').removeClass('active');
$navLi.eq(index).addClass('active');
$favContainer.filter('.show').removeClass('show');
$favContainer.eq(index).addClass('show');
}
//初始化swiper
function initSwiper(data) {
var i,
idStrReg = /container-(\d+)['"]{1}/gi,
idReg = /\d+/,
idArr = data.match(idStrReg),
idArrLen = idArr.length,
containerId;
//$swiperList = $('.swiper-container');
for (i = 0; i < idArrLen; i++) {
/*id = $swiperList.eq(i).attr('data-id');
if (!!swiperObj[id]) {
swiperObj[id].destroy(true, true);
}*/
containerId = idArr[i].match(idReg)[0];
swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'swiper-wrapper-' + containerId,
lazyLoading: true,
watchSlidesVisibility: true
});
}
}
// 上拉加载更多
function loadData($parent, url, page) {
if (url === 'favBrand') {
brandLockId = true;
} else {
lockId = true;
}
$.ajax({
method: 'post',
url: '/home/' + url,
data: {
page: page
},
success: function(data) {
if (url === 'favBrand') {
$brandLoadMore.addClass('hide');
} else {
$loadMore.addClass('hide');
}
if (data === ' ') {
$parent.closest('.fav-type').find('.fav-content-loading').addClass('hide');
$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
} else if (data === 'end') {
$parent.closest('.fav-type').find('.fav-load-background')
/**
* 个人中心--收藏
* @author: chenglong<chenglong.wang@yoho.cn>
* @date: 2015/11/12
*/
var $ = require("jquery"),
Hammer = require("hammer"),
Swiper = require("swiper");
var diaLog = require("js/me/dialog");
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content > .fav-type'),
swiperObj = {},
favTabHammer,
favContentHammer,
$loadMore = $('.fav-load-more'),
$brandLoadMore = $('.fav-brand-load-more'),
winH = $(window).height(),
footerH = $('#yoho-footer').height(),
$favProductList = $('.fav-product-list'),
$favBrandList = $('.fav-brand-swiper-wrapper'),
pageId = 1,
brandPageId = 1, //收藏品牌的当前页数
lockId = true,
brandLockId = true, //收藏品牌是否可下拉加载更多
brandTab = false; //当前是否停留在收藏品牌页
function showFavTab(index) {
$navLi.filter('.active').removeClass('active');
$navLi.eq(index).addClass('active');
$favContainer.filter('.show').removeClass('show');
$favContainer.eq(index).addClass('show');
}
//初始化swiper
function initSwiper(data) {
var i,
idStrReg = /container-(\d+)['"]{1}/gi,
idReg = /\d+/,
idArr = data.match(idStrReg),
idArrLen = idArr.length,
containerId;
//$swiperList = $('.swiper-container');
for (i = 0; i < idArrLen; i++) {
/*id = $swiperList.eq(i).attr('data-id');
if (!!swiperObj[id]) {
swiperObj[id].destroy(true, true);
}*/
containerId = idArr[i].match(idReg)[0];
swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'swiper-wrapper-' + containerId,
lazyLoading: true,
watchSlidesVisibility: true
});
}
}
// 上拉加载更多
function loadData($parent, url, page) {
if (url === 'favBrand') {
brandLockId = true;
} else {
lockId = true;
}
$.ajax({
method: 'post',
url: '/home/' + url,
data: {
page: page
},
success: function(data) {
if (url === 'favBrand') {
$brandLoadMore.addClass('hide');
} else {
$loadMore.addClass('hide');
}
if (data === ' ') {
$parent.closest('.fav-type').find('.fav-content-loading').addClass('hide');
$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
} else if (data === 'end') {
$parent.closest('.fav-type').find('.fav-load-background')
.removeClass('fav-load-background').html('没有更多了');
// hf: fixes bug to 修改没有数据还调接口,加载错误页面问题
brandLockId = true;
lockId = true;
} else if (data.length > 10) {
$parent.append(data);
$parent.closest('.fav-type').find('.fav-content-loading').remove();
if (url === 'favBrand') {
initSwiper(data);//如果是收藏品牌需要初始化swiper
brandLockId = false;//请求成功后解锁品牌收藏page++
} else {
lockId = false;//请求成功后解锁商品收藏page++
}
}
window.rePosFooter();
}
});
}
// 如果从品牌收藏入口进入
if ($('#fav-tab').hasClass('brand-tab')) {
showFavTab(1);
loadData($favBrandList, 'favBrand', 1);
brandTab = true;
window.rePosFooter();
} else {
showFavTab(0);
loadData($favProductList, 'favProduct', 1);
brandTab = false;
window.rePosFooter();
}
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
if (index === 0) {
brandTab = false;
if ($favProductList.find('li').length === 0 &&
$favProductList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) {
loadData($favProductList, 'favProduct', 1);
}
} else {
brandTab = true;
if ($favBrandList.find('div').length === 0 &&
$favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) {
loadData($favBrandList, 'favBrand', 1);
}
}
showFavTab(index);
window.rePosFooter();
});
//删除收藏的商品
favContentHammer = new Hammer(document.getElementById('fav-content'));
favContentHammer.on('tap', function(e) {
var id = '';
if (!$(e.target).hasClass('del-fav')) {
return;
}
diaLog.showDialog({
dialogText: '您确定要取消收藏吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
id = $(e.target).closest('li').attr('data-id');
$.ajax({
method: 'post',
url: '/home/favoriteDel',
data: {
id: id
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: '已经取消收藏'
});
$(e.target).closest('li').remove();
} else if (data.code === 400) {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: data.message
});
} else {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: '取消收藏失败'
});
}
}).fail(function() {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
});
});
function scrollHandler() {
//距离底部未1/4列表高度+底部高度的时候加载更多
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $favBrandList.height() - footerH) {
if (brandTab) {
$brandLoadMore.filter('.hide').removeClass('hide');
if (!brandLockId) {
brandPageId++;
loadData($favBrandList, 'favBrand', brandPageId);
}
} else {
$loadMore.filter('.hide').removeClass('hide');
if (!lockId) {
pageId++;
loadData($favProductList, 'favProduct', pageId);
}
}
}
}
//srcoll to load more
$(window).scroll(scrollHandler);
$(document).on('touchend', '.swiper-header', function() {
var url = $(this).find('.fav-more').attr('href');
if (url) {
window.location.href = url;
}
});
// hf: fixes bug to 修改没有数据还调接口,加载错误页面问题
brandLockId = true;
lockId = true;
} else if (data.length > 10) {
$parent.append(data);
$parent.closest('.fav-type').find('.fav-content-loading').remove();
if (url === 'favBrand') {
initSwiper(data);//如果是收藏品牌需要初始化swiper
brandLockId = false;//请求成功后解锁品牌收藏page++
} else {
lockId = false;//请求成功后解锁商品收藏page++
}
}
window.rePosFooter();
}
});
}
// 如果从品牌收藏入口进入
if ($('#fav-tab').hasClass('brand-tab')) {
showFavTab(1);
loadData($favBrandList, 'favBrand', 1);
brandTab = true;
window.rePosFooter();
} else {
showFavTab(0);
loadData($favProductList, 'favProduct', 1);
brandTab = false;
window.rePosFooter();
}
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
if (index === 0) {
brandTab = false;
if ($favProductList.find('li').length === 0 &&
$favProductList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) {
loadData($favProductList, 'favProduct', 1);
}
} else {
brandTab = true;
if ($favBrandList.find('div').length === 0 &&
$favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) {
loadData($favBrandList, 'favBrand', 1);
}
}
showFavTab(index);
window.rePosFooter();
});
//删除收藏的商品
favContentHammer = new Hammer(document.getElementById('fav-content'));
favContentHammer.on('tap', function(e) {
var id = '';
if (!$(e.target).hasClass('del-fav')) {
return;
}
diaLog.showDialog({
dialogText: '您确定要取消收藏吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
id = $(e.target).closest('li').attr('data-id');
$.ajax({
method: 'post',
url: '/home/favoriteDel',
data: {
id: id
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: '已经取消收藏'
});
$(e.target).closest('li').remove();
} else if (data.code === 400) {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: data.message
});
} else {
diaLog.showDialog({
autoHide: true,
fast: true,
dialogText: '取消收藏失败'
});
}
}).fail(function() {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
});
});
function scrollHandler() {
//距离底部未1/4列表高度+底部高度的时候加载更多
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $favBrandList.height() - footerH) {
if (brandTab) {
$brandLoadMore.filter('.hide').removeClass('hide');
if (!brandLockId) {
brandPageId++;
loadData($favBrandList, 'favBrand', brandPageId);
}
} else {
$loadMore.filter('.hide').removeClass('hide');
if (!lockId) {
pageId++;
loadData($favProductList, 'favProduct', pageId);
}
}
}
}
//srcoll to load more
$(window).scroll(scrollHandler);
$(document).on('touchend', '.swiper-header', function() {
var url = $(this).find('.fav-more').attr('href');
if (url) {
window.location.href = url;
}
});
});
define("js/me/suggest", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){
/**
* 个人中心--意见反馈
* @author: chenglong<chenglong.wang@yoho.cn>
* @date: 2015/11/12
*/
var $ = require("jquery"),
Hammer = require("hammer"),
lazyLoad = require("lazyload"),
Handlebars = require("handlebars");
var diaLog = require("js/me/dialog");
var $uploadImgList = $('.upload-img-list'),
headerNavHammer,
formHammer,
imgTpl,
imgTemplate,
$likeBtn = $('.suggest-item .like-btn'),
$disLikeBtn = $('.suggest-item .dislike-btn'),
$imgAdd = $('.img-add'),
imgStr = '',
uploadImgNum = 0;
require("js/me/jquery.upload");
imgTpl = '{{# imgList}}' +
'<li>' +
'{{# imgUrl}}<img src="{{.}}" />' +
'<span class="upload-img-remove"></span>{{/ imgUrl}}' +
'</li>' +
'{{/ imgList}}';
imgTemplate = Handlebars.compile(imgTpl);
$('#upload-img').upload({
auto: true,
fileType: 'image/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 300,
height: '100%',
width: '100%',
multi: false,
onAddQueueItem: function(files) {
//TODO
$uploadImgList.html(imgTemplate({
imgList: true
}));
},
onUploadComplete: function(file, data) {
$uploadImgList.html('');
imgStr = JSON.parse(data).imgList[0].imgRelUrl;
$uploadImgList.html(imgTemplate(JSON.parse(data)));
$imgAdd.hide();
uploadImgNum++;
}
});
lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
var suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if ($(e.target).hasClass('nav-btn')) {
if (!textReg.test(suggestText)) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
});
return;
}
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText,
image: imgStr
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
dialogText: '提交成功'
});
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '提交失败~'
});
}
}).fail(function() {
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
}
});
if (document.getElementById('img-form') !== null) {
formHammer = new Hammer(document.getElementById('img-form'));
formHammer.on('tap', function(e) {
if ($(e.target).hasClass('upload-img-remove')) {
$uploadImgList.html('');
imgStr = '';
uploadImgNum--;
setTimeout(function() {
$imgAdd.show();
}, 50);
}
});
}
// 点赞与取消点赞
$likeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
method: 'post',
url: '/home/upAndDown',
data: {
suggest_id: id,
reliable: 1
}
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-good').addClass('show');
}
}).fail(function(data) {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
});
$disLikeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
method: 'post',
url: '/home/upAndDown',
data: {
suggest_id: id,
reliable: 2
}
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-bad').addClass('show');
}
}).fail(function(data) {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
/**
* 个人中心--意见反馈
* @author: chenglong<chenglong.wang@yoho.cn>
* @date: 2015/11/12
*/
var $ = require("jquery"),
Hammer = require("hammer"),
lazyLoad = require("lazyload"),
Handlebars = require("handlebars");
var diaLog = require("js/me/dialog");
var $uploadImgList = $('.upload-img-list'),
headerNavHammer,
formHammer,
imgTpl,
imgTemplate,
$likeBtn = $('.suggest-item .like-btn'),
$disLikeBtn = $('.suggest-item .dislike-btn'),
$imgAdd = $('.img-add'),
imgStr = '',
uploadImgNum = 0;
require("js/me/jquery.upload");
imgTpl = '{{# imgList}}' +
'<li>' +
'{{# imgUrl}}<img src="{{.}}" />' +
'<span class="upload-img-remove"></span>{{/ imgUrl}}' +
'</li>' +
'{{/ imgList}}';
imgTemplate = Handlebars.compile(imgTpl);
$('#upload-img').upload({
auto: true,
fileType: 'image/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 300,
height: '100%',
width: '100%',
multi: false,
onAddQueueItem: function(files) {
//TODO
$uploadImgList.html(imgTemplate({
imgList: true
}));
},
onUploadComplete: function(file, data) {
$uploadImgList.html('');
imgStr = JSON.parse(data).imgList[0].imgRelUrl;
$uploadImgList.html(imgTemplate(JSON.parse(data)));
$imgAdd.hide();
uploadImgNum++;
}
});
lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
var suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if ($(e.target).hasClass('nav-btn')) {
if (!textReg.test(suggestText)) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
});
return;
}
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText,
image: imgStr
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
dialogText: '提交成功'
});
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '提交失败~'
});
}
}).fail(function() {
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
}
});
if (document.getElementById('img-form') !== null) {
formHammer = new Hammer(document.getElementById('img-form'));
formHammer.on('tap', function(e) {
if ($(e.target).hasClass('upload-img-remove')) {
$uploadImgList.html('');
imgStr = '';
uploadImgNum--;
setTimeout(function() {
$imgAdd.show();
}, 50);
}
});
}
// 点赞与取消点赞
$likeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
method: 'post',
url: '/home/upAndDown',
data: {
suggest_id: id,
reliable: 1
}
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-good').addClass('show');
}
}).fail(function(data) {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
});
$disLikeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
method: 'post',
url: '/home/upAndDown',
data: {
suggest_id: id,
reliable: 2
}
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-bad').addClass('show');
}
}).fail(function(data) {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
});
});
define("js/me/jquery.upload", ["jquery"], function(require, exports, module){
... ... @@ -8577,6 +8581,7 @@ $addressForm.on('submit', function() {
isSubmiting = true;
loading.showLoadingMask();
$submit.css('background', '#777');
$.ajax({
method: 'POST',
url: '/home/saveAddress',
... ... @@ -8599,6 +8604,8 @@ $addressForm.on('submit', function() {
}).fail(function() {
tip.show('网络出了点问题~');
isSubmiting = false;
loading.hideLoadingMask();
$submit.css('background', '#444');
});
return false;
});
... ... @@ -8734,7 +8741,8 @@ function getGender() {
require("js/home/maybe-like")(getGender());
//提前触发lazyload
$(window).scrollTop(1).scrollTop(0);
... ... @@ -8886,16 +8894,6 @@ function showPage() {
$pageList.css('visibility', 'visible');
}
function bindTouchedEvent() {
var $boxs = $('.box');
$boxs.on('touchstart', function(e) {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$boxs.removeClass('bytouch');
});
}
if (wxHammer) {
wxHammer.on('tap', function() {
callpay(theOrderCode);
... ... @@ -8907,7 +8905,6 @@ function main() {
loading.hideLoadingMask();
showPage();
loadIcon();
bindTouchedEvent();
}
loading.showLoadingMask();
... ... @@ -8915,7 +8912,6 @@ loading.showLoadingMask();
$(document).ready(main);
});
define("js/me/personal-details", ["jquery"], function(require, exports, module){
/**
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.