个人中心页面按钮跳转与样式修复;实名认证页面界面与文字调整;提取 IP 页面浮动组件复制问题修复
This commit is contained in:
@@ -94,20 +94,37 @@ export default function Extract(props: ExtractProps) {
|
||||
|
||||
const type = useRef<'copy' | 'open'>('open')
|
||||
const onSubmit = async (values: z.infer<typeof schema>) => {
|
||||
console.log('222', type.current)
|
||||
switch (type.current) {
|
||||
case 'copy':
|
||||
console.log('copy')
|
||||
const url = new URL(window.location.href).origin
|
||||
await navigator.clipboard.writeText(`${url}${params}`)
|
||||
const text = `${url}${params}`
|
||||
|
||||
// 使用 clipboard API 复制链接
|
||||
let copied = false
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
copied = true
|
||||
}
|
||||
catch (e) {
|
||||
console.log('剪贴板 API 调用失败,尝试备选方案')
|
||||
}
|
||||
|
||||
// 使用 document.execCommand 作为备选方案
|
||||
if (!copied) {
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = text
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
|
||||
toast.success('链接已复制到剪贴板')
|
||||
break
|
||||
case 'open':
|
||||
console.log('open')
|
||||
window.open(params, '_blank')
|
||||
break
|
||||
}
|
||||
console.log('333')
|
||||
}
|
||||
|
||||
const getResources = async () => {
|
||||
@@ -451,11 +468,11 @@ export default function Extract(props: ExtractProps) {
|
||||
</div>
|
||||
|
||||
<div className={merge(
|
||||
`flex flex-col gap-4 sticky bottom-0 bg-white py-4`,
|
||||
`border-t`,
|
||||
`flex flex-col gap-4 sticky bottom-0 bg-muted p-4`,
|
||||
`rounded-lg`,
|
||||
)}>
|
||||
{/* 展示链接地址 */}
|
||||
<div className={`bg-card text-card-foreground p-4 rounded-md break-all`}>
|
||||
<div className={`bg-neutral-900 text-white p-4 rounded-md break-all`}>
|
||||
{params}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import {Loader} from 'lucide-react'
|
||||
import {RechargeByAlipay, RechargeByAlipayConfirm, RechargeByWechat, RechargeByWechatConfirm} from '@/actions/user'
|
||||
import * as qrcode from 'qrcode'
|
||||
import {useProfileStore} from '@/components/providers/StoreProvider'
|
||||
import {merge} from '@/lib/utils'
|
||||
|
||||
const schema = zod.object({
|
||||
method: zod.enum(['alipay', 'wechat']),
|
||||
@@ -30,7 +31,11 @@ const schema = zod.object({
|
||||
|
||||
type Schema = zod.infer<typeof schema>
|
||||
|
||||
export type RechargeModelProps = {}
|
||||
export type RechargeModelProps = {
|
||||
classNames?: {
|
||||
trigger?: string
|
||||
}
|
||||
}
|
||||
|
||||
export default function RechargeModal(props: RechargeModelProps) {
|
||||
|
||||
@@ -144,7 +149,7 @@ export default function RechargeModal(props: RechargeModelProps) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button theme={`accent`} type={`button`} className={`px-4 h-8`}>去充值</Button>
|
||||
<Button theme={`accent`} type={`button`} className={merge(`px-4 h-8`, props.classNames?.trigger)}>去充值</Button>
|
||||
</DialogTrigger>
|
||||
|
||||
<DialogContent>
|
||||
|
||||
Reference in New Issue
Block a user