洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

10 months ago
10 months ago
10 months ago
10 months ago
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. this.getLocationAuthority()
  5. },
  6. onShow: function() {
  7. console.log('App Show')
  8. },
  9. onHide: function() {
  10. console.log('App Hide')
  11. },
  12. methods: {
  13. getLocationAuthority() {
  14. let _this = this
  15. uni.getLocation({
  16. type: 'wgs84',
  17. success: function(res) {
  18. _this.$store.dispatch('getUserInfo')
  19. },
  20. fail: function(err) {
  21. console.log('为什么失败了')
  22. console.log(err)
  23. uni.showModal({
  24. content: '为了能够获取精确的数据,请去手机设置里手动开启app定位权限',
  25. showCancel: false,
  26. confirmText: '知道了,关闭弹窗',
  27. success: function(res) {
  28. if (res.confirm) {
  29. console.log('用户点击确定');
  30. } else if (res.cancel) {
  31. console.log('用户点击取消');
  32. }
  33. }
  34. });
  35. }
  36. });
  37. }
  38. }
  39. }
  40. </script>
  41. <style lang="scss">
  42. /*每个页面公共css */
  43. @import '@/uni_modules/uview-ui/index.scss';
  44. @import 'common/css/app.scss'
  45. </style>