1. <button open-type="getUserInfo" bindgetuserinfo="getUserInformation">获取用户信息</button>
    2. <button bindtap="openSetting">打开设置</button>
    3. <button bindtap="getLocation">获取用户位置信息</button>
    4. <button bindtap="getWeRun">获取运动步数</button>
    1. getUserInformation(e){
    2. wx.getUserInfo({
    3. withCredentials: true,
    4. success: function(res){},
    5. fail: function(res){},
    6. complete: function(res){
    7. console.log('getUserInformation', res);
    8. }
    9. });
    10. },
    11. openSetting(){
    12. // wx.authorize({
    13. // scope: 'scope.userLocation',
    14. // success(){
    15. // },
    16. // fail(){
    17. // }
    18. // });
    19. wx.openSetting({
    20. success: function (res) { },
    21. fail: function (res) { },
    22. complete: function (res) {
    23. console.log("openSetting", res);
    24. }
    25. });
    26. },
    27. getLocation() {
    28. // wx.getLocation({
    29. // type: '',
    30. // altitude: true,
    31. // success: function(res) {},
    32. // fail: function(res){
    33. // },
    34. // complete:function(res){
    35. // console.log("get location", res);
    36. // }
    37. // });
    38. wx.chooseLocation({
    39. type: '',
    40. altitude: true,
    41. success: function (res) { },
    42. fail: function (res) {
    43. },
    44. complete: function (res) {
    45. console.log("choose location", res);
    46. }
    47. });
    48. },
    49. getWeRun(){
    50. wx.getWeRunData({
    51. success: function (res) { },
    52. fail: function (res) {
    53. },
    54. complete: function (res) {
    55. console.log("get WeRun", res);
    56. }
    57. });
    58. }