Authored by wangqing

模板改动

... ... @@ -83,7 +83,7 @@
<ul class="sub-nav-list">
{{# subnav}}
<li class="sub-nav-item">
<a href="{{link}}">{{name}} {{#is_new}}<span class="newlogo"></span>{{/is_new}}</a>
<a href="{{link}}">{{name}}</a>
{{#if thirdnav}}
<div class="third-nav-wrapper">
<div class="third-nav">
... ... @@ -94,8 +94,9 @@
<h1 class="category-title thirdnavbar">{{title}}</h1>
<ul class="category-list">
{{#branditems}}
<li class="category-item thirdnavbar">
<a href="{{link}}" class="{{hot}}">{{brandname}}</a>
<li class="category-
item thirdnavbar">
<a href="" hot={{hot}}>{{brandname}}</a>
</li>
{{/branditems}}
</ul>
... ... @@ -299,8 +300,7 @@
<script type="text/html" id="tmpl-my-login-new">
<div class="myyoho-info-header clearfix">
\{\{# head_ico \}\}
<div class="myyoho-photo" style="display:none;"><img src="" alt="" data-url ="\{\{it.head_ico\}\}">
</div>
<div class="myyoho-photo" style="display:none;"><img src="" alt="" data-url ="\{\{it.head_ico\}\}"></div>
\{\{/ head_ico\}\}
<h3 class="user-email"><a href="<?php print QConfigs_Site_Config::$site_url?>/home?t=\{\{random\}\}">\{\{profile_name\}\}</a></h3>
<h3 class="user-level">
... ...
... ... @@ -204,7 +204,7 @@ function actionGoodsCart() {
};
var params = '';
if (typeof(domain) === undefined || domain === '') {
if (typeof (domain) === undefined || domain === '') {
console.log('请设置请求的api地址');
return false;
}
... ... @@ -502,44 +502,38 @@ function actionTopLogoAnimate() {
window.setTimeout(fadeAnimate, 3000);
}
}
/**
* 导航处理
*
*/
var newArr = [],
g_index = 0,
targetArr1 = [],
targetArr2 = [],
targetArr3 = [],
oh1 = 0,
oh2 = 0,
oh3 = 0,
valueIndex = 0,
nowIndex = 0;
var wrapperindex = 0;
var oj1 = '<ul class="cate_row1 cate_row"></ul>';
var oj2 = '<ul class="cate_row2 cate_row"></ul>';
var oj3 = '<ul class="cate_row3 cate_row"></ul>';
var inner1 = '';
var inner2 = '';
var inner3 = '';
var finalresult = '';
window.newArr = [];
window.wrapperindex = 0;
window.gindex = 0;
window.targetArr1 = [];
window.targetArr2 = [];
window.targetArr3 = [];
window.oh1 = 0;
window.oh2 = 0;
window.oh3 = 0;
window.valueIndex = 0;
window.nowIndex = 0;
window.inner1 = '';
window.inner2 = '';
window.inner3 = '';
window.finalresult = '';
function createNewArray(obj) {
var thirdnavpanel = $(obj);
thirdnavpanel.find('.thirdnavbar').each(function() {
var $thirdnavpanel = $(obj);
$thirdnavpanel.find('.thirdnavbar').each(function() {
var $that = $(this);
var $a_link = $that.find('a');
var _href = $a_link.attr('href');
var hottag = $a_link.attr('hot') === 'true' ? true : false;
var $alink = $that.find('a');
var _href = $alink.attr('href');
var hottag = $alink.attr('hot') === 'true' ? true : false;
var objt = {};
if ($that.hasClass('category-title')) {
objt = {
type: 'title',
height: 49,
content: $that.text(),
index: valueIndex,
index: window.valueIndex,
href: _href,
hot: false
};
... ... @@ -547,136 +541,183 @@ function createNewArray(obj) {
objt = {
type: 'catlist',
height: 36,
content: $a_link.text(),
index: valueIndex,
content: $alink.text(),
index: window.valueIndex,
href: _href,
hot: hottag
};
}
valueIndex++;
newArr.push(objt);
})
window.valueIndex++;
window.newArr.push(objt);
});
}
function createWrapper() {
var arrlength = newArr.length;
for (var i = 0; i < arrlength; i++) {
var obj_new = newArr[i];
if (g_index === 0) {
oh1 = (oh1 + obj_new.height);
if (oh1 >= 340 && i !== (arrlength - 1)) {
targetArr1 = newArr.slice(0, obj_new.index + 1);
nowIndex = obj_new.index + 1;
g_index++;
var arrlength = window.newArr.length;
var i = 0;
var objnew = [];
var aobj = [];
var bobj = [];
var cobj = [];
var final1 = '',
final2 = '',
final3 = '';
var a = 0;
var b = 0;
var c = 0;
for (i; i < arrlength; i++) {
objnew = window.newArr[i];
if (window.gindex === 0) {
window.oh1 = (window.oh1 + objnew.height);
if (window.oh1 >= 340 && i !== (arrlength - 1)) {
window.targetArr1 = window.newArr.slice(0, objnew.index + 1);
window.nowIndex = objnew.index + 1;
window.gindex++;
}
if (i === (arrlength - 1)) {
targetArr1 = newArr.slice(0, arrlength + 1);
window.targetArr1 = window.newArr.slice(0, arrlength + 1);
break;
}
}
if (g_index === 1) {
oh2 = (oh2 + obj_new.height);
if (oh2 >= 340 && i !== (arrlength - 1)) {
targetArr2 = newArr.slice(nowIndex, obj_new.index + 1);
nowIndex = obj_new.index + 1;
g_index++;
if (window.gindex === 1) {
window.oh2 = (window.oh2 + objnew.height);
if (window.oh2 >= 340 && i !== (arrlength - 1)) {
window.targetArr2 = window.newArr.slice(window.nowIndex, objnew.index + 1);
window.nowIndex = objnew.index + 1;
window.gindex++;
}
if (i === (arrlength - 1)) {
targetArr2 = newArr.slice(nowIndex, arrlength + 1);
window.targetArr2 = window.newArr.slice(window.nowIndex, arrlength + 1);
break;
}
}
if (g_index === 2) {
oh3 = (oh3 + obj_new.height);
if (oh3 >= 340 && i !== (arrlength - 1)) {
targetArr3 = newArr.slice(nowIndex, obj_new.index + 1);
nowIndex = obj_new.index + 1;
g_index++;
if (window.gindex === 2) {
window.oh3 = (window.oh3 + objnew.height);
if (window.oh3 >= 340 && i !== (arrlength - 1)) {
window.targetArr3 = window.newArr.slice(window.nowIndex, objnew.index + 1);
window.nowIndex = objnew.index + 1;
window.gindex++;
break;
}
if (i === (arrlength - 1)) {
targetArr3 = newArr.slice(nowIndex, arrlength + 1);
window.targetArr3 = window.newArr.slice(window.nowIndex, arrlength + 1);
break;
}
}
}
for (var a = 0; a < targetArr1.length; a++) {
var aobj = targetArr1[a] || {};
for (a; a < window.targetArr1.length; a++) {
aobj = window.targetArr1[a] || {};
if (aobj.type === 'title') {
inner1 = (inner1 + '<li class="cattitle"><h3><a href="' + aobj.href + '">' + aobj.content + '</a></h3></li>');
window.inner1 = window.inner1 +
'<li class="cattitle"><h3><a href="' +
aobj.href +
'">' +
aobj.content +
'</a></h3></li>';
} else {
if (aobj.hot === true) {
inner1 = (inner1 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + aobj.href + '">' + aobj.content + '</a></li>');
window.inner1 = window.inner1 +
'<li class="catdetail"><a class="thirdcatelink hot" href="' +
aobj.href +
'">' +
aobj.content +
'</a></li>';
} else {
inner1 = (inner1 + '<li class="catdetail"><a class="thirdcatelink" href="' + aobj.href + '">' + aobj.content + '</a></li>');
window.inner1 = window.inner1 +
'<li class="catdetail"><a class="thirdcatelink" href="' +
aobj.href + '">' +
aobj.content +
'</a></li>';
}
}
}
for (var b = 0; b < targetArr2.length; b++) {
var bobj = targetArr2[b] || {};
for (b; b < window.targetArr2.length; b++) {
bobj = window.targetArr2[b] || {};
if (bobj.type === 'title') {
inner2 = (inner2 + '<li class="cattitle"><h3><a href="' + bobj.href + '">' + bobj.content + '</a></h3></li>');
window.inner2 = (window.inner2 +
'<li class="cattitle"><h3><a href="' +
bobj.href + '">' +
bobj.content +
'</a></h3></li>');
} else {
if (bobj.hot === true) {
inner2 = (inner2 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + bobj.href + '">' + bobj.content + '</a></li>');
window.inner2 = (window.inner2 +
'<li class="catdetail"><a class="thirdcatelink hot" href="' +
bobj.href + '">' + bobj.content + '</a></li>');
} else {
inner2 = (inner2 + '<li class="catdetail"><a class="thirdcatelink" href="' + bobj.href + '">' + bobj.content + '</a></li>');
window.inner2 = (window.inner2 +
'<li class="catdetail"><a class="thirdcatelink" href="' +
bobj.href + '">' + bobj.content + '</a></li>');
}
}
}
for (var c = 0; c < targetArr3.length; c++) {
var cobj = targetArr3[c] || {};
for (c; c < window.targetArr3.length; c++) {
cobj = window.targetArr3[c] || {};
if (cobj.type === 'title') {
inner3 = (inner3 + '<li class="cattitle"><h3><a href="' + cobj.href + '">' + cobj.content + '</a></h3></li>');
window.inner3 = (window.inner3 +
'<li class="cattitle"><h3><a href="' +
cobj.href +
'">' +
cobj.content +
'</a></h3></li>');
} else {
if (cobj.hot === true) {
inner3 = (inner3 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + cobj.href + '">' + cobj.content + '</a></li>');
window.inner3 = (window.inner3 +
'<li class="catdetail"><a class="thirdcatelink hot" href="' +
cobj.href + '">' +
cobj.content +
'</a></li>');
} else {
inner3 = (inner3 + '<li class="catdetail"><a class="thirdcatelink" href="' + cobj.href + '">' + cobj.content + '</a></li>');
window.inner3 = (window.inner3 +
'<li class="catdetail"><a class="thirdcatelink" href="' +
cobj.href + '">' +
cobj.content +
'</a></li>');
}
}
}
var final1 = '',
final2 = '',
final3 = '';
if (inner1 !== '') {
final1 = '<ul class="cate_row1 cate_row">' + inner1 + '</ul>';
if (window.inner1 !== '') {
final1 = '<ul class="cate_row1 cate_row">' +
window.inner1 +
'</ul>';
}
if (inner2 !== '') {
final2 = '<ul class="cate_row2 cate_row">' + inner2 + '</ul>';
if (window.inner2 !== '') {
final2 = '<ul class="cate_row2 cate_row">' +
window.inner2 +
'</ul>';
}
if (inner3 !== '') {
final3 = '<ul class="cate_row3 cate_row">' + inner3 + '</ul>';
if (window.inner3 !== '') {
final3 = '<ul class="cate_row3 cate_row">' +
window.inner3 +
'</ul>';
}
finalresult = final1 + final2 + final3;
$('#' + wrapperindex).empty().append(finalresult);
window.finalresult = final1 + final2 + final3;
$('#' + window.wrapperindex).empty().append(window.finalresult);
}
function actionNav() {
$('.categorywrapper').each(function(index) {
wrapperindex = $(this).attr('id');
newArr = [];
g_index = 0;
targetArr1 = [];
targetArr2 = [];
targetArr3 = [];
oh1 = 0;
oh2 = 0;
oh3 = 0;
valueIndex = 0;
nowIndex = 0;
oj1 = '<ul class="cate_row1 cate_row"></ul>';
oj2 = '<ul class="cate_row2 cate_row"></ul>';
oj3 = '<ul class="cate_row3 cate_row"></ul>';
inner1 = '';
inner2 = '';
inner3 = '';
window.wrapperindex = $(this).attr('id');
window.newArr = [];
window.gindex = 0;
window.targetArr1 = [];
window.targetArr2 = [];
window.targetArr3 = [];
window.oh1 = 0;
window.oh2 = 0;
window.oh3 = 0;
window.valueIndex = 0;
window.nowIndex = 0;
window.inner1 = '';
window.inner2 = '';
window.inner3 = '';
createNewArray($(this).find('.category'));
createWrapper();
})
});
}
... ... @@ -1284,7 +1325,7 @@ function actionLoginInfo() {
* @return {[type]} [description]
*/
function init() {
actionNav();//处理导航
actionNav(); //处理导航
actionExeTemplate(); //处理模板
actionInitCookie(); //初始化cookie
actionExeCookieMap(); //格式化cookie
... ...
... ... @@ -64,6 +64,8 @@ class HomeModel
}
$menu = array();
$item = array();
$index_main = 0;
$index_sub = 0;
foreach ($data['data'] as $val) {
$item = array(
'name_cn' => $val['sort_name'], // 父级
... ... @@ -71,13 +73,12 @@ class HomeModel
'link' => $val['sort_url'],
'icon' => $val['sort_ico'],
'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
'index_main' => 0,
'index_main' => $index_main ++,
'is_hot' => $val['is_hot'] == 'Y' ? true : false,
'is_new' => $val['is_new'] == 'Y' ? true : false,
// 'subnav' => array()
);
foreach ($val['sub'] as $sub) { // 二级
$index_sub = 0;
$subnav = array(
'name' => $sub['sort_name'],
'name_en' => $sub['sort_name_en'],
... ...