App.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <script>
  2. import amap from './common/amap-wx.130.js'
  3. var amapPlugin = new amap.AMapWX({
  4. key: 'bb69713f3c3d3c85e2662d313daa47b9'
  5. });
  6. export default {
  7. globalData: {
  8. getLoca: function() {
  9. var city = uni.getStorageSync('city')
  10. return new Promise((resolve, reject) => {
  11. if(!city) {
  12. uni.authorize({
  13. scope: 'scope.userLocation',
  14. success() {
  15. wx.getLocation({
  16. type: 'wgs84',
  17. success(res) {
  18. amapPlugin.getRegeo({
  19. success(data) {
  20. resolve(data)
  21. },
  22. fail(err) {
  23. console.log('err=',err)
  24. }
  25. })
  26. },
  27. fail(err){
  28. console.log('err=',err)
  29. }
  30. })
  31. },
  32. fail(err) {
  33. closeLoading('error',err)
  34. }
  35. })
  36. }
  37. })
  38. }
  39. },
  40. onLoad() {
  41. },
  42. onLaunch: function() {
  43. console.log('App Launch')
  44. },
  45. onShow: function() {
  46. console.log('App Show')
  47. },
  48. onHide: function() {
  49. console.log('App Hide')
  50. },
  51. }
  52. </script>
  53. <style lang="scss">
  54. /*每个页面公共css */
  55. @import "uview-ui/index.scss";
  56. .content {
  57. background-color: #ffffff;
  58. width: 100%;
  59. min-height: 100vh;
  60. display: flex;
  61. flex-direction: column;
  62. font-size: 28rpx;
  63. color: #333;
  64. box-sizing: border-box;
  65. }
  66. .hflex {
  67. display: flex;
  68. flex-direction: row;
  69. flex-wrap: nowrap;
  70. }
  71. .vflex {
  72. display: flex;
  73. flex-direction: column;
  74. flex-wrap: nowrap;
  75. }
  76. .jbetween {
  77. justify-content: space-between;
  78. }
  79. .jaround {
  80. justify-content: space-around;
  81. }
  82. .jend {
  83. justify-content: flex-end;
  84. }
  85. .jcenter {
  86. justify-content: center;
  87. }
  88. .acenter {
  89. align-items: center;
  90. }
  91. .abetween {
  92. align-content: space-between;
  93. }
  94. .astart {
  95. align-items: flex-start;
  96. }
  97. .aend {
  98. align-items: flex-end;
  99. }
  100. .fwrap {
  101. flex-wrap: wrap;
  102. }
  103. .text_hide {
  104. overflow: hidden;
  105. white-space: nowrap;
  106. text-overflow: ellipsis;
  107. }
  108. </style>