deotalandAi/.trae/documents/实现邀请码复制带域名文案功能.md

34 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 实现邀请码复制带域名文案功能
### 问题分析
当前点击复制邀请码按钮只会复制邀请码本身,而用户需要的是复制包含当前项目域名和邀请码参数的完整文案,以便分享给他人。
### 解决方案
1. 修改 `copyInviteCode` 函数,使其生成包含域名和邀请码的文案
2. 在 i18n 配置中添加相应的翻译项
3. 确保文案格式支持中英文切换
4. 实现动态获取当前项目域名
### 实现步骤
1.`index.vue` 中修改 `copyInviteCode` 函数,生成包含域名和邀请码的文案
2.`locales/index.js` 中添加中英文翻译项,用于生成邀请文案
3. 实现动态获取当前项目域名的逻辑
4. 测试复制功能,确保文案格式正确
5. 确保中英文切换时文案格式正确
### 预期结果
- 点击复制邀请码按钮时,会复制包含当前项目域名和邀请码参数的完整文案
- 文案格式支持中英文切换
- 保持现有的复制成功/失败提示
### 代码变更
- 修改 `d:/work/Aiproject/DeotalandAi/apps/frontend/src/views/user/index.vue`
- 更新 `copyInviteCode` 函数
- 添加动态获取域名的逻辑
- 修改 `d:/work/Aiproject/DeotalandAi/apps/frontend/src/locales/index.js`
- 添加中文翻译项 `copyWithDomain`
- 添加英文翻译项 `copyWithDomain`
### 文案格式示例
- 中文:"邀请您使用Deotaland AI注册时填写邀请码{inviteCode},或直接点击链接注册:{domain}/register?inviteCode={inviteCode}"
- 英文:"Invite you to use Deotaland AI, fill in the invite code when registering: {inviteCode}, or click the link to register directly: {domain}/register?inviteCode={inviteCode}"