App.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. // console.log('App Launch')
  5. this.checkUpdate()
  6. },
  7. onShow: function() {
  8. // console.log('App Show')
  9. },
  10. onHide: function() {
  11. // console.log('App Hide')
  12. },
  13. methods: {
  14. checkUpdate() {
  15. const updateManager = uni.getUpdateManager();
  16. updateManager.onCheckForUpdate(function(res) {
  17. // 请求完新版本信息的回调
  18. console.log('是否有新版本:', res.hasUpdate);
  19. });
  20. updateManager.onUpdateReady(function() {
  21. uni.showModal({
  22. title: '更新提示',
  23. content: '新版本已经准备好,是否重启小程序?',
  24. confirmText: '立即重启',
  25. confirmColor: '#2179f5',
  26. showCancel: false,
  27. success(res) {
  28. if (res.confirm) {
  29. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  30. updateManager.applyUpdate();
  31. }
  32. }
  33. });
  34. });
  35. updateManager.onUpdateFailed(function() {
  36. // 新的版本下载失败
  37. uni.showModal({
  38. title: '更新提示',
  39. content: '新版本下载失败,请检查网络后重试。',
  40. showCancel: false
  41. });
  42. });
  43. },
  44. }
  45. }
  46. </script>
  47. <style lang="less">
  48. @import '@/assets/css/common.less';
  49. @import './assets/css/tool.css';
  50. </style>
  51. <style lang="scss">
  52. @import "@/uni_modules/uview-ui/index.scss";
  53. @import '@/assets/css/common.scss';
  54. @import '@/assets/css/commonTheme.css';
  55. page{
  56. background-color: #f5f5f5;
  57. }
  58. ::-webkit-scrollbar{
  59. width: 0 !important;
  60. height: 0 !important;
  61. }
  62. /*每个页面公共css */
  63. .base-color {
  64. color: #1773ff;
  65. }
  66. .colorf{
  67. color: #fff;
  68. }
  69. .bgf{
  70. background-color: #fff;
  71. }
  72. .base-color-2 {
  73. color: #e7f1fe;
  74. }
  75. .base-color-3 {
  76. color: #425034;
  77. }
  78. .base-color-9 {
  79. color: #999;
  80. }
  81. .base-color-8 {
  82. color: #f8f8f8;
  83. }
  84. .base-color-6 {
  85. color: #666;
  86. }
  87. .base-color-gray {
  88. color: #DEDFE4;
  89. }
  90. .base-color-red{
  91. color:#ee0a25;
  92. }
  93. .base-color-dark {
  94. color: #313131;
  95. }
  96. .base-color-dark2 {
  97. color: #3E3E3E;
  98. }
  99. .base-price {
  100. color: #FF1212;
  101. }
  102. .base-success {
  103. color: #a3db42;
  104. }
  105. .base-bg {
  106. background: #1773ff;
  107. }
  108. .base-bg-2 {
  109. background: #e7f1fe;
  110. }
  111. .base-bg-red{
  112. background: #ee0a25;
  113. }
  114. .base-bg-f{
  115. background-color:#fff;
  116. }
  117. .base-bg-f8{
  118. background-color:#f8f8f8;
  119. }
  120. .base-bg-f5{
  121. background-color: #f5f5f5;
  122. }
  123. .base-bg-9{
  124. background-color: #f9f9f9;
  125. }
  126. .base-bg-blue{
  127. background:#1677ff;
  128. }
  129. .base-bg-sure{
  130. background:#e7f2fe;
  131. }
  132. .base-bg-orange{
  133. background:#FF7F00;
  134. }
  135. .base-bg-false{
  136. background:#fae7e7;
  137. }
  138. .bor-blue{
  139. border: 2rpx solid #c9e1fb;
  140. }
  141. .bor-red{
  142. border: 2rpx solid #f7a1a1;
  143. }
  144. </style>