Authored by wangqing

模板改动

@@ -83,8 +83,8 @@ @@ -83,8 +83,8 @@
83 <ul class="sub-nav-list"> 83 <ul class="sub-nav-list">
84 {{# subnav}} 84 {{# subnav}}
85 <li class="sub-nav-item"> 85 <li class="sub-nav-item">
86 - <a href="{{link}}">{{name}} {{#is_new}}<span class="newlogo"></span>{{/is_new}}</a>  
87 - {{#if thirdnav}} 86 + <a href="{{link}}">{{name}}</a>
  87 + {{#if thirdnav}}
88 <div class="third-nav-wrapper"> 88 <div class="third-nav-wrapper">
89 <div class="third-nav"> 89 <div class="third-nav">
90 <div class="categorywrapper" id="category{{../index_main}}{{index_sub}}"> 90 <div class="categorywrapper" id="category{{../index_main}}{{index_sub}}">
@@ -94,8 +94,9 @@ @@ -94,8 +94,9 @@
94 <h1 class="category-title thirdnavbar">{{title}}</h1> 94 <h1 class="category-title thirdnavbar">{{title}}</h1>
95 <ul class="category-list"> 95 <ul class="category-list">
96 {{#branditems}} 96 {{#branditems}}
97 - <li class="category-item thirdnavbar">  
98 - <a href="{{link}}" class="{{hot}}">{{brandname}}</a> 97 + <li class="category-
  98 + item thirdnavbar">
  99 + <a href="" hot={{hot}}>{{brandname}}</a>
99 </li> 100 </li>
100 {{/branditems}} 101 {{/branditems}}
101 </ul> 102 </ul>
@@ -299,8 +300,7 @@ @@ -299,8 +300,7 @@
299 <script type="text/html" id="tmpl-my-login-new"> 300 <script type="text/html" id="tmpl-my-login-new">
300 <div class="myyoho-info-header clearfix"> 301 <div class="myyoho-info-header clearfix">
301 \{\{# head_ico \}\} 302 \{\{# head_ico \}\}
302 - <div class="myyoho-photo" style="display:none;"><img src="" alt="" data-url ="\{\{it.head_ico\}\}">  
303 - </div> 303 + <div class="myyoho-photo" style="display:none;"><img src="" alt="" data-url ="\{\{it.head_ico\}\}"></div>
304 \{\{/ head_ico\}\} 304 \{\{/ head_ico\}\}
305 <h3 class="user-email"><a href="<?php print QConfigs_Site_Config::$site_url?>/home?t=\{\{random\}\}">\{\{profile_name\}\}</a></h3> 305 <h3 class="user-email"><a href="<?php print QConfigs_Site_Config::$site_url?>/home?t=\{\{random\}\}">\{\{profile_name\}\}</a></h3>
306 <h3 class="user-level"> 306 <h3 class="user-level">
@@ -204,7 +204,7 @@ function actionGoodsCart() { @@ -204,7 +204,7 @@ function actionGoodsCart() {
204 }; 204 };
205 var params = ''; 205 var params = '';
206 206
207 - if (typeof(domain) === undefined || domain === '') { 207 + if (typeof (domain) === undefined || domain === '') {
208 console.log('请设置请求的api地址'); 208 console.log('请设置请求的api地址');
209 return false; 209 return false;
210 } 210 }
@@ -502,44 +502,38 @@ function actionTopLogoAnimate() { @@ -502,44 +502,38 @@ function actionTopLogoAnimate() {
502 window.setTimeout(fadeAnimate, 3000); 502 window.setTimeout(fadeAnimate, 3000);
503 } 503 }
504 } 504 }
505 -/**  
506 - * 导航处理  
507 - *  
508 - */  
509 -  
510 -var newArr = [],  
511 - g_index = 0,  
512 - targetArr1 = [],  
513 - targetArr2 = [],  
514 - targetArr3 = [],  
515 - oh1 = 0,  
516 - oh2 = 0,  
517 - oh3 = 0,  
518 - valueIndex = 0,  
519 - nowIndex = 0;  
520 -var wrapperindex = 0;  
521 -var oj1 = '<ul class="cate_row1 cate_row"></ul>';  
522 -var oj2 = '<ul class="cate_row2 cate_row"></ul>';  
523 -var oj3 = '<ul class="cate_row3 cate_row"></ul>';  
524 -var inner1 = '';  
525 -var inner2 = '';  
526 -var inner3 = '';  
527 -var finalresult = ''; 505 +window.newArr = [];
  506 +window.wrapperindex = 0;
  507 +window.gindex = 0;
  508 +window.targetArr1 = [];
  509 +window.targetArr2 = [];
  510 +window.targetArr3 = [];
  511 +window.oh1 = 0;
  512 +window.oh2 = 0;
  513 +window.oh3 = 0;
  514 +window.valueIndex = 0;
  515 +window.nowIndex = 0;
  516 +window.inner1 = '';
  517 +window.inner2 = '';
  518 +window.inner3 = '';
  519 +window.finalresult = '';
528 520
529 function createNewArray(obj) { 521 function createNewArray(obj) {
530 - var thirdnavpanel = $(obj);  
531 - thirdnavpanel.find('.thirdnavbar').each(function() { 522 + var $thirdnavpanel = $(obj);
  523 +
  524 + $thirdnavpanel.find('.thirdnavbar').each(function() {
532 var $that = $(this); 525 var $that = $(this);
533 - var $a_link = $that.find('a');  
534 - var _href = $a_link.attr('href');  
535 - var hottag = $a_link.attr('hot') === 'true' ? true : false; 526 + var $alink = $that.find('a');
  527 + var _href = $alink.attr('href');
  528 + var hottag = $alink.attr('hot') === 'true' ? true : false;
536 var objt = {}; 529 var objt = {};
  530 +
537 if ($that.hasClass('category-title')) { 531 if ($that.hasClass('category-title')) {
538 objt = { 532 objt = {
539 type: 'title', 533 type: 'title',
540 height: 49, 534 height: 49,
541 content: $that.text(), 535 content: $that.text(),
542 - index: valueIndex, 536 + index: window.valueIndex,
543 href: _href, 537 href: _href,
544 hot: false 538 hot: false
545 }; 539 };
@@ -547,136 +541,183 @@ function createNewArray(obj) { @@ -547,136 +541,183 @@ function createNewArray(obj) {
547 objt = { 541 objt = {
548 type: 'catlist', 542 type: 'catlist',
549 height: 36, 543 height: 36,
550 - content: $a_link.text(),  
551 - index: valueIndex, 544 + content: $alink.text(),
  545 + index: window.valueIndex,
552 href: _href, 546 href: _href,
553 hot: hottag 547 hot: hottag
554 }; 548 };
555 } 549 }
556 - valueIndex++;  
557 - newArr.push(objt);  
558 - }) 550 + window.valueIndex++;
  551 + window.newArr.push(objt);
  552 + });
559 } 553 }
560 554
561 function createWrapper() { 555 function createWrapper() {
562 - var arrlength = newArr.length;  
563 - for (var i = 0; i < arrlength; i++) {  
564 - var obj_new = newArr[i];  
565 - if (g_index === 0) {  
566 - oh1 = (oh1 + obj_new.height);  
567 - if (oh1 >= 340 && i !== (arrlength - 1)) {  
568 - targetArr1 = newArr.slice(0, obj_new.index + 1);  
569 - nowIndex = obj_new.index + 1;  
570 - g_index++; 556 + var arrlength = window.newArr.length;
  557 + var i = 0;
  558 + var objnew = [];
  559 + var aobj = [];
  560 + var bobj = [];
  561 + var cobj = [];
  562 + var final1 = '',
  563 + final2 = '',
  564 + final3 = '';
  565 + var a = 0;
  566 + var b = 0;
  567 + var c = 0;
  568 +
  569 + for (i; i < arrlength; i++) {
  570 + objnew = window.newArr[i];
  571 + if (window.gindex === 0) {
  572 + window.oh1 = (window.oh1 + objnew.height);
  573 + if (window.oh1 >= 340 && i !== (arrlength - 1)) {
  574 + window.targetArr1 = window.newArr.slice(0, objnew.index + 1);
  575 + window.nowIndex = objnew.index + 1;
  576 + window.gindex++;
571 } 577 }
572 if (i === (arrlength - 1)) { 578 if (i === (arrlength - 1)) {
573 - targetArr1 = newArr.slice(0, arrlength + 1); 579 + window.targetArr1 = window.newArr.slice(0, arrlength + 1);
574 break; 580 break;
575 } 581 }
576 } 582 }
577 - if (g_index === 1) {  
578 - oh2 = (oh2 + obj_new.height);  
579 - if (oh2 >= 340 && i !== (arrlength - 1)) {  
580 - targetArr2 = newArr.slice(nowIndex, obj_new.index + 1);  
581 - nowIndex = obj_new.index + 1;  
582 - g_index++; 583 + if (window.gindex === 1) {
  584 + window.oh2 = (window.oh2 + objnew.height);
  585 + if (window.oh2 >= 340 && i !== (arrlength - 1)) {
  586 + window.targetArr2 = window.newArr.slice(window.nowIndex, objnew.index + 1);
  587 + window.nowIndex = objnew.index + 1;
  588 + window.gindex++;
583 } 589 }
584 if (i === (arrlength - 1)) { 590 if (i === (arrlength - 1)) {
585 - targetArr2 = newArr.slice(nowIndex, arrlength + 1); 591 + window.targetArr2 = window.newArr.slice(window.nowIndex, arrlength + 1);
586 break; 592 break;
587 } 593 }
588 } 594 }
589 - if (g_index === 2) {  
590 - oh3 = (oh3 + obj_new.height);  
591 - if (oh3 >= 340 && i !== (arrlength - 1)) {  
592 - targetArr3 = newArr.slice(nowIndex, obj_new.index + 1);  
593 - nowIndex = obj_new.index + 1;  
594 - g_index++; 595 + if (window.gindex === 2) {
  596 + window.oh3 = (window.oh3 + objnew.height);
  597 + if (window.oh3 >= 340 && i !== (arrlength - 1)) {
  598 + window.targetArr3 = window.newArr.slice(window.nowIndex, objnew.index + 1);
  599 + window.nowIndex = objnew.index + 1;
  600 + window.gindex++;
595 break; 601 break;
596 } 602 }
597 if (i === (arrlength - 1)) { 603 if (i === (arrlength - 1)) {
598 - targetArr3 = newArr.slice(nowIndex, arrlength + 1); 604 + window.targetArr3 = window.newArr.slice(window.nowIndex, arrlength + 1);
599 break; 605 break;
600 } 606 }
601 } 607 }
602 } 608 }
603 - for (var a = 0; a < targetArr1.length; a++) {  
604 - var aobj = targetArr1[a] || {}; 609 + for (a; a < window.targetArr1.length; a++) {
  610 + aobj = window.targetArr1[a] || {};
605 if (aobj.type === 'title') { 611 if (aobj.type === 'title') {
606 - inner1 = (inner1 + '<li class="cattitle"><h3><a href="' + aobj.href + '">' + aobj.content + '</a></h3></li>'); 612 + window.inner1 = window.inner1 +
  613 + '<li class="cattitle"><h3><a href="' +
  614 + aobj.href +
  615 + '">' +
  616 + aobj.content +
  617 + '</a></h3></li>';
607 } else { 618 } else {
608 if (aobj.hot === true) { 619 if (aobj.hot === true) {
609 - inner1 = (inner1 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + aobj.href + '">' + aobj.content + '</a></li>'); 620 + window.inner1 = window.inner1 +
  621 + '<li class="catdetail"><a class="thirdcatelink hot" href="' +
  622 + aobj.href +
  623 + '">' +
  624 + aobj.content +
  625 + '</a></li>';
610 } else { 626 } else {
611 - inner1 = (inner1 + '<li class="catdetail"><a class="thirdcatelink" href="' + aobj.href + '">' + aobj.content + '</a></li>'); 627 + window.inner1 = window.inner1 +
  628 + '<li class="catdetail"><a class="thirdcatelink" href="' +
  629 + aobj.href + '">' +
  630 + aobj.content +
  631 + '</a></li>';
612 } 632 }
613 633
614 } 634 }
615 } 635 }
616 - for (var b = 0; b < targetArr2.length; b++) {  
617 - var bobj = targetArr2[b] || {}; 636 + for (b; b < window.targetArr2.length; b++) {
  637 + bobj = window.targetArr2[b] || {};
618 if (bobj.type === 'title') { 638 if (bobj.type === 'title') {
619 - inner2 = (inner2 + '<li class="cattitle"><h3><a href="' + bobj.href + '">' + bobj.content + '</a></h3></li>'); 639 + window.inner2 = (window.inner2 +
  640 + '<li class="cattitle"><h3><a href="' +
  641 + bobj.href + '">' +
  642 + bobj.content +
  643 + '</a></h3></li>');
620 } else { 644 } else {
621 if (bobj.hot === true) { 645 if (bobj.hot === true) {
622 - inner2 = (inner2 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + bobj.href + '">' + bobj.content + '</a></li>'); 646 + window.inner2 = (window.inner2 +
  647 + '<li class="catdetail"><a class="thirdcatelink hot" href="' +
  648 + bobj.href + '">' + bobj.content + '</a></li>');
623 } else { 649 } else {
624 - inner2 = (inner2 + '<li class="catdetail"><a class="thirdcatelink" href="' + bobj.href + '">' + bobj.content + '</a></li>'); 650 + window.inner2 = (window.inner2 +
  651 + '<li class="catdetail"><a class="thirdcatelink" href="' +
  652 + bobj.href + '">' + bobj.content + '</a></li>');
625 } 653 }
626 654
627 } 655 }
628 } 656 }
629 - for (var c = 0; c < targetArr3.length; c++) {  
630 - var cobj = targetArr3[c] || {}; 657 + for (c; c < window.targetArr3.length; c++) {
  658 + cobj = window.targetArr3[c] || {};
631 if (cobj.type === 'title') { 659 if (cobj.type === 'title') {
632 - inner3 = (inner3 + '<li class="cattitle"><h3><a href="' + cobj.href + '">' + cobj.content + '</a></h3></li>'); 660 + window.inner3 = (window.inner3 +
  661 + '<li class="cattitle"><h3><a href="' +
  662 + cobj.href +
  663 + '">' +
  664 + cobj.content +
  665 + '</a></h3></li>');
633 } else { 666 } else {
634 if (cobj.hot === true) { 667 if (cobj.hot === true) {
635 - inner3 = (inner3 + '<li class="catdetail"><a class="thirdcatelink hot" href="' + cobj.href + '">' + cobj.content + '</a></li>'); 668 + window.inner3 = (window.inner3 +
  669 + '<li class="catdetail"><a class="thirdcatelink hot" href="' +
  670 + cobj.href + '">' +
  671 + cobj.content +
  672 + '</a></li>');
636 } else { 673 } else {
637 - inner3 = (inner3 + '<li class="catdetail"><a class="thirdcatelink" href="' + cobj.href + '">' + cobj.content + '</a></li>'); 674 + window.inner3 = (window.inner3 +
  675 + '<li class="catdetail"><a class="thirdcatelink" href="' +
  676 + cobj.href + '">' +
  677 + cobj.content +
  678 + '</a></li>');
638 } 679 }
639 680
640 } 681 }
641 } 682 }
642 - var final1 = '',  
643 - final2 = '',  
644 - final3 = '';  
645 - if (inner1 !== '') {  
646 - final1 = '<ul class="cate_row1 cate_row">' + inner1 + '</ul>'; 683 + if (window.inner1 !== '') {
  684 + final1 = '<ul class="cate_row1 cate_row">' +
  685 + window.inner1 +
  686 + '</ul>';
647 } 687 }
648 - if (inner2 !== '') {  
649 - final2 = '<ul class="cate_row2 cate_row">' + inner2 + '</ul>'; 688 + if (window.inner2 !== '') {
  689 + final2 = '<ul class="cate_row2 cate_row">' +
  690 + window.inner2 +
  691 + '</ul>';
650 } 692 }
651 - if (inner3 !== '') {  
652 - final3 = '<ul class="cate_row3 cate_row">' + inner3 + '</ul>'; 693 + if (window.inner3 !== '') {
  694 + final3 = '<ul class="cate_row3 cate_row">' +
  695 + window.inner3 +
  696 + '</ul>';
653 } 697 }
654 - finalresult = final1 + final2 + final3;  
655 - $('#' + wrapperindex).empty().append(finalresult); 698 + window.finalresult = final1 + final2 + final3;
  699 + $('#' + window.wrapperindex).empty().append(window.finalresult);
656 } 700 }
657 701
658 function actionNav() { 702 function actionNav() {
659 $('.categorywrapper').each(function(index) { 703 $('.categorywrapper').each(function(index) {
660 - wrapperindex = $(this).attr('id');  
661 - newArr = [];  
662 - g_index = 0;  
663 - targetArr1 = [];  
664 - targetArr2 = [];  
665 - targetArr3 = [];  
666 - oh1 = 0;  
667 - oh2 = 0;  
668 - oh3 = 0;  
669 - valueIndex = 0;  
670 - nowIndex = 0;  
671 - oj1 = '<ul class="cate_row1 cate_row"></ul>';  
672 - oj2 = '<ul class="cate_row2 cate_row"></ul>';  
673 - oj3 = '<ul class="cate_row3 cate_row"></ul>';  
674 - inner1 = '';  
675 - inner2 = '';  
676 - inner3 = ''; 704 + window.wrapperindex = $(this).attr('id');
  705 + window.newArr = [];
  706 + window.gindex = 0;
  707 + window.targetArr1 = [];
  708 + window.targetArr2 = [];
  709 + window.targetArr3 = [];
  710 + window.oh1 = 0;
  711 + window.oh2 = 0;
  712 + window.oh3 = 0;
  713 + window.valueIndex = 0;
  714 + window.nowIndex = 0;
  715 + window.inner1 = '';
  716 + window.inner2 = '';
  717 + window.inner3 = '';
677 createNewArray($(this).find('.category')); 718 createNewArray($(this).find('.category'));
678 createWrapper(); 719 createWrapper();
679 - }) 720 + });
680 } 721 }
681 722
682 723
@@ -1284,7 +1325,7 @@ function actionLoginInfo() { @@ -1284,7 +1325,7 @@ function actionLoginInfo() {
1284 * @return {[type]} [description] 1325 * @return {[type]} [description]
1285 */ 1326 */
1286 function init() { 1327 function init() {
1287 - actionNav();//处理导航 1328 + actionNav(); //处理导航
1288 actionExeTemplate(); //处理模板 1329 actionExeTemplate(); //处理模板
1289 actionInitCookie(); //初始化cookie 1330 actionInitCookie(); //初始化cookie
1290 actionExeCookieMap(); //格式化cookie 1331 actionExeCookieMap(); //格式化cookie
@@ -64,6 +64,8 @@ class HomeModel @@ -64,6 +64,8 @@ class HomeModel
64 } 64 }
65 $menu = array(); 65 $menu = array();
66 $item = array(); 66 $item = array();
  67 + $index_main = 0;
  68 + $index_sub = 0;
67 foreach ($data['data'] as $val) { 69 foreach ($data['data'] as $val) {
68 $item = array( 70 $item = array(
69 'name_cn' => $val['sort_name'], // 父级 71 'name_cn' => $val['sort_name'], // 父级
@@ -71,13 +73,12 @@ class HomeModel @@ -71,13 +73,12 @@ class HomeModel
71 'link' => $val['sort_url'], 73 'link' => $val['sort_url'],
72 'icon' => $val['sort_ico'], 74 'icon' => $val['sort_ico'],
73 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '', 75 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
74 - 'index_main' => 0, 76 + 'index_main' => $index_main ++,
75 'is_hot' => $val['is_hot'] == 'Y' ? true : false, 77 'is_hot' => $val['is_hot'] == 'Y' ? true : false,
76 'is_new' => $val['is_new'] == 'Y' ? true : false, 78 'is_new' => $val['is_new'] == 'Y' ? true : false,
77 // 'subnav' => array() 79 // 'subnav' => array()
78 ); 80 );
79 foreach ($val['sub'] as $sub) { // 二级 81 foreach ($val['sub'] as $sub) { // 二级
80 - $index_sub = 0;  
81 $subnav = array( 82 $subnav = array(
82 'name' => $sub['sort_name'], 83 'name' => $sub['sort_name'],
83 'name_en' => $sub['sort_name_en'], 84 'name_en' => $sub['sort_name_en'],