refactor(index, iconfont): 重构首页横幅数据处理逻辑并更新图标字体资源
将首页重复的横幅数据标准化处理逻辑提取为独立复用函数,统一对图片和跳转地址进行修剪操作;更新图标字体源文件地址并新增faxun图标类
Showing
3 changed files
with
21 additions
and
16 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-06-28 10:33:00 | 2 | * @Date: 2025-06-28 10:33:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-06-28 10:45:27 | 4 | + * @LastEditTime: 2026-05-14 17:45:50 |
| 5 | - * @FilePath: /myApp/config/dev.js | 5 | + * @FilePath: /jls_weapp/config/dev.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | export default { | 8 | export default { |
| 9 | env: { | 9 | env: { |
| 10 | NODE_ENV: '"development"', | 10 | NODE_ENV: '"development"', |
| 11 | - API_RUNTIME_ENV: '"mock"', | 11 | + // API_RUNTIME_ENV: '"mock"', |
| 12 | + API_RUNTIME_ENV: '"production"', | ||
| 12 | }, | 13 | }, |
| 13 | logger: { | 14 | logger: { |
| 14 | quiet: false, | 15 | quiet: false, | ... | ... |
| 1 | @font-face { | 1 | @font-face { |
| 2 | font-family: "iconfont"; | 2 | font-family: "iconfont"; |
| 3 | src: | 3 | src: |
| 4 | - url("https://at.alicdn.com/t/c/font_4618760_7lrp6nlwv9y.woff2?t=1778124018667") format("woff2"), | 4 | + url("https://at.alicdn.com/t/c/font_4618760_txgalo7jre.woff2?t=1778748375247") format("woff2"), |
| 5 | - url("https://at.alicdn.com/t/c/font_4618760_7lrp6nlwv9y.woff?t=1778124018667") format("woff"), | 5 | + url("https://at.alicdn.com/t/c/font_4618760_txgalo7jre.woff?t=1778748375247") format("woff"), |
| 6 | - url("https://at.alicdn.com/t/c/font_4618760_7lrp6nlwv9y.ttf?t=1778124018667") format("truetype"); | 6 | + url("https://at.alicdn.com/t/c/font_4618760_txgalo7jre.ttf?t=1778748375247") format("truetype"); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | .iconfont { | 9 | .iconfont { |
| ... | @@ -14,6 +14,10 @@ | ... | @@ -14,6 +14,10 @@ |
| 14 | -moz-osx-font-smoothing: grayscale; | 14 | -moz-osx-font-smoothing: grayscale; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | +.icon-faxun:before { | ||
| 18 | + content: "\e6c3"; | ||
| 19 | +} | ||
| 20 | + | ||
| 17 | .icon-zanwuneirong:before { | 21 | .icon-zanwuneirong:before { |
| 18 | content: "\e64b"; | 22 | content: "\e64b"; |
| 19 | } | 23 | } | ... | ... |
| ... | @@ -104,6 +104,14 @@ const hasLink = (item) => !!getItemTargetUrl(item) | ... | @@ -104,6 +104,14 @@ const hasLink = (item) => !!getItemTargetUrl(item) |
| 104 | 104 | ||
| 105 | const isInternalMiniProgramPath = (url) => String(url || '').startsWith('/pages/') | 105 | const isInternalMiniProgramPath = (url) => String(url || '').startsWith('/pages/') |
| 106 | 106 | ||
| 107 | +const normalizeBannerItem = (item = {}) => { | ||
| 108 | + return { | ||
| 109 | + ...item, | ||
| 110 | + image_url: String(item?.value || '').trim(), | ||
| 111 | + target_url: String(item?.link || '').trim(), | ||
| 112 | + } | ||
| 113 | +} | ||
| 114 | + | ||
| 107 | const getIconClass = (item) => { | 115 | const getIconClass = (item) => { |
| 108 | const icon = item?.icon || defaultIcon | 116 | const icon = item?.icon || defaultIcon |
| 109 | const fontClass = icon.startsWith('fa-') ? 'fa' : 'iconfont' | 117 | const fontClass = icon.startsWith('fa-') ? 'fa' : 'iconfont' |
| ... | @@ -129,18 +137,10 @@ const handleLinkedItemTap = (item) => { | ... | @@ -129,18 +137,10 @@ const handleLinkedItemTap = (item) => { |
| 129 | 137 | ||
| 130 | const normalizeHomeContent = (data = {}) => ({ | 138 | const normalizeHomeContent = (data = {}) => ({ |
| 131 | volunteer_top_banner: Array.isArray(data.volunteer_top_banner) | 139 | volunteer_top_banner: Array.isArray(data.volunteer_top_banner) |
| 132 | - ? data.volunteer_top_banner.map((item) => ({ | 140 | + ? data.volunteer_top_banner.map((item) => normalizeBannerItem(item)) |
| 133 | - ...item, | ||
| 134 | - image_url: item?.link || '', | ||
| 135 | - target_url: item?.value || '', | ||
| 136 | - })) | ||
| 137 | : [], | 141 | : [], |
| 138 | volunteer_bottom_banner: Array.isArray(data.volunteer_bottom_banner) | 142 | volunteer_bottom_banner: Array.isArray(data.volunteer_bottom_banner) |
| 139 | - ? data.volunteer_bottom_banner.map((item) => ({ | 143 | + ? data.volunteer_bottom_banner.map((item) => normalizeBannerItem(item)) |
| 140 | - ...item, | ||
| 141 | - image_url: item?.link || '', | ||
| 142 | - target_url: item?.value || '', | ||
| 143 | - })) | ||
| 144 | : [], | 144 | : [], |
| 145 | volunteer_home_icon: Array.isArray(data.volunteer_home_icon) | 145 | volunteer_home_icon: Array.isArray(data.volunteer_home_icon) |
| 146 | ? data.volunteer_home_icon.map((item) => ({ | 146 | ? data.volunteer_home_icon.map((item) => ({ | ... | ... |
-
Please register or login to post a comment