authIdentity.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="container">
  3. <view class="prompt-item">
  4. 法律规定骑行电单车须满16周岁,请先进行实名认证,信息仅用于平台审核绝不泄露,请放心填写。
  5. </view>
  6. <view class="center-item">
  7. <view class="item-title">姓名</view>
  8. <view class="item-text">
  9. <input type="text" placeholder="请输入您的真实姓名" @blur="inputUserName">
  10. </view>
  11. <view class="item-title">身份证号</view>
  12. <view class="item-text">
  13. <input type="text" placeholder="请输入您的身份证号" @blur="inputCardNo">
  14. </view>
  15. </view>
  16. <view @tap="bindAuthentication" class="authentication-btn">
  17. 立即认证
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { login } from '../../common/user.js';
  23. var config = require('../../common/config.js');
  24. var http = require('../../common/http.js');
  25. var common = require('../../common/common.js');
  26. var storage = require('../../common/storage.js')
  27. export default {
  28. data() {
  29. return {
  30. face_token: '',
  31. face_key: '',
  32. user_name: '',
  33. card_no: '',
  34. };
  35. },
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad: function(options) {
  40. this.loadFaceToken()
  41. },
  42. /**
  43. * 生命周期函数--监听页面显示
  44. */
  45. onShow: function() {
  46. },
  47. methods: {
  48. loadFaceToken() {
  49. http.postApi(config.API_USER_FACE_TOKEN,{},(resp) => {
  50. if (resp.data.code === 200) {
  51. this.face_token = resp.data.data.token
  52. this.face_key = resp.data.data.key
  53. } else{
  54. common.simpleToast(resp.data.msg)
  55. }
  56. })
  57. },
  58. inputUserName: function (e) {
  59. this.user_name = e.detail.value
  60. },
  61. inputCardNo: function (e) {
  62. this.card_no = e.detail.value
  63. },
  64. bindAuthentication() {
  65. if (common.isEmpty(this.user_name)) {
  66. common.simpleToast('请输入您的姓名')
  67. return
  68. }
  69. if (common.isEmpty(this.card_no)) {
  70. common.simpleToast('请输入您的身份证号')
  71. return
  72. }
  73. uni.navigateTo({
  74. url: '/pages/livenessView/livenessView?face_token=' + this.face_token + '&face_key=' + this.face_key,
  75. success: function (res) { },
  76. fail: function (res) { },
  77. complete: function (res) { },
  78. })
  79. },
  80. }
  81. };
  82. </script>
  83. <style>
  84. @import './authIdentity.css';
  85. </style>