mirror of
https://gitee.com/liuxioabin/fengketrade.git
synced 2026-04-17 21:03:17 +08:00
'隐藏邀请海报添加展示邀请码'
This commit is contained in:
parent
098e3dfafd
commit
cc1c869a1a
@ -77,16 +77,6 @@
|
|||||||
path: '/pages/commission/apply',
|
path: '/pages/commission/apply',
|
||||||
isAgentFrom: true,
|
isAgentFrom: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon2.png',
|
|
||||||
title: '我的邀请码',
|
|
||||||
path: '/pages/user/invite-code',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon7.png',
|
|
||||||
title: '邀请海报',
|
|
||||||
path: 'action:showShareModal',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
img: '/assets/addons/shopro/uniapp/commission/commission_icon8.png',
|
img: '/assets/addons/shopro/uniapp/commission/commission_icon8.png',
|
||||||
title: '分享记录',
|
title: '分享记录',
|
||||||
|
|||||||
@ -21,10 +21,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right-box ss-m-r-52">
|
<view class="right-box ss-m-r-36" v-if="isLogin && state.inviteCode">
|
||||||
<!-- <button class="ss-reset-button" @tap="showShareModal">
|
<view class="invite-code-box ss-flex ss-col-center" @tap="copyInviteCode">
|
||||||
<text class="sicon-qrcode"></text>
|
<text class="invite-code-label">邀请码:</text>
|
||||||
</button> -->
|
<text class="invite-code-value">{{ state.inviteCode }}</text>
|
||||||
|
<text class="cicon-copy copy-icon"></text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -57,7 +59,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive, watch, onMounted } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { showShareModal, showAuthModal } from '@/sheep/hooks/useModal';
|
import { showShareModal, showAuthModal } from '@/sheep/hooks/useModal';
|
||||||
|
|
||||||
@ -66,6 +68,57 @@
|
|||||||
|
|
||||||
// 是否登录
|
// 是否登录
|
||||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||||
|
|
||||||
|
// 状态管理
|
||||||
|
const state = reactive({
|
||||||
|
inviteCode: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取邀请码
|
||||||
|
const getInviteCode = async () => {
|
||||||
|
if (!isLogin.value) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data, code } = await sheep.$api.invite.myCode();
|
||||||
|
if (code === 1 && data) {
|
||||||
|
state.inviteCode = data.invite_code || data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取邀请码失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 监听登录状态变化
|
||||||
|
watch(isLogin, (newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
getInviteCode();
|
||||||
|
} else {
|
||||||
|
state.inviteCode = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 组件挂载时获取邀请码
|
||||||
|
onMounted(() => {
|
||||||
|
if (isLogin.value) {
|
||||||
|
getInviteCode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 复制邀请码
|
||||||
|
const copyInviteCode = () => {
|
||||||
|
if (!state.inviteCode) return;
|
||||||
|
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: state.inviteCode,
|
||||||
|
success: () => {
|
||||||
|
sheep.$helper.toast('邀请码已复制');
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
sheep.$helper.toast('复制失败,请重试');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 接收参数
|
// 接收参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
background: {
|
background: {
|
||||||
@ -133,6 +186,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invite-code-box {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8rpx 16rpx;
|
||||||
|
background: #fff5f0;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
border: 1rpx solid #ffe0cc;
|
||||||
|
|
||||||
|
.invite-code-label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-code-value {
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #ff6100;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-icon {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #ff6100;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.bind-mobile-box {
|
.bind-mobile-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user