61 lines
1.7 KiB
Vue
61 lines
1.7 KiB
Vue
<template>
|
|
<div class="bg-primary rounded-lg p-2 py-1 mt-2">
|
|
<div class="p-2">
|
|
<div
|
|
v-if="userStore.userInfo?.referral_id"
|
|
class="text-tertiary font-bold w-full text-center flex justify-between gap-2 items-center"
|
|
>
|
|
کد معرف:
|
|
<div class="flex gap-2">
|
|
<div class="mr-2">{{ userStore.userInfo?.referral_id }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="w-full flex gap-2 mt-1">
|
|
<BasicButton
|
|
icon="vuesax-linear:share"
|
|
size="small"
|
|
class="flex-1 !bg-primary !border-tertiary !text-tertiary"
|
|
icon-size="18"
|
|
@click.stop="shareCode"
|
|
>
|
|
دعوت از دوستان
|
|
</BasicButton>
|
|
<BasicButton
|
|
icon="vuesax-linear:copy"
|
|
size="small"
|
|
class="flex-1 !bg-primary !border-tertiary !text-tertiary"
|
|
icon-size="18"
|
|
@click.stop="copyCode"
|
|
>
|
|
رونوشت
|
|
</BasicButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useUserStore } from '@/store/userStore'
|
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|
import { message } from 'ant-design-vue'
|
|
import { getReferralShareText, getReferralShareTitle } from '@/utils/config'
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const shareCode = () => {
|
|
const text = getReferralShareText({
|
|
userName: userStore.userInfo?.name,
|
|
referralId: userStore.userInfo?.referral_id,
|
|
})
|
|
|
|
navigator.share({ title: getReferralShareTitle(), text })
|
|
}
|
|
|
|
const copyCode = () => {
|
|
const code = userStore.userInfo?.referral_id
|
|
if (code) {
|
|
navigator.clipboard.writeText(code)
|
|
message.info('کد رونوشت شد')
|
|
}
|
|
}
|
|
</script> |