App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <script>
  2. export default {
  3. onLaunch: function () {
  4. let updateManager = uni.getUpdateManager();
  5. if (!updateManager) {
  6. return;
  7. } else {
  8. //新版本更新
  9. if (uni.canIUse("getUpdateManager")) {
  10. //判断当前微信版本是否支持版本更新
  11. updateManager.onCheckForUpdate(function (res) {
  12. if (res.hasUpdate) {
  13. // 请求完新版本信息的回调
  14. updateManager.onUpdateReady(function () {
  15. uni.showModal({
  16. title: "更新提示",
  17. content: "新版本已经准备好,是否重启应用?",
  18. success: function (res) {
  19. if (res.confirm) {
  20. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  21. updateManager.applyUpdate();
  22. }
  23. },
  24. });
  25. });
  26. updateManager.onUpdateFailed(function () {
  27. uni.showModal({
  28. // 新的版本下载失败
  29. title: "已经有新版本了哟~",
  30. content:
  31. "新版本已经上线啦~,请您删除当前小程序,重新搜索(极速生活圈)打开哟~",
  32. });
  33. });
  34. } else {
  35. }
  36. });
  37. } else {
  38. uni.showModal({
  39. // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
  40. title: "提示",
  41. content:
  42. "当前微信版本过低,部分功能无法使用,请升级到最新微信版本后重试。",
  43. });
  44. }
  45. }
  46. },
  47. };
  48. </script>
  49. <style lang="scss">
  50. /* #ifdef MP-TOUTIAO */
  51. /* #endif */
  52. /* #ifdef MP-WEIXIN */
  53. @import "@/wxcomponents/vant/common/index.wxss";
  54. @import "@/common/css/animation.css";
  55. /* #endif */
  56. /*每个页面公共css */
  57. // page {
  58. // font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
  59. // Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB",
  60. // "Microsoft Yahei", sans-serif;
  61. // }
  62. page {
  63. font-family: -apple-system, Arial, "Helvetica Neue", Helvetica, "PingFang SC",
  64. "Hiragino Sans GB", "Heiti SC", "MicrosoftYaHei", "WenQuanYi Micro Hei",
  65. sans-serif;
  66. }
  67. view {
  68. margin: 0;
  69. padding: 0;
  70. box-sizing: border-box;
  71. }
  72. html {
  73. background-color: #f1f1f1;
  74. }
  75. .night {
  76. filter: invert(1) hue-rotate(180deg);
  77. }
  78. .van-overlay {
  79. position: fixed;
  80. top: 0;
  81. left: 0;
  82. width: 100%;
  83. height: 100%;
  84. background-color: rgba(0, 0, 0, 0.65);
  85. }
  86. .uni-app-fontsize-paragraph{
  87. font-size: $uni-app-fontsize-paragraph;
  88. }
  89. .wxad{
  90. padding-bottom: 20rpx;
  91. padding-top: 20rpx;
  92. border-top: 2rpx dashed #a8a8a8;
  93. width: 100%;
  94. }
  95. .pl0{
  96. padding-left: 0 !important;
  97. }
  98. .mt40{
  99. margin-top: 40rpx;
  100. }
  101. </style>