周立森 5 лет назад
Родитель
Сommit
4c8a06ee69
5 измененных файлов: 77 добавлений и 68 удалений
  1. 8
    3
      src/components/CaseCard.vue
  2. 16
    4
      src/views/Case.vue
  3. 10
    16
      src/views/Details.vue
  4. 36
    38
      src/views/Dynamic.vue
  5. 7
    7
      src/views/Home.vue

+ 8
- 3
src/components/CaseCard.vue Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 <template>
2
-  <el-card class="case-card" shadow="hover" :body-style="{ padding: '0px' }">
3
-    <img :src="thumb" class="image">
2
+  <el-card class="case-card" shadow="hover" :body-style="{ padding: '0px' }" style=" padding: 0px">
3
+    <img :style="{background: `url(${thumb})`}" class="image">  
4 4
     <div class="body">
5 5
       <h3>{{title}}</h3>
6 6
       <div class="bottom clearfix caption">
@@ -27,7 +27,12 @@ export default {
27 27
   padding: 0;
28 28
 
29 29
   .image {
30
-    width: 100%;
30
+      bottom: 0;
31
+  width: 100%;
32
+
33
+  height: 0;
34
+  padding-bottom: 48.5%;
35
+  background-size: 100% 100% !important;
31 36
   }
32 37
 
33 38
   .body {

+ 16
- 4
src/views/Case.vue Просмотреть файл

@@ -41,13 +41,13 @@
41 41
     <div class="contanier center-block dyn-main">
42 42
       <div class="row">
43 43
         <div class="col-md-6 col-xs-6" v-for="(item,index) in caselist" :key="index" :class="{ marginTP: index > 1 }">
44
-          <a href="/details">
45
-            <case-card :thumb="item.caseCoverImg" :title="item.caseTitle" :caption="item.caseSummary"></case-card>
46
-          </a>
44
+          <router-link :to="{ name: 'details', query: { id: item.id }}">
45
+            <case-card :thumb="item.caseCoverImg" :title="item.caseTitle" :caption="item.caseSummary" class="casecard"></case-card>
46
+          </router-link>
47 47
         </div>
48 48
       </div>
49 49
     </div>
50
-
50
+<!--  -->
51 51
     <div style="margin-top:40px">
52 52
       <button type="button" v-if="!allLoaded" class="btn btn-default" @click="more">加载更多</button>
53 53
       <p v-else>已经到底了~更多案例尽请期待~</p>
@@ -160,6 +160,18 @@ export default {
160 160
 
161 161
 <style scoped>
162 162
 
163
+.casecard{
164
+ 
165
+  width: 100%;
166
+
167
+  padding-bottom: 100%;
168
+  background-size: 100% 100% !important;
169
+  /* position: relative; */
170
+
171
+  margin: 0;
172
+
173
+}
174
+
163 175
 .border-bottom {
164 176
   /* display: none; */
165 177
   border-bottom: 1px solid #bfbfbf;

+ 10
- 16
src/views/Details.vue Просмотреть файл

@@ -67,14 +67,8 @@
67 67
   </div>
68 68
 </template>
69 69
 
70
-<script>
71 70
 
72 71
 
73
-export default {
74
-
75
-}
76
-</script>
77
-
78 72
 
79 73
 <script scoped>
80 74
 // @ is an alias to /src
@@ -100,28 +94,28 @@ export default {
100 94
     getDetail () {
101 95
       const id = this.$route.query.id;
102 96
       const type = this.$route.query.type;
103
-      const taCaseTypeId = this.$route.query.taCaseTypeId;
97
+      // const taCaseTypeId = this.$route.query.taCaseTypeId;
104 98
       request({
105 99
         ...apis.case.list,
106 100
         urlData: { type: type },
107 101
         params: { pageNum: 1, pageSize: 1, id: id },
108 102
         query: {}
109 103
       }).then(con => {
110
-        console.log(con, "124")
104
+        // console.log(con, "124")
111 105
         this.datas = con.records[0];
112 106
         // window.console.log(this.caselist, "543");
113 107
       })
114 108
 
115
-      request({
116
-        ...apis.case.list,
117
-        urlData: { type: type },
118
-        params: { pageNum: 1, pageSize: 4, }
119
-      }).then(con => {
120
-        console.log(con, "456")
121
-        console.log(taCaseTypeId, "456")
109
+      // request({
110
+      //   ...apis.case.list,
111
+      //   urlData: { type: type },
112
+      //   params: { pageNum: 1, pageSize: 4, }
113
+      // }).then(con => {
114
+        // console.log(con, "456")
115
+        // console.log(taCaseTypeId, "456")
122 116
         // this.morecase = con.records[0];
123 117
         // window.console.log(this.caselist, "543");
124
-      })
118
+      // })
125 119
     }
126 120
 
127 121
   },

+ 36
- 38
src/views/Dynamic.vue Просмотреть файл

@@ -14,14 +14,14 @@
14 14
     </div>
15 15
 
16 16
     <div class="row mobtype border-bottom">
17
-   
18
-        <div class="col-xs-6">
19
-          <div> <p style="line-height:40px">选择想看的动态类型:</p></div>
17
+      <div class="col-xs-6">
18
+        <div>
19
+          <p style="line-height:40px">选择想看的动态类型:</p>
20 20
         </div>
21
-        <div class="col-xs-6">
22
-          <el-button class="btn-link mobbtn" @click="drawer = true" type="button" style="margin-left: 16px;">全部动态</el-button>
23
-        </div>
24
-  
21
+      </div>
22
+      <div class="col-xs-6">
23
+        <el-button class="btn-link mobbtn" @click="drawer = true" type="button" style="margin-left: 16px;">全部动态</el-button>
24
+      </div>
25 25
     </div>
26 26
     <el-drawer :visible.sync="drawer" :direction="direction" :before-close="handleClose" :show-close="true" size="80%">
27 27
       <div>
@@ -42,12 +42,14 @@
42 42
     <div class="contanier center-block dyn-main">
43 43
       <div class="row">
44 44
         <div class="col-md-6 col-xs-6" v-for="(item,index) in caselist" :key="index" :class="{ marginTP: index > 1 }">
45
-          <case-card :thumb="item.caseCoverImg" :title="item.caseTitle" :caption="item.caseSummary"></case-card>
45
+          <router-link :to="{ name: 'details', query: { id: item.id }}">
46
+            <case-card :thumb="item.caseCoverImg" :title="item.caseTitle" :caption="item.caseSummary"></case-card>
47
+          </router-link>
46 48
         </div>
47 49
       </div>
48 50
     </div>
49 51
 
50
-    <div style="margin-top:40px" >
52
+    <div style="margin-top:40px">
51 53
       <button type="button" class="btn btn-default" @click="more" v-if="!allLoaded">加载更多</button>
52 54
       <p v-else>已经到底了~更多案例尽请期待~</p>
53 55
     </div>
@@ -158,21 +160,20 @@ export default {
158 160
 </script>
159 161
 
160 162
 <style scoped>
161
-
162 163
 .border-bottom {
163 164
   /* display: none; */
164 165
   border-bottom: 1px solid #bfbfbf;
165
-      margin-top: 10px !important;
166
+  margin-top: 10px !important;
167
+}
168
+.btn1 {
169
+  font-size: 24px !important;
170
+  color: black !important;
171
+  border: none !important;
172
+}
173
+.btn1:hover {
174
+  color: red !important;
175
+  text-decoration: none;
166 176
 }
167
- .btn1 {
168
-    font-size: 24px !important;
169
-    color: black !important;
170
-    border: none !important;
171
-  }
172
-  .btn1:hover {
173
-    color: red !important;
174
-    text-decoration: none;
175
-  }
176 177
 .text-left {
177 178
   color: #000;
178 179
 }
@@ -187,7 +188,7 @@ export default {
187 188
 }
188 189
 
189 190
 @media (max-width: 992px) {
190
-  .dynamic{
191
+  .dynamic {
191 192
     margin-top: 58px;
192 193
   }
193 194
   .comtype {
@@ -199,8 +200,8 @@ export default {
199 200
   }
200 201
 }
201 202
 .row {
202
-    margin: 0;
203
-  }
203
+  margin: 0;
204
+}
204 205
 .marginTP {
205 206
   margin-top: 3rem;
206 207
 }
@@ -215,17 +216,16 @@ export default {
215 216
     justify-content: center;
216 217
   }
217 218
   .dynamic {
218
-  margin-top: 116px;
219
-  margin-bottom: -116px;
220
-  padding-bottom: 116px; 
221
-  background-color: #fafafa;
222
-}
223
-  
219
+    margin-top: 116px;
220
+    margin-bottom: -116px;
221
+    padding-bottom: 116px;
222
+    background-color: #fafafa;
223
+  }
224
+
224 225
   .mobtype {
225 226
     display: none;
226 227
   }
227 228
 
228
-  
229 229
   .btn {
230 230
     font-size: 24px;
231 231
     margin-top: 88px;
@@ -253,16 +253,14 @@ export default {
253 253
   }
254 254
 }
255 255
 
256
+.mobbtn {
257
+  color: #e03723;
256 258
 
257
-.mobbtn{
258
-color: #e03723;
259
-   
260
-  padding:12px 40px;
259
+  padding: 12px 40px;
261 260
 
262
-    border-radius: 0px;
261
+  border-radius: 0px;
263 262
 
264
-    background-color: rgb(252, 151, 252);
265
-    border: 2px solid #bfbfbf;
266
-  
263
+  background-color: rgb(252, 151, 252);
264
+  border: 2px solid #bfbfbf;
267 265
 }
268 266
 </style>

+ 7
- 7
src/views/Home.vue Просмотреть файл

@@ -9,7 +9,7 @@
9 9
             <span class="icon-bar"></span>
10 10
             <span class="icon-bar"></span>
11 11
           </button>
12
-          <a class="navbar-brand" href="#">
12
+          <a class="navbar-brand" href="/">
13 13
             <div alt="Brand" class="logo"></div>
14 14
           </a>
15 15
         </div>
@@ -134,7 +134,7 @@
134 134
       </div>
135 135
     </div>
136 136
 
137
-    <a class="btn btn-default btn-lg" href="/case" role="button">更多案例</a>
137
+    <router-link class="btn btn-default btn-lg" :to="{ name: 'case' }">更多案例</router-link>
138 138
 
139 139
     <div></div>
140 140
 
@@ -161,17 +161,17 @@
161 161
         <div class="contanier st top-news">
162 162
           <div class="row">
163 163
             <div class="col-xs-6 col-md-6 home-news-hover home-news" v-for="(item,index) in dynamiclist" :key="index">
164
-              <a href="/details">
164
+              <router-link :to="{ name: 'details', query: { id: item.id }}">
165 165
                 <div :style="{background: `url(${item.caseCoverImg})`}" class="home-dynamic"></div>
166 166
                 <h3 class="text-left" style>{{item.caseTitle}}</h3>
167
-              </a>
167
+              </router-link>
168 168
             </div>
169 169
             <!-- item.caseCoverImg -->
170 170
           </div>
171 171
         </div>
172 172
       </div>
173 173
     </div>
174
-    <a class="btn btn-default btn-lg dynbtn" href="/dynamic" role="button">更多动态</a>
174
+    <router-link class="btn btn-default btn-lg" role="button" :to="{ name: 'dynamic' }">更多案例</router-link>
175 175
   </div>
176 176
 </template>
177 177
 
@@ -282,7 +282,7 @@ export default {
282 282
     margin-top: 20px;
283 283
     font-size: 20px;
284 284
     font-weight: bold;
285
-    letter-spacing:1px;
285
+    letter-spacing: 1px;
286 286
   }
287 287
   h3 {
288 288
     font-size: 2.4rem;
@@ -386,7 +386,7 @@ export default {
386 386
   }
387 387
   .btn:hover {
388 388
     color: #e03723;
389
-    border: 1px solid #e03723;
389
+    border: 2px solid #e03723;
390 390
   }
391 391
 
392 392
   p {