"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Label } from "@/components/ui/label" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" import { Button } from "@/components/ui/button" import { useStore } from "@/lib/store" import { QrCode, Upload, Link, ExternalLink, Copy, Check, HelpCircle } from "lucide-react" export default function QRCodesPage() { const { settings, updateSettings } = useStore() const [liveQRUrls, setLiveQRUrls] = useState("") const [wechatGroupUrl, setWechatGroupUrl] = useState("") const [copied, setCopied] = useState("") useEffect(() => { setLiveQRUrls(settings.liveQRCodes?.[0]?.urls?.join("\n") || "") setWechatGroupUrl(settings.paymentMethods?.wechat?.groupQrCode || "") }, [settings]) const handleCopy = (text: string, field: string) => { navigator.clipboard.writeText(text) setCopied(field) setTimeout(() => setCopied(""), 2000) } const handleSaveLiveQR = () => { const urls = liveQRUrls .split("\n") .map((u) => u.trim()) .filter(Boolean) const updatedLiveQRCodes = [...(settings.liveQRCodes || [])] if (updatedLiveQRCodes[0]) { updatedLiveQRCodes[0].urls = urls } else { updatedLiveQRCodes.push({ id: "live-1", name: "微信群活码", urls, clickCount: 0 }) } updateSettings({ liveQRCodes: updatedLiveQRCodes }) alert("群活码配置已保存!") } const handleSaveWechatGroup = () => { updateSettings({ paymentMethods: { ...settings.paymentMethods, wechat: { ...settings.paymentMethods.wechat, groupQrCode: wechatGroupUrl, }, }, }) alert("微信群链接已保存!用户支付成功后将自动跳转") } // 测试跳转 const handleTestJump = () => { if (wechatGroupUrl) { window.open(wechatGroupUrl, "_blank") } else { alert("请先配置微信群链接") } } return (

微信群活码管理

配置微信群跳转链接,用户支付后自动跳转加群

{/* 使用说明 */}

微信群活码配置指南

方法一:使用草料活码(推荐)

  1. 访问{" "} 草料二维码 {" "} 创建活码
  2. 上传微信群二维码图片,生成永久链接
  3. 复制生成的短链接填入下方配置
  4. 群满后可直接在草料后台更换新群码,链接不变

方法二:直接使用微信群链接

  1. 微信打开目标群 → 右上角"..." → 群二维码
  2. 长按二维码 → 识别二维码 → 复制链接
  3. 或使用第三方工具解析二维码获取链接

注意:微信原生群二维码7天后失效,建议使用草料活码

{/* 主要配置 - 支付后跳转 */} 支付成功跳转链接(核心配置) 用户支付完成后自动跳转到此链接,进入指定微信群
setWechatGroupUrl(e.target.value)} />

支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等

{/* 多群轮换配置 */} 多群轮换(高级配置) 配置多个群链接,系统自动轮换分配,避免单群满员