fix(pay): 优化订阅号获取逻辑并调整支付组件样式

- 优先从小程序码 scene 参数读取 subscriptionNo,提升参数兼容性
- 对 scene 参数进行解码,避免编码引起的问题
- 移除支付组件价格显示处的固定颜色设置,增强样式灵活性
This commit is contained in:
2026-06-30 17:03:10 +08:00
parent 5f71295aae
commit 93c66e1f14
2 changed files with 33 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
## 修复 WXSS 不兼容的 .\!visible CSS 选择器
- **问题**: Tailwind JIT 引擎把 JS 代码 `if (!visible)` 误识别为 `!visible` important 修饰符类名,生成 `.\!visible` CSS 选择器WXSS 不支持反斜杠转义的 `!`
- **修复**: 创建 PostCSS 插件 `postcss-remove-tailwind-important.js` 移除所有 `.\!xxx` 选择器
- **配置**: 更新 `postcss.config.js` 引入该插件(使用函数引用方式,非字符串模块名)
- **验证**: 构建通过,`.\!visible` 从输出中移除,`.visible` 保留
- **注意**: 项目中实际无人使用 Tailwind 的 `!` 修饰符类名,安全移除。将来若需使用,需创建对应 WXSS 兼容类名
## 替换项目中不兼容 WXSS 的 space-x/y-* 类名
- **问题**: `space-y-*` / `space-x-*` 依赖 `:not()` + `~` + CSS 变量 + 嵌套 calc()WXSS 不兼容
- **修复**:
- 源码中将所有 `space-y-*` 替换为 `flex flex-col gap-*`
- 注释中的 `space-y-*` 也一并替换,防止 Tailwind JIT 误扫描生成
- 扩展 PostCSS 插件为 `postcss-remove-wxss-incompatible.js`,一并移除 `space-*``divide-*` 规则
- 删除旧的 `postcss-remove-tailwind-important.js` 文件
- **涉及文件**: dealer/qrcode/index.tsx, dealer/invite-stats/index.tsx, components/QRScanModal.tsx
- **验证**: 构建通过,所有不兼容选择器已从输出中移除
## 审查并修复剪切板接口合规问题
- **问题**: 用户截图显示「复制成功」与系统「内容已复制」重复 Toast担心违反 5.15.4 剪切板接口滥用规范
- **审查结果**:
- 所有复制操作均为用户点击触发,无 `getClipboardData` 自动读取
- 无复制后强制跳转或中断业务流程
- 当前实现基本合规,主要问题是重复 Toast 影响体验
- **修复**: 更新 `src/utils/common.ts` 中的 `copyText` 函数小程序端不再显示自定义「复制成功」Toast由系统自带提示替代
- **验证**: weapp 构建通过

View File

@@ -39,10 +39,13 @@ const PayPage: React.FC = () => {
const [paid, setPaid] = useState(false)
// 从页面参数中获取 subscriptionNo
// 小程序码 scene 会作为 query.scene 传入,需解码
const getSubscriptionNo = useCallback(() => {
const instance = Taro.getCurrentInstance()
const params = instance?.router?.params || {}
return params.subscriptionNo || ''
// 优先读取 scene小程序码参数再读取 subscriptionNo(普通链接参数)
const scene = params.scene ? decodeURIComponent(params.scene) : ''
return scene || params.subscriptionNo || ''
}, [])
// 获取订阅详情
@@ -234,7 +237,6 @@ const PayPage: React.FC = () => {
price={detail?.payPrice}
size="large"
thousands
color="#e53e3e"
/>
</View>