index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. username:'未登录'
  7. },
  8. getPhoneNumber (e) {
  9. console.log(e.detail.errMsg)
  10. console.log(e.detail.iv)
  11. console.log(e.detail.encryptedData)
  12. },
  13. //事件处理函数
  14. bindViewTap: function() {
  15. wx.navigateTo({
  16. url: '../logs/logs'
  17. })
  18. },
  19. getmenu:function(){
  20. wx.request({
  21. url: 'http://192.168.20.53:9999/admin/menu/tree',
  22. method: 'get',
  23. header: {
  24. 'Authorization': 'Bearer '+wx.getStorageSync('token')
  25. },
  26. success(r) {
  27. console.log(r)
  28. console.log(r)
  29. }
  30. })
  31. },
  32. login:function(){
  33. // var self = this
  34. // wx.login({
  35. // success(res){
  36. // wx.request({
  37. // url: 'http://192.168.20.53:9999/auth/mobile/token/social?grant_type=mobil&mobile=MINI@'+res.code,
  38. // method: 'post',
  39. // header: {
  40. // 'Authorization': 'Basic dGVzdDp0ZXN0'
  41. // },
  42. // success(res){
  43. // console.log(res)
  44. // wx.setStorageSync('token', res.data.access_token);
  45. // if (res.statusCode === 401){
  46. // console.log(res.data)
  47. // wx.navigateTo({
  48. // url: '../bind/bind',
  49. // })
  50. // }else{
  51. // self.setData({
  52. // username: res.data.username
  53. // })
  54. // }
  55. // }
  56. // })
  57. // }
  58. // })
  59. }
  60. })