完善分销部分功能
This commit is contained in:
@@ -45,14 +45,6 @@
|
||||
</div>
|
||||
<p class="qrcode-tip">扫描二维码,好友可直接注册并绑定您的推荐关系</p>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-buttons">
|
||||
<el-button
|
||||
@click="shareQRCode"
|
||||
>
|
||||
分享二维码
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,7 +99,8 @@ const generateInviteLink = () => {
|
||||
const userId = userStore.user?.id || userStore.user?.user_id || 'guest'
|
||||
console.log(userStore.user.id,userStore.user.user_id)
|
||||
const baseUrl = `${window.location.origin}/frontend`
|
||||
return `${baseUrl}/register?inviter=${userId}`
|
||||
// return `${baseUrl}/register?inviter=${userId}`
|
||||
return `http://192.168.1.124:5173/register?inviter=${userId}`
|
||||
}
|
||||
|
||||
// 生成二维码
|
||||
@@ -163,29 +156,6 @@ const copyLink = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 分享二维码
|
||||
const shareQRCode = () => {
|
||||
if (navigator.share && qrcodeCanvas.value) {
|
||||
// 将canvas转换为blob
|
||||
qrcodeCanvas.value.toBlob(async (blob) => {
|
||||
const file = new File([blob], 'qrcode.png', { type: 'image/png' })
|
||||
try {
|
||||
await navigator.share({
|
||||
title: '邀请注册',
|
||||
text: '扫描二维码注册获得奖励',
|
||||
files: [file]
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('分享取消或失败')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 降级方案:复制链接
|
||||
copyLink()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
@@ -321,7 +291,26 @@ onMounted(() => {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.link-input .el-input-group__append) {
|
||||
padding: 0;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
:deep(.link-input .el-input-group__append .el-button) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
/* 确保按钮内文字垂直居中 */
|
||||
:deep(.link-input .el-input-group__append .el-button span) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 480px) {
|
||||
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
const settings = ref([
|
||||
{text:'账号安全',path:'/editpasswordpage'},
|
||||
{text:'商户资料',path:'/editdetailspage'},
|
||||
// {text:'分销',path:'/distribution'},
|
||||
{text:'分销',path:'/distribution'},
|
||||
// {text:'通知设置'},
|
||||
// {text:'积分获取规则'},
|
||||
// {text:'隐私协议'},
|
||||
|
||||
@@ -543,6 +543,21 @@ const handleUploadError = (error) => {
|
||||
ElMessage.error('图片上传失败,请重试');
|
||||
};
|
||||
|
||||
const invite = async () => {
|
||||
const inviter = route.query.inviter;
|
||||
console.log('邀请人ID:', inviter);
|
||||
if (inviter) {
|
||||
// try {
|
||||
// const response = await api.get(`/user/${inviter}`);
|
||||
// if (response.data.success) {
|
||||
// registerForm.inviter = inviter;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('获取邀请人信息失败:', error);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// 组件挂载时的处理
|
||||
onMounted(() => {
|
||||
// 如果已经登录,直接跳转
|
||||
@@ -556,6 +571,8 @@ onMounted(() => {
|
||||
|
||||
// 加载省市区级联数据
|
||||
loadRegionOptions();
|
||||
|
||||
invite();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user