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.
 
 

83 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. }).catch(err => {
  55. console.log(err, 'err');
  56. })
  57. },
  58. agreedClick() {
  59. this.setData({
  60. isNotRead: !this.data.isNotRead
  61. })
  62. },
  63. // 跳转至用户协议页面
  64. checkUserProtocol() {
  65. wx.navigateTo({
  66. url: '/pages/userProtocol/userProtocol',
  67. })
  68. },
  69. skip() {
  70. this.setData({
  71. show: false
  72. })
  73. }
  74. }
  75. })