permission.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // pages/permisission/permission.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. phoneLoading: false,
  8. showCreateForm: true,
  9. createForm: null,
  10. date: '',
  11. sexList: [
  12. {
  13. id: 1,
  14. title: '男'
  15. },
  16. {
  17. id: 0,
  18. title: '女'
  19. }
  20. ],
  21. sexActive: 0
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad(options) {
  27. console.log('permission load');
  28. },
  29. /**
  30. * 生命周期函数--监听页面显示
  31. */
  32. onShow() {
  33. },
  34. /**
  35. * 获取用户手机号权限
  36. */
  37. getPhoneNumber (e) {
  38. var that = this
  39. console.log(e.detail.code)
  40. setTimeout(() => {
  41. that.getUser()
  42. }, 1000);
  43. },
  44. getUser () {
  45. console.log('get user');
  46. wx.getUserProfile({
  47. desc: '获取您的微信头像和昵称用于登录',
  48. success: (res) => {
  49. console.log(res);
  50. }
  51. })
  52. },
  53. fillInfo () {
  54. console.log('filinfo');
  55. wx.reLaunch({
  56. url: "/pages/createInfo/createInfo"
  57. })
  58. },
  59. bindDateChange (e) {
  60. console.log(e);
  61. this.setData({
  62. date: e.detail.value
  63. })
  64. },
  65. handleSex (e) {
  66. this.setData({
  67. sexActive: e.currentTarget.dataset.index
  68. })
  69. },
  70. handleConfirmBind () {
  71. wx.showLoading({
  72. title: '绑定中...',
  73. mask: true
  74. })
  75. setTimeout(() => {
  76. wx.hideLoading({
  77. success: (res) => {
  78. wx.reLaunch({
  79. url: '/pages/index/index',
  80. })
  81. }
  82. })
  83. }, 1000);
  84. }
  85. })