[baozhangchao] 3 anni fa
parent
commit
071ed07fa4

+ 12
- 14
src/views/ClassInfo.vue Vedi File

@@ -1,17 +1,13 @@
1 1
 <template>
2 2
   <div class="class-box">
3 3
     <ratio-div class="thumb-banner" :ratio="0.6">
4
-      <img width="100%" :src="ClassContent.thumb" alt />
4
+      <img width="100%" :src="compressImage(ClassContent.thumb)" alt />
5 5
     </ratio-div>
6 6
 
7 7
     <div class="summary">
8
-      <div class="title">
9
-        {{ClassContent.title}}
10
-      </div>
8
+      <div class="title">{{ClassContent.title}}</div>
11 9
       <div class="flex" style="margin-top: 16px">
12
-        <div class="flex-1 subtitle">
13
-          {{dateStr}}
14
-        </div>
10
+        <div class="flex-1 subtitle">{{dateStr}}</div>
15 11
         <div class="flex-0" @click="handleFavor()">
16 12
           <span>
17 13
             <van-icon size="1.4em" :name="favor.icon" :color="favor.color" />
@@ -22,9 +18,9 @@
22 18
     </div>
23 19
 
24 20
     <div class="content-bar"></div>
25
-    
21
+
26 22
     <div class="class-box-body">
27
-      <img :src="ClassContent.content" alt />
23
+      <img :src=" compressImage(ClassContent.content)" alt />
28 24
     </div>
29 25
   </div>
30 26
 </template>
@@ -32,6 +28,7 @@
32 28
 <script>
33 29
 import { getCourseInfof, addCollection, deleteCollection } from '@/util/api'
34 30
 import { parseTime } from '@/util/formattingData'
31
+import { compressImage } from '../util/index'
35 32
 
