[baozhangchao] 3 years ago
parent
commit
071ed07fa4

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

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

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

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

1
 <template>
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
       <van-swipe-item v-for="image in list" :key="image">
9
       <van-swipe-item v-for="image in list" :key="image">
5
         <ration-div :ratio="0.6">
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
         </ration-div>
12
         </ration-div>
8
       </van-swipe-item>
13
       </van-swipe-item>
9
     </van-swipe>
14
     </van-swipe>
14
 </template>
19
 </template>
15
 
20
 
16
 <script>
21
 <script>
22
+import { compressImage } from '../../util/index'
17
 export default {
23
 export default {
18
   name: 'BannerSwipe',
24
   name: 'BannerSwipe',
19
   components: {
25
   components: {
20
-    RationDiv: () => import('@/components/RatioDiv/index.vue'),
26
+    RationDiv: () => import('@/components/RatioDiv/index.vue')
21
   },
27
   },
22
   props: {
28
   props: {
23
     list: {
29
     list: {
24
       type: Array,
30
       type: Array,
25
-      default: () => ([])
31
+      default: () => []
26
     }
32
     }
27
   },
33
   },
28
   data() {
34
   data() {
29
     return {
35
     return {
30
-      current: 0,
36
+      current: 0
31
     }
37
     }
38
+  },
39
+  methods: {
40
+    compressImage
32
   }
41
   }
33
 }
42
 }
34
 </script>
43
 </script>
60
       background: rgba(0, 0, 0, 0.2);
69
       background: rgba(0, 0, 0, 0.2);
61
 
70
 
62
       & + span {
71
       & + span {
63
-        margin-left: .2em;
72
+        margin-left: 0.2em;
64
       }
73
       }
65
     }
74
     }
66
     .active {
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 View File

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