Quellcode durchsuchen

修复自由页 专题页 二级列表 背景色 背景图动态设置

zhengjinyi vor 3 Jahren
Ursprung
Commit
ea97e75e78

+ 4 - 0
src/main/resources/static/css/equipment/detail.css

@@ -4,6 +4,8 @@ li{list-style:none}
  * PC端
  */
 @media screen and (min-width:768px){
+.bg-repeat{background-repeat: repeat-x;}
+.bg-cover{background-size: cover;}
 .equipmentBox{width:100%;margin:16px 0;background:#FFF;box-sizing:border-box;padding:15px}
 .equipmentBox .imageBox{float:left;width:452px;height:300px;background:#F3F7FE;}
 .equipmentBox img{width:100%;height:100%;display:block}
@@ -52,6 +54,8 @@ li{list-style:none}
 * 移动端
 */
 @media screen and (max-width:768px){
+.bg-repeat{background-repeat: repeat-x;}
+.bg-cover{background-size: cover;}
 .equipmentBox{width:100%;background:#FFF;padding-bottom:2.7vw;margin-bottom: 2.7vw;}
 .equipmentBox .imageBox{width:100%;height:66.6vw;}
 .equipmentBox img{width:100%;height:100%;display:block}

+ 7 - 1
src/main/resources/static/js/equipment/detail.js

@@ -4,7 +4,8 @@ var equipmentDetail = new Vue({
         equipmentId: 0,
         userId: 6,
         userIdentity: '',
-        recommends: [],
+        bgClass:'',
+        recommends: {},
         listLoading:true
     },
     computed: {},
@@ -15,6 +16,11 @@ var equipmentDetail = new Vue({
             ProductApi.GetEquipmentDdtailsRecommend({ equipmentId: this.equipmentId,userId:_self.userId},function (response) {
                 if (response.code === 0 && response.data) {
                     _self.recommends = response.data;
+                    if( _self.recommends.backgroundImageWay == 1){
+                        _self.bgClass = 'bg-repeat';
+                    }else{
+                        _self.bgClass = 'bg-cover';
+                    }
                     _self.listLoading = false;
                 }else if(response.code === 1){
                     window.location.href = "/404.html?error=未查询到该项目仪器";

+ 4 - 1
src/main/resources/templates/equipment/detail.html

@@ -15,7 +15,10 @@
 <template th:replace="components/header"></template>
 
 <!-- 项目仪器详情 -->
-<div id="equipmentDetail">
+<div id="equipmentDetail"
+     :class="bgClass"
+     :style="{backgroundColor:recommends.backgroundColour,backgroundImage:'url('+recommends.backgroundImage+')'}"
+>
     <div v-if="listLoading" class="loading">
         <img src="/img/base/loading.gif">
     </div>