소스 검색

Merge branch 'hotfix-search-wangcz'

wangcz 7 년 전
부모
커밋
158770c250
3개의 변경된 파일42개의 추가작업 그리고 15개의 파일을 삭제
  1. 1 1
      src/main/resources/prod/sys.properties
  2. 39 12
      src/main/webapp/resources/js/index/app.js
  3. 2 2
      src/main/webapp/resources/tpl/index/common/header.html

+ 1 - 1
src/main/resources/prod/sys.properties

@@ -3,7 +3,7 @@ b2b=http://uas.ubtob.com
 manage=http://manage.ubtob.com
 manageInner=http://10.10.100.81:8080
 im=http://113.105.74.140:8092
-b2c=http://www.usoftmall.com
+b2c=https://www.usoftmall.com
 registerUrl=https://sso.ubtob.com/register/enterpriseRegistration
 
 #report url

+ 39 - 12
src/main/webapp/resources/js/index/app.js

@@ -24088,13 +24088,47 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
      * B2C搜索
      */
     app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', 'AccountEnterprise', function($scope, $http, $rootScope, SessionService, AccountEnterprise) {
+        $scope.hotwords = new Array();
+        var hasBrand = false;
+        var hasComponent = false;
+
+        // 热词搜索品牌
+        var hotBrand = function () {
+            $http.get($scope.toB2cLink + '/api/product/brand/mostSearchBrands'
+            ).success(function(data){
+                hasBrand = true;
+
+                angular.forEach(data, function (value) {
+                    $scope.hotwords.push({name: value.nameEn, url: $scope.toB2cLink + '/search?w='+ value.nameEn +'&type=brand'})
+                })
+                if (hasBrand) {
+                    hotComponent();
+                }
+            }).error(function(response) {
+                console.log(response)
+            });
+        };
+
+        // 热词搜索器件
+        var hotComponent = function () {
+            $http.get($scope.toB2cLink + '/api/product/component/mostSearchComponent'
+            ).success(function(data){
+                hasComponent = true;
+                if (hasBrand && hasComponent) {
+                    angular.forEach(data, function (value) {
+                        $scope.hotwords.push({name: value.code, url: $scope.toB2cLink + '/search?w='+ value.code +'&type=component'})
+                    })
+                }
+            }).error(function(response) {
+                console.log(response)
+            });
+        };
+
         AccountEnterprise.getB2cUrl({}, function(data) {
             $scope.toB2cLink = data.url
-            // 热门搜索跳转
-            angular.forEach($scope.hotwords, function (value, key) {
-                $scope.hotwords[key].url = $scope.toB2cLink + '/' + value.url
-            })
-        })
+            hotBrand();
+        });
+
         // 默认搜索类型
         $scope.searchType = 'component';
         $scope.placeholderSearch = '请输入型号';
@@ -24188,13 +24222,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.associateEnter = false;
         };
 
-        // 热词
-        $scope.hotwords = [{name : 'SCT2080KEC', url : 'product/component/1100400300009990/', id : 0},
-            {name : '电池组', url : 'product/kinds/346', id : 1},
-            {name : 'Vishay',url : 'product/brand/30327265e42a871be050007f01003d96/', id : 2},
-            {name : 'Panasonic Battery', url : 'product/brand/30327265e4e7871be050007f01003d96/', id : 3}];
-
-
         // 跳转到B2C
         $scope.b2cLink = function (url) {
             window.location.href = $scope.toB2cLink + url;

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

@@ -55,7 +55,7 @@
 		margin-bottom: 10px;
 	}
 	#header .header-main .mall-search input.form-control, #header .header-main .mall-search button.btn-default {
-		width: 441px;
+		width: 440px;
 		height: 40px;
 		border: 2px solid #5078cb;
 		border-radius: 0;
@@ -206,7 +206,7 @@
                             <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>
+                                    <li class="active-search-item" ng-repeat="hw in hotwords"><a ng-href="{{hw.url}}" ng-bind="hw.name"></a></li>
                                 </ul>
                             </div>
                         </div>