修复已知问题
This commit is contained in:
178
pages/my-index/wallet/invite.vue
Normal file
178
pages/my-index/wallet/invite.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useAuthUser } from '../../../composables/useAuthUser'
|
||||
|
||||
const { userInfo } = useAuthUser()
|
||||
|
||||
const inviteLink = computed(() => {
|
||||
const { href } = window.location
|
||||
return `${href}/pages/login/phone-register/phone-register?invitationCode=${userInfo.value.invitationCode}`
|
||||
})
|
||||
|
||||
// 复制文本通用函数
|
||||
const copyText = text => {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
console.log('已复制到剪贴板')
|
||||
},
|
||||
fail: () => {
|
||||
console.log('复制失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="invite-page">
|
||||
<view class="header">
|
||||
<text class="subtitle">邀请好友一起使用,双方都能获得奖励!</text>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<view class="card-item">
|
||||
<text class="label">您的邀请码</text>
|
||||
<view class="code-box">
|
||||
<text class="code">{{ userInfo.invitationCode }}</text>
|
||||
<button
|
||||
class="copy-btn"
|
||||
@click="copyText(userInfo.invitationCode)"
|
||||
>
|
||||
复制
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="divider"></view>
|
||||
|
||||
<view class="card-item">
|
||||
<text class="label">邀请注册链接</text>
|
||||
<view class="link-box">
|
||||
<text class="link" selectable>{{ inviteLink }}</text>
|
||||
<button class="copy-btn" @click="copyText(inviteLink)">
|
||||
复制
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="share-tips">
|
||||
<text>将链接或邀请码发送给好友即可完成邀请</text>
|
||||
</view>
|
||||
|
||||
<!-- 可选:添加分享按钮(如微信、朋友圈等) -->
|
||||
<!-- <button class="share-btn">分享到微信</button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.invite-page {
|
||||
padding: 40rpx;
|
||||
background-color: #f9fafc;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #1a1a1a;
|
||||
display: block;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 20rpx;
|
||||
padding: 40rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.card-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
color: #888;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.code-box,
|
||||
.link-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #f5f7fa;
|
||||
padding: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
|
||||
.code {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #1a1a1a;
|
||||
letter-spacing: 8rpx;
|
||||
}
|
||||
|
||||
.link {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
margin-right: 20rpx;
|
||||
white-space: nowrap; /* 禁止换行 */
|
||||
overflow: hidden; /* 隐藏溢出内容 */
|
||||
text-overflow: ellipsis; /* 溢出部分显示省略号 */
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
width: 120rpx;
|
||||
height: 56rpx;
|
||||
background: #4a6cf7;
|
||||
color: white;
|
||||
border-radius: 12rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 56rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.copy-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 2rpx;
|
||||
background: #eee;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
|
||||
.share-tips {
|
||||
text-align: center;
|
||||
margin-top: 40rpx;
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
/* .share-btn {
|
||||
margin-top: 60rpx;
|
||||
background: #07c160;
|
||||
color: white;
|
||||
border-radius: 50rpx;
|
||||
height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
} */
|
||||
</style>
|
||||
Reference in New Issue
Block a user