App.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. const that = this;
  5. that.forceUpdate();
  6. },
  7. methods: {
  8. // 强制更新
  9. forceUpdate() {
  10. const that = this;
  11. let system = that.$config.system;
  12. if (system.uniPlatform == 'mp-weixin') {
  13. const updateManager = uni.getUpdateManager();
  14. updateManager.onCheckForUpdate(function(res) {
  15. // 请求完新版本信息的回调
  16. console.log(res.hasUpdate);
  17. });
  18. updateManager.onUpdateReady(function(res) {
  19. uni.showModal({
  20. title: '更新提示',
  21. content: '新版本已经准备好,是否重启应用?',
  22. success(res) {
  23. if (res.confirm) {
  24. uni.clearStorage();
  25. updateManager.applyUpdate();
  26. }
  27. }
  28. });
  29. });
  30. updateManager.onUpdateFailed(function(res) {
  31. console.log(res);
  32. console.log('更新失败');
  33. });
  34. }
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. /*每个页面公共css */
  41. @import '@/uni_modules/uni-scss/index.scss';
  42. @import '@/common/css/font-icon.css';
  43. /* 公用 */
  44. .container {
  45. display: flex;
  46. flex-direction: column;
  47. box-sizing: border-box;
  48. width: 100vw;
  49. height: 100vh;
  50. }
  51. .textOver {
  52. overflow: hidden;
  53. text-overflow: ellipsis;
  54. white-space: nowrap;
  55. }
  56. // 弹框公共样式
  57. .uni-dialog-content {
  58. padding: 2vw !important;
  59. max-height: 40vh;
  60. overflow-y: auto;
  61. align-items: normal !important;
  62. box-sizing: border-box;
  63. }
  64. /* 设置整个项目的公用样式*/
  65. page {
  66. /* 窗口可用高度 */
  67. /* 有头有底 */
  68. --oneHeight: 100vh;
  69. /* 有头无底 */
  70. --twoHeight: 92vh;
  71. /* 可用窗口背景颜色 */
  72. --mainColor: #ffffff;
  73. /* 底部菜单背景颜色 */
  74. --footColor: #f1f1f1;
  75. /* 字体大小 */
  76. --font20Szie: 20px;
  77. --font19Szie: 19px;
  78. --font18Szie: 18px;
  79. --font17Size: 17px;
  80. --font16Size: 16px;
  81. --font15Size: 15px;
  82. --font14Size: 14px;
  83. --font13Size: 13px;
  84. --font12Size: 12px;
  85. /* 颜色 */
  86. --f1Color: #f1f1f1;
  87. --f2Color: #f2f2f2;
  88. --f3Color: #f3f3f3;
  89. --f4Color: #f4f4f4;
  90. --f5Color: #f5f5f5;
  91. --f6Color: #f6f6f6;
  92. --f7Color: #f7f7f7;
  93. --f8Color: #f8f8f8;
  94. --f9Color: #f9f9f9;
  95. --f99Color: #999999;
  96. --f85Color: #858585;
  97. --fcColor: #cccccc;
  98. --f00Color: #000000;
  99. --fffColor: #ffffff;
  100. --ff0Color: #ff0000;
  101. --f0fColor: #0000ff;
  102. --f08Color: #008000;
  103. --f35BColor: #35BD7B;
  104. --fFB1Color: #FB1438;
  105. }
  106. </style>