From 44479dcb86c45a6477daeee04060e6cc8b838eb3 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 14 Oct 2026 17:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=A1=B5=E9=9D=A2=E7=BC=A9?= =?UTF-8?q?=E7=95=A5=E5=9B=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/application/api/controller/Common.php | 3 +++ .../miniapp/pages/promoter/index/index.js | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/backend/application/api/controller/Common.php b/backend/application/api/controller/Common.php index a9111a8..bfa679e 100644 --- a/backend/application/api/controller/Common.php +++ b/backend/application/api/controller/Common.php @@ -184,6 +184,7 @@ class Common extends Api $toLabels = function ($value) { return array_values(array_filter(array_map('trim', explode(',', $value ?? '')))); }; + $shareImage = config('site.promotion_share_image') ?? ''; $config = [ 'languageLabels' => $toLabels($code_languages), 'frontLabels' => $toLabels($front_techs), @@ -192,6 +193,8 @@ class Common extends Api 'developTypes' => $developTypes, // 平台服务费比例(0~1),前端据此计算开发者预计到手金额 'platform_commission_ratio' => (float)DemandService::getPlatformCommissionRatio(), + // 推广分享卡片预览图,未配置时为空 + 'promotion_share_image' => $shareImage ? cdnurl($shareImage, true) : '', ]; $this->success('', $config); diff --git a/frontend/miniapp/pages/promoter/index/index.js b/frontend/miniapp/pages/promoter/index/index.js index 9e5a1e5..7c19ee0 100644 --- a/frontend/miniapp/pages/promoter/index/index.js +++ b/frontend/miniapp/pages/promoter/index/index.js @@ -1,5 +1,6 @@ // pages/promoter/index/index.js import { fetchPromoterInfo, fetchPromoterOrders, fetchPromoterQrcode } from '../../../services/promoter/fetchPromoter'; +import { fetchConfig } from '../../../services/home/home'; import { withPromoter } from '../../../utils/promoter'; const PAGE_SIZE = 10; @@ -21,11 +22,24 @@ Page({ qrcode: '', // 推广小程序码 data URL qrcodeLoading: false, // 推广码生成中 saving: false, // 保存推广码中 + shareImage: '', // 分享卡片预览图(后台配置 site.promotion_share_image),为空时微信默认截取当前页 }, onLoad() { this.loadOverview(); this.loadList(true); + this.loadShareImage(); + }, + + async loadShareImage() { + try { + const res = await fetchConfig(); + if (res.code === 1 && res.data?.promotion_share_image) { + this.setData({ shareImage: res.data.promotion_share_image }); + } + } catch (err) { + console.error('loadShareImage failed:', err); + } }, async onPullDownRefresh() { @@ -40,10 +54,14 @@ Page({ }, onShareAppMessage() { - return { + const share = { title: '代码帮 - 软件商城与定制开发平台', path: withPromoter('/pages/home/home'), }; + if (this.data.shareImage) { + share.imageUrl = this.data.shareImage; + } + return share; }, async loadOverview() {