You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

84 lines
1.5 KiB

  1. // components/userNumberSync.ts
  2. import request from '../utils/request'
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. show: {
  9. type: Boolean,
  10. value: false
  11. },
  12. },
  13. /**
  14. * 组件的初始数据
  15. */
  16. data: {
  17. isNotRead: true
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. methods: {
  23. closeBox(e) {
  24. const id = e.target.id
  25. if (id == 'componentBG') {
  26. this.setData({
  27. show: false
  28. })
  29. }
  30. },
  31. getphonenumber(e) {
  32. const sessionKey = wx.getStorageSync('sessionKey')
  33. this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId)
  34. },
  35. /** 获取手机号授权 */
  36. doGetUserPhone(encryptedData, iv, sessionKey, appId) {
  37. request.post({
  38. url: '/api/user/getUserPhone',
  39. data: {
  40. encryptedData,
  41. iv,
  42. sessionKey,
  43. appId
  44. }
  45. }).then(res => {
  46. console.log(res, 'getUserPhone');
  47. wx.showToast({
  48. title: '登录成功!',
  49. icon: 'success'
  50. })
  51. this.setData({
  52. show: false
  53. })
  54. this.triggerEvent('getUserPhoneSuccess')
  55. }).catch(err => {
  56. console.log(err, 'err');
  57. })
  58. },
  59. agreedClick() {
  60. this.setData({
  61. isNotRead: !this.data.isNotRead
  62. })
  63. },
  64. // 跳转至用户协议页面
  65. checkUserProtocol() {
  66. wx.navigateTo({
  67. url: '/pages/userProtocol/userProtocol',
  68. })
  69. },
  70. skip() {
  71. this.setData({
  72. show: false
  73. })
  74. }
  75. }
  76. })