...
|
...
|
@@ -6,7 +6,8 @@ |
|
|
|
|
|
define('mobile', function(require, exports) {
|
|
|
var $ = require('zepto'),
|
|
|
swipe = require("plugins/swipe");
|
|
|
swipe = require("plugins/swipe"),
|
|
|
common = require("common");
|
|
|
exports.index = function() {
|
|
|
//大banner滑动
|
|
|
swipe.init({
|
...
|
...
|
@@ -29,6 +30,34 @@ define('mobile', function(require, exports) { |
|
|
|
|
|
};
|
|
|
exports.brand = function() {
|
|
|
var getBrand = function()
|
|
|
{
|
|
|
var brand = $.trim($("input[type='text']").val());
|
|
|
var template = '<ul class="brand-list cooperation-list clearfix">{li}</ul>';
|
|
|
var noSearchTemplate = '<div class="no-search" style="display:block;"><p>未搜索到“{brand}”的相关品牌</p><a href="javascript:;" class="all_brand"><查看全部品牌</a></div>';
|
|
|
var html = '';
|
|
|
$.ajax({
|
|
|
type: "post",
|
|
|
url: "/brand/getbrand",
|
|
|
data: {
|
|
|
brand: brand
|
|
|
},
|
|
|
dataType:'json',
|
|
|
success: function(data) {
|
|
|
var brands = data.data;
|
|
|
if (data.code == 200 && brands != "") {
|
|
|
$.each(brands, function(k, v) {
|
|
|
html += '<li><a href=""javascript:void(0);" target="_blank" title="' + v.name + '"><div class="img-box" brand_id="' + v.id + '">' +
|
|
|
'<img src="' + common.getImages(v.logo, '0145x0097', 'blogimg', 'primary') + '" alt="" alt="' + v.name + '"></div>' +
|
|
|
'<p>' + v.name + '</p></a></li>';
|
|
|
});
|
|
|
$(".brand-content").html(template.replace('{li}', html));
|
|
|
} else {
|
|
|
$(".brand-content").html(noSearchTemplate.replace('{brand}', brand));
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
//大banner滑动
|
|
|
swipe.init({
|
|
|
slideBox: '.slide-box',
|
...
|
...
|
@@ -37,13 +66,20 @@ define('mobile', function(require, exports) { |
|
|
auto: 3000,
|
|
|
continuous: true
|
|
|
});
|
|
|
|
|
|
//搜索框获得焦点
|
|
|
$('.search-wrap input').on('focus', function() {
|
|
|
var offsetTop = $('.search-wrap').offset().top;
|
|
|
$('.overlay').addClass('show');
|
|
|
//document.body.scrollTop = offsetTop;
|
|
|
});
|
|
|
$('.search-wrap').find('input').on('keyup', function(event) {
|
|
|
var keycode = event.which;
|
|
|
getBrand();
|
|
|
if(keycode == 13)
|
|
|
{
|
|
|
$('.search-wrap input').blur();
|
|
|
}
|
|
|
});
|
|
|
$('.search-btn').on('tap', function() {
|
|
|
$('.search-wrap input').focus().addClass('hasVal');
|
|
|
});
|
...
|
...
|
@@ -54,8 +90,9 @@ define('mobile', function(require, exports) { |
|
|
txtInput.removeClass('hasVal');
|
|
|
} else {
|
|
|
txtInput.addClass('hasVal');
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
getBrand();
|
|
|
};
|
|
|
|
|
|
exports.scene = function() {
|
...
|
...
|
|