36 33
 export default {
37 34
   components: {
@@ -49,7 +46,7 @@ export default {
49 46
   },
50 47
   computed: {
51 48
     dateStr() {
52
-      if (!this.startDate || !this.endDate) return '课程时间: 暂无';
49
+      if (!this.startDate || !this.endDate) return '课程时间: 暂无'
53 50
 
54 51
       const start = parseTime(this.startDate, '{y}-{m}-{d} {h}:{i}')
55 52
       const end = parseTime(this.endDate, '{y}-{m}-{d} {h}:{i}')
@@ -62,7 +59,7 @@ export default {
62 59
       return {
63 60
         icon: isFavored ? 'star' : 'star-o',
64 61
         color: isFavored ? '#2BB898' : '#000',
65
-        text: isFavored?'已收藏':'收藏',
62
+        text: isFavored ? '已收藏' : '收藏'
66 63
       }
67 64
     }
68 65
   },
@@ -75,8 +72,9 @@ export default {
75 72
     }
76 73
   },
77 74
   methods: {
75
+    compressImage,
78 76
     onloadClass(id) {
79
-      const courseId = id || this.$route.query.courseId;
77
+      const courseId = id || this.$route.query.courseId
80 78
 
81 79
       getCourseInfof(courseId).then((e) => {
82 80
         this.ClassContent = e
@@ -149,7 +147,7 @@ export default {
149 147
 
150 148
     .star-favor {
151 149
       display: inline-block;
152
-      margin-left: .6em;
150
+      margin-left: 0.6em;
153 151
       vertical-align: top;
154 152
     }
155 153
   }
@@ -157,7 +155,7 @@ export default {
157 155
   .content-bar {
158 156
     position: relative;
159 157
     margin-top: -1.5em;
160
-    box-shadow: 0 0 4px 4px rgba(0, 0, 0, .08);
158
+    box-shadow: 0 0 4px 4px rgba(0, 0, 0, 0.08);
161 159
     border-top-left-radius: 30px;
162 160
     border-top-right-radius: 30px;
163 161
     height: 30px;

+ 8
- 5
src/views/StrongPhoto.vue Vedi File

@@ -29,7 +29,7 @@
29 29
           :key="index"
30 30
           width="31vw"
31 31
           height="13vh"
32
-          :src="image.url"
32
+          :src=" compressImage(image.url)"
33 33
           style="padding:0 3px 0 2px"
34 34
           @click="showBig(image.url)"
35 35
         />
@@ -40,9 +40,9 @@
40 40
 </template>
41 41
 
42 42
 <script>
43
-import { getPhotoSotr, getPhotos } from '@/util/api'
43
+import { getPhotoSotr, getPhotos, getBanner } from '@/util/api'
44 44
 import { parseTime } from '@/util/formattingData'
45
-import { getBanner } from '@/util/api'
45
+import { compressImage } from '../util/index'
46 46
 
47 47
 export default {
48 48
   components: {
@@ -79,6 +79,7 @@ export default {
79 79
     this.dataResort()
80 80
   },
81 81
   methods: {
82
+    compressImage,
82 83
     showBig(val) {
83 84
       this.bigImg = [val]
84 85
       this.imageShow = true
@@ -125,18 +126,20 @@ export default {
125 126
         this.buttList.unshift(item)
126 127
       }
127 128
     },
129
+    SeePhotoas(i, pos) {
130
+      console.log(i)
131
+      console.log(pos)
132
+    },
128 133
     SeePhotos(i, id) {
129 134
       this.activeNum = i
130 135
       getPhotos(id).then((e) => {
131 136
         this.imageList = e.records
132 137
         this.dataResort()
133 138
       })
134
-      // this.clickStyle = !this.clickStyle
135 139
     },
136 140
     onBanner() {
137 141
       getBanner('Wonderful').then((e) => {
138 142
         this.photoBannerImages = (e.records || []).map((x) => x.thumb)
139
-        // console.log(e)
140 143
       })
141 144
     }
142 145
   }

+ 17
- 8
src/views/components/BannerSwipe.vue Vedi File

@@ -1,9 +1,14 @@
1 1
 <template>
2
-  <div class="banner-swipe-box" >
3
-    <van-swipe class="banner-swipe" :autoplay="3000" @change="i => current = i" :show-indicators="false">
2
+  <div class="banner-swipe-box">
3
+    <van-swipe
4
+      class="banner-swipe"
5
+      :autoplay="3000"
6
+      @change="i => current = i"
7
+      :show-indicators="false"
8
+    >
4 9
       <van-swipe-item v-for="image in list" :key="image">
5 10
         <ration-div :ratio="0.6">
6
-          <van-image width="100%" height="100%" :src="image" />
11
+          <van-image width="100%" height="100%" :src=" compressImage(image)" />
7 12
         </ration-div>
8 13
       </van-swipe-item>
9 14
     </van-swipe>
@@ -14,21 +19,25 @@
14 19
 </template>
15 20
 
16 21
 <script>
22
+import { compressImage } from '../../util/index'
17 23
 export default {
18 24
   name: 'BannerSwipe',
19 25
   components: {
20
-    RationDiv: () => import('@/components/RatioDiv/index.vue'),
26
+    RationDiv: () => import('@/components/RatioDiv/index.vue')
21 27
   },
22 28
   props: {
23 29
     list: {
24 30
       type: Array,
25
-      default: () => ([])
31
+      default: () => []
26 32
     }
27 33
   },
28 34
   data() {
29 35
     return {
30
-      current: 0,
36
+      current: 0
31 37
     }
38
+  },
39
+  methods: {
40
+    compressImage
32 41
   }
33 42
 }
34 43
 </script>
@@ -60,11 +69,11 @@ export default {
60 69
       background: rgba(0, 0, 0, 0.2);
61 70
 
62 71
       & + span {
63
-        margin-left: .2em;
72
+        margin-left: 0.2em;
64 73
       }
65 74
     }
66 75
     .active {
67
-      background: rgba(0, 0, 0, .65);
76
+      background: rgba(0, 0, 0, 0.65);
68 77
     }
69 78
   }
70 79
 }

+ 14
- 12
src/views/components/CourseCard.vue Vedi File

@@ -2,7 +2,7 @@
2 2
   <div class="course-card">
3 3
     <div class="media-box">
4 4
       <div class="media-head">
5
-        <img :src="thumb" alt="">
5
+        <img :src="compressImage(thumb)" alt />
6 6
       </div>
7 7
       <div class="media-body">
8 8
         <div class="title">{{title}}</div>
@@ -10,9 +10,7 @@
10 10
       </div>
11 11
     </div>
12 12
     <div class="card-footer" @click="onDetail">
13
-      <div class="footer-body">
14
-        查看详情
15
-      </div>
13
+      <div class="footer-body">查看详情</div>
16 14
       <div class="footer-action">
17 15
         <van-icon name="arrow" />
18 16
       </div>
@@ -21,8 +19,8 @@
21 19
 </template>
22 20
 
23 21
 <script>
24
-import { parseTime } from "@/util/formattingData";
25
-
22
+import { parseTime } from '@/util/formattingData'
23
+import { compressImage } from '../../util/index'
26 24
 export default {
27 25
   name: 'CourseCard',
28 26
   props: {
@@ -34,7 +32,7 @@ export default {
34 32
   },
35 33
   computed: {
36 34
     dateStr() {
37
-      if (!this.startDate || !this.endDate) return '课程时间: 暂无';
35
+      if (!this.startDate || !this.endDate) return '课程时间: 暂无'
38 36
 
39 37
       const start = parseTime(this.startDate, '{y}-{m}-{d} {h}:{i}')
40 38
       const end = parseTime(this.endDate, '{y}-{m}-{d} {h}:{i}')
@@ -43,13 +41,16 @@ export default {
43 41
     }
44 42
   },
45 43
   // 组件加载完成执行
46
-  mounted() {
47
-  },
44
+  mounted() {},
48 45
   methods: {
46
+    compressImage,
49 47
     onDetail() {
50
-      this.$router.push({ name: 'ClassInfo', query: { courseId: this.courseId } })
48
+      this.$router.push({
49
+        name: 'ClassInfo',
50
+        query: { courseId: this.courseId }
51
+      })
51 52
     }
52
-  }  
53
+  }
53 54
 }
54 55
 </script>
55 56
 
@@ -65,7 +66,8 @@ export default {
65 66
     margin-top: 3vw;
66 67
   }
67 68
 
68
-  .media-box, .card-footer {
69
+  .media-box,
70
+  .card-footer {
69 71
     display: flex;
70 72
     justify-content: space-between;
71 73
   }