feat(新页面): 邀请新用户页

This commit is contained in:
hzj 2025-10-17 20:23:22 +08:00
parent 1c875cb6a2
commit 379d6a5ba0
24 changed files with 949 additions and 0 deletions

BIN
src/assets/icon/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,154 @@
<template>
<div style="box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08)">
<!-- 状态栏占位区域仅在APP中显示 -->
<div v-if="isInAppEnvironment" style="height: 30px"></div>
<!-- header内容 -->
<div
style="
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
height: 60px;
"
>
<!-- 返回键 -->
<div style="width: 10%; display: flex; align-items: center">
<button v-if="showBack" class="back-btn" @click="handleBack">
<img
src="../assets/icon/arrowBack.png"
alt=""
style="width: 100%; aspect-ratio: 1/1; display: block"
/>
</button>
</div>
<h1
style="
font-size: 1.2em;
font-weight: 600;
margin: 0;
color: #fff;
text-align: center;
flex: 1;
letter-spacing: 0.3px;
"
>
{{ title }}
</h1>
<button v-if="showHelp" class="help-btn" style="width: 10%" @click="$emit('help')">
<img src="../assets/icon/helpWhite.png" alt="" style="width: 100%; display: block" />
</button>
<slot name="extraFunction"></slot>
</div>
</div>
</template>
<script setup>
import { useRouter, useRoute } from 'vue-router'
import { computed, ref, onMounted } from 'vue'
import { closePage, isInApp } from '../utils/appBridge.js'
// props
const props = defineProps({
title: {
type: String,
required: true,
},
showBack: {
type: Boolean,
default: true,
},
showHelp: {
type: Boolean,
default: false,
},
isHomePage: {
type: Boolean,
default: false,
},
})
// emits
defineEmits(['help'])
const router = useRouter()
const route = useRoute()
// APP
const isInAppEnvironment = ref(false)
//
const homeRoutes = ['/host-center', '/agency-center', '/coin-seller', '/']
//
const isCurrentlyHomePage = computed(() => {
// 1. props
const propsHomePage = props.isHomePage === true || props.isHomePage === 'true'
// 2.
const routeHomePage = homeRoutes.includes(route.path)
// 3. true
return propsHomePage || routeHomePage
})
const handleBack = () => {
if (isCurrentlyHomePage.value && isInApp()) {
// APP
console.log('home back')
closePage()
} else {
//
router.go(-1)
}
}
//
onMounted(() => {
isInAppEnvironment.value = isInApp()
})
</script>
<style scoped>
* {
color: white;
font-family: 'SF Pro Text';
}
.back-btn,
.help-btn {
border: none;
background: transparent;
transition: all 0.2s ease;
}
.back-btn:active,
.help-btn:active {
transform: scale(0.9);
}
@media screen and (max-width: 360px) {
* {
font-size: 10px;
}
}
@media screen and (min-width: 360px) {
* {
font-size: 16px;
}
}
@media screen and (min-width: 768px) {
* {
font-size: 24px;
}
}
@media screen and (min-width: 1024px) {
* {
font-size: 32px;
}
}
</style>

View File

@ -239,6 +239,12 @@ const router = createRouter({
component: () => import('../views/RechargeAgency/Recruit.vue'),
meta: { requiresAuth: true },
},
{
path: '/invitation-to-register',
name: 'invitation-to-register',
component: () => import('../views/Invitation/InvitationToRegister.vue'),
meta: { requiresAuth: true },
},
],
})

View File

@ -118,6 +118,7 @@ export const ROLE_PERMISSIONS = {
'/ranking', //总排行榜
'/halloween', //万圣节活动页面
'/recharge-agency-recruit', //充值代理介绍页面
'/invitation-to-register', //邀请新用户注册页面
],
// 加载页面

View File

