index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. <!-- iframe 容器 -->
  17. <div class="iframe-page">
  18. <div class="iframe-mask"></div>
  19. <iframe
  20. :src="etsUrl"
  21. frameborder="0"
  22. class="iframe"
  23. allowfullscreen
  24. scrolling="no"
  25. ref="iframeRef"
  26. ></iframe>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup lang="ts">
  31. import StepProgress from '@/components/StepProgress.vue'
  32. import { getFaceAuthInfoApi } from '@/services/modules/faceRecognition'
  33. import { ref, onBeforeMount } from 'vue'
  34. import { useUserStore } from '@/stores/modules/user'
  35. const userStore = useUserStore()
  36. const etsUrl = ref('')
  37. // 获取认证链接
  38. const getConfirmInvoiceInfo = async () => {
  39. const callbackUrl = window.location.origin + '/h5/pedding-face-recognition'
  40. const obj = {
  41. pushRecordId: userStore.pushRecordId,
  42. callbackUrl: callbackUrl,
  43. }
  44. const res = await getFaceAuthInfoApi(obj)
  45. if (res.code === 0 && res.data?.faceAuthUrl) {
  46. etsUrl.value = res.data.faceAuthUrl
  47. } else {
  48. console.warn('获取认证链接失败', res)
  49. }
  50. }
  51. const onClickLeft = () => history.back()
  52. onBeforeMount(() => {
  53. getConfirmInvoiceInfo()
  54. })
  55. </script>
  56. <style scoped lang="scss">
  57. .face-recognition {
  58. height: 100dvh;
  59. display: flex;
  60. flex-direction: column;
  61. background: #fff;
  62. font-family:
  63. -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei',
  64. sans-serif;
  65. font-size: 3.8vw;
  66. padding: 4vw 3.5vw;
  67. box-sizing: border-box;
  68. overflow: hidden;
  69. }
  70. .van-nav-bar {
  71. background-color: #fff;
  72. border-bottom: 1px solid #f2f2f2;
  73. font-weight: 600;
  74. }
  75. /* 修改左侧返回图标颜色与大小 */
  76. :deep(.van-icon-arrow-left) {
  77. color: #ff8036;
  78. font-size: 28px;
  79. }
  80. /* 顶部步骤进度卡片 */
  81. .card {
  82. background: #fff;
  83. border-radius: 14px;
  84. margin-bottom: 4vw;
  85. padding: 4vw 3.5vw;
  86. box-shadow:
  87. 0 4px 12px rgba(0, 0, 0, 0.06),
  88. 0 1px 3px rgba(0, 0, 0, 0.04);
  89. flex-shrink: 0;
  90. }
  91. /* iframe 外层 */
  92. .iframe-page {
  93. flex: 1;
  94. min-height: 0;
  95. overflow: hidden;
  96. /* 用负边距抵消父 padding,使 iframe 全宽 */
  97. margin-left: -3.5vw;
  98. margin-right: -3.5vw;
  99. margin-bottom: -4vw; /* 让底部贴合视口 */
  100. border-radius: 0;
  101. position: relative;
  102. }
  103. /* 遮罩层 */
  104. .iframe-mask {
  105. position: absolute;
  106. top: 0;
  107. left: 0;
  108. width: 100%;
  109. height: 3vw; // 根据实际导航高度调整
  110. background: #fff; // 或与你页面背景一致的颜色
  111. z-index: 999;
  112. pointer-events: none; // 保证不影响 iframe 内部点击
  113. }
  114. /* iframe 内容 */
  115. .iframe {
  116. position: absolute;
  117. top: 0;
  118. left: 0;
  119. width: 100vw; /* 全屏宽 */
  120. height: 100%;
  121. border: none;
  122. display: block;
  123. overflow: hidden;
  124. /* 禁止横向滚动条 */
  125. overflow-x: hidden;
  126. overflow-y: auto;
  127. -webkit-overflow-scrolling: touch; /* 移动端平滑滚动 */
  128. }
  129. /* iframe 外层滚动条美化(仅当内部非跨域时生效) */
  130. .iframe::-webkit-scrollbar {
  131. width: 6px;
  132. }
  133. .iframe::-webkit-scrollbar-thumb {
  134. background: rgba(255, 122, 0, 0.4);
  135. border-radius: 4px;
  136. }
  137. .iframe::-webkit-scrollbar-thumb:hover {
  138. background: rgba(255, 122, 0, 0.7);
  139. }
  140. .iframe::-webkit-scrollbar-track {
  141. background: transparent;
  142. }
  143. </style>