App.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. const that = this;
  5. that.forceUpdate();
  6. },
  7. onShow: function() {
  8. console.log('App Show')
  9. },
  10. onHide: function() {
  11. console.log('App Hide')
  12. },
  13. methods: {
  14. // 强制更新
  15. forceUpdate() {
  16. let system = uni.getSystemInfoSync();
  17. if (system.uniPlatform == 'mp-weixin') {
  18. const updateManager = uni.getUpdateManager();
  19. updateManager.onCheckForUpdate(function(res) {
  20. // 请求完新版本信息的回调
  21. console.log(res.hasUpdate);
  22. });
  23. updateManager.onUpdateReady(function(res) {
  24. uni.showModal({
  25. title: '更新提示',
  26. content: '新版本已经准备好,是否重启应用?',
  27. success(res) {
  28. if (res.confirm) {
  29. uni.clearStorage();
  30. updateManager.applyUpdate();
  31. }
  32. }
  33. });
  34. });
  35. updateManager.onUpdateFailed(function(res) {
  36. console.log(res);
  37. console.log('更新失败');
  38. });
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. /*每个页面公共css */
  46. @import "uview-plus/index.scss";
  47. @import './static/iconfont-weapp/iconfont-weapp-icon.css';
  48. @import '@/uni_modules/uni-scss/index.scss';
  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. page {
  73. font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  74. /* 窗口可用高度 */
  75. /* 有头有底 */
  76. --oneHeight: 100vh;
  77. /* 有头无底 */
  78. --twoHeight: 92vh;
  79. /* 可用窗口背景颜色 */
  80. --mainColor: #ffffff;
  81. /* 底部菜单背景颜色 */
  82. --footColor: #f1f1f1;
  83. /* 字体大小 */
  84. --font20Size: 20px;
  85. --font19Size: 19px;
  86. --font18Size: 18px;
  87. --font17Size: 17px;
  88. --font16Size: 16px;
  89. --font15Size: 15px;
  90. --font14Size: 14px;
  91. --font13Size: 13px;
  92. --font12Size: 12px;
  93. /* 颜色 */
  94. --f1Color: #f1f1f1;
  95. --f2Color: #f2f2f2;
  96. --f3Color: #f3f3f3;
  97. --f4Color: #f4f4f4;
  98. --f5Color: #f5f5f5;
  99. --f6Color: #f6f6f6;
  100. --f7Color: #f7f7f7;
  101. --f8Color: #f8f8f8;
  102. --f9Color: #f9f9f9;
  103. --f99Color: #999999;
  104. --f85Color: #858585;
  105. --f69Color: #696969;
  106. --f80Color: #808080;
  107. --f33Color: #333333;
  108. --fFB1Color: #7A7E83;
  109. --f828Color: #82848a;
  110. --fDCColor: #DCDCDC;
  111. --fcColor: #cccccc;
  112. --f00Color: #000000;
  113. --fffColor: #ffffff;
  114. --ff0Color: #FF0000;
  115. --3c9Color: #3c9cff;
  116. --262Color: #262D3D;
  117. }
  118. </style>