@ -409,6 +409,7 @@ class RouteGuard {
'/ranking', //总排行榜
'/halloween', //万圣节活动页面
'/recharge-agency-recruit', //充值代理介绍页面
'/invitation-to-register', //邀请新用户注册页面
]
return publicPages.includes(path)
}

View File

@ -0,0 +1,787 @@
<template>
<div class="fullPage">
<div style="position: absolute; top: 0; left: 0; width: 100%">
<GeneralHeader title="Invitation to register" :showHelp="true" @help="helpInfoShow = true" />
</div>
<!-- 确认邀请码 -->
<div style="padding: 87% 0 5%">
<img
:src="images.enterCode"
alt=""
width="40%"
@click="enterCodeShow = true"
style="display: block"
/>
</div>
<!-- 主体内容 -->
<div
style="padding: 0 3%; display: flex; flex-direction: column; gap: 12px; padding-bottom: 30px"
>
<!-- 倒计时 -->
<div style="position: relative">
<img :src="images.countdownBg" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.2em;
font-weight: 700;
letter-spacing: 2px;
"
>
29D 2323:23
</div>
</div>
<!-- 我的邀请码 -->
<div
style="
width: 100%;
border-radius: 8px;
background: rgba(194, 174, 232, 0.2);
backdrop-filter: blur(32px);
padding: 12px;
display: flex;
flex-direction: column;
gap: 4px;
"
@click.stop
>
<div style="font-weight: 590">My invitation code:</div>
<div
style="
border-radius: 8px;
background: rgba(255, 255, 255, 0.2);
padding: 12px;
display: flex;
justify-content: center;
align-items: center;
gap: 4px;
"
>
<div style="font-weight: 590">18709616238</div>
<img
src="../../assets/icon/copy.png"
alt=""
width="24px"
@click="copyCode('18709616238')"
/>
</div>
<div style="font-weight: 510; font-size: 0.7em">
*Copy your invitation code and send it to your new friends.
</div>
</div>
<!-- 模块切换按钮 -->
<div>
<div
v-if="showModule == 'list'"
style="display: flex; justify-content: space-around; align-items: center"
>
<img :src="images.listBtActive" alt="" width="40%" style="display: block" />
<img
:src="images.rewardBt"
alt=""
width="40%"
style="display: block"
@click="showModule = 'reward'"
/>
</div>
<div v-else style="display: flex; justify-content: space-around; align-items: center">
<img
:src="images.listBt"
alt=""
width="40%"
style="display: block"
@click="showModule = 'list'"
/>
<img :src="images.rewardBtActive" alt="" width="40%" style="display: block" />
</div>
</div>
<!-- 邀请列表模块 -->
<div v-if="showModule == 'list'" style="display: flex; flex-direction: column; gap: 12px">
<!-- 收入展示 -->
<div style="display: flex; justify-content: space-around; align-items: center">
<div style="position: relative; width: 47%">
<img :src="images.totalIncome" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
top: 40%;
width: 100%;
height: 60%;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="/src/assets/icon/coin.png" alt="" width="10%" style="display: block" />
<div style="font-weight: 590">111111</div>
</div>
</div>
<div style="position: relative; width: 47%">
<img :src="images.todayIncome" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
top: 40%;
width: 100%;
height: 60%;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="/src/assets/icon/coin.png" alt="" width="10%" style="display: block" />
<div style="font-weight: 590">111111</div>
</div>
</div>
</div>
<!-- 邀请人数 -->
<div
style="
border-radius: 8px;
background: rgba(194, 174, 232, 0.2);
backdrop-filter: blur(32px);
padding: 12px;
display: flex;
align-items: center;
gap: 4px;
"
>
<div
style="
width: 3px;
height: 12px;
flex-shrink: 0;
background: radial-gradient(323.25% 50.32% at 50% 50%, #d58ef4 0%, #7a5aff 100%);
"
></div>
<div style="font-weight: 590">Number of valid users l invited: 9</div>
</div>
<!-- 列表 -->
<div
style="
border-radius: 8px;
background: rgba(194, 174, 232, 0.2);
backdrop-filter: blur(32px);
padding: 8px;
display: flex;
flex-direction: column;
gap: 4px;
"
>
<!-- 头部 -->
<div style="width: 100%; display: flex; align-items: center">
<div style="flex: 1; font-weight: 590; font-size: 0.85em">Users</div>
<div
style="
flex: 1;
font-weight: 590;
display: flex;
justify-content: space-between;
align-items: center;
"
>
<div
style="
width: 1px;
height: 16px;
background: linear-gradient(
rgba(217, 217, 217, 0) 0%,
#d9d9d9 50%,
rgba(217, 217, 217, 0) 100%
);
"
></div>
<div style="font-weight: 590; font-size: 0.85em">Remaining time</div>
<div
style="
width: 1px;
height: 16px;
background: linear-gradient(
rgba(217, 217, 217, 0) 0%,
#d9d9d9 50%,
rgba(217, 217, 217, 0) 100%
);
"
></div>
</div>
<div style="flex: 1; font-weight: 590; text-align: end; font-size: 0.85em">
Prowide income
</div>
</div>
<!-- 列表项 -->
<div v-for="value in 10" style="width: 100%; display: flex; align-items: center">
<div style="flex: 1; font-weight: 590; font-size: 0.7em">ID:152319866</div>
<div
style="
flex: 1;
font-weight: 590;
display: flex;
justify-content: space-between;
align-items: center;
"
>
<div
style="
width: 1px;
height: 16px;
background: linear-gradient(
rgba(217, 217, 217, 0) 0%,
#d9d9d9 50%,
rgba(217, 217, 217, 0) 100%
);
"
></div>
<div style="font-weight: 590; font-size: 0.7em">10Day</div>
<div
style="
width: 1px;
height: 16px;
background: linear-gradient(
rgba(217, 217, 217, 0) 0%,
#d9d9d9 50%,
rgba(217, 217, 217, 0) 100%
);
"
></div>
</div>
<div
style="
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 4px;
"
>
<img src="../../assets/icon/coin.png" alt="" width="15%" />
<div style="color: #ffb627; font-size: 0.8em; font-weight: 590">11111111111</div>
</div>
</div>
</div>
</div>
<!-- 奖励说明模块 -->
<div v-if="showModule == 'reward'" style="display: flex; flex-direction: column; gap: 12px">
<!-- 邀请5人奖励 -->
<div style="position: relative">
<img :src="images.reward5people" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
inset: 12% 0 0;
display: flex;
flex-direction: column;
justify-content: space-around;
"
>
<div style="display: flex; justify-content: space-around">
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
</div>
<div style="display: flex; justify-content: center">
<img
v-if="reward5peopleShow"
:src="images.receiveBtActive"
alt=""
width="35%"
@click="reward5peopleShow = false"
/>
<img
v-else
:src="images.receiveBt"
alt=""
width="35%"
@click="reward5peopleShow = true"
/>
</div>
</div>
</div>
<!-- 邀请10人奖励 -->
<div style="position: relative">
<img :src="images.reward10people" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
inset: 12% 0 0;
display: flex;
flex-direction: column;
justify-content: space-around;
"
>
<div style="display: flex; justify-content: space-around">
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
</div>
<div style="display: flex; justify-content: center">
<img
v-if="reward10peopleShow"
:src="images.receiveBtActive"
alt=""
width="35%"
@click="reward10peopleShow = false"
/>
<img
v-else
:src="images.receiveBt"
alt=""
width="35%"
@click="reward10peopleShow = true"
/>
</div>
</div>
</div>
<!-- 邀请15人奖励 -->
<div style="position: relative">
<img :src="images.reward15people" alt="" width="100%" style="display: block" />
<div
style="
position: absolute;
inset: 12% 0 0;
display: flex;
flex-direction: column;
justify-content: space-around;
"
>
<div style="display: flex; justify-content: space-around">
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
<div style="width: 45%; position: relative">
<img :src="images.rewardItemBg" alt="" width="100%" />
<div
style="
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
"
>
<img src="../../assets/icon/coinMore.png" alt="" width="50%" />
</div>
</div>
</div>
<div style="display: flex; justify-content: center">
<img
v-if="reward15peopleShow"
:src="images.receiveBtActive"
alt=""
width="35%"
@click="reward15peopleShow = false"
/>
<img
v-else
:src="images.receiveBt"
alt=""
width="35%"
@click="reward15peopleShow = true"
/>
</div>
</div>
</div>
</div>
</div>
<!-- 弹窗遮罩层 -->
<maskLayer :maskLayerShow="maskLayerShow" @click="closedPopup">
<!-- 帮助模块 -->
<div v-if="helpInfoShow" style="margin: 20% 10%; position: relative" @click.stop>
<img :src="images.helpInfo" alt="" width="100%" />
<div
style="position: absolute; width: 8%; aspect-ratio: 1/1; top: 3.8%; right: 7%"
@click="closedPopup"
></div>
</div>
<!-- 输入邀请码模块 -->
<div
v-if="enterCodeShow"
style="
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
"
@click="closedPopup"
>
<div
style="
width: 80%;
border-radius: 12px;
background: #fff;
padding: 12px;
display: flex;
flex-direction: column;
gap: 4px;
"
@click.stop
>
<div style="color: rgba(0, 0, 0, 0.8); font-weight: 800">Enter Invitation Code</div>
<div style="display: flex; justify-content: space-between; align-items: center; gap: 8px">
<!-- 邀请码 -->
<div style="flex: 1">
<input
v-model="invitationCode"
type="text"
style="
width: 100%;
height: 100%;
color: rgba(0, 0, 0, 0.4);
font-weight: 510;
border-radius: 8px;
padding: 4px 8px;
border: 1px solid rgba(0, 0, 0, 0.4);
outline: none;
background-color: transparent;
"
@keyup.enter="confirmInvitationCode"
/>
</div>
<!-- 确认按钮 -->
<img :src="images.confirm" alt="" width="25%" @click="confirmInvitationCode" />
</div>
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 510; font-size: 0.7em">
*Only users who registered within 72 hours can fill in the invitation code. Once the
invitation code is flled in, itcannot be modifed.
</div>
</div>
</div>
</maskLayer>
</div>
</template>
<script setup>
import {
connectApplication,
parseAccessOrigin,
parseHeader,
setHttpHeaders,
isInApp,
} from '@/utils/appBridge.js'
import {
appConnectionManager,
isAppConnected,
getAppHeaderInfo,
} from '@/utils/appConnectionManager.js'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import GeneralHeader from '@/components/GeneralHeader.vue'
import itemCenter from '@/components/WeeklyStar/itemCenter.vue'
import TopUser from '@/components/WeeklyStar/topUser.vue'
import maskLayer from '../../components/MaskLayer.vue'
import { useDebounce, useThrottle } from '@/utils/useDebounce'
import { getMemberProfile } from '@/api/wallet'
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
import { useClipboard } from '@vueuse/core'
// vite
const imageModules = import.meta.glob('@/assets/images/InvitationNewUser/*.{png,jpg,svg}', {
eager: true,
})
//
const images = Object.fromEntries(
Object.entries(imageModules).map(([path, module]) => {
const fileName = path.split('/').pop().split('.')[0]
return [fileName, module.default]
})
)
const { copy, isSupported } = useClipboard()
const isInAppEnvironment = ref(false) // APP
const appConnected = ref(false)
const headerInfo = ref({})
const helpInfoShow = ref(false) //
const enterCodeShow = ref(false) //
const invitationCode = ref('') //
const showModule = ref('list') //
const reward5peopleShow = ref(false)
const reward10peopleShow = ref(false)
const reward15peopleShow = ref(false)
//
const maskLayerShow = computed(() => {
return helpInfoShow.value || enterCodeShow.value
})
//
const closedPopup = () => {
helpInfoShow.value = false
enterCodeShow.value = false
}
//
const copyCode = (text) => {
if (isSupported.value) {
copy(text)
} else {
//
const textArea = document.createElement('textarea')
textArea.value = text
document.body.appendChild(textArea)
textArea.select()
document.execCommand('copy')
document.body.removeChild(textArea)
}
}
/**
* 连接APP并获取认证信息优化版 - 仅专注连接
*/
const connectToApp = async () => {
console.group('🔗 APP Connection Process')
console.debug('🚀 Starting APP connection...')
try {
// APP
if (!isInApp()) {
console.debug('🌐 Browser environment detected')
appConnected.value = true
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'browser' }
}
//
if (isAppConnected()) {
console.debug('✅ APP already connected and valid')
appConnected.value = true
// 使
const cachedHeaderInfo = getAppHeaderInfo()
if (cachedHeaderInfo) {
headerInfo.value = cachedHeaderInfo
console.debug('🔧 Using cached HTTP headers')
}
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'app', fromCache: true }
}
//
if (appConnectionManager.isConnecting()) {
console.debug('⏳ Connection already in progress, waiting...')
await appConnectionManager.getConnectionPromise()
appConnected.value = true
console.debug('✅ Connected via existing process')
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'app', fromCache: true }
}
// APP
console.debug('📱 Establishing new APP connection...')
const connectionResult = await new Promise((resolve, reject) => {
const connectionPromise = new Promise((connectResolve, connectReject) => {
connectApplication(async (access) => {
try {
const result = parseAccessOrigin(access)
if (result.success) {
//
headerInfo.value = parseHeader(result.data)
// HTTP
console.debug('🔧 Setting HTTP headers...')
await setHttpHeaders(headerInfo.value)
//
appConnected.value = true
appConnectionManager.setConnected(headerInfo.value)
console.debug('🎉 APP connection established successfully')
connectResolve({ success: true, environment: 'app', fromCache: false })
} else {
console.error('❌ Failed to parse access origin:', result.error)
appConnectionManager.reset()
connectReject(new Error(result.error))
}
} catch (error) {
console.error('❌ Connection process failed:', error)
appConnectionManager.reset()
connectReject(error)
}
})
})
//
appConnectionManager.setConnecting(connectionPromise)
connectionPromise.then(resolve).catch(reject)
})
console.debug('✅ Connection completed successfully')
console.groupEnd()
//
// getUserInfo()
return connectionResult
} catch (error) {
console.error('❌ Connection failed:', error)
appConnected.value = false
console.groupEnd()
//
// if (onConnectionFailed) {
// onConnectionFailed(error)
// }
//
if (error.message && error.message.includes('parse access')) {
router.push({ path: '/not_app', query: { message: error.message } })
}
return { success: false, error: error.message }
}
}
const confirmInvitationCode = () => {
if (!invitationCode.value.trim()) {
showWarning('Please enter a valid invitation code.')
return
}
invitationCode.value = ''
showSuccess('Invitation code confirmed!')
enterCodeShow.value = false
}
onMounted(() => {
connectToApp()
isInAppEnvironment.value = isInApp()
})
</script>
<style lang="scss" scoped>
* {
color: white;
font-family: 'SF Pro Text';
}
.fullPage {
width: 100vw;
min-height: 100vh;
background-color: #5b4a8a;
background-image: url(../../assets/images/InvitationNewUser/bg.png);
background-size: 100% auto;
background-repeat: no-repeat;
position: relative;
}
@media screen and (max-width: 360px) {
* {
font-size: 10px;
}
}
@media screen and (min-width: 360px) {
* {
font-size: 16px;
}
}
@media screen and (min-width: 768px) {
* {
font-size: 24px;
}
}
@media screen and (min-width: 1024px) {
* {
font-size: 32px;
}
}
</style>