auth_self.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Component({
  2. data: {
  3. protocolAgree: false
  4. },
  5. methods: {
  6. protocolChange(data) {
  7. this.setData({
  8. protocolAgree: data
  9. })
  10. },
  11. authClick() {
  12. if(!this.data.protocolAgree) {
  13. return
  14. }
  15. const authPopup = this.$selectComponent('#authPopup')
  16. authPopup.open('芯易行通行管理系统')
  17. },
  18. protocol(e) {
  19. if(e.currentTarget.dataset.type === 'privacyPolicy') {
  20. my.ap.openURL({
  21. url: 'https://render.alipay.com/p/yuyan/180020010001104047/index.html?appid=2021003181682188',
  22. })
  23. }
  24. },
  25. // 授权获取三要素结果
  26. async authResult(e) {
  27. if(e.detail && e.detail.code === 200) {
  28. const params = {
  29. userId: e.detail.data.userId,
  30. username: e.detail.data.username,
  31. idNumber: e.detail.data.idNumber,
  32. phone: e.detail.data.phone,
  33. avatar: e.detail.data.avatar || null,
  34. personPictures: e.detail.data.personPictures || null,
  35. photoBase64: e.detail.data.photoBase64 || null
  36. }
  37. this.triggerEvent("updateState", params)
  38. } else {
  39. my.alert({
  40. title: '提示',
  41. content: '身份授权认证失败!'
  42. })
  43. }
  44. }
  45. }
  46. })