index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="face-recognition">
  3. <!-- 顶部导航 -->
  4. <van-nav-bar
  5. title="自然人开票"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. fixed
  9. placeholder
  10. safe-area-inset-top
  11. />
  12. <!-- 步骤卡片 -->
  13. <div class="card">
  14. <StepProgress :activeStep="2" />
  15. </div>
  16. <!-- 加载状态 -->
  17. <div class="loading-box">
  18. <van-loading size="24px" color="#ff8036" />
  19. <div class="loading-text">正在获取认证信息,请稍候…</div>
  20. </div>
  21. </div>
  22. </template>
  23. <script setup lang="ts">
  24. import StepProgress from '@/components/StepProgress.vue'
  25. import { getFaceAuthInfoApi } from '@/services/modules/faceRecognition'
  26. import { onBeforeMount } from 'vue'
  27. import { useUserStore } from '@/stores/modules/user'
  28. const userStore = useUserStore()
  29. const getConfirmInvoiceInfo = async () => {
  30. const callbackUrl = window.location.origin + '/h5/pedding-face-recognition'
  31. const params = {
  32. pushRecordId: userStore.pushRecordId,
  33. callbackUrl,
  34. }
  35. const res = await getFaceAuthInfoApi(params)
  36. if (res.code === 0 && res.data?.faceAuthUrl) {
  37. console.log('faceAuthUrl:', res.data.faceAuthUrl)
  38. // 直接跳转进行人脸识别
  39. window.location.href = res.data.faceAuthUrl
  40. } else {
  41. console.warn('获取认证链接失败', res)
  42. }
  43. }
  44. const onClickLeft = () => history.back()
  45. onBeforeMount(() => {
  46. getConfirmInvoiceInfo()
  47. })
  48. </script>
  49. <style scoped lang="scss">
  50. .face-recognition {
  51. height: 100dvh;
  52. display: flex;
  53. flex-direction: column;
  54. background: #fff;
  55. padding: 4vw 3.5vw;
  56. box-sizing: border-box;
  57. }
  58. .van-nav-bar {
  59. background-color: #fff;
  60. border-bottom: 1px solid #f2f2f2;
  61. font-weight: 600;
  62. }
  63. :deep(.van-icon-arrow-left) {
  64. color: #ff8036;
  65. font-size: 28px;
  66. }
  67. .card {
  68. background: #fff;
  69. border-radius: 14px;
  70. margin-bottom: 4vw;
  71. padding: 4vw 3.5vw;
  72. box-shadow:
  73. 0 4px 12px rgba(0, 0, 0, 0.06),
  74. 0 1px 3px rgba(0, 0, 0, 0.04);
  75. flex-shrink: 0;
  76. }
  77. .loading-box {
  78. flex: 1;
  79. display: flex;
  80. flex-direction: column;
  81. height: 100%;
  82. justify-content: center;
  83. align-items: center;
  84. text-align: center;
  85. }
  86. .loading-text {
  87. margin-top: 16px;
  88. color: #666;
  89. font-size: 14px;
  90. }
  91. </style>