Explorar o código

二手商品链接

chao %!s(int64=4) %!d(string=hai) anos
pai
achega
1cb1cd325c

+ 6 - 2
src/main/java/com/caimei/www/controller/unlimited/FleaMarketController.java

@@ -1,8 +1,11 @@
 package com.caimei.www.controller.unlimited;
 
 import com.caimei.www.controller.BaseController;
+import com.caimei.www.pojo.page.ProductDetail;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 
 /**
  * Description
@@ -45,8 +48,9 @@ public class FleaMarketController extends BaseController {
     /**
      * 二手商品详情
      */
-    @GetMapping("/flea-market/detail.html")
-    public String fleaMarketDetail() {
+    @GetMapping("/flea-market-{id}.html")
+    public String fleaMarketDetail(final Model model, @PathVariable("id") Integer productId) {
+        model.addAttribute("productId", productId);
         return FLEA_MARKET_DETAIL;
     }
 

+ 1 - 1
src/main/resources/static/css/flea-market/list.css

@@ -89,13 +89,13 @@
     }
 
     .itemImg {
+        display: block;
         position: relative;
         width: 100%;
         height: 284px;
         margin-right: 20px;
         background-color: #fff;
         cursor: pointer;
-        background: #000
     }
 
     .itemImg .bigImg {

+ 0 - 4
src/main/resources/static/js/flea-market/list.js

@@ -104,10 +104,6 @@ var fleaMarketList = new Vue({
                      }else{
                      }
                 })
