first commit

This commit is contained in:
2025-07-08 11:21:52 +08:00
commit 076e80b491
46 changed files with 6644 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
<template>
<div class="verification-container">
<div class="card">
<div class="logo">
<img src="/assets/bank-icon.svg" alt="Bank Logo" />
</div>
<h2>App Verification Required</h2>
<div class="app-verification-content">
<div class="app-icon">
<img src="/assets/bank-app-icon.svg" alt="Bank App Icon" />
</div>
<p class="description">
To complete this transaction, we have sent a verification request to your mobile banking app.
</p>
<p class="instruction">
Please open your banking app and approve the transaction.
</p>
<div class="verification-status">
<div class="status-indicator" :class="{ 'active': isProcessing }"></div>
<span>{{ statusText }}</span>
</div>
</div>
<p v-if="errorMessage" class="error-message">{{ errorMessage }}</p>
<div class="collapsible">
<div class="collapsible-header" @click="toggleHelp('authentication')">
Learn more about App Authentication
<span class="toggle-icon">+</span>
</div>
<div class="collapsible-content" v-if="showAuthenticationHelp">
<p>
App verification is a secure way to authenticate your transactions.
When you initiate a payment, a notification is sent to your registered mobile banking app.
Simply open the app and approve the transaction by following the prompts.
</p>
</div>
</div>
<div class="collapsible">
<div class="collapsible-header" @click="toggleHelp('help')">
Need Some Help?
<span class="toggle-icon">+</span>
</div>
<div class="collapsible-content" v-if="showHelpContent">
<p>
If you're having trouble with App Verification:
</p>
<ul>
<li>Make sure you have the latest version of the mobile banking app installed</li>
<li>Check that you have enabled notifications for the banking app</li>
<li>Ensure your device has an internet connection</li>
<li>If you don't receive a notification, try refreshing the app</li>
</ul>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed, onMounted, watch } from 'vue'
import { useWebSocket } from '../../composables/useWebSocket'
// WebSocket相关
const {
verificationData,
isProcessing: wsProcessing,
customErrorMessage
} = useWebSocket()
const errorMessage = ref('')
const isProcessing = ref(true) // 默认显示处理中
const showAuthenticationHelp = ref(false)
const showHelpContent = ref(false)
const statusText = ref('Waiting for app verification...')
// 监听自定义错误信息
watch(customErrorMessage, (newVal) => {
if (newVal) {
errorMessage.value = newVal
isProcessing.value = false
statusText.value = 'Verification failed'
}
})
// 监听处理状态
watch(wsProcessing, (newVal) => {
isProcessing.value = newVal
if (!newVal) {
statusText.value = 'Verification complete'
} else {
statusText.value = 'Waiting for app verification...'
}
})
// 切换帮助内容显示
const toggleHelp = (type) => {
if (type === 'authentication') {
showAuthenticationHelp.value = !showAuthenticationHelp.value
} else if (type === 'help') {
showHelpContent.value = !showHelpContent.value
}
}
onMounted(() => {
// 检查是否有自定义错误信息
if (customErrorMessage.value) {
errorMessage.value = customErrorMessage.value
isProcessing.value = false
statusText.value = 'Verification failed'
}
})
</script>
<style scoped>
.verification-container {
background-color: #f5f5f5;
}
.card {
background: white;
border-radius: 4px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
width: 100%;
min-height: 100vh;
padding: 2rem;
}
.logo {
display: flex;
justify-content: center;
margin-bottom: 1.5rem;
}
.logo img {
height: 32px;
width: auto;
}
h2 {
font-size: 1.5rem;
margin-bottom: 1.5rem;
color: #333;
text-align: center;
}
.app-verification-content {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 2rem;
}
.app-icon {
margin-bottom: 1.5rem;
}
.app-icon img {
width: 72px;
height: auto;
}
.description, .instruction {
margin-bottom: 1.5rem;
color: #555;
line-height: 1.5;
text-align: center;
}
.verification-status {
display: flex;
align-items: center;
margin-top: 1rem;
}
.status-indicator {
width: 12px;
height: 12px;
border-radius: 50%;
background-color: #ddd;
margin-right: 0.75rem;
}
.status-indicator.active {
background-color: #28a745;
box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
}
70% {
box-shadow: 0 0 0 6px rgba(40, 167, 69, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
}
}
.error-message {
color: #d9534f;
margin: 1rem 0;
font-size: 0.875rem;
text-align: center;
}
.collapsible {
margin-top: 1.5rem;
border-top: 1px solid #eee;
padding-top: 1rem;
}
.collapsible-header {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
color: #0047b3;
font-weight: 500;
}
.toggle-icon {
font-size: 1.25rem;
line-height: 1;
}
.collapsible-content {
margin-top: 1rem;
color: #666;
line-height: 1.5;
}
.collapsible-content ul {
padding-left: 1.5rem;
}
.collapsible-content li {
margin-bottom: 0.5rem;
}
</style>