index.js 957 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const WXAPI = require('apifm-wxapi')
  2. Page({
  3. data: {
  4. },
  5. onLoad: function (options) {
  6. },
  7. onShow: function () {
  8. },
  9. async submit() {
  10. if (!this.data.name) {
  11. wx.showToast({
  12. title: '请输入姓名',
  13. icon: 'none'
  14. })
  15. return
  16. }
  17. if (!this.data.idcard) {
  18. wx.showToast({
  19. title: '请输入身份证号码',
  20. icon: 'none'
  21. })
  22. return
  23. }
  24. wx.showLoading({
  25. title: '',
  26. })
  27. this.setData({
  28. loading: true
  29. })
  30. const res = await WXAPI.idcardCheck(wx.getStorageSync('token'), this.data.name, this.data.idcard)
  31. wx.hideLoading({
  32. success: (res) => {},
  33. })
  34. this.setData({
  35. loading: false
  36. })
  37. if (res.code != 0) {
  38. wx.showToast({
  39. title: res.msg,
  40. icon: 'none'
  41. })
  42. return
  43. }
  44. wx.showToast({
  45. title: '认证通过',
  46. })
  47. setTimeout(() => {
  48. wx.navigateBack()
  49. }, 1000);
  50. },
  51. })