hookehuyr

perf(图片优化): 为所有图片URL添加压缩和缩略图参数以提高加载性能

...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
108 <div class="three-columns"> 108 <div class="three-columns">
109 <!-- 三师七证栏目 --> 109 <!-- 三师七证栏目 -->
110 <div class="column-item" v-for="(item, index) in mastersList" :key="index"> 110 <div class="column-item" v-for="(item, index) in mastersList" :key="index">
111 - <div class="column-content" :style="{ backgroundImage: `url(${item.cover})` }"> 111 + <div class="column-content" :style="{ backgroundImage: `url(${item.cover + '?imageMogr2/thumbnail/100x/strip/quality/70'})` }">
112 <div class="column-overlay"></div> 112 <div class="column-overlay"></div>
113 <div class="column-text"> 113 <div class="column-text">
114 <h3 class="column-title">{{ item.name }}</h3> 114 <h3 class="column-title">{{ item.name }}</h3>
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
148 <div class="news-carousel" ref="newsCarousel"> 148 <div class="news-carousel" ref="newsCarousel">
149 <div class="news-item" v-for="(item, index) in displayNewsItems" :key="index" @click="handleNewsClick(item)"> 149 <div class="news-item" v-for="(item, index) in displayNewsItems" :key="index" @click="handleNewsClick(item)">
150 <div class="news-image"> 150 <div class="news-image">
151 - <img :src="item.image" :alt="item.title"> 151 + <img :src="item.image + '?imageMogr2/thumbnail/200x/strip/quality/70'" :alt="item.title">
152 </div> 152 </div>
153 <div class="news-content"> 153 <div class="news-content">
154 <div class="news-title">{{ item.title }}</div> 154 <div class="news-title">{{ item.title }}</div>
...@@ -202,7 +202,7 @@ const videoOptions = ref({ ...@@ -202,7 +202,7 @@ const videoOptions = ref({
202 aspectRatio: '16:9', 202 aspectRatio: '16:9',
203 controls: true, 203 controls: true,
204 preload: 'metadata', 204 preload: 'metadata',
205 - poster: 'https://cdn.ipadbiz.cn/stdj/video/workflow.jpg', 205 + poster: 'https://cdn.ipadbiz.cn/stdj/video/workflow.jpg?imageMogr2/thumbnail/200x/strip/quality/70',
206 playbackRates: [0.5, 1, 1.25, 1.5, 2], 206 playbackRates: [0.5, 1, 1.25, 1.5, 2],
207 }) 207 })
208 208
...@@ -261,7 +261,7 @@ const currentStep = computed(() => { ...@@ -261,7 +261,7 @@ const currentStep = computed(() => {
261 * @returns {Object} 内联样式对象 261 * @returns {Object} 内联样式对象
262 */ 262 */
263 const intro_background_style = computed(() => { 263 const intro_background_style = computed(() => {
264 - const url = currentStep.value && currentStep.value.cover ? currentStep.value.cover : '' 264 + const url = currentStep.value && currentStep.value.cover ? currentStep.value.cover + '?imageMogr2/thumbnail/400x/strip/quality/70' : ''
265 if (!url) return {} 265 if (!url) return {}
266 const safe_url = encodeURI(url) 266 const safe_url = encodeURI(url)
267 return { backgroundImage: 'url("' + safe_url + '")' } 267 return { backgroundImage: 'url("' + safe_url + '")' }
...@@ -759,7 +759,7 @@ const handlePhotoClick = () => { ...@@ -759,7 +759,7 @@ const handlePhotoClick = () => {
759 margin: 0 1rem; 759 margin: 0 1rem;
760 height: 3.5rem; 760 height: 3.5rem;
761 border-radius: 1rem; 761 border-radius: 1rem;
762 - background-image: url('https://cdn.ipadbiz.cn/stdj/images/%E7%85%A7%E7%89%87%E4%B8%8B%E8%BD%BD@2x.png'); 762 + background-image: url('https://cdn.ipadbiz.cn/stdj/images/%E7%85%A7%E7%89%87%E4%B8%8B%E8%BD%BD@2x.png?imageMogr2/thumbnail/200x/strip/quality/70');
763 background-size: cover; 763 background-size: cover;
764 background-position: center; 764 background-position: center;
765 background-repeat: no-repeat; 765 background-repeat: no-repeat;
...@@ -1048,7 +1048,7 @@ const handlePhotoClick = () => { ...@@ -1048,7 +1048,7 @@ const handlePhotoClick = () => {
1048 .ceremony-wrapper { 1048 .ceremony-wrapper {
1049 position: relative; 1049 position: relative;
1050 width: 100vw; 1050 width: 100vw;
1051 - background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/%E8%83%8C%E6%99%AF@2x.png'); 1051 + background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/%E8%83%8C%E6%99%AF@2x.png?imageMogr2/thumbnail/200x/strip/quality/70');
1052 background-size: cover; 1052 background-size: cover;
1053 background-position: center; 1053 background-position: center;
1054 background-repeat: no-repeat; 1054 background-repeat: no-repeat;
...@@ -1582,7 +1582,7 @@ const handlePhotoClick = () => { ...@@ -1582,7 +1582,7 @@ const handlePhotoClick = () => {
1582 .news-section { 1582 .news-section {
1583 padding: 3rem 1.5rem; 1583 padding: 3rem 1.5rem;
1584 position: relative; 1584 position: relative;
1585 - background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/%E8%83%8C%E6%99%AF@2x.png'); 1585 + background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/%E8%83%8C%E6%99%AF@2x.png?imageMogr2/thumbnail/200x/strip/quality/70');
1586 background-size: cover; 1586 background-size: cover;
1587 background-position: center; 1587 background-position: center;
1588 background-repeat: no-repeat; 1588 background-repeat: no-repeat;
...@@ -1597,7 +1597,7 @@ const handlePhotoClick = () => { ...@@ -1597,7 +1597,7 @@ const handlePhotoClick = () => {
1597 left: 0; 1597 left: 0;
1598 width: 100%; /* 可根据实际图片大小调整 */ 1598 width: 100%; /* 可根据实际图片大小调整 */
1599 height: 200px; /* 可根据实际图片大小调整 */ 1599 height: 200px; /* 可根据实际图片大小调整 */
1600 - background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/bg@2x.png'); 1600 + background-image: url('https://cdn.ipadbiz.cn/stdj/images/home/bg@2x.png?imageMogr2/thumbnail/200x/strip/quality/70');
1601 background-size: cover; 1601 background-size: cover;
1602 background-repeat: no-repeat; 1602 background-repeat: no-repeat;
1603 z-index: 1; 1603 z-index: 1;
......
...@@ -86,13 +86,13 @@ onMounted(async () => { ...@@ -86,13 +86,13 @@ onMounted(async () => {
86 id: item.id, 86 id: item.id,
87 role: item.post_excerpt, 87 role: item.post_excerpt,
88 name: item.post_title, 88 name: item.post_title,
89 - image: item.photo 89 + image: item.photo + '?imageMogr2/thumbnail/400x/strip/quality/70'
90 })) 90 }))
91 gridItems.value = gridItemsData.map(item => ({ 91 gridItems.value = gridItemsData.map(item => ({
92 id: item.id, 92 id: item.id,
93 role: item.post_excerpt, 93 role: item.post_excerpt,
94 name: item.post_title, 94 name: item.post_title,
95 - image: item.photo 95 + image: item.photo + '?imageMogr2/thumbnail/400x/strip/quality/70'
96 })) 96 }))
97 } 97 }
98 }) 98 })
......
1 <!-- 1 <!--
2 * @Date: 2025-10-30 20:00:25 2 * @Date: 2025-10-30 20:00:25
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-11-12 11:30:48 4 + * @LastEditTime: 2025-11-13 10:33:41
5 * @FilePath: /stdj_h5/src/views/MastersDetail.vue 5 * @FilePath: /stdj_h5/src/views/MastersDetail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -88,7 +88,7 @@ const loadArticleDetail = async () => { ...@@ -88,7 +88,7 @@ const loadArticleDetail = async () => {
88 id: data.id, 88 id: data.id,
89 role: data.post_excerpt, 89 role: data.post_excerpt,
90 name: data.post_title, 90 name: data.post_title,
91 - src: data?.file_list?.photo?.value, 91 + src: data?.file_list?.photo?.value + '?imageMogr2/thumbnail/400x/strip/quality/70',
92 desc: data.post_content, 92 desc: data.post_content,
93 imgs: data?.file_list?.img || [] 93 imgs: data?.file_list?.img || []
94 } 94 }
...@@ -117,7 +117,7 @@ const initWaterfallImages = function (imgs) { ...@@ -117,7 +117,7 @@ const initWaterfallImages = function (imgs) {
117 const src = typeof item === 'string' ? item : (item?.value || item?.src || '') 117 const src = typeof item === 'string' ? item : (item?.value || item?.src || '')
118 return { 118 return {
119 id: typeof item === 'object' && item?.id ? item.id : idx + 1, 119 id: typeof item === 'object' && item?.id ? item.id : idx + 1,
120 - src: src, 120 + src: src + '?imageMogr2/thumbnail/400x/strip/quality/70',
121 title: typeof item === 'object' && item?.name ? item.name : ('图片' + (idx + 1)), 121 title: typeof item === 'object' && item?.name ? item.name : ('图片' + (idx + 1)),
122 height: Math.floor(Math.random() * 200) + 200 122 height: Math.floor(Math.random() * 200) + 200
123 } 123 }
...@@ -172,7 +172,7 @@ const onImageError = function () { ...@@ -172,7 +172,7 @@ const onImageError = function () {
172 */ 172 */
173 const onImageClick = function (item) { 173 const onImageClick = function (item) {
174 const currentIndex = all_images.value.findIndex(function (img) { return img.id === item.id }) 174 const currentIndex = all_images.value.findIndex(function (img) { return img.id === item.id })
175 - const images = all_images.value.map(function (img) { return img.src }) 175 + const images = all_images.value.map(function (img) { return img.src.replace('?imageMogr2/thumbnail/400x/strip/quality/70', '') })
176 showImagePreview({ 176 showImagePreview({
177 images: images, 177 images: images,
178 startPosition: currentIndex >= 0 ? currentIndex : 0, 178 startPosition: currentIndex >= 0 ? currentIndex : 0,
......