feat: 更新图片流接口参数及样式优化
- 将图片流接口参数从cid改为i,并更新相关API和视图 - 优化首页栏目按钮样式和响应式布局 - 添加外部链接跳转支持 - 移除Rollup构建中的注释保留配置
Showing
5 changed files
with
60 additions
and
50 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-08-24 09:42:27 | 2 | * @Date: 2023-08-24 09:42:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-10-31 13:23:09 | 4 | + * @LastEditTime: 2025-11-03 15:21:35 |
| 5 | * @FilePath: /stdj_h5/src/api/index.js | 5 | * @FilePath: /stdj_h5/src/api/index.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -10,6 +10,7 @@ import { fn, fetch } from '@/api/fn'; | ... | @@ -10,6 +10,7 @@ import { fn, fetch } from '@/api/fn'; |
| 10 | const Api = { | 10 | const Api = { |
| 11 | GET_HOME: '/srv/?a=home', | 11 | GET_HOME: '/srv/?a=home', |
| 12 | GET_ARTICLE: '/srv/?a=get_article', | 12 | GET_ARTICLE: '/srv/?a=get_article', |
| 13 | + GET_ARTICLE_FILE: '/srv/?a=get_article&t=file', | ||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| ... | @@ -53,17 +54,16 @@ export const getSSQZAPI = (params) => fn(fetch.get(Api.GET_ARTICLE, params)); | ... | @@ -53,17 +54,16 @@ export const getSSQZAPI = (params) => fn(fetch.get(Api.GET_ARTICLE, params)); |
| 53 | 54 | ||
| 54 | /** | 55 | /** |
| 55 | * @description: 图片流媒体数据 | 56 | * @description: 图片流媒体数据 |
| 56 | - * @param {String} cid 分类id | 57 | + * @param {String} i 分类id |
| 57 | * @param {String} page 页码,默认0 | 58 | * @param {String} page 页码,默认0 |
| 58 | * @param {String} limit 每页数量,默认10 | 59 | * @param {String} limit 每页数量,默认10 |
| 59 | - * @returns {Object} list | 60 | + * @returns {Object} data |
| 60 | - * @property integer list.id 分类id | 61 | + * @property integer data.id 分类id |
| 61 | - * @property string list.post_title 标题/名称 | 62 | + * @property string data.post_title 标题/名称 |
| 62 | - * @property string list.post_date 发布日期 | 63 | + * @property [object] data.list 封面图列表 |
| 63 | - * @property string list.post_excerpt 简介 | 64 | + * @property string data.list.value 封面图地址 |
| 64 | - * @property string list.photo 封面图 | ||
| 65 | */ | 65 | */ |
| 66 | -export const getImgStreamAPI = (params) => fn(fetch.get(Api.GET_ARTICLE, params)); | 66 | +export const getImgStreamAPI = (params) => fn(fetch.get(Api.GET_ARTICLE_FILE, params)); |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| 69 | * @description: 文章详情数据 | 69 | * @description: 文章详情数据 | ... | ... |
| ... | @@ -99,7 +99,7 @@ | ... | @@ -99,7 +99,7 @@ |
| 99 | <div class="column-overlay"></div> | 99 | <div class="column-overlay"></div> |
| 100 | <div class="column-text"> | 100 | <div class="column-text"> |
| 101 | <h3 class="column-title">{{ item.name }}</h3> | 101 | <h3 class="column-title">{{ item.name }}</h3> |
| 102 | - <div class="more-button" @click="viewMore(item.name, item.id)"> | 102 | + <div class="more-button" @click="viewMore(item.name, item)"> |
| 103 | <span class="more-text">查看更多</span> | 103 | <span class="more-text">查看更多</span> |
| 104 | </div> | 104 | </div> |
| 105 | </div> | 105 | </div> |
| ... | @@ -280,24 +280,27 @@ watch(currentStep, () => { | ... | @@ -280,24 +280,27 @@ watch(currentStep, () => { |
| 280 | }, { deep: true }) | 280 | }, { deep: true }) |
| 281 | 281 | ||
| 282 | // 查看更多按钮点击事件 | 282 | // 查看更多按钮点击事件 |
| 283 | -const viewMore = (type, id) => { | 283 | +const viewMore = (type, item) => { |
| 284 | switch (type) { | 284 | switch (type) { |
| 285 | case '法会流程': | 285 | case '法会流程': |
| 286 | - console.log('法会流程', currentStep.value); | 286 | + // 跳转页面 |
| 287 | - // TODO: 提供URL跳转页面 | 287 | + location.href = item.category_link; |
| 288 | - location.href = 'http://www.baidu.com' | ||
| 289 | break | 288 | break |
| 290 | case '三师七证': | 289 | case '三师七证': |
| 291 | // 跳转到三师七证页面的逻辑 | 290 | // 跳转到三师七证页面的逻辑 |
| 292 | - router.push(`/masters?pid=${id}`) | 291 | + if (item.category_link) { |
| 292 | + location.href = item.category_link; | ||
| 293 | + } else { | ||
| 294 | + router.push(`/masters?pid=${item.id}`) | ||
| 295 | + } | ||
| 293 | break | 296 | break |
| 294 | case '戒子': | 297 | case '戒子': |
| 295 | // 跳转到戒子页面的逻辑 | 298 | // 跳转到戒子页面的逻辑 |
| 296 | - router.push(`/students?cid=${id}`) | 299 | + router.push(`/students?i=${item.id}`) |
| 297 | break | 300 | break |
| 298 | case '义工': | 301 | case '义工': |
| 299 | // 跳转到义工页面的逻辑 | 302 | // 跳转到义工页面的逻辑 |
| 300 | - router.push(`/volunteers?cid=${id}`) | 303 | + router.push(`/volunteers?i=${item.id}`) |
| 301 | break | 304 | break |
| 302 | } | 305 | } |
| 303 | } | 306 | } |
| ... | @@ -402,9 +405,12 @@ const attachTransitionEndOnce = (looping) => { | ... | @@ -402,9 +405,12 @@ const attachTransitionEndOnce = (looping) => { |
| 402 | 405 | ||
| 403 | // 处理新闻点击事件 | 406 | // 处理新闻点击事件 |
| 404 | const handleNewsClick = (item) => { | 407 | const handleNewsClick = (item) => { |
| 405 | - console.log('点击新闻:', item) | ||
| 406 | // 这里可以添加跳转到新闻详情页面的逻辑 | 408 | // 这里可以添加跳转到新闻详情页面的逻辑 |
| 409 | + if (item.post_link) { | ||
| 410 | + location.href = item.post_link | ||
| 411 | + } else { | ||
| 407 | router.push({ name: 'NewsDetail', params: { id: item.id } }) | 412 | router.push({ name: 'NewsDetail', params: { id: item.id } }) |
| 413 | + } | ||
| 408 | } | 414 | } |
| 409 | </script> | 415 | </script> |
| 410 | 416 | ||
| ... | @@ -659,32 +665,32 @@ const handleNewsClick = (item) => { | ... | @@ -659,32 +665,32 @@ const handleNewsClick = (item) => { |
| 659 | /* 中等屏幕 (768px - 1199px) */ | 665 | /* 中等屏幕 (768px - 1199px) */ |
| 660 | @media (min-width: 768px) and (max-width: 1199px) { | 666 | @media (min-width: 768px) and (max-width: 1199px) { |
| 661 | .column-title { | 667 | .column-title { |
| 662 | - font-size: 1.25rem; | 668 | + font-size: 1.5rem; |
| 663 | } | 669 | } |
| 664 | 670 | ||
| 665 | .column-text .more-text { | 671 | .column-text .more-text { |
| 666 | - font-size: 0.75rem; | 672 | + font-size: 0.875rem; |
| 667 | } | 673 | } |
| 668 | 674 | ||
| 669 | .column-text .more-button { | 675 | .column-text .more-button { |
| 670 | height: 2.5rem; | 676 | height: 2.5rem; |
| 671 | - width: 6rem; | 677 | + width: 100%; |
| 672 | } | 678 | } |
| 673 | } | 679 | } |
| 674 | 680 | ||
| 675 | /* 小屏幕 (481px - 767px) */ | 681 | /* 小屏幕 (481px - 767px) */ |
| 676 | @media (min-width: 481px) and (max-width: 767px) { | 682 | @media (min-width: 481px) and (max-width: 767px) { |
| 677 | .column-title { | 683 | .column-title { |
| 678 | - font-size: 1.125rem; | 684 | + font-size: 1.25rem; |
| 679 | } | 685 | } |
| 680 | 686 | ||
| 681 | .column-text .more-text { | 687 | .column-text .more-text { |
| 682 | - font-size: 0.6875rem; | 688 | + font-size: 0.875rem; |
| 683 | } | 689 | } |
| 684 | 690 | ||
| 685 | .column-text .more-button { | 691 | .column-text .more-button { |
| 686 | height: 2.25rem; | 692 | height: 2.25rem; |
| 687 | - width: 5.5rem; | 693 | + width: 100%; |
| 688 | } | 694 | } |
| 689 | 695 | ||
| 690 | .column-text { | 696 | .column-text { |
| ... | @@ -699,16 +705,16 @@ const handleNewsClick = (item) => { | ... | @@ -699,16 +705,16 @@ const handleNewsClick = (item) => { |
| 699 | } | 705 | } |
| 700 | 706 | ||
| 701 | .column-text .more-text { | 707 | .column-text .more-text { |
| 702 | - font-size: 0.625rem; | 708 | + font-size: 0.75rem; |
| 703 | } | 709 | } |
| 704 | 710 | ||
| 705 | .column-text .more-button { | 711 | .column-text .more-button { |
| 706 | height: 2rem; | 712 | height: 2rem; |
| 707 | - width: 5rem; | 713 | + width: 100%; |
| 708 | } | 714 | } |
| 709 | 715 | ||
| 710 | .column-text { | 716 | .column-text { |
| 711 | - padding: 1rem; | 717 | + padding: 1rem 0.5rem; |
| 712 | } | 718 | } |
| 713 | } | 719 | } |
| 714 | 720 | ||
| ... | @@ -742,7 +748,7 @@ const handleNewsClick = (item) => { | ... | @@ -742,7 +748,7 @@ const handleNewsClick = (item) => { |
| 742 | 748 | ||
| 743 | .column-text .more-button { | 749 | .column-text .more-button { |
| 744 | height: 1.75rem; | 750 | height: 1.75rem; |
| 745 | - width: 4.5rem; | 751 | + width: 100%; |
| 746 | } | 752 | } |
| 747 | 753 | ||
| 748 | .column-text { | 754 | .column-text { |
| ... | @@ -761,6 +767,7 @@ const handleNewsClick = (item) => { | ... | @@ -761,6 +767,7 @@ const handleNewsClick = (item) => { |
| 761 | background-attachment: fixed; | 767 | background-attachment: fixed; |
| 762 | overflow: hidden; | 768 | overflow: hidden; |
| 763 | background-color: #F2EBDB; | 769 | background-color: #F2EBDB; |
| 770 | + padding-bottom: 1.5rem; | ||
| 764 | } | 771 | } |
| 765 | 772 | ||
| 766 | /* 法会流程模块 */ | 773 | /* 法会流程模块 */ |
| ... | @@ -1090,7 +1097,9 @@ const handleNewsClick = (item) => { | ... | @@ -1090,7 +1097,9 @@ const handleNewsClick = (item) => { |
| 1090 | } | 1097 | } |
| 1091 | 1098 | ||
| 1092 | .more-button { | 1099 | .more-button { |
| 1093 | - height: 1.75rem; | 1100 | + bottom: 0.75rem; |
| 1101 | + left: 1rem; | ||
| 1102 | + height: 2.5rem; | ||
| 1094 | } | 1103 | } |
| 1095 | 1104 | ||
| 1096 | .more-text { | 1105 | .more-text { |
| ... | @@ -1119,9 +1128,9 @@ const handleNewsClick = (item) => { | ... | @@ -1119,9 +1128,9 @@ const handleNewsClick = (item) => { |
| 1119 | } | 1128 | } |
| 1120 | 1129 | ||
| 1121 | .more-button { | 1130 | .more-button { |
| 1122 | - bottom: 1rem; | 1131 | + bottom: 0.75rem; |
| 1123 | left: 1rem; | 1132 | left: 1rem; |
| 1124 | - height: 1.5rem; | 1133 | + height: 2rem; |
| 1125 | } | 1134 | } |
| 1126 | 1135 | ||
| 1127 | .more-text { | 1136 | .more-text { | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-10-30 20:52:19 | 2 | * @Date: 2025-10-30 20:52:19 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-10-31 13:19:13 | 4 | + * @LastEditTime: 2025-11-03 15:31:32 |
| 5 | * @FilePath: /stdj_h5/src/views/Students.vue | 5 | * @FilePath: /stdj_h5/src/views/Students.vue |
| 6 | * @Description: 戒子页面 - 图片瀑布流展示 | 6 | * @Description: 戒子页面 - 图片瀑布流展示 |
| 7 | --> | 7 | --> |
| ... | @@ -57,7 +57,7 @@ useTitle('同戒录') | ... | @@ -57,7 +57,7 @@ useTitle('同戒录') |
| 57 | 57 | ||
| 58 | const router = useRouter() | 58 | const router = useRouter() |
| 59 | 59 | ||
| 60 | -const cid = ref(router.currentRoute.value.query.cid) | 60 | +const i = ref(router.currentRoute.value.query.i) |
| 61 | 61 | ||
| 62 | // 响应式数据 | 62 | // 响应式数据 |
| 63 | const loading = ref(false) | 63 | const loading = ref(false) |
| ... | @@ -73,18 +73,18 @@ const onLoad = async () => { | ... | @@ -73,18 +73,18 @@ const onLoad = async () => { |
| 73 | 73 | ||
| 74 | try { | 74 | try { |
| 75 | // 调用正式接口 | 75 | // 调用正式接口 |
| 76 | - const response = await getImgStreamAPI({ | 76 | + const { code, data } = await getImgStreamAPI({ |
| 77 | - cid: cid.value, | 77 | + i: i.value, |
| 78 | page: currentPage.value, | 78 | page: currentPage.value, |
| 79 | limit: pageSize | 79 | limit: pageSize |
| 80 | }) | 80 | }) |
| 81 | 81 | ||
| 82 | - if (response && response.list) { | 82 | + if (code) { |
| 83 | - const newData = response.list.map(item => ({ | 83 | + const newData = data.list.map(item => ({ |
| 84 | id: item.id, | 84 | id: item.id, |
| 85 | - src: item.photo, // 修改为src,用于ImagePreview | 85 | + src: item.value, // 修改为src,用于ImagePreview |
| 86 | - title: item.post_title, | 86 | + title: item.name, |
| 87 | - description: item.post_excerpt, | 87 | + description: item.description, |
| 88 | date: item.post_date, | 88 | date: item.post_date, |
| 89 | height: Math.floor(Math.random() * 200) + 200 // 随机高度用于瀑布流布局 | 89 | height: Math.floor(Math.random() * 200) + 200 // 随机高度用于瀑布流布局 |
| 90 | })) | 90 | })) | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-01-01 15:20:00 | 2 | * @Date: 2025-01-01 15:20:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-10-31 16:43:29 | 4 | + * @LastEditTime: 2025-11-03 15:31:15 |
| 5 | * @FilePath: /stdj_h5/src/views/Volunteers.vue | 5 | * @FilePath: /stdj_h5/src/views/Volunteers.vue |
| 6 | * @Description: 义工页面 - 图片瀑布流展示 | 6 | * @Description: 义工页面 - 图片瀑布流展示 |
| 7 | --> | 7 | --> |
| ... | @@ -57,7 +57,7 @@ useTitle('义工') | ... | @@ -57,7 +57,7 @@ useTitle('义工') |
| 57 | 57 | ||
| 58 | const router = useRouter() | 58 | const router = useRouter() |
| 59 | 59 | ||
| 60 | -const cid = ref(router.currentRoute.value.query.cid) | 60 | +const i = ref(router.currentRoute.value.query.i) |
| 61 | 61 | ||
| 62 | // 响应式数据 | 62 | // 响应式数据 |
| 63 | const loading = ref(false) | 63 | const loading = ref(false) |
| ... | @@ -73,18 +73,18 @@ const onLoad = async () => { | ... | @@ -73,18 +73,18 @@ const onLoad = async () => { |
| 73 | 73 | ||
| 74 | try { | 74 | try { |
| 75 | // 调用正式接口 | 75 | // 调用正式接口 |
| 76 | - const response = await getImgStreamAPI({ | 76 | + const { code, data } = await getImgStreamAPI({ |
| 77 | - cid: cid.value, | 77 | + i: i.value, |
| 78 | page: currentPage.value, | 78 | page: currentPage.value, |
| 79 | limit: pageSize | 79 | limit: pageSize |
| 80 | }) | 80 | }) |
| 81 | 81 | ||
| 82 | - if (response.code && response.list) { | 82 | + if (code) { |
| 83 | - const newData = response.list.map(item => ({ | 83 | + const newData = data.list.map(item => ({ |
| 84 | id: item.id, | 84 | id: item.id, |
| 85 | - src: item.photo, | 85 | + src: item.value, |
| 86 | - title: item.post_title, | 86 | + title: item.name, |
| 87 | - description: item.post_content, | 87 | + description: item.description, |
| 88 | date: item.post_date, | 88 | date: item.post_date, |
| 89 | height: Math.floor(Math.random() * 200) + 200 // 随机高度用于瀑布流布局 | 89 | height: Math.floor(Math.random() * 200) + 200 // 随机高度用于瀑布流布局 |
| 90 | })) | 90 | })) | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-10-30 10:27:43 | 2 | * @Date: 2025-10-30 10:27:43 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-10-30 21:48:53 | 4 | + * @LastEditTime: 2025-11-03 09:48:52 |
| 5 | * @FilePath: /stdj_h5/vite.config.js | 5 | * @FilePath: /stdj_h5/vite.config.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -100,6 +100,7 @@ export default ({ command, mode }) => { | ... | @@ -100,6 +100,7 @@ export default ({ command, mode }) => { |
| 100 | chunkFileNames: 'static/js/[name]-[hash].js', | 100 | chunkFileNames: 'static/js/[name]-[hash].js', |
| 101 | entryFileNames: 'static/js/[name]-[hash].js', | 101 | entryFileNames: 'static/js/[name]-[hash].js', |
| 102 | assetFileNames: 'static/[ext]/[name]-[hash].[ext]', | 102 | assetFileNames: 'static/[ext]/[name]-[hash].[ext]', |
| 103 | + preserveComments: false // 确保 Rollup 层面也不保留 | ||
| 103 | }, | 104 | }, |
| 104 | input: { // 多页面应用模式, 打包时配置,运行配置要处理root | 105 | input: { // 多页面应用模式, 打包时配置,运行配置要处理root |
| 105 | main: path.resolve(__dirname, 'index.html'), | 106 | main: path.resolve(__dirname, 'index.html'), | ... | ... |
-
Please register or login to post a comment