App.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <script>
  2. var user = require('./utils/user.js');
  3. export default {
  4. data() {
  5. return {};
  6. },
  7. onLaunch: function () {
  8. const updateManager = uni.getUpdateManager();
  9. uni.getUpdateManager().onUpdateReady(function () {
  10. updateManager.applyUpdate();
  11. });
  12. },
  13. onLoad() {
  14. var updateManager = uni.getUpdateManager();
  15. updateManager.onUpdateReady((res) => {
  16. uni.showModal({
  17. title: '更新提示',
  18. content: '新版本已经准备好,是否重启小程序?',
  19. success: (res) => {
  20. if (res.confirm) {
  21. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  22. updateManager.applyUpdate();
  23. }
  24. }
  25. });
  26. });
  27. updateManager.onUpdateFailed((err) => {
  28. // 新的版本下载失败
  29. console.log('版本下载失败原因', err);
  30. uni.showToast({
  31. title: '新版本下载失败,请稍后再试',
  32. icon: 'none'
  33. });
  34. });
  35. },
  36. onShow: function (options) {
  37. /*是否授权登录*/
  38. user.checkLogin()
  39. .then((res) => {
  40. this.globalData.hasLogin = true;
  41. if (this.globalData.checkLoginReadyCallback) {
  42. this.globalData.checkLoginReadyCallback();
  43. }
  44. })
  45. .catch(() => {
  46. this.globalData.hasLogin = false;
  47. });
  48. },
  49. globalData: {
  50. hasLogin: false,
  51. userInfo: {},
  52. //是否注册过
  53. mapKey: 'AEZBZ-7JYL6-N4WSL-EFMOK-SAHSO-GLFA4',
  54. currentLocationName: '位置获取中',
  55. city: '',
  56. checkLoginReadyCallback: function () {
  57. //是否登录
  58. this.hasLogin = true;
  59. }
  60. }
  61. };
  62. </script>
  63. <style>
  64. /**app.ttss**/
  65. .container {
  66. box-sizing: border-box;
  67. background-color: #f5f5f5;
  68. font-family: PingFangSC-Light, helvetica, 'Heiti SC';
  69. }
  70. view,
  71. image,
  72. text,
  73. navigator {
  74. box-sizing: border-box;
  75. padding: 0;
  76. margin: 0;
  77. }
  78. page {
  79. color: #2a2a2a; /*主要颜色*/
  80. font-size: 28rpx;
  81. background: #f5f5f5;
  82. }
  83. text,
  84. view {
  85. font-family: PingFangSC-Light, helvetica, 'Heiti SC';
  86. /* font-weight: 500; */
  87. }
  88. .sub-color {
  89. color: #85868a;
  90. }
  91. .jz-color {
  92. color: #09afff; /*鲸致色号00AFFF*/
  93. }
  94. .van-tab > view.van-ellipsis {
  95. color: #888;
  96. }
  97. .van-tab--active.van-tab > view.van-ellipsis {
  98. color: #09afff;
  99. }
  100. van-dialog .van-button {
  101. color: #09afff !important;
  102. }
  103. .van-dialog__message-text {
  104. color: #666;
  105. }
  106. .van-button--info {
  107. background: #09afff !important;
  108. border: none !important;
  109. }
  110. .bottom-fixed-btn-wrapper {
  111. position: fixed;
  112. bottom: 146rpx;
  113. left: 0;
  114. right: 28rpx;
  115. left: 28rpx;
  116. }
  117. .bottom-fixed-btn-wrapper .van-button {
  118. height: 74rpx;
  119. border: none;
  120. }
  121. .common-btn-wrapper {
  122. margin: 0 28rpx 0;
  123. }
  124. .common-btn-wrapper .van-button {
  125. height: 74rpx;
  126. margin: 0 0 48rpx 0;
  127. }
  128. </style>