You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
6.1 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view class="content ">
  3. <view class="stepTop">
  4. <view class="steps flex-b">
  5. <view class="proress" :style="{width: proressWith}"></view>
  6. <view class="step">
  7. <view class="num active" >01<view class="text">房屋信息1</view></view>
  8. </view>
  9. <view class="step">
  10. <view class="num" :class="{active: currentStep}">02<view class="text">个人资料</view></view>
  11. </view>
  12. <view class="step">
  13. <view class="num" :class="{active: currentStep==2}">03<view class="text">认证成功</view></view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="line"></view>
  18. <view class="padding" >
  19. <view class="step1" v-if="currentStep==0">
  20. <view class="h1">请选择您的房屋地址</view>
  21. <view class="lab">房屋信息</view>
  22. <view class="row flex-b">
  23. <view class="lable">详细地址</view>
  24. <view class="flex" @click="$goPage('/pages/subPage/authentication/comp/select1')">
  25. <view class="adrs" v-if="counterStore.chooseHouse.houseId">{{ houseStr }}</view>
  26. <view class="adrs" v-else>请选择</view>
  27. <u-icon name="arrow-right" color="#CCCCCC"></u-icon>
  28. </view>
  29. </view>
  30. <view class="btnBox">
  31. <oneBtn text="下一步" :disabled="!counterStore.chooseHouse.houseId" @oneBtnClick="nextStep(1)"></oneBtn>
  32. </view>
  33. </view>
  34. <view class="step2" v-if="currentStep==1">
  35. <view class="btnBox">
  36. <oneBtn text="点击开始实名认证" @oneBtnClick="nextStep(2)"></oneBtn>
  37. </view>
  38. </view>
  39. <view class="step3" v-if="currentStep==2">
  40. <view class="okIcon">
  41. <image src="@/static/images/okIcon.png" mode=""></image>
  42. </view>
  43. <view class="oktext">认证成功</view>
  44. <view class="btnBox">
  45. <oneBtn text="返回首页" @oneBtnClick="nextStep(3)"></oneBtn>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script setup>
  52. import { startEid } from '@/mp_ecard_sdk/main';
  53. import { getFacetoken, getFaceResult, houseRoomBind } from '@/config/api.js'
  54. import {userStore} from '@/store/index.js';
  55. const counterStore = userStore();
  56. import { ref, computed } from 'vue'
  57. const currentStep = ref(0)
  58. const proressWith = computed(() => {
  59. if(currentStep.value==1) return '290rpx'
  60. if(currentStep.value==2) return '100%'
  61. return 0
  62. })
  63. const houseStr = computed(() => {
  64. let item = counterStore.chooseHouse
  65. if(!item.houseId) return ''
  66. let str = item.communityName +' - '+ item.houseTypeName +' - '+ item.roomNum
  67. return str
  68. })
  69. function nextStep(num) {
  70. // 第一步如果没有选择房子是不能走第二步的
  71. if(num==0&&!counterStore.chooseHouse.houseId) return
  72. if(num==1) currentStep.value = num
  73. if(num==2) {
  74. getpersonfaceFn()
  75. }
  76. if(num==3) {
  77. counterStore.chooseHouse = {
  78. "roomNum": "",
  79. "houseType": '',
  80. "houseTypeName": '',
  81. "communityId": '',
  82. "communityName": '',
  83. "userName": 0,
  84. "idNo": "",
  85. "houseId": '',
  86. }
  87. uni.switchTab({
  88. url: '/pages/tabbar/index/index'
  89. })
  90. }
  91. }
  92. async function getpersonfaceFn() {
  93. // {MerchantId: '0NSJ2407181630565100'}
  94. // let obj = {
  95. // }
  96. const {data: res} = await getFacetoken()
  97. console.log('获取到token了,很好')
  98. console.log(res)
  99. console.log(res.eidToken)
  100. goSDK(res.eidToken)
  101. }
  102. async function GetDetectInfoEnhancedFn(EidToken) {
  103. // userId: counterStore.loginInfo.userId, InfoType: 1
  104. const {data: res} = await getFaceResult({token: EidToken, })
  105. console.log('返回的结果信息')
  106. console.log(res)
  107. counterStore.upDateHouse('idNo', res.idCard)
  108. counterStore.upDateHouse('userName', res.name)
  109. counterStore.upDateUseInfo('idCard', res.idCard)
  110. counterStore.upDateUseInfo('name', res.name)
  111. houseRoomBindFn()
  112. }
  113. // 绑定房子
  114. async function houseRoomBindFn() {
  115. const {data: res} = await houseRoomBind(counterStore.chooseHouse)
  116. console.log(res)
  117. currentStep.value = 2
  118. uni.hideLoading()
  119. }
  120. // 示例方法
  121. function goSDK(token) {
  122. startEid({
  123. data: {
  124. token,
  125. },
  126. verifyDoneCallback(res) {
  127. const { token, verifyDone } = res;
  128. console.log('收到核身完成的res:', res);
  129. console.log('核身的token是:', token);
  130. uni.showLoading({
  131. title: '正在加载,请稍后……'
  132. })
  133. GetDetectInfoEnhancedFn(token)
  134. console.log('是否完成核身:', verifyDone);
  135. },
  136. });
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. image {
  141. display: block;
  142. width: 100%;
  143. height: 100%;
  144. }
  145. .content {
  146. .btnBox {
  147. margin-top: 60rpx;
  148. }
  149. .line {
  150. width: 100%;
  151. height: 20rpx;
  152. background: #EFEFEF;
  153. }
  154. .step1 {
  155. padding: 20rpx 0;
  156. font-size: 28rpx;
  157. color: #343434;
  158. .lab {
  159. padding: 30rpx 0 10rpx 0;
  160. }
  161. .row {
  162. height: 96rpx;
  163. border-bottom: 1px solid #EFEFEF;
  164. .adrs {
  165. color: $themC;
  166. margin-right: 6rpx;
  167. }
  168. }
  169. }
  170. .step3 {
  171. padding: 40rpx 0;
  172. display: flex;
  173. flex-direction: column;
  174. justify-content: center;
  175. align-items: center;
  176. .okIcon {
  177. width: 303rpx;
  178. height: 164rpx;
  179. }
  180. .oktext {
  181. font-size: 36rpx;
  182. color: #343434;
  183. margin-top: 20rpx;
  184. }
  185. .btnBox {
  186. width: 100%;
  187. }
  188. }
  189. .stepTop {
  190. padding: 20rpx 20rpx 50rpx 20rpx;
  191. }
  192. .steps {
  193. width: 528rpx;
  194. height: 50rpx;
  195. background: #EFEFEF;
  196. border-radius: 25rpx;
  197. position: relative;
  198. margin: 20rpx auto 40rpx auto;
  199. .proress {
  200. position: absolute;
  201. left: 0;
  202. top: 0;
  203. height: 100%;
  204. width: 290rpx;
  205. background: linear-gradient(90deg, rgba(222,58,38,0.1) 0%, #DE3A26 100%);
  206. border-radius: 25rpx;
  207. }
  208. .step {
  209. .num {
  210. width: 44rpx;
  211. height: 44rpx;
  212. background: #FFFFFF;
  213. border-radius: 50%;
  214. font-size: 24rpx;
  215. color: #9C9C9C;
  216. line-height: 44rpx;
  217. text-align: center;
  218. position: relative;
  219. &.active {
  220. border: 1px solid $themC;
  221. color: $themC;
  222. .text {
  223. color: #333;
  224. }
  225. }
  226. .text {
  227. position: absolute;
  228. bottom: -60rpx;
  229. left: -26rpx;
  230. font-size: 24rpx;
  231. white-space: nowrap;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. </style>