App.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 './static/iconfont-weapp/iconfont-weapp-icon.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. page {
  81. // font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  82. /* 窗口可用高度 */
  83. /* 有头有底 */
  84. --oneHeight: 100vh;
  85. /* 有头无底 */
  86. --twoHeight: 92vh;
  87. /* 可用窗口背景颜色 */
  88. --mainColor: #ffffff;
  89. /* 底部菜单背景颜色 */
  90. --footColor: #f1f1f1;
  91. /* 字体大小 */
  92. --font20Size: 20px;
  93. --font19Size: 19px;
  94. --font18Size: 18px;
  95. --font17Size: 17px;
  96. --font16Size: 16px;
  97. --font15Size: 15px;
  98. --font14Size: 14px;
  99. --font13Size: 13px;
  100. --font12Size: 12px;
  101. /* 颜色 */
  102. --f1Color: #f1f1f1;
  103. --f2Color: #f2f2f2;
  104. --f3Color: #f3f3f3;
  105. --f4Color: #f4f4f4;
  106. --f5Color: #f5f5f5;
  107. --f6Color: #f6f6f6;
  108. --f7Color: #f7f7f7;
  109. --f8Color: #f8f8f8;
  110. --f9Color: #f9f9f9;
  111. --f99Color: #999999;
  112. --f85Color: #858585;
  113. --f69Color: #696969;
  114. --f80Color: #808080;
  115. --f33Color: #333333;
  116. --fFB1Color: #7A7E83;
  117. --fDCColor: #DCDCDC;
  118. --fcColor: #cccccc;
  119. --f00Color: #000000;
  120. --fffColor: #ffffff;
  121. --f3CColor: #007AFF;
  122. --fF0Color: #FF0000;
  123. --f08Color: #008000;
  124. --f35BColor: #35BD7B;
  125. --f191Color: #191970;
  126. }
  127. </style>