Przeglądaj źródła

头部搜索固定合作伙伴页面宽度调整

hangb 7 lat temu
rodzic
commit
3dc63c6087

+ 5 - 0
src/main/webapp/resources/css/index.css

@@ -18,8 +18,13 @@ body {
 }
 #header{
 	padding-top: 20px;
+    margin: 0 auto;
 	background: #fff;
 }
+#header .container{
+	width: 1190px !important;
+	padding: 0 !important;
+}
 
 #top .container {
 	margin-bottom: -10px;

+ 24 - 22
src/main/webapp/resources/js/index/app.js

@@ -24081,7 +24081,13 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
      * B2C搜索
      */
     app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', 'AccountEnterprise', function($scope, $http, $rootScope, SessionService, AccountEnterprise) {
-
+        AccountEnterprise.getB2cUrl({}, function(data) {
+            $scope.toB2cLink = data.url
+            // 热门搜索跳转
+            angular.forEach($scope.hotwords, function (value, key) {
+                $scope.hotwords[key].url = $scope.toB2cLink + '/' + value.url
+            })
+        })
         // 默认搜索类型
         $scope.searchType = 'component';
         $scope.placeholderSearch = '请输入型号';
@@ -24106,9 +24112,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             if($scope.keyword) {
                 SessionService.set('brand', true);
                 SessionService.unset('component');
-                AccountEnterprise.getB2cUrl({}, function(data) {
-                    window.location.href = data.url + '/search?w=' + encodeURI($scope.keyword) + '&type=' + $scope.searchType;
-                });
+                window.location.href = $scope.toB2cLink + '/search?w=' + encodeURI($scope.keyword) + '&type=' + $scope.searchType;
             }
         };
 
@@ -24148,15 +24152,13 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     keyword: $scope.keyword,
                     type: $scope.searchType
                 };
-                AccountEnterprise.getB2cUrl({}, function(data) {
-                    $http.get(data.url + '/search/similarKeywords', {
-                        params : params
-                    }).success(function(data){
-                        $scope.associates = data.result;// 联想词数组
-                    }).error(function(response) {
-                        console.log(response)
-                    });
-                })
+                $http.get($scope.toB2cLink + '/search/similarKeywords', {
+                    params : params
+                }).success(function(data){
+                    $scope.associates = data.result;// 联想词数组
+                }).error(function(response) {
+                    console.log(response)
+                });
             } else {
                 $scope.associates = [];// 联想词数组
             }
@@ -24185,20 +24187,20 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             {name : 'Vishay',url : 'product/brand/30327265e42a871be050007f01003d96/', id : 2},
             {name : 'Panasonic Battery', url : 'product/brand/30327265e4e7871be050007f01003d96/', id : 3}];
 
-        // 热门搜索跳转
-        angular.forEach($scope.hotwords, function (value, key) {
-            AccountEnterprise.getB2cUrl({}, function(data) {
-                $scope.hotwords[key].url = data.url + '/' + value.url
-            })
-        })
 
         // 跳转到B2C
         $scope.b2cLink = function (url) {
-            AccountEnterprise.getB2cUrl({}, function(data) {
-                window.location.href = data.url + url;
+            window.location.href = $scope.toB2cLink + url;
+        };
+        // 头部固定
+        window.addEventListener('scroll', function () {
+            var obj = document.getElementById('fixed-header');
+            var scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
+            $scope.$apply(function () {
+                $scope.isFixed = scrolled >= obj.offsetTop;
             });
-        }
 
+        }, false);
     }]);
 
     /**

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/customersInfo.html

@@ -113,7 +113,7 @@
 	border-bottom: none;
 }
 </style>
-<div style="width: 1170px; background: #fff;" id="myquest-public">
+<div style="background: #fff;" id="myquest-public">
 <div ng-include src="'static/tpl/index/baseInfo/vendorAndCustomer.html'"></div>
 <div class="loading in" ng-class="{'in': loading}">
 	<i></i>

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/invitation.html

@@ -119,7 +119,7 @@
 	border-bottom: none;
 }
 </style>
-<div style="width: 1170px; background: #fff;" id="myquest-public">
+<div style=" background: #fff;" id="myquest-public">
 <div ng-include src="'static/tpl/index/baseInfo/addPartnerAndRecord.html'"></div>
 <link rel="stylesheet" href="static/css/public.css">
 <div id="public" style="background: #f5f5f5;">

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/searchresult.html

@@ -302,7 +302,7 @@
 	background: #f5f5f5;
 }
 </style>
-<div class="block" style="width: 1170px;border: #e8e8e8 1px solid;border-top: none;">
+<div class="block" style="border: #e8e8e8 1px solid;border-top: none;">
 <div class="loading in" ng-class="{'in': loading}">
 	<i></i>
 </div>

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/servicerInfo.html

@@ -130,7 +130,7 @@
 	border-bottom: none;
 }
 </style>
-<div style="width: 1170px; background: #fff;" id="myquest-public">
+<div style="background: #fff;" id="myquest-public">
 <div ng-include src="'static/tpl/index/baseInfo/vendorAndCustomer.html'"></div>
 <link rel="stylesheet" href="static/css/public.css">
 <div id="public">

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/vendorsInfo.html

@@ -130,7 +130,7 @@
 	border-bottom: none;
 }
 </style>
-<div style="width: 1170px; background: #fff;" id="myquest-public">
+<div style="background: #fff;" id="myquest-public">
 <div ng-include src="'static/tpl/index/baseInfo/vendorAndCustomer.html'"></div>
 <link rel="stylesheet" href="static/css/public.css">
 <div id="public">

+ 102 - 79
src/main/webapp/resources/tpl/index/common/header.html

@@ -1,4 +1,19 @@
 <style>
+	#fixed-header {
+		height: 120px;
+	}
+	#header.fix-header{
+		position: fixed;
+		/* padding: 10px 0; */
+		width: 100%;
+		height: 113px;
+		background: #fff;
+		z-index: 1001;
+		top: 0;
+		padding: 10px 0;
+		-webkit-box-shadow: 0 2px 0 0 #ccc;
+		box-shadow: 0 2px 0 0 #ccc;
+	}
 	#header .header-main {
 		height: 100px;
 		width: 1190px;
