RealAuthentication.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="vh100">
  3. <!-- Add Toast component -->
  4. <Toast ref="toast" />
  5. <!-- 导航栏 -->
  6. <div class="nav-bar">
  7. <div class="back-btn" @click="$router.back()">
  8. <i class="arrow-left"></i>
  9. </div>
  10. <div class="title">实名认证</div>
  11. </div>
  12. <!-- 已认证状态 -->
  13. <div v-if="userInfo.if_real === 1" class="auth-success">
  14. <div class="success-icon">
  15. <svg viewBox="64 64 896 896" data-icon="check-circle" width="80px" height="80px" fill="#52c41a" aria-hidden="true">
  16. <path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"></path>
  17. </svg>
  18. </div>
  19. <div class="success-text">您已完成实名认证</div>
  20. </div>
  21. <!-- 未认证状态 -->
  22. <div v-else>
  23. <!-- 认证表单 -->
  24. <div class="flex bgwhite alcenter radius4 pl10 pt10 bdb_blue3">
  25. <div class="flex between h40 lh40 pr10 tr flex1">
  26. <span>证件认证</span>
  27. <span>身份证</span>
  28. </div>
  29. </div>
  30. <div class="flex bgwhite alcenter radius4 pl10 pt10 bdb_blue3">
  31. <span>证件姓氏:</span>
  32. <input
  33. type="text"
  34. class="h40 lh40 pr10 tr flex1 input-uni"
  35. placeholder="姓名"
  36. v-model="formData.realName"
  37. >
  38. </div>
  39. <div class="flex bgwhite alcenter radius4 pl10 mt10 bdb_blue3">
  40. <span>证件号码:</span>
  41. <input
  42. type="text"
  43. class="h40 lh40 pr10 tr flex1 input-uni"
  44. placeholder="输入证件号码"
  45. v-model="formData.idCard"
  46. >
  47. </div>
  48. <div
  49. class="mt30 h40 lh40 tc white bgBlue radius28 ft14 w90 mauto"
  50. @click="handleSubmit"
  51. >
  52. 确 认
  53. </div>
  54. <div class="flex alcenter mt10">
  55. <div class="bottom">
  56. <ul>
  57. <li style="height: 45px;">为保证您的权益请认真查看以下条例,如有疑问请及时联系在线客服</li>
  58. <li>身份证件拍摄不完整有反光</li>
  59. <li>提交信息和身份证件不一致</li>
  60. <li style="height: 45px;">为了您的信息安全审核期间由AI机器人全程负责我们无法干预</li>
  61. <li style="height: 45px;">使用虚假信息的用户我们将采取相应措施,包含且不限于封号、冻结资产、限制登录等</li>
  62. </ul>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. import Toast from '@/components/Toast.vue';
  70. import { setReal, getUserInfo } from '@/api/home';
  71. export default {
  72. name: 'RealAuthentication',
  73. components: {
  74. Toast
  75. },
  76. data() {
  77. return {
  78. userInfo: {},
  79. formData: {
  80. realName: '',
  81. idCard: ''
  82. }
  83. }
  84. },
  85. created() {
  86. this.getUserInfo();
  87. },
  88. methods: {
  89. async getUserInfo() {
  90. try {
  91. const res = await getUserInfo();
  92. this.userInfo = res.data;
  93. } catch (error) {
  94. this.$refs.toast.show('获取用户信息失败', 'error');
  95. }
  96. },
  97. async handleSubmit() {
  98. if (!this.formData.realName) {
  99. this.$refs.toast.show('请输入姓名', 'warning');
  100. return;
  101. }
  102. if (!this.formData.idCard) {
  103. this.$refs.toast.show('请输入证件号码', 'warning');
  104. return;
  105. }
  106. try {
  107. const params = {
  108. type: '身份证',
  109. name: this.formData.realName,
  110. idCard: this.formData.idCard
  111. };
  112. const res = await setReal(params);
  113. if (res.code === 1) {
  114. this.$refs.toast.show('认证信息提交成功', 'success');
  115. setTimeout(() => {
  116. this.$router.back();
  117. }, 1500);
  118. } else {
  119. this.$refs.toast.show(res.msg || '认证失败,请重试', 'error');
  120. }
  121. } catch (error) {
  122. this.$refs.toast.show('网络错误,请稍后重试', 'error');
  123. }
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. .vh100 {
  130. min-height: 100vh;
  131. background: #fff;
  132. }
  133. .nav-bar {
  134. height: 44px;
  135. background-color: #ed4b39;
  136. color: #fff;
  137. display: flex;
  138. align-items: center;
  139. position: relative;
  140. padding: 0 15px;
  141. }
  142. .back-btn {
  143. width: 24px;
  144. height: 44px;
  145. display: flex;
  146. align-items: center;
  147. cursor: pointer;
  148. }
  149. .arrow-left {
  150. width: 12px;
  151. height: 12px;
  152. border-left: 2px solid #fff;
  153. border-bottom: 2px solid #fff;
  154. transform: rotate(45deg);
  155. }
  156. .title {
  157. position: absolute;
  158. left: 50%;
  159. transform: translateX(-50%);
  160. font-size: 16px;
  161. font-weight: 500;
  162. }
  163. .flex { display: flex; }
  164. .between { justify-content: space-between; }
  165. .alcenter { align-items: center; }
  166. .tc { text-align: center; }
  167. .tr { text-align: right; }
  168. .mt10 { margin-top: 10px; }
  169. .mt30 { margin-top: 30px; }
  170. .pl10 { padding-left: 10px; }
  171. .pr10 { padding-right: 10px; }
  172. .pt10 { padding-top: 10px; }
  173. .h40 { height: 40px; }
  174. .lh40 { line-height: 40px; }
  175. .ft14 { font-size: 14px; }
  176. .white { color: #fff; }
  177. .bgwhite { background: #fff; }
  178. .flex1 { flex: 1; }
  179. .w90 { width: 90%; }
  180. .mauto { margin: 0 auto; }
  181. .radius4 { border-radius: 4px; }
  182. .radius28 { border-radius: 28px; }
  183. .bgBlue {
  184. margin-top: 20px;
  185. background: #ed4b39;
  186. cursor: pointer;
  187. }
  188. .bgBlue:active {
  189. opacity: 0.9;
  190. }
  191. .bdb_blue3 {
  192. border-bottom: 1px solid rgba(85, 89, 105, 0.12);
  193. }
  194. .input-uni {
  195. border: none;
  196. outline: none;
  197. background: transparent;
  198. }
  199. .bottom {
  200. padding: 0 20px;
  201. width: 100%;
  202. }
  203. .bottom ul {
  204. list-style: none;
  205. padding: 0;
  206. margin: 0;
  207. }
  208. .bottom li {
  209. color: #666;
  210. font-size: 12px;
  211. line-height: 1.5;
  212. margin-bottom: 10px;
  213. padding-left: 15px;
  214. position: relative;
  215. }
  216. .bottom li::before {
  217. content: '';
  218. position: absolute;
  219. left: 0;
  220. top: 8px;
  221. width: 4px;
  222. height: 4px;
  223. background: #666;
  224. border-radius: 50%;
  225. }
  226. .auth-success {
  227. padding: 40px 20px;
  228. text-align: center;
  229. }
  230. .success-icon {
  231. margin-bottom: 20px;
  232. }
  233. .success-text {
  234. font-size: 20px;
  235. color: #52c41a;
  236. font-weight: 500;
  237. margin-bottom: 30px;
  238. }
  239. .auth-info {
  240. background: #f8f8f8;
  241. border-radius: 8px;
  242. padding: 20px;
  243. text-align: left;
  244. }
  245. .info-item {
  246. margin-bottom: 15px;
  247. font-size: 14px;
  248. line-height: 1.5;
  249. }
  250. .info-item:last-child {
  251. margin-bottom: 0;
  252. }
  253. .info-item .label {
  254. color: #666;
  255. }
  256. .info-item .value {
  257. color: #333;
  258. margin-left: 5px;
  259. }
  260. </style>