permission.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // pages/permisission/permission.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. phoneLoading: false,
  8. showCreateForm: false,
  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. console.log(e.currentTarget.dataset.index)
  67. this.setData({
  68. sexActive: e.currentTarget.dataset.index
  69. })
  70. }
  71. })