App.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. const that = this;
  5. that.forceUpdate();
  6. },
  7. onShow: function() {
  8. const that = this;
  9. },
  10. onHide: function() {
  11. console.log('App Hide')
  12. },
  13. methods: {
  14. // 强制更新
  15. forceUpdate() {
  16. const that = this;
  17. let system = uni.getSystemInfoSync();
  18. if (system.uniPlatform == 'mp-weixin') {
  19. const updateManager = uni.getUpdateManager();
  20. updateManager.onCheckForUpdate(function(res) {
  21. // 请求完新版本信息的回调
  22. console.log(res.hasUpdate);
  23. });
  24. updateManager.onUpdateReady(function(res) {
  25. uni.showModal({
  26. title: '更新提示',
  27. content: '新版本已经准备好,是否重启应用?',
  28. success(res) {
  29. if (res.confirm) {
  30. uni.clearStorage();
  31. updateManager.applyUpdate();
  32. }
  33. }
  34. });
  35. });
  36. updateManager.onUpdateFailed(function(res) {
  37. console.log(res);
  38. console.log('更新失败');
  39. });
  40. }
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. /*每个页面公共css */
  47. @import '@/uni_modules/uni-scss/index.scss';
  48. @import '@/common/css/iconfont.css';
  49. /* 公用 */
  50. .container {
  51. display: flex;
  52. flex-direction: column;
  53. box-sizing: border-box;
  54. width: 100vw;
  55. height: 100vh;
  56. }
  57. .textOne {
  58. overflow: hidden;
  59. white-space: nowrap;
  60. text-overflow: ellipsis;
  61. -o-text-overflow: ellipsis;
  62. }
  63. .textOver {
  64. overflow: hidden;
  65. text-overflow: ellipsis;
  66. word-break: break-all;
  67. display: -webkit-box;
  68. -webkit-box-orient: vertical;
  69. -webkit-line-clamp: 2;
  70. }
  71. // 弹框公共样式
  72. .uni-dialog-content {
  73. padding: 2vw !important;
  74. max-height: 40vh;
  75. overflow-y: auto;
  76. align-items: normal !important;
  77. box-sizing: border-box;
  78. }
  79. // 轮播图样式
  80. wx-swiper .wx-swiper-dot {
  81. width: 20rpx;
  82. height: 4rpx;
  83. border-radius: 10rpx;
  84. }
  85. wx-swiper .wx-swiper-dot-active {
  86. width: 40rpx;
  87. border-radius: 10rpx;
  88. }
  89. /* 设置整个项目的公用样式*/
  90. page {
  91. // font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  92. /* 窗口可用高度 */
  93. /* 有头有底 */
  94. --oneHeight: 100vh;
  95. /* 有头无底 */
  96. --twoHeight: 92vh;
  97. /* 可用窗口背景颜色 */
  98. --mainColor: #ffffff;
  99. /* 底部菜单背景颜色 */
  100. --footColor: #f1f1f1;
  101. /* 字体大小 */
  102. --font20Size: 20px;
  103. --font19Size: 19px;
  104. --font18Size: 18px;
  105. --font17Size: 17px;
  106. --font16Size: 16px;
  107. --font15Size: 15px;
  108. --font14Size: 14px;
  109. --font13Size: 13px;
  110. --font12Size: 12px;
  111. /* 颜色 */
  112. --f1Color: #f1f1f1;
  113. --f2Color: #f2f2f2;
  114. --f3Color: #f3f3f3;
  115. --f4Color: #f4f4f4;
  116. --f5Color: #f5f5f5;
  117. --f6Color: #f6f6f6;
  118. --f7Color: #f7f7f7;
  119. --f8Color: #f8f8f8;
  120. --f9Color: #f9f9f9;
  121. --f99Color: #999999;
  122. --f85Color: #858585;
  123. --f69Color: #696969;
  124. --f80Color: #808080;
  125. --fFB1Color: #7A7E83;
  126. --fDCColor: #DCDCDC;
  127. --fcColor: #cccccc;
  128. --f00Color: #000000;
  129. --fffColor: #ffffff;
  130. --f3CColor: #007AFF;
  131. --fF0Color: #FF0000;
  132. --f08Color: #008000;
  133. --f35BColor: #35BD7B;
  134. }
  135. </style>