-          },
-          getproduct:function(id){
-            window.location.href = '/flea-market/detail.html?productID='+id;
-            return false
           },
            returnedTarget:function(){//对象合并 IE 兼容方法
             if (typeof Object.assign != 'function') {

+ 5 - 2
src/main/resources/static/js/flea-market/secondDetail.js

@@ -7,7 +7,7 @@ var fleaMarket = new Vue({
         tabIndex:0,
         userId:'',
         shopId:'',
-        id:window.location.href.split('=')[1],
+        id: $("#productId").val(),
         isShow:false,
         isRequest:false,
         Showlogo:false,
@@ -16,7 +16,7 @@ var fleaMarket = new Vue({
         previewThumb:[],
         previewParams:[],
         recommdeImage:[],
-        userID:JSON.parse(localStorage.getItem('userInfo')),
+        userID: GLOBAL_USER_ID,
         HandType:false,
         ShowImage:false,
         recommde:false,
@@ -120,6 +120,9 @@ var fleaMarket = new Vue({
             _this.previewBigimage = item;
         },
     },
+    created: function () {
+        this.id = $("#productId").val();
+    },
     mounted: function () {
      var _this = this;
         _this.InfoData();

+ 2 - 1
src/main/resources/templates/flea-market/detail.html

@@ -11,7 +11,8 @@
 <template th:replace="components/header"></template>
 
 <!-- 二手商品详情 -->
-    <div class="preview-container" id="fleaMarket" >
+<div class="preview-container" id="fleaMarket" >
+    <input type="hidden" th:value="${productId}" id="productId">
     <div class="inner-container">
         <div class="preview-header clearfix">
             <div class="preview-banner clearfix" id="imgShown" >

+ 76 - 74
src/main/resources/templates/flea-market/list.html

@@ -13,86 +13,88 @@
 <!-- 二手商品列表 -->
 <div id="fleaMarketList">
     <div class="wrap">
-        <div class="ListImg" >
-            <img src="/img/flea-market/banner.png"/>
-       </div>
-       <template>
-           <ul class="secondTitle " v-if="isPC">
-                <li class="ClassA icon "  v-for="(item, index) in tabTitle" :key="index" @click="handle(item)" :class="[currentId==item.value?'active':'',item.value==1?'jqSelect':'']">{{item.name}} </li>
-                <li class="fabu"><a href="/flea-market/form.html">我要发布</a><li/>
-           </ul>
-           <ul class="secondTitle" v-else>
-               <li class="ClassA  mIcon"  v-for="(item, index) in tabTitle" :key="index" @click="handle(item)" :class="[currentId==item.value?'active':'',item.value==1?'off':'']">{{item.name}}
-                <span class="line" v-if="currentId==item.value"></span>
-               </li>
-               <li class="fabu"><a href="/flea-market/form.html">我要发布</a><li/>
-           </ul>
-       </template>
-
-
-
-       <ul class="mainTab"  v-if="mainflag">
-           <li v-for="(item,index) in tabList" @click='handleChild(item)' :class="currentID2 ==index?'addstyle':' '" >{{item.name}}</li>
-
-       </ul>
-       <div class="shopList">
-            <div class="Listitem" v-if="isShow"   v-for="(item, index) in tabchildList">
-                <div class="itemImg onhref" :data-id="item.productID" @click="getproduct(item.productID)">
+        <div class="ListImg">
+            <img src="/img/flea-market/banner.png" />
+        </div>
+        <template>
+            <ul class="secondTitle " v-if="isPC">
+                <li class="ClassA icon " v-for="(item, index) in tabTitle" :key="index" @click="handle(item)" :class="[currentId==item.value?'active':'',item.value==1?'jqSelect':'']">{{item.name}} </li>
+                <li class="fabu">
+                    <a href="/flea-market/form.html">我要发布</a>
+                <li/>
+            </ul>
+            <ul class="secondTitle" v-else>
+                <li class="ClassA  mIcon" v-for="(item, index) in tabTitle" :key="index" @click="handle(item)" :class="[currentId==item.value?'active':'',item.value==1?'off':'']">{{item.name}}
+                    <span class="line" v-if="currentId==item.value"></span>
+                </li>
+                <li class="fabu">
+                    <a href="/flea-market/form.html">我要发布</a>
+                <li/>
+            </ul>
+        </template>
+        <ul class="mainTab" v-if="mainflag">
+            <li v-for="(item,index) in tabList" @click='handleChild(item)' :class="currentID2 ==index?'addstyle':' '">{{item.name}}</li>
+        </ul>
+        <div class="shopList">
+            <div class="Listitem" v-if="isShow" v-for="(item, index) in tabchildList">
+                <a class="itemImg onhref" :href="'/flea-market-'+item.productID+'.html'">
                     <img :src="item.imageList[0]" :class="item.sold==1?'activeImg':''" class="bigImg">
+                </a>
+                <div class="ItemInfo">
+                    <div class="tag">
+                        <span class="infotag news" v-if="item.sold==0&&item.newAdded==1">最新</span>
+                        <span class="infotag brand" v-if="item.brandName==null&&item.brandName==''">{{item.brandName}}</span>
+                        <span class="infotag sold" v-if="item.sold==1&&item.newAdded==1||item.sold==1&&item.newAdded==0">已售</span>
+                        <span class="infotag other" v-if="item.brandID==161&&item.brandName!=''&&item.brandName!=null">{{item.brandName}}</span>
+                    </div>
+                    <a class="productname" :href="'/flea-market-'+item.productID+'.html'">
+                        {{item.name}}
+                    </a>
+                    <div class="targetprice">
+                        <span v-if="item.detailTalkFlag ==2 && userID==null">价格详聊</span>
+                        <span v-else-if="userID==null" class="priceparam" @click="toLogin">登录查看价格></span>
+                        <span v-else-if="userID!=null && item.detailTalkFlag==2">价格详聊</span>
+                        <span v-else>¥{{item.price1Str}}</span>
+                    </div>
+                    <div class="shijian">
+                        <div>
+                            <i class="icon mIcon  liulanliang"></i> {{item.viewingNum}}
+                        </div>
+                        <div>
+                            <i class="icon mIcon  shijian"></i> {{item.onLineDateStr}}
+                        </div>
+                    </div>
+                    <div class="dizhi">
+                        <i class="icon mIcon dizhi"></i>
+                        {{item.provinceCityDistrict}}
+                    </div>
+                </div>
+            </div>
+            <div class="no-content" v-show="showflag" :class="showflag?'show':''">
+                <img src="/img/flea-market/nologo.png" v-if="isPC" />
+                <img src="/img/flea-market/kong_m.png" v-else />
+                <div class="error-message">
+                    <p>此分类下面没有商品,换其它分类瞅瞅</p>
                 </div>
-            <div class="ItemInfo" >
-                 <div class="tag">
-                   <span class="infotag news" v-if="item.sold==0&&item.newAdded==1">最新</span>
-                   <span class="infotag brand" v-if="item.brandName==null&&item.brandName==''">{{item.brandName}}</span>
-                   <span class="infotag sold" v-if="item.sold==1&&item.newAdded==1||item.sold==1&&item.newAdded==0">已售</span>
-                   <span class="infotag other" v-if="item.brandID==161&&item.brandName!=''&&item.brandName!=null">{{item.brandName}}</span>
-                  </div>
-                  <div class="productname">
-                    {{item.name}}
-                  </div>
-                  <div class="targetprice">
-                    <span v-if="item.detailTalkFlag ==2 && userID==null">价格详聊</span>
-                    <span v-else-if="userID==null" class="priceparam" @click="toLogin">登录查看价格></span>
-                    <span v-else-if="userID!=null && item.detailTalkFlag==2">价格详聊</span>
-                    <span v-else>¥{{item.price1Str}}</span>
-                  </div>
-                  <div class="shijian">
-                        <div ><i class="icon mIcon  liulanliang"></i> {{item.viewingNum}}</div>
-                        <div><i class="icon mIcon  shijian"></i> {{item.onLineDateStr}}</div>
-                   </div>
-                  <div class="dizhi">
-                    <i class="icon mIcon dizhi"></i>
-                     {{item.provinceCityDistrict}}
-                  </div>
             </div>
-          </div>
-             <div class="no-content" v-show="showflag" :class="showflag?'show':''">
-               <img src="/img/flea-market/nologo.png" v-if="isPC"/>
-               <img src="/img/flea-market/kong_m.png" v-else />
-               <div class="error-message">
-                 <p>此分类下面没有商品,换其它分类瞅瞅</p>
-               </div>
-           </div>
-
-
-       </div>
-    </div>
-    <div  class="pageWrap clear" v-if="isPC">
-            <a v-if="listQuery.pageNum>1" class="prev" @click="toPagination(listQuery.pageNum*1-1)" href="javascript:void(0);"></a>
-            <template v-for="n in showPageBtn">
-                <a v-if="n" :class="{ 'on': (n==listQuery.pageNum) }" @click="toPagination(n)" href="javascript:void(0);">{{ n }}</a>
-                <template v-else>···</template>
-            </template>
-            <a v-if="listQuery.pageNum<pageTotal" class="next" @click="toPagination(listQuery.pageNum*1+1)"href="javascript:void(0);"> </a>
-            <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
-            <span>跳至</span>
-            <input v-model="pageInput" @blur="checkNum()"/>
-            <span>页</span>&nbsp;
-              <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
         </div>
-
+    </div>
+    <div class="pageWrap clear" v-if="isPC">
+        <a v-if="listQuery.pageNum>1" class="prev" @click="toPagination(listQuery.pageNum*1-1)" href="javascript:void(0);"></a>
+        <template v-for="n in showPageBtn">
+            <a v-if="n" :class="{ 'on': (n==listQuery.pageNum) }" @click="toPagination(n)" href="javascript:void(0);">{{ n }}</a>
+            <template v-else>···</template>
+        </template>
+        <a v-if="listQuery.pageNum<pageTotal" class="next" @click="toPagination(listQuery.pageNum*1+1)" href="javascript:void(0);"> </a>
+        <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
+        <span>跳至</span>
+        <input v-model="pageInput" @blur="checkNum()" />
+        <span>页</span>&nbsp;
+        <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
+    </div>
 </div>
 
+
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>