Selaa lähdekoodia

项目详情增加userId字段参数

zhengjinyi 3 vuotta sitten
vanhempi
commit
b89c5023d6

+ 6 - 2
src/main/resources/static/js/equipment/detail.js

@@ -4,7 +4,8 @@ var equipmentDetail = new Vue({
         equipmentId: 0,
         userId: 6,
         userIdentity: '',
-        recommends: []
+        recommends: [],
+        listLoading:true
     },
     computed: {},
     methods: {
@@ -14,10 +15,13 @@ var equipmentDetail = new Vue({
             ProductApi.GetEquipmentDdtailsRecommend({ equipmentId: this.equipmentId,userId:_self.userId},function (response) {
                 if (response.code === 0 && response.data) {
                     _self.recommends = response.data;
+                    _self.listLoading = false;
                 }else if(response.code === 1){
                     window.location.href = "/404.html?error=未查询到该项目仪器";
                 }else{
-                    CAIMEI.Alert(response.msg, '确定', false);
+                    CAIMEI.Alert(response.msg, '确定', true,function(){
+                        window.location.href = "/equipment/list.html?keyword=";
+                    });
                 }
             });
         }

+ 55 - 50
src/main/resources/templates/equipment/detail.html

@@ -16,63 +16,68 @@
 
 <!-- 项目仪器详情 -->
 <div id="equipmentDetail">
-    <div class="wrap">
-        <div class="equipmentBox clear">
-            <div class="imageBox"><img th:src="${equipment.image}"></div>
-            <div class="infoBox">
-                <p class="row" th:each="item: ${equipment.pageContents}" th:if="${item.type}==1">
-                    <span class="l" th:text="${item.name}"></span><i>:</i><em th:text="${item.content}"></em>
-                </p>
-                <hr>
-                <p class="tit" th:each="item,status : ${equipment.pageContents}" th:if="${item.type}==2 and ${status.index}==4">
-                    <span th:text="${item.name}"></span>
-                </p>
-                <p class="row" th:each="item,status : ${equipment.pageContents}" th:if="${item.type}==2 and ${status.index}>4">
-                    <span class="l" th:text="${item.name}"></span><i>:</i><em th:text="${item.content}"></em>
-                </p>
-                <a href="javascript:void(0);" class="share" title="手机扫一扫分享">分享<i class="icon"></i>
-                <div class="code"></div>
-                </a>
-<!--                <a href="javascript:void(0);" class="buy">点击购买</a>-->
-            </div>
-        </div>
+    <div v-if="listLoading" class="loading">
+        <img src="/img/base/loading.gif">
     </div>
-    <div class="wrap">
-        <div class="detailInfo">
-            <div class="tabTit">
-                <!--<span class="on">项目详情</span>-->
-                <span th:each="item,status : ${equipment.pageContents}"
-                      th:if="${item.type}==3 and (${status.index}==10 or ${status.index}==11 or ${status.index}==12)"
-                      th:text="${item.name}"></span>
+    <template v-else>
+        <div class="wrap" >
+            <div class="equipmentBox clear">
+                <div class="imageBox"><img th:src="${equipment.image}"></div>
+                <div class="infoBox">
+                    <p class="row" th:each="item: ${equipment.pageContents}" th:if="${item.type}==1">
+                        <span class="l" th:text="${item.name}"></span><i>:</i><em th:text="${item.content}"></em>
+                    </p>
+                    <hr>
+                    <p class="tit" th:each="item,status : ${equipment.pageContents}" th:if="${item.type}==2 and ${status.index}==4">
+                        <span th:text="${item.name}"></span>
+                    </p>
+                    <p class="row" th:each="item,status : ${equipment.pageContents}" th:if="${item.type}==2 and ${status.index}>4">
+                        <span class="l" th:text="${item.name}"></span><i>:</i><em th:text="${item.content}"></em>
+                    </p>
+                    <a href="javascript:void(0);" class="share" title="手机扫一扫分享">分享<i class="icon"></i>
+                        <div class="code"></div>
+                    </a>
+                    <!--                <a href="javascript:void(0);" class="buy">点击购买</a>-->
+                </div>
             </div>
-            <div class="tabCon">
-                <div th:each="item,status : ${equipment.pageContents}"
-                     th:if="${item.type}==3 and (${status.index}==10 or ${status.index}==11 or ${status.index}==12)"
-                     th:utext="${item.content}" class="item">
+        </div>
+        <div class="wrap">
+            <div class="detailInfo">
+                <div class="tabTit">
+                    <!--<span class="on">项目详情</span>-->
+                    <span th:each="item,status : ${equipment.pageContents}"
+                          th:if="${item.type}==3 and (${status.index}==10 or ${status.index}==11 or ${status.index}==12)"
+                          th:text="${item.name}"></span>
+                </div>
+                <div class="tabCon">
+                    <div th:each="item,status : ${equipment.pageContents}"
+                         th:if="${item.type}==3 and (${status.index}==10 or ${status.index}==11 or ${status.index}==12)"
+                         th:utext="${item.content}" class="item">
+                    </div>
                 </div>
             </div>
         </div>
-    </div>
-    <div class="wrap">
-        <div class="pageFloor" v-for="floor in recommends">
-            <div class="title" v-text="floor.title"></div>
-            <ul class="content clear">
-                <li v-for="item in floor.floorData">
-                    <a :href="item.link">
-                        <img :src="item.image">
-                        <span v-text="item.title"></span>
-                    </a>
-                </li>
-            </ul>
+        <div class="wrap">
+            <div class="pageFloor" v-for="floor in recommends">
+                <div class="title" v-text="floor.title"></div>
+                <ul class="content clear">
+                    <li v-for="item in floor.floorData">
+                        <a :href="item.link">
+                            <img :src="item.image">
+                            <span v-text="item.title"></span>
+                        </a>
+                    </li>
+                </ul>
+            </div>
         </div>
-    </div>
-    <div class="contactBox">
-        <div class="tit"><span>咨询 · 购买</span></div>
-        <div class="cont">
-            <span class="icon mIcon call">0755-22907771转806<br>15338851365</span>
-            <span class="icon mIcon phone">产品设备:18948339365<br>商务合作:17318032647</span>
+        <div class="contactBox">
+            <div class="tit"><span>咨询 · 购买</span></div>
+            <div class="cont">
+                <span class="icon mIcon call">0755-22907771转806<br>15338851365</span>
+                <span class="icon mIcon phone">产品设备:18948339365<br>商务合作:17318032647</span>
+            </div>
         </div>
-    </div>
+    </template>
 </div>
 
 <!-- 引入底部 -->