"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 (
配置微信群跳转链接,用户支付后自动跳转加群
微信群活码配置指南
方法一:使用草料活码(推荐)
方法二:直接使用微信群链接
注意:微信原生群二维码7天后失效,建议使用草料活码
Q: 为什么推荐使用草料活码?
A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。
Q: 支付后没有跳转怎么办?
A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接
Q: 如何获取企业微信群链接?
A: 企业微信后台 → 客户联系 → 加入群聊 → 获取永久有效的群二维码链接