index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view>
  3. <view class="wrapper" @click="handlePersonalInfo">
  4. <text class="text">个人信息</text>
  5. <up-icon name="arrow-right" class="icon"></up-icon>
  6. <up-divider></up-divider>
  7. </view>
  8. <!-- <view class="wrapper">
  9. <text class="text">绑定</text>
  10. <up-icon name="arrow-right" class="icon"></up-icon>
  11. <up-divider></up-divider>
  12. </view> -->
  13. <!-- <view class="wrapper" @click="handlServiceAddress">
  14. <text class="text">被服务地址</text>
  15. <up-icon name="arrow-right" class="icon"></up-icon>
  16. <up-divider></up-divider>
  17. </view> -->
  18. <view class="wrapper" @click="handelAuthentication">
  19. <text class="text">实名认证</text>
  20. <up-icon name="arrow-right" class="icon"></up-icon>
  21. <up-divider></up-divider>
  22. </view>
  23. <view class="wrapper" @click="logoOut">
  24. <text class="text">退出登陆</text>
  25. <up-icon name="arrow-right" class="icon"></up-icon>
  26. <up-divider></up-divider>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import {
  32. ref
  33. } from 'vue'
  34. import { showConfirm } from '@/utils/common'
  35. import store from '@/store'
  36. import { onLoad, onShow } from '@dcloudio/uni-app'
  37. import { startEid, initEid } from '../mp_ecard_sdk/main'
  38. import { getEidToken,getEidResult } from '@/api/face'
  39. const eidToken = ref('2C4B0550-55F0-47E2-AF8D-0E359C9EBC74');
  40. const handlServiceAddress = () => {
  41. uni.navigateTo({
  42. url: '/pages_mine/pages/setupUser/Address'
  43. })
  44. }
  45. const handlePersonalInfo = () => {
  46. uni.navigateTo({
  47. url: '/pages_mine/pages/setupUser/personalInfo'
  48. })
  49. }
  50. const logoOut = () => {
  51. showConfirm('确认退出登陆吗?').then((res) => {
  52. if (res.confirm) {
  53. store.dispatch('LogOut').then((res) => {
  54. uni.reLaunch({
  55. url: '/pages/index',
  56. })
  57. })
  58. }
  59. })
  60. }
  61. const handelAuthentication = () => {
  62. getEidToken().then(res => {
  63. eidToken.value = res.data;
  64. const param = {
  65. data: {
  66. token: eidToken.value,
  67. },
  68. verifyDoneCallback(res) {
  69. console.log('收到核身完成的res', res);
  70. getEidResult({eidToken: res.token,verifyDone:res.verifyDone}).then(result=>{
  71. console.log("TCL: verifyDoneCallback -> result", result)
  72. if(result.code === 200){
  73. uni.showToast({
  74. title: '您已完成实名认证!',
  75. icon: 'success',
  76. })
  77. }
  78. })
  79. },
  80. };
  81. eidToken.value && startEid(param);
  82. })
  83. }
  84. onLoad(() => {
  85. //初始化
  86. initEid();
  87. })
  88. </script>
  89. <style scoped>
  90. .wrapper {
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. padding: 24rpx 32rpx;
  95. }
  96. .text {
  97. flex: 1;
  98. /* 文字占据剩余空间 */
  99. font-size: 28rpx;
  100. color: #333;
  101. }
  102. .icon {
  103. margin-left: 16rpx;
  104. /* 图标与文字的间距 */
  105. color: #999;
  106. /* 图标颜色 */
  107. font-size: 28rpx;
  108. /* 与文字大小匹配 */
  109. }
  110. /* 分隔线样式调整 */
  111. .up-divider {
  112. margin: 0 32rpx;
  113. /* 与内容对齐 */
  114. }
  115. </style>