From f8d78588259a4d226eeba4d1e51b4fd1f600bdb3 Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:01:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=BC=A0=E7=BB=9F=20emoji=20=E4=B8=BA=20iconfont=20=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=9B=BE=E6=A0=87=EF=BC=8C=E6=8F=90=E5=8D=87=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E4=B8=80=E8=87=B4=E6=80=A7=E3=80=82=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E9=A1=B5=E9=9D=A2=E4=BB=A5=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B0=E5=9B=BE=E6=A0=87=E7=BB=84=E4=BB=B6=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=A8=E6=88=B7=E7=95=8C=E9=9D=A2=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E3=80=82=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=9A=84=20API=20=E5=9C=B0=E5=9D=80=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=90=AF=E7=94=A8=20URL=20=E6=A3=80=E6=9F=A5=E4=BB=A5?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=AE=89=E5=85=A8=E6=80=A7=E3=80=82=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8=E7=9A=84=20iconfo?= =?UTF-8?q?nt=20CSS=20=E6=96=87=E4=BB=B6=EF=BC=8C=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E5=AD=97=E4=BD=93=E3=80=82?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=20iconfo?= =?UTF-8?q?nt=20=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E5=9C=A8=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=B8=AD=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=9B=BE=E6=A0=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/app.js | 24 +- miniprogram/assets/iconfont.css | 434 ------------------ miniprogram/components/icon/icon.js | 64 ++- miniprogram/components/icon/icon.wxml | 8 +- miniprogram/components/icon/icon.wxss | 8 + miniprogram/pages/about/about.wxml | 2 +- miniprogram/pages/addresses/addresses.wxml | 2 +- .../avatar-nickname/avatar-nickname.wxml | 4 +- miniprogram/pages/chapters/chapters.wxml | 18 +- miniprogram/pages/gift-pay/detail.wxml | 4 +- miniprogram/pages/index/index.wxml | 12 +- miniprogram/pages/match/match.wxml | 14 +- .../pages/member-detail/member-detail.wxml | 2 +- .../pages/mentor-detail/mentor-detail.wxml | 5 +- miniprogram/pages/mentors/mentors.wxml | 5 +- miniprogram/pages/my/my.wxml | 23 +- .../pages/profile-edit/profile-edit.wxml | 6 +- .../pages/profile-show/profile-show.wxml | 2 +- miniprogram/pages/read/read.wxml | 14 +- miniprogram/pages/referral/referral.wxml | 6 +- miniprogram/pages/search/search.wxml | 2 +- miniprogram/pages/settings/settings.wxml | 8 +- miniprogram/pages/vip/vip.js | 2 +- miniprogram/project.private.config.json | 2 +- miniprogram/static/iconfont.wxss | 121 +++++ 25 files changed, 289 insertions(+), 503 deletions(-) delete mode 100644 miniprogram/assets/iconfont.css create mode 100644 miniprogram/static/iconfont.wxss diff --git a/miniprogram/app.js b/miniprogram/app.js index 681faff1..319dbf3e 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -14,8 +14,8 @@ App({ globalData: { // API 基础地址:开发时修改下面一行切换环境 // baseUrl: "https://soulapi.quwanzhi.com", - baseUrl: 'http://localhost:8080', // 开发 - // baseUrl: 'https://souldev.quwanzhi.com', // 测试 + // baseUrl: 'http://localhost:8080', // 开发 + baseUrl: 'https://souldev.quwanzhi.com', // 测试 // 小程序配置 - 真实AppID appId: DEFAULT_APP_ID, @@ -84,6 +84,9 @@ App({ onLaunch(options) { this.globalData.readSectionIds = wx.getStorageSync('readSectionIds') || [] + // 加载 iconfont(字体图标)。注意:小程序不支持在 wxss 里用本地 @font-face 引用字体文件, + // 需使用 loadFontFace 动态加载(字体文件建议走 https CDN)。 + this.loadIconFont() // 获取系统信息 this.getSystemInfo() @@ -111,6 +114,23 @@ App({ // 处理分享参数(推荐码绑定) this.handleReferralCode(options) }, + + // 动态加载 iconfont(避免本地 @font-face 触发 do-not-use-local-path) + loadIconFont() { + if (!wx.loadFontFace) return + // 来自 iconfont 项目(Project id 5142223) + // 线上/真机需把 at.alicdn.com 加入「downloadFile 合法域名」 + const urlWoff2 = 'https://at.alicdn.com/t/c/font_5142223_1sq6pv9vvbt.woff2' + wx.loadFontFace({ + family: 'iconfont', + source: `url("${urlWoff2}")`, + global: true, + success: () => {}, + fail: (e) => { + console.warn('[Iconfont] loadFontFace failed:', e) + }, + }) + }, // 小程序显示时:处理分享参数、检测更新、刷新审核模式(从后台切回时) onShow(options) { diff --git a/miniprogram/assets/iconfont.css b/miniprogram/assets/iconfont.css deleted file mode 100644 index 311e2b1f..00000000 --- a/miniprogram/assets/iconfont.css +++ /dev/null @@ -1,434 +0,0 @@ -@font-face { - font-family: "iconfont"; /* Project id 5142223 */ - src: url('//at.alicdn.com/t/c/font_5142223_1sq6pv9vvbt.woff2?t=1773819902347') format('woff2'), - url('//at.alicdn.com/t/c/font_5142223_1sq6pv9vvbt.woff?t=1773819902347') format('woff'), - url('//at.alicdn.com/t/c/font_5142223_1sq6pv9vvbt.ttf?t=1773819902347') format('truetype'); -} - -.iconfont { - font-family: "iconfont" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.icon-wallet:before { - content: "\e6c8"; -} - -.icon-gift:before { - content: "\e6c9"; -} - -.icon-zap1:before { - content: "\e75c"; -} - -.icon-user:before { - content: "\e6b9"; -} - -.icon-upload:before { - content: "\e6ba"; -} - -.icon-work:before { - content: "\e6bb"; -} - -.icon-training:before { - content: "\e6bc"; -} - -.icon-warning:before { - content: "\e6bd"; -} - -.icon-zoom-in:before { - content: "\e6be"; -} - -.icon-zoom-out:before { - content: "\e6bf"; -} - -.icon-arrow-left-bold:before { - content: "\e6c1"; -} - -.icon-arrow-up-bold:before { - content: "\e6c2"; -} - -.icon-close-bold:before { - content: "\e6c3"; -} - -.icon-arrow-down-bold:before { - content: "\e6c4"; -} - -.icon-minus-bold:before { - content: "\e6c5"; -} - -.icon-arrow-right-bold:before { - content: "\e6c6"; -} - -.icon-select-bold:before { - content: "\e6c7"; -} - -.icon-money-wallet:before { - content: "\e833"; -} - -.icon-book-open:before { - content: "\e993"; -} - -.icon-biaoshilei_yonghuzu:before { - content: "\e61b"; -} - -.icon-add:before { - content: "\e664"; -} - -.icon-add-circle:before { - content: "\e665"; -} - -.icon-adjust:before { - content: "\e666"; -} - -.icon-arrow-up-circle:before { - content: "\e667"; -} - -.icon-arrow-right-circle:before { - content: "\e668"; -} - -.icon-arrow-down:before { - content: "\e669"; -} - -.icon-ashbin:before { - content: "\e66a"; -} - -.icon-arrow-right:before { - content: "\e66b"; -} - -.icon-browse:before { - content: "\e66c"; -} - -.icon-bottom:before { - content: "\e66d"; -} - -.icon-back:before { - content: "\e66e"; -} - -.icon-bad:before { - content: "\e66f"; -} - -.icon-arrow-left-circle:before { - content: "\e670"; -} - -.icon-camera:before { - content: "\e671"; -} - -.icon-chart-bar:before { - content: "\e672"; -} - -.icon-attachment:before { - content: "\e673"; -} - -.icon-code:before { - content: "\e674"; -} - -.icon-close:before { - content: "\e675"; -} - -.icon-check-item:before { - content: "\e676"; -} - -.icon-calendar:before { - content: "\e677"; -} - -.icon-comment:before { - content: "\e678"; -} - -.icon-complete:before { - content: "\e679"; -} - -.icon-direction-down:before { - content: "\e67a"; -} - -.icon-direction-down-circle:before { - content: "\e67b"; -} - -.icon-direction-right:before { - content: "\e67c"; -} - -.icon-direction-up:before { - content: "\e67d"; -} - -.icon-discount:before { - content: "\e67e"; -} - -.icon-direction-left:before { - content: "\e67f"; -} - -.icon-download:before { - content: "\e680"; -} - -.icon-electronics:before { - content: "\e681"; -} - -.icon-elipsis:before { - content: "\e682"; -} - -.icon-export:before { - content: "\e683"; -} - -.icon-explain:before { - content: "\e684"; -} - -.icon-edit:before { - content: "\e685"; -} - -.icon-eye-close:before { - content: "\e686"; -} - -.icon-email:before { - content: "\e687"; -} - -.icon-error:before { - content: "\e688"; -} - -.icon-favorite:before { - content: "\e689"; -} - -.icon-file-common:before { - content: "\e68a"; -} - -.icon-file-delete:before { - content: "\e68b"; -} - -.icon-file-add:before { - content: "\e68c"; -} - -.icon-film:before { - content: "\e68d"; -} - -.icon-fabulous:before { - content: "\e68e"; -} - -.icon-file:before { - content: "\e68f"; -} - -.icon-folder-close:before { - content: "\e690"; -} - -.icon-filter:before { - content: "\e691"; -} - -.icon-good:before { - content: "\e692"; -} - -.icon-hide:before { - content: "\e693"; -} - -.icon-home:before { - content: "\e694"; -} - -.icon-file-open:before { - content: "\e695"; -} - -.icon-forward:before { - content: "\e696"; -} - -.icon-import:before { - content: "\e697"; -} - -.icon-layers:before { - content: "\e698"; -} - -.icon-lock:before { - content: "\e699"; -} - -.icon-map:before { - content: "\e69a"; -} - -.icon-menu:before { - content: "\e69b"; -} - -.icon-help:before { - content: "\e69c"; -} - -.icon-minus-circle:before { - content: "\e69d"; -} - -.icon-notification:before { - content: "\e69e"; -} - -.icon-more:before { - content: "\e69f"; -} - -.icon-mobile-phone:before { - content: "\e6a0"; -} - -.icon-minus:before { - content: "\e6a1"; -} - -.icon-navigation:before { - content: "\e6a2"; -} - -.icon-prompt:before { - content: "\e6a3"; -} - -.icon-refresh:before { - content: "\e6a4"; -} - -.icon-run-up:before { - content: "\e6a5"; -} - -.icon-picture:before { - content: "\e6a6"; -} - -.icon-run-in:before { - content: "\e6a7"; -} - -.icon-pin:before { - content: "\e6a8"; -} - -.icon-save:before { - content: "\e6a9"; -} - -.icon-search:before { - content: "\e6aa"; -} - -.icon-share:before { - content: "\e6ab"; -} - -.icon-scanning:before { - content: "\e6ac"; -} - -.icon-security:before { - content: "\e6ad"; -} - -.icon-sign-out:before { - content: "\e6ae"; -} - -.icon-select:before { - content: "\e6af"; -} - -.icon-stop:before { - content: "\e6b0"; -} - -.icon-success:before { - content: "\e6b1"; -} - -.icon-switch:before { - content: "\e6b2"; -} - -.icon-setting:before { - content: "\e6b3"; -} - -.icon-survey:before { - content: "\e6b4"; -} - -.icon-time:before { - content: "\e6b5"; -} - -.icon-telephone:before { - content: "\e6b6"; -} - -.icon-top:before { - content: "\e6b7"; -} - -.icon-unlock:before { - content: "\e6b8"; -} diff --git a/miniprogram/components/icon/icon.js b/miniprogram/components/icon/icon.js index 8c0e59cb..91676abc 100644 --- a/miniprogram/components/icon/icon.js +++ b/miniprogram/components/icon/icon.js @@ -31,7 +31,8 @@ Component({ }, data: { - svgData: '' + svgData: '', + fontGlyph: '' }, lifetimes: { @@ -41,6 +42,54 @@ Component({ }, methods: { + // iconfont 映射:将业务 name(lucide 风格)映射到 iconfont 的 unicode(形如 "\ue6aa") + // 小程序不支持通过 :before { content } 渲染,因此必须直接输出 unicode 字符 + getFontGlyph(name) { + const map = { + // 基础高频(来自 static/iconfont.css 的 content 值) + 'wallet': '\ue6c8', + 'gift': '\ue6c9', + 'user': '\ue6b9', + 'search': '\ue6aa', + 'share': '\ue6ab', + 'home': '\ue694', + 'lock': '\ue699', + 'camera': '\ue671', + 'warning': '\ue6bd', + + // 箭头/展开 + 'chevron-left': '\ue6c1', + 'chevron-right': '\ue6c6', + 'chevron-down': '\ue6c4', + 'chevron-up': '\ue6c2', + 'arrow-up-right': '\ue6c2', + + // 交互/状态 + 'x': '\ue6c3', + 'check': '\ue6c7', + 'plus': '\ue664', + 'trash-2': '\ue66a', + 'pencil': '\ue685', + 'zap': '\ue75c', + 'info': '\ue69c', + + // 语义近似映射(iconfont 不一定有同名) + 'map-pin': '\ue6a8', + 'message-circle': '\ue678', + 'smartphone': '\ue6a0', + 'refresh-cw': '\ue6a4', + 'shield': '\ue6ad', + 'star': '\ue689', + 'heart': '\ue68e', + + // 其他:若 iconfont 里不存在,则继续走 SVG 兜底 + 'book-open': '\ue993', + 'bar-chart': '\ue672', + 'clock': '\ue6b5', + } + return map[name] || '' + }, + // SVG 图标数据映射(Lucide 风格,替换原 emoji) getSvgPath(name) { const s = '' @@ -96,8 +145,15 @@ Component({ // 更新图标 updateIcon() { const { name, color } = this.data + const fontGlyph = this.getFontGlyph(name) let svgString = this.getSvgPath(name) + // 若 iconfont 存在映射,则优先用字体图标;否则走 SVG + if (fontGlyph) { + this.setData({ fontGlyph, svgData: '' }) + return + } + if (svgString) { // 替换颜色占位符 svgString = svgString.replace(/COLOR/g, color) @@ -106,11 +162,13 @@ Component({ const svgData = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgString)}` this.setData({ - svgData: svgData + svgData: svgData, + fontGlyph: '' }) } else { this.setData({ - svgData: '' + svgData: '', + fontGlyph: '' }) } } diff --git a/miniprogram/components/icon/icon.wxml b/miniprogram/components/icon/icon.wxml index b1c29a25..1fe32f96 100644 --- a/miniprogram/components/icon/icon.wxml +++ b/miniprogram/components/icon/icon.wxml @@ -1,5 +1,11 @@ - + + {{fontGlyph}} + {{name}} diff --git a/miniprogram/components/icon/icon.wxss b/miniprogram/components/icon/icon.wxss index d12d2a0a..acdd180a 100644 --- a/miniprogram/components/icon/icon.wxss +++ b/miniprogram/components/icon/icon.wxss @@ -1,4 +1,5 @@ /* components/icon/icon.wxss */ + .icon { display: inline-flex; align-items: center; @@ -6,6 +7,13 @@ flex-shrink: 0; } +.iconfont { + font-family: "iconfont" !important; + display: inline-flex; + align-items: center; + justify-content: center; +} + .icon-image { display: block; width: 100%; diff --git a/miniprogram/pages/about/about.wxml b/miniprogram/pages/about/about.wxml index 8ad748aa..5966329f 100644 --- a/miniprogram/pages/about/about.wxml +++ b/miniprogram/pages/about/about.wxml @@ -30,7 +30,7 @@ - + {{item}} diff --git a/miniprogram/pages/addresses/addresses.wxml b/miniprogram/pages/addresses/addresses.wxml index dbdf8da8..5c5105ee 100644 --- a/miniprogram/pages/addresses/addresses.wxml +++ b/miniprogram/pages/addresses/addresses.wxml @@ -42,7 +42,7 @@ bindtap="editAddress" data-id="{{item.id}}" > - ✏️ + 编辑 完善更多资料 - + - + 使用微信头像 点击下方按钮,一键同步当前微信头像 diff --git a/miniprogram/pages/chapters/chapters.wxml b/miniprogram/pages/chapters/chapters.wxml index 5d584051..b4a3a189 100644 --- a/miniprogram/pages/chapters/chapters.wxml +++ b/miniprogram/pages/chapters/chapters.wxml @@ -6,7 +6,7 @@ - 🔍 + 目录 @@ -37,7 +37,7 @@ - 📚 + 一场SOUL的创业实验场 @@ -54,12 +54,12 @@ - 📖 + 序言|为什么我每天早上6点在Soul开播? 免费 - + @@ -77,7 +77,7 @@ {{item.chapters.length || item.chapterCount}}章 - + @@ -99,7 +99,7 @@ 免费 已解锁 ¥{{section.price}} - + @@ -113,12 +113,12 @@ - 📖 + 尾声|这本书的真实目的 免费 - + @@ -135,7 +135,7 @@ data-mid="{{item.mid}}" > {{item.title}} - + diff --git a/miniprogram/pages/gift-pay/detail.wxml b/miniprogram/pages/gift-pay/detail.wxml index 727bd157..36d4fd74 100644 --- a/miniprogram/pages/gift-pay/detail.wxml +++ b/miniprogram/pages/gift-pay/detail.wxml @@ -144,7 +144,7 @@ @@ -97,7 +97,7 @@ 精选推荐 {{featuredExpandedLoading ? '加载中...' : (featuredExpanded ? '收起' : '展开更多')}} - {{featuredExpanded ? '▲' : '▼'}} + @@ -116,7 +116,7 @@ {{item.title}} - + @@ -131,7 +131,7 @@ {{latestExpanded ? '收起' : '展开更多'}} - {{latestExpanded ? '▲' : '▼'}} + diff --git a/miniprogram/pages/match/match.wxml b/miniprogram/pages/match/match.wxml index fed65336..b1ea6ae8 100644 --- a/miniprogram/pages/match/match.wxml +++ b/miniprogram/pages/match/match.wxml @@ -16,7 +16,7 @@ - + 今日免费次数已用完 购买次数 @@ -36,7 +36,7 @@ - + 购买次数 ¥1 = 1次匹配 @@ -102,9 +102,9 @@ 正在匹配{{currentTypeLabel}}... 正在从 {{matchAttempts * 127 + 89}} 位创业者中为你寻找 - ✓ 分析兴趣标签 - ✓ 匹配创业方向 - ✓ 筛选优质伙伴 + 分析兴趣标签 + 匹配创业方向 + 筛选优质伙伴 取消 @@ -183,7 +183,7 @@ {{joinTypeLabel}} 请先绑定联系方式 填写联系方式,专人对接 - + @@ -299,7 +299,7 @@ - + 购买匹配次数 今日3次免费匹配已用完,可付费购买额外次数 diff --git a/miniprogram/pages/member-detail/member-detail.wxml b/miniprogram/pages/member-detail/member-detail.wxml index c6dbb790..b96e244c 100644 --- a/miniprogram/pages/member-detail/member-detail.wxml +++ b/miniprogram/pages/member-detail/member-detail.wxml @@ -132,7 +132,7 @@ 成为超级个体 - + diff --git a/miniprogram/pages/mentor-detail/mentor-detail.wxml b/miniprogram/pages/mentor-detail/mentor-detail.wxml index 6ec7ecf1..a587b372 100644 --- a/miniprogram/pages/mentor-detail/mentor-detail.wxml +++ b/miniprogram/pages/mentor-detail/mentor-detail.wxml @@ -81,7 +81,7 @@ 选择咨询项目 - + - {{creating ? '处理中...' : '确认选择 →'}} + {{creating ? '处理中...' : '确认选择'}} + 点击确认即代表同意 服务协议 diff --git a/miniprogram/pages/mentors/mentors.wxml b/miniprogram/pages/mentors/mentors.wxml index 35b4de96..0962dda1 100644 --- a/miniprogram/pages/mentors/mentors.wxml +++ b/miniprogram/pages/mentors/mentors.wxml @@ -37,7 +37,10 @@ 推荐导师 - 查看全部 › + + 查看全部 + + 加载中... diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 75b951d5..758d94df 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -91,7 +91,10 @@ 将依次调起微信收款页完成领取 - 查看提现记录 › + + 查看提现记录 + + @@ -144,7 +147,7 @@ 暂无阅读记录 - 去阅读 → + 去阅读 @@ -155,21 +158,21 @@ 我的订单 - + 我的代付 - + 设置 - + @@ -177,7 +180,7 @@