邃芒智像相册
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

133 行
2.1 KiB

  1. const app = getApp()
  2. import request from '../../utils/request'
  3. import Dialog from '@vant/weapp/dialog/dialog';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isAgree: false
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad() {
  15. },
  16. /**
  17. * 生命周期函数--监听页面显示
  18. */
  19. onShow() {
  20. },
  21. getPhoneNumber(e) {
  22. const that = this
  23. if (e.detail.iv) {
  24. const openId = wx.getStorageSync('openId')
  25. const appId = request.appId
  26. const iv = e.detail.iv
  27. const encryptedData = e.detail.encryptedData
  28. const data = {
  29. openId,
  30. appId,
  31. encryptedData,
  32. iv,
  33. }
  34. that.loginWithPhone(data)
  35. } else {
  36. wx.showToast({
  37. title: '授权失败',
  38. icon: "error"
  39. })
  40. }
  41. },
  42. checkUserPro() {
  43. if (!this.data.isAgree) {
  44. Dialog.confirm({
  45. title: '提示',
  46. message: '同意智像相机用户使用协议?',
  47. })
  48. .then(() => {
  49. this.setData({
  50. isAgree: true
  51. })
  52. })
  53. .catch(() => {
  54. // on cancel
  55. });
  56. }
  57. },
  58. checkboxChange(e) {
  59. if (e.detail.value[0]) {
  60. this.setData({
  61. isAgree: true
  62. })
  63. } else {
  64. this.setData({
  65. isAgree: false
  66. })
  67. }
  68. },
  69. goPro() {
  70. wx.navigateTo({
  71. url: '/pages/userProtocol/userProtocol',
  72. })
  73. },
  74. loginWithPhone(data) {
  75. request.post({
  76. url: '/api/miniApp/loginPhone',
  77. data
  78. }).then(res => {
  79. wx.showToast({
  80. title: '登录成功!',
  81. icon: "success",
  82. duration: 1500,
  83. complete: () => {
  84. setTimeout(() => {
  85. wx.redirectTo({
  86. url: '/pages/index/index',
  87. })
  88. }, 1500);
  89. }
  90. })
  91. }).catch(err => {
  92. console.log(err, 'err');
  93. })
  94. },
  95. /**
  96. * 页面相关事件处理函数--监听用户下拉动作
  97. */
  98. onPullDownRefresh() {
  99. },
  100. /**
  101. * 页面上拉触底事件的处理函数
  102. */
  103. onReachBottom() {
  104. },
  105. /**
  106. * 用户点击右上角分享
  107. */
  108. onShareAppMessage() {
  109. }
  110. })