diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..2c181c4 --- /dev/null +++ b/.env.dev @@ -0,0 +1,2 @@ +APP_ENV=dev +TARO_APP_ID=wx815b533167eb7b53 diff --git a/.env.dev_local b/.env.dev_local new file mode 100644 index 0000000..066bf5c --- /dev/null +++ b/.env.dev_local @@ -0,0 +1,2 @@ +APP_ENV=dev_local +TARO_APP_ID=wx815b533167eb7b53 diff --git a/.env.pr b/.env.pr new file mode 100644 index 0000000..57ad172 --- /dev/null +++ b/.env.pr @@ -0,0 +1,2 @@ +APP_ENV=pr +TARO_APP_ID=wx915ecf6c01bea4ec diff --git a/.env.sit b/.env.sit new file mode 100644 index 0000000..5085367 --- /dev/null +++ b/.env.sit @@ -0,0 +1,2 @@ +APP_ENV=sit +TARO_APP_ID=wx815b533167eb7b53 diff --git a/.gitignore b/.gitignore index ddaf3df..ebe3e16 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ node_modules/ src/config/env.ts .vscode *.http -env.ts + diff --git a/config/env.config.ts b/config/env.config.ts new file mode 100644 index 0000000..dc38fd9 --- /dev/null +++ b/config/env.config.ts @@ -0,0 +1,79 @@ +/** + * 统一环境配置(dev/sit/pr) + * 构建时通过 APP_ENV 选择,defineConstants 注入业务代码 + * project.config.json 的 appid 由 scripts/sync-project-config.js 同步 + */ + +export type EnvType = "dev" | "dev_local" | "sit" | "pr"; + +export interface EnvConfig { + name: string; + apiBaseURL: string; + ossBaseURL: string; + appid: string; + timeout: number; + enableLog: boolean; + enableMock: boolean; + customerService: { + corpId: string; + serviceUrl: string; + }; +} + +const baseConfig = { + apiBaseURL: "https://tennis.bimwe.com", + ossBaseURL: "https://bimwe-oss.oss-cn-shanghai.aliyuncs.com", + appid: "wx815b533167eb7b53", // 测试号 + timeout: 15000, + enableLog: true, + enableMock: false, + customerService: { + corpId: "ww51fc969e8b76af82", + serviceUrl: "https://work.weixin.qq.com/kfid/kfc64085b93243c5c91", + }, +} + +export const envConfigs: Record = { + // 本地开发:API 指向本地或测试服 + dev: { + name: "DEV", + // apiBaseURL: "http://localhost:9098", + ...baseConfig + }, + // 本地联调:API 指向本机 + dev_local: { + name: "DEV_LOCAL", + + ...Object.assign(baseConfig, { + apiBaseURL: "http://localhost:9098", + }) + + }, + + // SIT 测试环境 + sit: { + name: "SIT", + ...Object.assign(baseConfig, { + apiBaseURL: "https://tennis.bimwe.com", + }) + }, + + // PR 生产环境 + pr: { + name: "PR", + apiBaseURL: "https://youchang.qiongjingtiyu.com", + ossBaseURL: "https://youchang2026.oss-cn-shanghai.aliyuncs.com", + appid: "wx915ecf6c01bea4ec", // 生产小程序 appid,按实际填写 + timeout: 10000, + enableLog: false, + enableMock: false, + customerService: { + corpId: "ww9a2d9a5d9410c664", + serviceUrl: "https://work.weixin.qq.com/kfid/kfcd355e162e0390684", + }, + }, +}; + +export function getEnvConfig(env: EnvType): EnvConfig { + return envConfigs[env]; +} diff --git a/config/index.ts b/config/index.ts index 56b2b5f..cee913f 100644 --- a/config/index.ts +++ b/config/index.ts @@ -2,11 +2,21 @@ import { defineConfig, type UserConfigExport } from '@tarojs/cli' import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' import devConfig from './dev' import prodConfig from './prod' -// import vitePluginImp from 'vite-plugin-imp' +import { getEnvConfig, type EnvType } from './env.config' import path from 'path' +// 环境:dev(本地) | dev_local(联调) | sit(测试) | pr(生产) +const ENV_LIST: EnvType[] = ['dev', 'dev_local', 'sit', 'pr'] + // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 export default defineConfig<'webpack5'>(async (merge, { command, mode }) => { + const appEnv = ( + (ENV_LIST.includes(mode as EnvType) ? mode : process.env.APP_ENV) || + (process.env.NODE_ENV === 'production' ? 'pr' : 'dev') + ) as EnvType + + const envConfig = getEnvConfig(appEnv) + const baseConfig: UserConfigExport<'webpack5'> = { projectName: 'playBallTogether', date: '2025-8-9', @@ -22,6 +32,13 @@ export default defineConfig<'webpack5'>(async (merge, { command, mode }) => { outputRoot: 'dist', plugins: ['@tarojs/plugin-html'], defineConstants: { + 'process.env.APP_ENV': JSON.stringify(appEnv), + 'process.env.API_BASE_URL': JSON.stringify(envConfig.apiBaseURL), + 'process.env.OSS_BASE_URL': JSON.stringify(envConfig.ossBaseURL), + 'process.env.ENABLE_LOG': JSON.stringify(envConfig.enableLog), + 'process.env.TIMEOUT': JSON.stringify(envConfig.timeout), + 'process.env.CUSTOMER_CORP_ID': JSON.stringify(envConfig.customerService.corpId), + 'process.env.CUSTOMER_SERVICE_URL': JSON.stringify(envConfig.customerService.serviceUrl), }, alias: { '@': path.resolve(__dirname, '..', 'src'), @@ -76,6 +93,9 @@ export default defineConfig<'webpack5'>(async (merge, { command, mode }) => { }, // @ts-expect-error: Taro 类型定义缺少 mini.hot hot: true, + projectConfig: { + appid: envConfig.appid, + }, }, h5: { publicPath: '/', diff --git a/package.json b/package.json index 5143872..1fc0a64 100644 --- a/package.json +++ b/package.json @@ -10,32 +10,17 @@ "framework": "React" }, "scripts": { - "build": "npm run build:weapp ", - "dev": "npm run dev:weapp ", - "build:weapp": "taro build --type weapp --mode production", - "build:swan": "taro build --type swan", - "build:alipay": "taro build --type alipay", - "build:tt": "taro build --type tt", - "build:h5": "taro build --type h5", - "build:rn": "taro build --type rn", - "build:qq": "taro build --type qq", - "build:jd": "taro build --type jd", - "build:quickapp": "taro build --type quickapp", - "dev:weapp": "npm run build:weapp -- --watch", - "dev:swan": "npm run build:swan -- --watch", - "dev:alipay": "npm run build:alipay -- --watch", - "dev:tt": "npm run build:tt -- --watch", - "dev:h5": "npm run build:h5 -- --watch", - "dev:rn": "npm run build:rn -- --watch", - "dev:qq": "npm run build:qq -- --watch", - "dev:jd": "npm run build:jd -- --watch", - "dev:quickapp": "npm run build:quickapp -- --watch" + "dev": "npm run dev:weapp", + "dev:local": "npm run dev:weapp:dev_local", + "dev:weapp": "node scripts/sync-project-config.js dev && taro build --type weapp --mode dev --watch", + "dev:weapp:dev_local": "node scripts/sync-project-config.js dev_local && taro build --type weapp --mode dev_local --watch", + "build": "npm run build:weapp", + "build:weapp": "node scripts/sync-project-config.js pr && taro build --type weapp --mode pr", + "build:sit": "node scripts/sync-project-config.js sit && taro build --type weapp --mode sit", + "build:pr": "node scripts/sync-project-config.js pr && taro build --type weapp --mode pr", + "dev:h5": "npm run build:h5 -- --watch" }, - "browserslist": [ - "last 3 versions", - "Android >= 4.1", - "ios >= 8" - ], + "browserslist": ["last 3 versions", "Android >= 4.1", "ios >= 8"], "author": "", "dependencies": { "@babel/plugin-transform-runtime": "^7.28.3", diff --git a/scripts/sync-project-config.js b/scripts/sync-project-config.js new file mode 100644 index 0000000..2156f6e --- /dev/null +++ b/scripts/sync-project-config.js @@ -0,0 +1,25 @@ +const fs = require('fs'); +const path = require('path'); + +require('ts-node/register/transpile-only'); + +const envArg = process.argv[2]; +const appEnv = envArg || process.env.APP_ENV || (process.env.NODE_ENV === 'production' ? 'pr' : 'dev'); + +const envConfigPath = path.resolve(__dirname, '../config/env.config.ts'); +const { envConfigs } = require(envConfigPath); + +const config = envConfigs[appEnv]; +if (!config) { + console.error(`[sync-project-config] Unknown APP_ENV: ${appEnv}`); + process.exit(1); +} + +const projectConfigPath = path.resolve(__dirname, '../project.config.json'); +const projectConfigRaw = fs.readFileSync(projectConfigPath, 'utf-8'); +const projectConfig = JSON.parse(projectConfigRaw); + +projectConfig.appid = config.appid; + +fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2) + '\n', 'utf-8'); +console.log(`[sync-project-config] project.config.json appid -> ${config.appid} (${appEnv})`); diff --git a/src/components/CustomPopup/CustomPopup.tsx b/src/components/CustomPopup/CustomPopup.tsx new file mode 100644 index 0000000..002c658 --- /dev/null +++ b/src/components/CustomPopup/CustomPopup.tsx @@ -0,0 +1,208 @@ +import React, { useRef, useState, useEffect } from 'react' +import type { CSSProperties, ReactNode } from 'react' +import { View, Text } from '@tarojs/components' +import { Button } from '@nutui/nutui-react-taro' +import { useKeyboardHeight } from '@/store/keyboardStore' +import styles from './index.module.scss' + +export interface CustomPopupProps { + visible: boolean + onClose: () => void + title?: ReactNode + showHeader?: boolean + hideFooter?: boolean + cancelText?: string + confirmText?: string + onCancel?: () => void + onConfirm?: () => void + children?: ReactNode + className?: string + style?: CSSProperties + // 与 CommonPopup 保持入参一致 + position?: 'center' | 'bottom' | 'top' | 'left' | 'right' + round?: boolean + zIndex?: number + enableDragToClose?: boolean +} + +const CustomPopup: React.FC = ({ + visible, + onClose, + title, + showHeader = false, + hideFooter = false, + cancelText = '返回', + confirmText = '完成', + onCancel, + onConfirm, + children, + className, + style, + position = 'bottom', + round = true, + zIndex, + enableDragToClose = true, +}) => { + const [dragOffset, setDragOffset] = useState(0) + const [isDragging, setIsDragging] = useState(false) + const touchStartY = useRef(0) + + // 使用全局键盘状态 + const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener } = useKeyboardHeight() + + // 使用全局键盘状态监听 + useEffect(() => { + // 初始化全局键盘监听器 + initializeKeyboardListener() + + // 添加本地监听器 + const removeListener = addListener((height, visible) => { + console.log('CustomPopup 收到键盘变化:', height, visible) + }) + + return () => { + removeListener() + } + }, [initializeKeyboardListener, addListener]) + + if (!visible) { + return null + } + + const handleCancel = () => { + if (onCancel) { + onCancel() + } else { + onClose() + } + } + + const handleTouchStart = (e: any) => { + if (!enableDragToClose) return + + touchStartY.current = e.touches[0].clientY + setIsDragging(true) + } + + const handleTouchMove = (e: any) => { + if (!enableDragToClose || !isDragging) return + + const currentY = e.touches[0].clientY + const deltaY = currentY - touchStartY.current + + if (deltaY > 0) { + setDragOffset(Math.min(deltaY, 100)) + } + } + + const handleTouchEnd = () => { + if (!enableDragToClose || !isDragging) return + + setIsDragging(false) + + if (dragOffset > 50) { + onClose() + } + + setDragOffset(0) + } + + const overlayAlignItems = + position === 'center' + ? 'center' + : position === 'top' + ? 'flex-start' + : 'flex-end' + + const handleOverlayClick = () => { + onClose() + } + + // 阻止弹窗内的触摸事件冒泡 + const handleTouchMoveInPopup = (e: any) => { + if (!isKeyboardVisible) { + e.stopPropagation() + } + } + + + return ( + + + { + e.stopPropagation() + }} + > + {enableDragToClose && ( + + + + )} + + {showHeader && ( + + {typeof title === 'string' ? ( + {title} + ) : ( + title + )} + + + + + + + + )} + + {children} + + {!hideFooter && !isKeyboardVisible && ( + + + + + )} + + + ) +} + +export default CustomPopup + diff --git a/src/components/CustomPopup/index.module.scss b/src/components/CustomPopup/index.module.scss new file mode 100644 index 0000000..8aa1f88 --- /dev/null +++ b/src/components/CustomPopup/index.module.scss @@ -0,0 +1,155 @@ +@use "~@/scss/themeColor.scss" as theme; + +.custom-popup-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 999; + display: flex; + align-items: flex-end; + justify-content: center; +} +.custom-popup-move{ + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 998; +} +.custom-popup { + position: relative; + z-index: 999; + width: 100%; + padding: 0; + box-sizing: border-box; + display: flex; + flex-direction: column; + background-color: theme.$page-background-color; + border-radius: 20px 20px 0 0; + overflow: hidden; + transition: padding-bottom 0.3s ease; + .custom-popup__drag-handle-container { + position: relative; + height: 0; + } + + .custom-popup__drag-handle { + position: absolute; + top: 6px; + left: 50%; + width: 90px; + height: 30px; + z-index: 10; + display: flex; + justify-content: center; + align-items: flex-start; + + &::before { + content: ""; + width: 32px; + height: 4px; + background-color: rgba(22, 24, 35, 0.2); + border-radius: 2px; + } + } + + .custom-popup__header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16px 20px; + + .custom-popup__title { + font-family: "PingFang SC"; + font-weight: 600; + font-size: 22px; + line-height: 1.27em; + color: #000000; + text-align: center; + } + + .close_button { + width: 40px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + background: #ffffff; + border: 1px solid rgba(0, 0, 0, 0.06); + border-radius: 50%; + cursor: pointer; + box-shadow: 0px 4px 36px 0px rgba(0, 0, 0, 0.06); + + .close_icon { + position: relative; + width: 24px; + height: 24px; + + .close_line { + position: absolute; + top: 50%; + left: 50%; + width: 17px; + height: 3px; + border-radius: 3px; + background: #000000; + transform: translate(-50%, -50%) rotate(45deg); + + &:nth-child(2) { + transform: translate(-50%, -50%) rotate(-45deg); + } + } + } + } + } + + .custom-popup__body { + flex: 1 1 auto; + max-height: 80vh; + overflow-y: auto; + } + + .custom-popup__footer { + padding: 8px 10px 0 10px; + display: flex; + gap: 8px; + background: #fafafa; + padding-bottom: max(10px, env(safe-area-inset-bottom)); + } + + .custom-popup__btn { + flex: 1; + font-feature-settings: "liga" off, "clig" off; + font-family: "PingFang SC"; + font-size: 16px; + font-style: normal; + font-weight: 600; + line-height: normal; + } + + .custom-popup__btn-cancel { + background: #f5f6f7; + color: #1f2329; + border: none; + width: 154px; + height: 44px; + border-radius: 12px !important; + border: 0.5px solid rgba(0, 0, 0, 0.06); + background: #fff; + padding: 4px 10px; + } + + .custom-popup__btn-confirm { + width: 154px; + height: 44px; + border: 0.5px solid rgba(0, 0, 0, 0.06); + background: #000; + border-radius: 12px !important; + padding: 4px 10px; + } +} + diff --git a/src/components/CustomPopup/index.ts b/src/components/CustomPopup/index.ts new file mode 100644 index 0000000..325f791 --- /dev/null +++ b/src/components/CustomPopup/index.ts @@ -0,0 +1,4 @@ +import CustomPopup from './CustomPopup' +export default CustomPopup +export * from './CustomPopup' + diff --git a/src/components/ListCard/index.scss b/src/components/ListCard/index.scss index a316a7d..54362cb 100644 --- a/src/components/ListCard/index.scss +++ b/src/components/ListCard/index.scss @@ -53,7 +53,7 @@ } .location-position { - flex: 1; + // flex: 1; min-width: 0; // 允许缩小 white-space: nowrap; overflow: hidden; diff --git a/src/components/ListCard/index.tsx b/src/components/ListCard/index.tsx index c4b65c2..55d5246 100644 --- a/src/components/ListCard/index.tsx +++ b/src/components/ListCard/index.tsx @@ -127,10 +127,10 @@ const ListCard: React.FC = ({ return ( - {renderItemImage(image_list?.[0])} + {renderItemImage(image_list?.[1])} - {renderItemImage(image_list?.[1])} + {renderItemImage(image_list?.[0])} ); diff --git a/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx b/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx index 1156de6..7c8555c 100644 --- a/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx +++ b/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect, useRef } from "react"; import CommonPopup from "@/components/CommonPopup"; import { View } from "@tarojs/components"; +import Taro from "@tarojs/taro"; import CalendarUI, { CalendarUIRef, } from "@/components/Picker/CalendarUI/CalendarUI"; @@ -47,6 +48,13 @@ const DialogCalendarCard: React.FC = ({ onClose(); return; } + if (!selected) { + Taro.showToast({ + title: '请选择日期', + icon: "none", + }); + return; + } // 年份选择完成后,进入月份选择 setType("time"); } else if (type === "month") { diff --git a/src/components/Picker/DayDialog/index.tsx b/src/components/Picker/DayDialog/index.tsx index c36237c..3547210 100644 --- a/src/components/Picker/DayDialog/index.tsx +++ b/src/components/Picker/DayDialog/index.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect, useRef } from "react"; import CommonPopup from "@/components/CommonPopup"; +import Taro from "@tarojs/taro"; import { View } from "@tarojs/components"; import CalendarUI, { CalendarUIRef, @@ -32,6 +33,13 @@ const DayDialog: React.FC = ({ } | null>(null); const handleConfirm = () => { console.log(selected, 'selectedselected'); + if (!selected) { + Taro.showToast({ + title: '请选择日期', + icon: "none", + }); + return; + } const finalDate = dayjs(selected as Date).format("YYYY-MM-DD"); if (onChange){ onChange(finalDate) diff --git a/src/components/TextareaTag/TextareaTag.tsx b/src/components/TextareaTag/TextareaTag.tsx index e2b475d..f73c9a6 100644 --- a/src/components/TextareaTag/TextareaTag.tsx +++ b/src/components/TextareaTag/TextareaTag.tsx @@ -79,6 +79,7 @@ const TextareaTag: React.FC = ({ autoHeight={true} onFocus={onFocus} onBlur={onBlur} + adjustPosition={false} /> {value.description.length}/{maxLength} diff --git a/src/components/index.ts b/src/components/index.ts index 3720f2e..a4019f5 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -8,6 +8,7 @@ import NumberInterval from "./NumberInterval"; import TimeSelector from "./TimeSelector"; import TitleTextarea from "./TitleTextarea"; import CommonPopup from "./CommonPopup"; +import CustomPopup from "./CustomPopup"; import { CalendarUI, DialogCalendarCard } from "./Picker"; import CommonDialog from "./CommonDialog"; import PublishMenu from "./PublishMenu/PublishMenu"; @@ -37,6 +38,7 @@ export { TimeSelector, TitleTextarea, CommonPopup, + CustomPopup, DialogCalendarCard, CalendarUI, CommonDialog, diff --git a/src/config/env.ts b/src/config/env.ts new file mode 100644 index 0000000..3545aea --- /dev/null +++ b/src/config/env.ts @@ -0,0 +1,61 @@ +import Taro from "@tarojs/taro"; + +/** + * 环境配置:从 config/env.config.ts 经 defineConstants 注入 + * 构建时由 config/index.ts 根据 APP_ENV 选择并注入 + */ +export type EnvType = "dev" | "dev_local" | "sit" | "pr"; + +export interface EnvConfig { + name: string; + apiBaseURL: string; + ossBaseURL: string; + timeout: number; + enableLog: boolean; + enableMock: boolean; + customerService: { + corpId: string; + serviceUrl: string; + }; +} + +// 从 defineConstants 注入的编译时常量读取 +const getInjectedConfig = (): EnvConfig => ({ + name: process.env.APP_ENV || "dev", + apiBaseURL: process.env.API_BASE_URL || "", + ossBaseURL: process.env.OSS_BASE_URL || "", + timeout: Number(process.env.TIMEOUT) || 10000, + enableLog: process.env.ENABLE_LOG === "true", + enableMock: false, + customerService: { + corpId: process.env.CUSTOMER_CORP_ID || "", + serviceUrl: process.env.CUSTOMER_SERVICE_URL || "", + }, +}); + +export const getCurrentEnv = (): EnvType => + (process.env.APP_ENV as EnvType) || "dev"; + +export const getCurrentConfig = (): EnvConfig => getInjectedConfig(); + +export const isDevelopment = (): boolean => + getCurrentEnv() === "dev" || getCurrentEnv() === "dev_local" || getCurrentEnv() === "sit"; + +export const isProduction = (): boolean => getCurrentEnv() === "pr"; + +export const getEnvInfo = () => { + const config = getCurrentConfig(); + return { + env: getCurrentEnv(), + config, + taroEnv: (Taro as any).getEnv?.(), + platform: + (Taro as any).getEnv?.() === (Taro as any).ENV_TYPE?.WEAPP + ? "微信小程序" + : (Taro as any).getEnv?.() === (Taro as any).ENV_TYPE?.WEB + ? "Web" + : "未知", + }; +}; + +export default getCurrentConfig(); diff --git a/src/login_pages/index/index.scss b/src/login_pages/index/index.scss index b70f97d..9cc5987 100644 --- a/src/login_pages/index/index.scss +++ b/src/login_pages/index/index.scss @@ -9,6 +9,23 @@ } +.link_button +{ + display: flex; + align-items: center; + justify-content: center; + gap: 12px; + height: 52px; + border-radius: 16px; + border: none; + position: relative; + font-size: 16px; + + .button_text { + color: #fff; + } +} + // 背景图片和渐变覆盖层 .background_image { position: absolute; diff --git a/src/login_pages/index/index.tsx b/src/login_pages/index/index.tsx index ef2eda6..d5c85e3 100644 --- a/src/login_pages/index/index.tsx +++ b/src/login_pages/index/index.tsx @@ -155,6 +155,11 @@ const LoginPage: React.FC = () => { e.stopPropagation(); }; + // 返回首页 + const handle_return_home = () => { + Taro.navigateTo({ url: "/main_pages/index" }); + }; + return ( @@ -211,6 +216,10 @@ const LoginPage: React.FC = () => { 手机号快捷登录 + + 返回首页 + + {/* 用户协议复选框 */} diff --git a/src/other_pages/enable_notification/index.scss b/src/other_pages/enable_notification/index.scss index f5fbae8..dec3952 100644 --- a/src/other_pages/enable_notification/index.scss +++ b/src/other_pages/enable_notification/index.scss @@ -1,7 +1,9 @@ .enable_notification_page { width: 100%; - // min-height: 100vh; - // background: radial-gradient(circle at 50% 0%, rgba(191, 255, 239, 1) 0%, rgba(255, 255, 255, 1) 37%); + height: 100%; + background: radial-gradient(circle at 50% 0%, rgba(191, 255, 239, 1) 0%, rgba(255, 255, 255, 1) 37%); + box-sizing: border-box; + display: flex; flex-direction: column; @@ -34,6 +36,7 @@ box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.08); box-sizing: border-box; position: absolute; + background: #ffffff; // 第三个卡片(最上面) &--3 { diff --git a/src/publish_pages/publishBall/components/AiImportPopup/AiImportPopup.tsx b/src/publish_pages/publishBall/components/AiImportPopup/AiImportPopup.tsx index 0f9f08f..ddd3d44 100644 --- a/src/publish_pages/publishBall/components/AiImportPopup/AiImportPopup.tsx +++ b/src/publish_pages/publishBall/components/AiImportPopup/AiImportPopup.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import { View, Text, Textarea, Image } from '@tarojs/components' import Taro from '@tarojs/taro' -import { ConfigProvider, Loading, Popup, Toast } from '@nutui/nutui-react-taro' +import { ConfigProvider, Loading, Toast } from '@nutui/nutui-react-taro' import styles from './index.module.scss' import uploadFiles from '@/services/uploadFiles' import publishService from '@/services/publishService' @@ -109,7 +109,10 @@ const AiImportPopup: React.FC = ({ } const handleTextChange = (e: any) => { - setText(e.detail.value) + const text = e.detail.value; + const maxAllowedLength = 120; + const truncatedVal = text.length > maxAllowedLength ? text.slice(0, maxAllowedLength) : text + setText(truncatedVal) } // 使用全局键盘状态监听 @@ -191,73 +194,90 @@ const AiImportPopup: React.FC = ({ } const showManualButton = uploadFailCount >= maxFailCount + if (!visible) { + return null + } + // 阻止弹窗内的触摸事件冒泡 + const handleTouchMoveInPopup = (e) => { + if (!isKeyboardVisible) { + e.stopPropagation() + } + } + return ( - - - {/* 头部 */} - - - - 智能导入球局信息 - - - - - - - {/* 文本域 */} - -