chao 4 년 전
부모
커밋
cd7a3f2ab4

+ 2 - 0
src/main/java/com/caimei/www/controller/unlimited/ProductController.java

@@ -85,7 +85,9 @@ public class ProductController extends BaseController {
         if (pageId == null) {
             return super.errorPath();
         }
+        String title = singlePageService.getPageTitleById(id);
         model.addAttribute("pageId", id);
+        model.addAttribute("pageTitle", title);
         return INSTRUMENT_PAGE_PATH;
     }
 

+ 1 - 0
src/main/java/com/caimei/www/mapper/SinglePageDao.java

@@ -94,6 +94,7 @@ public interface SinglePageDao {
      * 产品仪器页
      */
     Integer getInstrumentPageIdById(Integer id);
+    String getPageTitleById(Integer id);
     /**
      * 活动专题页
      */

+ 1 - 0
src/main/java/com/caimei/www/service/page/SinglePageService.java

@@ -33,6 +33,7 @@ public interface SinglePageService {
      * @return
      */
     Integer getInstrumentPageIdById(Integer id);
+    String getPageTitleById(Integer id);
     /**
      * 活动专题页
      */

+ 8 - 0
src/main/java/com/caimei/www/service/page/impl/SinglePageServiceImpl.java

@@ -110,6 +110,14 @@ public class SinglePageServiceImpl implements SinglePageService {
         return pageId;
     }
 
+    @Override
+    public String getPageTitleById(Integer id) {
+        if (id == null) {
+            return null;
+        }
+        return singlePageDao.getPageTitleById(id);
+    }
+
     @Override
     public Integer getActivityPageIdById(Integer id) {
         if (id == null) {

+ 3 - 0
src/main/resources/mapper/SinglePageMapper.xml

@@ -82,6 +82,9 @@
             a.type=5 and a.enabledStatus=1
             and a.id=#{id}
     </select>
+    <select id="getPageTitleById" resultType="java.lang.String">
+        select title from cm_page where id=#{id}
+    </select>
     <select id="getActivityPageIdById" resultType="java.lang.Integer">
         select id from cm_page a
         where

+ 1 - 1
src/main/resources/static/js/product/instruement.js

@@ -50,7 +50,7 @@
             }
         },
         toserch:function(item){
-            window.location.href='/product/classify-'+this.typeSort+'-'+item.bigTypeID+'.html?name='+this.nav_linkName
+            window.location.href='/product/classify-'+this.typeSort+'-'+item.bigTypeId+'.html?name='+this.nav_linkName
         },
         seeMore:function(page){
              page.isPageMore = !page.isPageMore;

+ 80 - 75
src/main/resources/static/js/product/list.js

@@ -1,7 +1,7 @@
 var productList = new Vue({
     el: "#productList",
     data: {
-        searchFlag: false,
+        // searchFlag: false,
         listLoading: true,
         requestFlag: true,
         noMore: false,
@@ -11,9 +11,9 @@ var productList = new Vue({
             keyword: "",
             sortField: "",
             sortType: 1, // 1降序,其他升序
-            bid: "",
-            sid: "",
-            tid: ""
+            // bid: "",
+            // sid: "",
+            // tid: ""
         },
         classify: [],
         listData: [], //priceflag 0公开价格 1不公开价格 2仅对会员机构公开,//userIdentity: 2-会员机构, 4-普通机构
@@ -103,37 +103,37 @@ var productList = new Vue({
                 }
             });
         },
-        getListByCategory: function (path, categoryId) {
-            var _self = this;
-            $.getJSON(spiServer+"/search/query/product/"+ path ,{
-                id: categoryId,
-                identity: GLOBAL_USER_IDENTITY,
-                pageSize: this.params.size,
-                pageNum: this.params.num,
-                sortField: this.params.sortField,
-                sortType: this.params.sortType
-            }, function (r) {
-                if (r.code === 0 && r.data) {
-                    var result = JSON.parse(r.data);
-                    _self.listRecord = result.total;
-                    var resultData = setSearchProductList(result.items, _self.userId, function(){
-                        _self.$forceUpdate();
-                        setTimeout(function(){
-                            // 图片懒加载
-                            $("img[data-original]").lazyload();
-                        },500);
-                    });
-                    if(isPC){
-                        _self.listData = resultData;
-                    }else{
-                        _self.listData = _self.listData.concat(resultData);
-                    }
-                    console.log(_self.listData)
-                }
-                _self.listLoading = false;
-                _self.requestFlag = true;
-            })
-        }
+        // getListByCategory: function (path, categoryId) {
+        //     var _self = this;
+        //     $.getJSON(spiServer+"/search/query/product/"+ path ,{
+        //         id: categoryId,
+        //         identity: GLOBAL_USER_IDENTITY,
+        //         pageSize: this.params.size,
+        //         pageNum: this.params.num,
+        //         sortField: this.params.sortField,
+        //         sortType: this.params.sortType
+        //     }, function (r) {
+        //         if (r.code === 0 && r.data) {
+        //             var result = JSON.parse(r.data);
+        //             _self.listRecord = result.total;
+        //             var resultData = setSearchProductList(result.items, _self.userId, function(){
+        //                 _self.$forceUpdate();
+        //                 setTimeout(function(){
+        //                     // 图片懒加载
+        //                     $("img[data-original]").lazyload();
+        //                 },500);
+        //             });
+        //             if(isPC){
+        //                 _self.listData = resultData;
+        //             }else{
+        //                 _self.listData = _self.listData.concat(resultData);
+        //             }
+        //             console.log(_self.listData)
+        //         }
+        //         _self.listLoading = false;
+        //         _self.requestFlag = true;
+        //     })
+        // }
     },
     created: function () {
         if(isPC){
@@ -150,7 +150,7 @@ var productList = new Vue({
         $('#topSearch').find('.keyword').val(getUrlParam("keyword"));
         this.params.sortField = getUrlParam("sortField") ? getUrlParam("sortField") : "";
         this.params.sortType = getUrlParam("sortType") ? getUrlParam("sortType") * 1 : 1;
-        this.searchFlag = (this.params.keyword !== "");
+        // this.searchFlag = (this.params.keyword !== "");
         if(globalUserData){
             this.userId = globalUserData.userId;
             this.userIdentity = globalUserData.identity;
@@ -161,32 +161,35 @@ var productList = new Vue({
             this.userId = JSON.parse(userInfo).userId;
             this.shopID = JSON.parse(userInfo).shopId;
         }
-        if (this.searchFlag) {
-            // 获取列表数据
-            this.getListByKeyword();
-        } else {
-            // category=1000-1001-1005
-            if (!getUrlParam("category")) {
-                this.listLoading = false;
-                return false;
-            }
-            var category = getUrlParam("category").split("-");
-            this.params.bid = category[0];
-            this.params.sid = category[1];
-            this.params.tid = category[2];
-            // 根据分类获取数据
-            if (this.params.tid && this.params.tid>0) {
-                this.getListByCategory("tinyType", this.params.tid);
-            } else if (this.params.sid && this.params.sid>0){
-                this.getListByCategory("smallType", this.params.sid);
-            } else if (this.params.bid && this.params.bid>0) {
-                this.getListByCategory("bigType", this.params.bid);
-            } else {
-                alertInfo("URL参数异常!", function(){
-                    window.location.href = "/";
-                });
-            }
-        }
+        // 获取列表数据
+        this.getListByKeyword();
+
+        // if (this.searchFlag) {
+        //     // 获取列表数据
+        //     this.getListByKeyword();
+        // } else {
+        //     // category=1000-1001-1005
+        //     if (!getUrlParam("category")) {
+        //         this.listLoading = false;
+        //         return false;
+        //     }
+        //     var category = getUrlParam("category").split("-");
+        //     this.params.bid = category[0];
+        //     this.params.sid = category[1];
+        //     this.params.tid = category[2];
+        //     // 根据分类获取数据
+        //     if (this.params.tid && this.params.tid>0) {
+        //         this.getListByCategory("tinyType", this.params.tid);
+        //     } else if (this.params.sid && this.params.sid>0){
+        //         this.getListByCategory("smallType", this.params.sid);
+        //     } else if (this.params.bid && this.params.bid>0) {
+        //         this.getListByCategory("bigType", this.params.bid);
+        //     } else {
+        //         alertInfo("URL参数异常!", function(){
+        //             window.location.href = "/";
+        //         });
+        //     }
+        // }
     },
     mounted: function () {
         var _self = this;
@@ -204,19 +207,21 @@ var productList = new Vue({
                     if(next <= totalPage){
                         if (_self.requestFlag){
                             _self.params.num = next;
-                            if (_self.searchFlag) {
-                                // 获取列表数据
-                                _self.getListByKeyword();
-                            } else {
-                                // 根据分类获取数据
-                                if (_self.params.tid && _self.params.tid>0) {
-                                    _self.getListByCategory("tinyType", _self.params.tid);
-                                } else if (_self.params.sid && _self.params.sid>0){
-                                    _self.getListByCategory("smallType", _self.params.sid);
-                                } else if (_self.params.bid && _self.params.bid>0) {
-                                    _self.getListByCategory("bigType", _self.params.bid);
-                                }
-                            }
+                            // 获取列表数据
+                            _self.getListByKeyword();
+                            // if (_self.searchFlag) {
+                            //     // 获取列表数据
+                            //     _self.getListByKeyword();
+                            // } else {
+                            //     // 根据分类获取数据
+                            //     if (_self.params.tid && _self.params.tid>0) {
+                            //         _self.getListByCategory("tinyType", _self.params.tid);
+                            //     } else if (_self.params.sid && _self.params.sid>0){
+                            //         _self.getListByCategory("smallType", _self.params.sid);
+                            //     } else if (_self.params.bid && _self.params.bid>0) {
+                            //         _self.getListByCategory("bigType", _self.params.bid);
+                            //     }
+                            // }
                         }
                         _self.requestFlag = false;
                     }else{

+ 32 - 32
src/main/resources/static/js/product/produce-list.js

@@ -13,9 +13,9 @@ var productList = new Vue({
         bigName:'',
         smallName:'',
         tinyName:'',
-        bigTypeID:'',
-        smallTypeID:'',//二级分类id
-        tinyTypeID:'',//三级分类id
+        bigTypeId:'',
+        smallTypeId:'',//二级分类id
+        tinyTypeId:'',//三级分类id
         listRecord: 0,
         pageInput: '1',
         source:'www',
@@ -59,7 +59,7 @@ var productList = new Vue({
     methods:{
         getclassify:function(){
             var _self = this;
-            ProductApi.GetbigTypeclassify({ typeId:_self.bigTypeID, idType:1, source:_self.source },function (res) {
+            ProductApi.GetbigTypeclassify({ typeId:_self.bigTypeId, idType:1, source:_self.source },function (res) {
                 if(res.code==0){
                     _self.smalltypeList = res.data.smallTypeList;
                 }else {
@@ -119,14 +119,14 @@ var productList = new Vue({
             switch (index) {
                 case 1:
                     this.smallName = '';
-                    this.params.id = this.bigTypeID;
-                    this.smallTypeID='';
+                    this.params.id = this.bigTypeId;
+                    this.smallTypeId='';
                     this.getproductList();
                     break;
                 case 2:
                     this.tinyName = '';
-                    this.params.id = this.smallTypeID;
-                    this.tinyTypeID='';
+                    this.params.id = this.smallTypeId;
+                    this.tinyTypeId='';
                     this.getproductList();
                     break;
             }
@@ -149,26 +149,26 @@ var productList = new Vue({
                 case 1://选择1集分类查询
                     this.bigName=item.name;
                     this.smallName = '';
-                    this.bigTypeID = item.bigTypeId;
+                    this.bigTypeId = item.bigTypeId;
                     this.params.id = item.bigTypeId;
                     this.smallName ='';
                     this.tinyName ='';
-                    this.smallTypeID='';
-                    this.tinyTypeID='';
+                    this.smallTypeId='';
+                    this.tinyTypeId='';
                     this.tinytypeList=[];
                     this.getclassify();
                     break;
                 case 2://选择二级分类查询
                     this.smallName = item.name;
                     this.tinyName = '';
-                    this.smallTypeID = item.smallTypeId;
+                    this.smallTypeId = item.smallTypeId;
                     this.params.id = item.smallTypeId;
-                    this.tinyTypeID='';
+                    this.tinyTypeId='';
                     this.tinytypeList =item.tinytypeList;
                     break;
                 case 3://选择三级分类查询
                     this.tinyName = item.name;
-                    this.tinyTypeID = item.tinyTypeId;
+                    this.tinyTypeId = item.tinyTypeId;
                     this.params.id = item.tinyTypeId;
                     break;
             }
@@ -185,28 +185,28 @@ var productList = new Vue({
     mounted:function () {
         var _self = this;
         this.nav_linkName = decodeURI(CAIMEI.getUrlParam('name'));
-        // this.bigTypeID = getUrlParam('bigTypeID');
-        // this.smallTypeID = getUrlParam('smallTypeID');
-        // this.tinyTypeID = getUrlParam('tinyTypeID');
+        // this.bigTypeId = getUrlParam('bigTypeId');
+        // this.smallTypeId = getUrlParam('smallTypeId');
+        // this.tinyTypeId = getUrlParam('tinyTypeId');
         // var typeSort =  getUrlParam('typeSort');
         var paramsArr = window.location.pathname.split(".")[0].split("-");
         var typeSort =  paramsArr.length>=1 ? paramsArr[1] : '';
-        this.bigTypeID = paramsArr.length>=2 ? paramsArr[2] : '';
-        this.smallTypeID = paramsArr.length>=3 ? paramsArr[3] : '';
-        this.tinyTypeID = paramsArr.length>=4 ? paramsArr[4] : '';
-        console.log( this.smallTypeID)
-        console.log( this.tinyTypeID)
-        if(this.tinyTypeID==null &&  this.smallTypeID==null){
-            this.params.id=this.bigTypeID;
+        this.bigTypeId = paramsArr.length>=2 ? paramsArr[2] : '';
+        this.smallTypeId = paramsArr.length>=3 ? paramsArr[3] : '';
+        this.tinyTypeId = paramsArr.length>=4 ? paramsArr[4] : '';
+        console.log( this.smallTypeId)
+        console.log( this.tinyTypeId)
+        if(this.tinyTypeId==null &&  this.smallTypeId==null){
+            this.params.id=this.bigTypeId;
             this.params.idType = 1;
-        }else if(this.tinyTypeID==null){
-            this.params.id=this.smallTypeID;
+        }else if(this.tinyTypeId==null){
+            this.params.id=this.smallTypeId;
             this.params.idType = 2;
-        }else if(this.smallTypeID==null){
-            this.params.id=this.bigTypeID;
+        }else if(this.smallTypeId==null){
+            this.params.id=this.bigTypeId;
             this.params.idType = 1;
         }else {
-            this.params.id=this.tinyTypeID;
+            this.params.id=this.tinyTypeId;
             this.params.idType = 3;
         }
 
@@ -215,17 +215,17 @@ var productList = new Vue({
                 if (res.code==0){
                     _self.classify = res.data;
                     _self.classify.forEach(function (item) {
-                        if(_self.bigTypeID == item.bigTypeId){
+                        if(_self.bigTypeId == item.bigTypeId){
                             _self.bigName = item.name;
                             if (item.smallTypeList!='' && item.smallTypeList!=null){
                                 _self.smalltypeList= item.smallTypeList;
                                 _self.smalltypeList.forEach(function (pros) {
-                                    if(_self.smallTypeID == pros.smallTypeId){
+                                    if(_self.smallTypeId == pros.smallTypeId){
                                         _self.smallName = pros.name;
                                         if(pros.tinyTypeList!=''&&pros.tinyTypeList!=null){
                                             _self.tinytypeList = pros.tinyTypeList;
                                             _self.tinytypeList.forEach(function (thiny) {
-                                                if (thiny.tinyTypeId ==_self.tinyTypeID){
+                                                if (thiny.tinyTypeId ==_self.tinyTypeId){
                                                     _self.tinyName=thiny.name;
                                                 }
                                             })

+ 4 - 4
src/main/resources/templates/product/instruelist.html

@@ -32,19 +32,19 @@
             <div class="classification">
                 <div class="class-title">分类</div>
                 <div class="class-nav-main">
-                    <div v-for="item in classify" @click="checkedClasslyFn(item,1)" :class="{'on':item.bigTypeId == bigTypeID}">{{item.name}}</div>
+                    <div v-for="item in classify" @click="checkedClasslyFn(item,1)" :class="{'on':item.bigTypeId == bigTypeId}">{{item.name}}</div>
                 </div>
             </div>
             <div class="classification" v-if="smalltypeList!='' && smalltypeList!=null">
                 <div class="class-title">二级</div>
                 <div class="class-nav-main">
-                    <div v-for="item in smalltypeList" @click="checkedClasslyFn(item,2)" :class="{'on':item.smallTypeId == smallTypeID}">{{item.name}}</div>
+                    <div v-for="item in smalltypeList" @click="checkedClasslyFn(item,2)" :class="{'on':item.smallTypeId == smallTypeId}">{{item.name}}</div>
                 </div>
             </div>
-            <div class="classification" v-if="params.smallTypeID!=''&& tinytypeList!=''&& tinytypeList!=null">
+            <div class="classification" v-if="params.smallTypeId!=''&& tinytypeList!=''&& tinytypeList!=null">
                 <div class="class-title">三级</div>
                 <div class="class-nav-main">
-                    <div v-for="item in tinytypeList" @click="checkedClasslyFn(item,3)" :class="{'on':item.tinyTypeId == tinyTypeID}">{{item.name}}</div>
+                    <div v-for="item in tinytypeList" @click="checkedClasslyFn(item,3)" :class="{'on':item.tinyTypeId == tinyTypeId}">{{item.name}}</div>
                 </div>
             </div>
         </template>

+ 2 - 2
src/main/resources/templates/product/instrument.html

@@ -2,12 +2,12 @@
 <html lang="zh-CN" xmlns:th="https://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="https://www.thymeleaf.org ">
 <head>
-    <title>采美365网-仪器</title>
+    <title th:text="'采美365网-'+${pageTitle}">采美365网-产品/仪器</title>
     <template th:replace="components/head-link"></template>
     <link th:href="@{/css/product/instruement.css(v=${version})}" rel="stylesheet" type="text/css">
     <template th:replace="components/analysis"></template>
 </head>
-<body >
+<body>
     <!-- 引用头部 -->
     <template th:replace="components/header"></template>
     <div id="container">

+ 53 - 47
src/main/resources/templates/product/list.html

@@ -13,53 +13,59 @@
 
 <!-- 商品列表 -->
 <div id="productList">
-    <template v-if="isPC && listData && listData.length>0">
-        <!-- 面包屑 -->
-        <div v-if="searchFlag" class="crumbs">
-            <span>搜索结果</span>
-            <span>&gt;</span> <a href="javascript:void(0);" @click="toPagination(1)" v-text="params.keyword"></a>
-        </div>
-        <div v-else class="crumbs">
-            <a href="/">首页</a>
-            <template v-if="params.bid && params.bid>0">
-                <template v-if="params.sid && params.sid>0">
-                    <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-0-0'" v-text="bigType"></a>
-                    <template v-if="params.tid && params.tid>0">
-                        <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-'+params.sid+'-0'" v-text="smallType"></a>
-                        <span>&gt;</span> <span v-text="tinyType"></span>
-                    </template>
-                    <template v-else>
-                        <span>&gt;</span> <span v-text="smallType"></span>
-                    </template>
-                </template>
-                <template v-else>
-                    <span>&gt;</span> <span v-text="bigType"></span>
-                </template>
-            </template>
-        </div>
-        <!--分类-->
-        <div v-if="(!searchFlag)" id="listClassify" class="classifyBox">
-            <div class="clsTab">
-                <template v-for="(big,i) in classify">
-                    <a :class="{'on': params.bid==big.bigTypeID}" v-if="big.validFlag==1" href="javascript:void(0);" v-text="big.name"></a>
-                </template>
-            </div>
-            <div class="clsCon">
-                <div class="tabItem" v-for="big in classify" :bid="big.bigTypeID" style="display: none;">
-                    <div class="line" :class="{'on': params.sid==small.smallTypeID}" v-for="small in big.smalltypeList" v-if="small.validFlag==1">
-                        <div class="lft" :class="{'on': params.sid==small.smallTypeID}">
-                            <a :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-0'" v-text="small.name"></a>
-                        </div>
-                        <div class="rgt">
-                            <template v-for="tiny in small.tinytypeList">
-                                <a v-if="tiny.validFlag==1" :class="{'on': params.tid==tiny.tinyTypeID}" :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-'+tiny.tinyTypeID" v-text="tiny.name"></a>
-                            </template>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </template>
+    <!-- 面包屑 -->
+    <div v-if="isPC && listData && listData.length>0" class="crumbs">
+        <span>搜索结果</span>
+        <span>&gt;</span> <a href="javascript:void(0);" @click="toPagination(1)" v-text="params.keyword"></a>
+    </div>
+
+<!--    <template v-if="isPC && listData && listData.length>0">-->
+<!--        &lt;!&ndash; 面包屑 &ndash;&gt;-->
+<!--        <div v-if="searchFlag" class="crumbs">-->
+<!--            <span>搜索结果</span>-->
+<!--            <span>&gt;</span> <a href="javascript:void(0);" @click="toPagination(1)" v-text="params.keyword"></a>-->
+<!--        </div>-->
+<!--        <div v-else class="crumbs">-->
+<!--            <a href="/">首页</a>-->
+<!--            <template v-if="params.bid && params.bid>0">-->
+<!--                <template v-if="params.sid && params.sid>0">-->
+<!--                    <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-0-0'" v-text="bigType"></a>-->
+<!--                    <template v-if="params.tid && params.tid>0">-->
+<!--                        <span>&gt;</span> <a :href="'/product/list.html?category='+params.bid+'-'+params.sid+'-0'" v-text="smallType"></a>-->
+<!--                        <span>&gt;</span> <span v-text="tinyType"></span>-->
+<!--                    </template>-->
+<!--                    <template v-else>-->
+<!--                        <span>&gt;</span> <span v-text="smallType"></span>-->
+<!--                    </template>-->
+<!--                </template>-->
+<!--                <template v-else>-->
+<!--                    <span>&gt;</span> <span v-text="bigType"></span>-->
+<!--                </template>-->
+<!--            </template>-->
+<!--        </div>-->
+<!--        &lt;!&ndash;分类&ndash;&gt;-->
+<!--        <div v-if="(!searchFlag)" id="listClassify" class="classifyBox">-->
+<!--            <div class="clsTab">-->
+<!--                <template v-for="(big,i) in classify">-->
+<!--                    <a :class="{'on': params.bid==big.bigTypeID}" v-if="big.validFlag==1" href="javascript:void(0);" v-text="big.name"></a>-->
+<!--                </template>-->
+<!--            </div>-->
+<!--            <div class="clsCon">-->
+<!--                <div class="tabItem" v-for="big in classify" :bid="big.bigTypeID" style="display: none;">-->
+<!--                    <div class="line" :class="{'on': params.sid==small.smallTypeID}" v-for="small in big.smalltypeList" v-if="small.validFlag==1">-->
+<!--                        <div class="lft" :class="{'on': params.sid==small.smallTypeID}">-->
+<!--                            <a :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-0'" v-text="small.name"></a>-->
+<!--                        </div>-->
+<!--                        <div class="rgt">-->
+<!--                            <template v-for="tiny in small.tinytypeList">-->
+<!--                                <a v-if="tiny.validFlag==1" :class="{'on': params.tid==tiny.tinyTypeID}" :href="'/product/list.html?category='+big.bigTypeID+'-'+small.smallTypeID+'-'+tiny.tinyTypeID" v-text="tiny.name"></a>-->
+<!--                            </template>-->
+<!--                        </div>-->
+<!--                    </div>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--    </template>-->
     <!--loading-->
     <div v-if="listLoading" class="loading">
         <img src="/img/base/loading.gif">

BIN
target/www-0.0.1-SNAPSHOT.jar