@@ -147,85 +162,93 @@
 		color: #fff;
 	}
 </style>
-<header id="header" role="banner" ng-controller="SearchCtrl">
-	<ul class="header-main list-unstyled">
-		<li class="ghost-center">
-			<div class="mall-logo">
-				<a ng-click="b2cLink('/')" target="_self" >
-					<img src="static/img/all/uas_mall.png" alt="返回首页"/>
-				</a>
-			</div>
-		</li>
-		<li>
-			<div class="mall-slogan"><p>For the World<br/>为世界电子产业创造价值</p></div>
-		</li>
-		<li>
-			<div class="mall-search">
-				<div class="input-group">
-					<div class="type">
-						<span class="type-item" ng-class="{'active': searchType === 'component'}" ng-click="setTypeClick('component')">型号</span>
-						<span class="type-item" ng-class="{'active': searchType === 'kind'}" ng-click="setTypeClick('kind')">物料名称</span>
-						<span class="type-item" ng-class="{'active': searchType === 'store'}" ng-click="setTypeClick('store')">卖家</span>
-						<span class="type-item" ng-class="{'active': searchType === 'brand'}" ng-click="setTypeClick('brand')">品牌</span>
-					</div>
-					<input ng-model="keyword" ng-change="onChange()" type="text" class="form-control"
-						   placeholder="{{placeholderSearch}}" ng-search="search()" ng-focus="onFocus()"
-						   ng-blur="onBlur()" ng-keyup="onKeyup()"/>
-					<span class="input-group-btn" ng-click="search()">
-                        <button class="btn btn-default" type="button">搜索</button>
-                    </span>
-					<ul class="association" ng-show="keyword && (associate || associateEnter)" ng-mouseenter="onAssociateEnter()"
-						ng-mouseleave="onAssociateLeave()">
-						<li ng-repeat="as in associates" ng-bind="as.code" ng-class="{'active': $index==selectIndex}"
-							ng-click="onAssociateClick(as.code)"></li>
-						<li ng-repeat="as in associates" ng-bind="as.nameCn" ng-class="{'active': $index==selectIndex}"
-							ng-click="onAssociateClick(as.nameCn)"></li>
-						<li ng-repeat="as in associates" ng-bind="as.name" ng-class="{'active': $index==selectIndex}"
-							ng-click="onAssociateClick(as.name)"></li>
-					</ul>
-				</div>
-				<div class="active-search">
-					<ul class="list-untyled active-search-body" style="padding: 0;">
-						<li class="active-search-item">热门搜索</li>
-						<li class="active-search-item" ng-repeat="hw in hotwords track by hw.id"><a ng-href="{{hw.url}}" ng-bind="hw.name" target="_blank"></a></li>
-					</ul>
-				</div>
-			</div>
-		</li>
-	</ul>
-	<!--nav   导航-->
-	<nav role="navigation" class="nav-main">
-		<ul class="container">
-			<li><a class="more-title" ng-click="b2cLink('/product/kind/home')">器件选型</a></li>
-			<li>
-				<a ng-click="b2cLink('/')">&nbsp;&nbsp;首页</a>
-			</li>
-			<li>
-				<a ng-click="b2cLink('/applyPurchase')">询价求购</a>
-				<img class="new-animate" src="static/img/all/banner-cuxiao03.png" alt="">
-			</li>
-			<li>
-				<a ng-click="b2cLink('/supplier')">供应商</a>
-			</li>
-			<li>
-				<a ui-sref="home" class="active">B2B商务</a>
-				<img class="new-animate" src="static/img/all/hot.png" alt="">
-			</li>
-			<li>
-				<a ng-click="b2cLink('/provider/shop')">店铺</a>
-			</li>
-			<li>
-				<a ng-click="b2cLink('/product/brand/brandList/A')">品牌墙</a>
-			</li>
-			<li>
-				<a ng-click="b2cLink('/pcb')">PCB专区</a>
-			</li>
-			<li>
-				<a ng-click="b2cLink('/news')">优软快讯</a>
-			</li>
-		</ul>
-	</nav>
-</header>
+
+<div ng-controller="SearchCtrl">
+    <div id="fixed-header">
+        <header id="header" role="banner" ng-class="{'fix-header': isFixed}">
+            <div class="container">
+                <ul class="header-main list-unstyled">
+                    <li class="ghost-center">
+                        <div class="mall-logo">
+                            <a ng-click="b2cLink('/')" target="_self" >
+                                <img src="static/img/all/uas_mall.png" alt="返回首页"/>
+                            </a>
+                        </div>
+                    </li>
+                    <li>
+                        <div class="mall-slogan"><p>For the World<br/>为世界电子产业创造价值</p></div>
+                    </li>
+                    <li>
+                        <div class="mall-search">
+                            <div class="input-group">
+                                <div class="type">
+                                    <span class="type-item" ng-class="{'active': searchType === 'component'}" ng-click="setTypeClick('component')">型号</span>
+                                    <span class="type-item" ng-class="{'active': searchType === 'kind'}" ng-click="setTypeClick('kind')">物料名称</span>
+                                    <span class="type-item" ng-class="{'active': searchType === 'store'}" ng-click="setTypeClick('store')">卖家</span>
+                                    <span class="type-item" ng-class="{'active': searchType === 'brand'}" ng-click="setTypeClick('brand')">品牌</span>
+                                </div>
+                                <input ng-model="keyword" ng-change="onChange()" type="text" class="form-control"
+                                       placeholder="{{placeholderSearch}}" ng-search="search()" ng-focus="onFocus()"
+                                       ng-blur="onBlur()" ng-keyup="onKeyup()"/>
+                                <span class="input-group-btn" ng-click="search()">
+					<button class="btn btn-default" type="button">搜索</button>
+				</span>
+                                <ul class="association" ng-show="keyword && (associate || associateEnter)" ng-mouseenter="onAssociateEnter()"
+                                    ng-mouseleave="onAssociateLeave()">
+                                    <li ng-repeat="as in associates" ng-bind="as.code" ng-class="{'active': $index==selectIndex}"
+                                        ng-click="onAssociateClick(as.code)"></li>
+                                    <li ng-repeat="as in associates" ng-bind="as.nameCn" ng-class="{'active': $index==selectIndex}"
+                                        ng-click="onAssociateClick(as.nameCn)"></li>
+                                    <li ng-repeat="as in associates" ng-bind="as.name" ng-class="{'active': $index==selectIndex}"
+                                        ng-click="onAssociateClick(as.name)"></li>
+                                </ul>
+                            </div>
+                            <div class="active-search">
+                                <ul class="list-untyled active-search-body" style="padding: 0;">
+                                    <li class="active-search-item">热门搜索</li>
+                                    <li class="active-search-item" ng-repeat="hw in hotwords track by hw.id"><a ng-href="{{hw.url}}" ng-bind="hw.name"></a></li>
+                                </ul>
+                            </div>
+                        </div>
+                    </li>
+                </ul>
+            </div>
+        </header>
+    </div>
+
+    <!--nav   导航-->
+    <nav role="navigation" class="nav-main">
+        <ul class="container">
+            <li><a class="more-title" ng-click="b2cLink('/product/kind/home')">器件选型</a></li>
+            <li>
+                <a ng-click="b2cLink('/')">&nbsp;&nbsp;首页</a>
+            </li>
+            <li>
+                <a ng-click="b2cLink('/applyPurchase')">询价求购</a>
+                <img class="new-animate" src="static/img/all/banner-cuxiao03.png" alt="">
+            </li>
+            <li>
+                <a ng-click="b2cLink('/supplier')">供应商</a>
+            </li>
+            <li>
+                <a ui-sref="home" class="active">B2B商务</a>
+                <img class="new-animate" src="static/img/all/hot.png" alt="">
+            </li>
+            <li>
+                <a ng-click="b2cLink('/provider/shop')">店铺</a>
+            </li>
+            <li>
+                <a ng-click="b2cLink('/product/brand/brandList/A')">品牌墙</a>
+            </li>
+            <li>
+                <a ng-click="b2cLink('/pcb')">PCB专区</a>
+            </li>
+            <li>
+                <a ng-click="b2cLink('/news')">优软快讯</a>
+            </li>
+        </ul>
+    </nav>
+</div>
 <script language="javascript" type="text/javascript">
 	$(function () {
 		var targetChildrem_Height = $('.scroll-data dl').height();