From c7f431991f80d61a6d0918f231d99f529deeb4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Thu, 4 Dec 2025 11:25:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20oss=20=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.scss | 2 ++ src/components/ShareCardCanvas/index.tsx | 7 ++++--- src/config/api.ts | 3 +++ .../detail/components/SharePopup/index.tsx | 3 ++- src/game_pages/sharePoster/index.tsx | 3 ++- src/order_pages/orderDetail/index.tsx | 3 ++- src/other_pages/ntrp-evaluate/index.tsx | 7 ++++--- src/services/uploadFiles.ts | 1 - src/utils/genPoster.ts | 20 ++++++++----------- src/utils/share.ts | 7 ++++--- 10 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/app.scss b/src/app.scss index 925b969..9cb3e4f 100644 --- a/src/app.scss +++ b/src/app.scss @@ -19,6 +19,8 @@ page { @font-face { font-family: "Quicksand"; + // 注意:此路径来自 @/config/api.ts 中的 OSS_BASE_URL 配置 + // 如需修改,请更新配置文件中的 OSS_BASE_URL src: url("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/other/57dc951f-f10e-45b7-9157-0b1e468187fd.ttf") format("truetype"); font-display: swap; } \ No newline at end of file diff --git a/src/components/ShareCardCanvas/index.tsx b/src/components/ShareCardCanvas/index.tsx index 5e1cdeb..20a35b6 100644 --- a/src/components/ShareCardCanvas/index.tsx +++ b/src/components/ShareCardCanvas/index.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' import { View, Canvas } from '@tarojs/components' import Taro from '@tarojs/taro' +import { OSS_BASE_URL } from "@/config/api"; // 分享卡片数据接口 export interface ShareCardData { @@ -553,7 +554,7 @@ const ShareCardCanvas: React.FC = ({ const textX = iconX + iconSize + 20 // 绘制网球图标 - const tennisBallPath = await loadImage('https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/b3eaf45e-ef28-4e45-9195-823b832e0451.jpg') + const tennisBallPath = await loadImage(`${OSS_BASE_URL}/images/b3eaf45e-ef28-4e45-9195-823b832e0451.jpg`) ctx.drawImage(tennisBallPath, iconX, gameInfoY, iconSize, iconSize) // 绘制"单打"标签 @@ -580,7 +581,7 @@ const ShareCardCanvas: React.FC = ({ const dateX = danDaX const timeInfoY = infoStartY + infoSpacing const timeInfoFontSize = scale * 24 * dpr - const calendarPath = await loadImage("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/ea792a5d-b105-4c95-bfc4-8af558f2b33b.jpg") + const calendarPath = await loadImage(`${OSS_BASE_URL}/images/ea792a5d-b105-4c95-bfc4-8af558f2b33b.jpg`) ctx.drawImage(calendarPath, iconX, timeInfoY, iconSize, iconSize) // 绘制日期(绿色) @@ -593,7 +594,7 @@ const ShareCardCanvas: React.FC = ({ // 绘制地点 const locationInfoY = infoStartY + infoSpacing * 2 const locationFontSize = scale * 22 * dpr - const locationPath = await loadImage("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/adc9a167-2ea9-4e3b-b963-6a894a1fd91b.jpg") + const locationPath = await loadImage(`${OSS_BASE_URL}/images/adc9a167-2ea9-4e3b-b963-6a894a1fd91b.jpg`) ctx.drawImage(locationPath, iconX, locationInfoY, iconSize, iconSize) drawText(ctx, data.venueName, danDaX, locationInfoY + 10, 600, locationFontSize, '#000000') diff --git a/src/config/api.ts b/src/config/api.ts index 94de38c..e7d494b 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -1,5 +1,8 @@ import envConfig from './env'// API配置 +// OSS 基础路径配置 +export const OSS_BASE_URL = 'https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball' + export const API_CONFIG = { // 基础URL BASE_URL: envConfig.apiBaseURL, diff --git a/src/game_pages/detail/components/SharePopup/index.tsx b/src/game_pages/detail/components/SharePopup/index.tsx index cceb262..163a406 100644 --- a/src/game_pages/detail/components/SharePopup/index.tsx +++ b/src/game_pages/detail/components/SharePopup/index.tsx @@ -15,6 +15,7 @@ import CrossIcon from "@/static/detail/cross.svg"; import { genNTRPRequirementText, navto } from "@/utils/helper"; import { waitForAuthInit } from "@/utils/authInit"; import { useUserActions } from "@/store/userStore"; +import { OSS_BASE_URL } from "@/config/api"; import { generatePosterImage, base64ToTempFilePath, delay } from "@/utils"; import { DayOfWeekMap } from "../../config"; import styles from "./index.module.scss"; @@ -131,7 +132,7 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { mainCoursal: image_list[0] && image_list[0].startsWith("http") ? image_list[0] - : "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/0621b8cf-f7d6-43ad-b852-7dc39f29a782.png", + : `${OSS_BASE_URL}/images/0621b8cf-f7d6-43ad-b852-7dc39f29a782.png`, nickname, avatarUrl: avatar_url, title, diff --git a/src/game_pages/sharePoster/index.tsx b/src/game_pages/sharePoster/index.tsx index 2c6211c..a95b35c 100644 --- a/src/game_pages/sharePoster/index.tsx +++ b/src/game_pages/sharePoster/index.tsx @@ -16,6 +16,7 @@ import { useUserActions } from "@/store/userStore"; import { DayOfWeekMap } from "../detail/config"; import { genNTRPRequirementText } from "@/utils/helper"; import { waitForAuthInit } from "@/utils/authInit"; +import { OSS_BASE_URL } from "@/config/api"; import styles from "./index.module.scss"; dayjs.locale("zh-cn"); @@ -68,7 +69,7 @@ function SharePoster(props) { mainCoursal: image_list[0] && image_list[0].startsWith("http") ? image_list[0] - : "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/0621b8cf-f7d6-43ad-b852-7dc39f29a782.png", + : `${OSS_BASE_URL}/images/0621b8cf-f7d6-43ad-b852-7dc39f29a782.png`, nickname, avatarUrl: avatar_url, title, diff --git a/src/order_pages/orderDetail/index.tsx b/src/order_pages/orderDetail/index.tsx index 7ee5549..19c2565 100644 --- a/src/order_pages/orderDetail/index.tsx +++ b/src/order_pages/orderDetail/index.tsx @@ -25,6 +25,7 @@ import { useGlobalStore } from "@/store/global"; import { useOrder } from "@/store/orderStore"; import detailService, { GameData } from "@/services/detailService"; import { withAuth, RefundPopup, GeneralNavbar } from "@/components"; +import { OSS_BASE_URL } from "@/config/api"; import img from "@/config/images"; import CustomerIcon from "@/static/order/customer.svg"; import { handleCustomerService } from "@/services/userService"; @@ -299,7 +300,7 @@ function GameInfo(props) { {/* location message */} diff --git a/src/other_pages/ntrp-evaluate/index.tsx b/src/other_pages/ntrp-evaluate/index.tsx index bf90dea..d923d36 100644 --- a/src/other_pages/ntrp-evaluate/index.tsx +++ b/src/other_pages/ntrp-evaluate/index.tsx @@ -19,6 +19,7 @@ import { waitForAuthInit } from "@/utils/authInit"; import httpService from "@/services/httpService"; import DetailService from "@/services/detailService"; import { base64ToTempFilePath } from "@/utils/genPoster"; +import { OSS_BASE_URL } from "@/config/api"; import CloseIcon from "@/static/ntrp/ntrp_close_icon.svg"; import DocCopy from "@/static/ntrp/ntrp_doc_copy.svg"; import ArrowRight from "@/static/ntrp/ntrp_arrow_right.svg"; @@ -229,7 +230,7 @@ function Intro() { @@ -281,7 +282,7 @@ function Intro() { @@ -289,7 +290,7 @@ function Intro() { diff --git a/src/services/uploadFiles.ts b/src/services/uploadFiles.ts index 7988dcc..0bf757a 100644 --- a/src/services/uploadFiles.ts +++ b/src/services/uploadFiles.ts @@ -13,7 +13,6 @@ export interface UploadFilesData { is_public?: 0 | 1, } -// {"code":0,"message":"请求成功!","data":{"tags":["test"],"create_time":"2025-08-24 22:51:03","last_modify_time":"2025-08-24 22:51:03","duration":"0","thumbnail_url":"","view_count":"0","download_count":"0","id":16,"user_id":1,"resource_type":"image","file_name":"front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","original_name":"QyoUvEsLG6ci57c7e25cca0845dafed3ee1fde07876d.png","file_path":"http://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","file_url":"http://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","file_size":17756,"mime_type":"image/png","description":"test","is_public":"1","status":"active","width":0,"height":0,"uploadInfo":{"success":true,"name":"front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","path":"http://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","ossPath":"http://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png","fileType":"image/png","fileSize":17756,"originalName":"QyoUvEsLG6ci57c7e25cca0845dafed3ee1fde07876d.png","suffix":"png","storagePath":"front/ball/images/63f56978-ffe9-4397-b897-8aca6f4fdcd8.png"}}} export interface uploadFileResponse { code: number, diff --git a/src/utils/genPoster.ts b/src/utils/genPoster.ts index a690046..9c2c464 100644 --- a/src/utils/genPoster.ts +++ b/src/utils/genPoster.ts @@ -1,23 +1,19 @@ import Taro from "@tarojs/taro"; +import { OSS_BASE_URL } from "@/config/api"; -// const qrCodeUrl = -// "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/5e013195-fc79-4082-bf06-9aa79aea65ae.png"; +// const qrCodeUrl = `${OSS_BASE_URL}/images/5e013195-fc79-4082-bf06-9aa79aea65ae.png`; -const bgUrl = "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/5e2c85ab-fb0c-4026-974d-1e0725181542.png"; +const bgUrl = `${OSS_BASE_URL}/images/5e2c85ab-fb0c-4026-974d-1e0725181542.png`; -const ringUrl = - "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/b635164f-ecec-434a-a00b-69614a918f2f.png"; +const ringUrl = `${OSS_BASE_URL}/images/b635164f-ecec-434a-a00b-69614a918f2f.png`; -const dateIcon = - "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/1b49476e-0eda-42ff-b08c-002ce510df82.jpg"; +const dateIcon = `${OSS_BASE_URL}/images/1b49476e-0eda-42ff-b08c-002ce510df82.jpg`; -const mapIcon = - "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/06b994fa-9227-4708-8555-8a07af8d0c3b.jpg"; +const mapIcon = `${OSS_BASE_URL}/images/06b994fa-9227-4708-8555-8a07af8d0c3b.jpg`; -// const logo = "http://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/fb732da6-11b9-4022-a524-a377b17635eb.jpg" +// const logo = `${OSS_BASE_URL}/images/fb732da6-11b9-4022-a524-a377b17635eb.jpg` -const logoText = - "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/9d8cbc9d-9601-4e2d-ab23-76420a4537d6.png"; +const logoText = `${OSS_BASE_URL}/images/9d8cbc9d-9601-4e2d-ab23-76420a4537d6.png`; export function base64ToTempFilePath(base64Data: string): Promise { return new Promise((resolve, reject) => { diff --git a/src/utils/share.ts b/src/utils/share.ts index 1cf3000..3cfdf58 100644 --- a/src/utils/share.ts +++ b/src/utils/share.ts @@ -1,4 +1,5 @@ import Taro from '@tarojs/taro' +import { OSS_BASE_URL } from "@/config/api"; export interface ShareCardData { userAvatar: string @@ -595,7 +596,7 @@ const drawShareCard = async (ctx: any, data: ShareCardData, offscreen: any): Pro const textX = iconX + iconSize + 20 // 绘制网球图标 - const tennisBallPath = await loadImage('https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/b3eaf45e-ef28-4e45-9195-823b832e0451.jpg') + const tennisBallPath = await loadImage(`${OSS_BASE_URL}/images/b3eaf45e-ef28-4e45-9195-823b832e0451.jpg`) ctx.drawImage(tennisBallPath, iconX, gameInfoY, iconSize, iconSize) // 绘制"单打"标签 @@ -622,7 +623,7 @@ const drawShareCard = async (ctx: any, data: ShareCardData, offscreen: any): Pro const dateX = danDaX const timeInfoY = infoStartY + infoSpacing const timeInfoFontSize = scale * 24 * dpr - const calendarPath = await loadImage("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/ea792a5d-b105-4c95-bfc4-8af558f2b33b.jpg") + const calendarPath = await loadImage(`${OSS_BASE_URL}/images/ea792a5d-b105-4c95-bfc4-8af558f2b33b.jpg`) ctx.drawImage(calendarPath, iconX, timeInfoY, iconSize, iconSize) // 绘制日期(绿色) @@ -635,7 +636,7 @@ const drawShareCard = async (ctx: any, data: ShareCardData, offscreen: any): Pro // 绘制地点 const locationInfoY = infoStartY + infoSpacing * 2 const locationFontSize = scale * 22 * dpr - const locationPath = await loadImage("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/adc9a167-2ea9-4e3b-b963-6a894a1fd91b.jpg") + const locationPath = await loadImage(`${OSS_BASE_URL}/images/adc9a167-2ea9-4e3b-b963-6a894a1fd91b.jpg`) ctx.drawImage(locationPath, iconX, locationInfoY, iconSize, iconSize) drawText(ctx, data.venueName, danDaX, locationInfoY + 10, 600, locationFontSize, '#000000')