个人中心页面按钮跳转与样式修复;实名认证页面界面与文字调整;提取 IP 页面浮动组件复制问题修复

This commit is contained in:
2025-04-30 10:42:47 +08:00
parent 09d6255bd5
commit 5ef673bacb
5 changed files with 63 additions and 41 deletions

View File

@@ -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>