permission.js 1.7 KB

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