App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <script>
  2. import $http from '@/utils/request.js'
  3. export default {
  4. globalData: {
  5. userInfo: {},
  6. },
  7. onLaunch: function() {
  8. uni.hideTabBar()
  9. },
  10. onShow: function() {
  11. this.updateManager()
  12. },
  13. methods: {
  14. updateManager() {
  15. const updateManager = uni.getUpdateManager();
  16. if(updateManager){
  17. updateManager.onCheckForUpdate(res => {
  18. // 请求完新版本信息的回调
  19. })
  20. updateManager.onUpdateReady(() => {
  21. uni.showModal({
  22. title: '更新提示',
  23. content: '新版本已经准备好,即将重启应用',
  24. showCancel: false,
  25. success(res) {
  26. if (res.confirm) {
  27. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  28. updateManager.applyUpdate()
  29. }
  30. }
  31. })
  32. })
  33. updateManager.onUpdateFailed(() => {
  34. // 新的版本下载失败
  35. uni.showModal({
  36. title: '更新提示',
  37. content: '新版本下载失败',
  38. showCancel: false
  39. })
  40. })
  41. }
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  48. @import "uview-ui/index.scss";
  49. // 设置整个项目的背景色
  50. page {
  51. background-color: #F9F7F5;
  52. font-size: 14px;
  53. color: #333;
  54. }
  55. view {
  56. box-sizing: border-box;
  57. word-break: break-all;
  58. }
  59. .container {
  60. background-color: #fff;
  61. font-size: 14px;
  62. color: #333;
  63. padding: 10px;
  64. }
  65. .flex {
  66. display: flex;
  67. align-items: center;
  68. justify-content: center;
  69. }
  70. .ells{
  71. overflow: hidden;
  72. text-overflow: ellipsis;
  73. display: -webkit-box;
  74. -webkit-box-orient: vertical;
  75. -webkit-line-clamp: 2;
  76. }
  77. .ells-one{
  78. overflow: hidden;
  79. text-overflow: ellipsis;
  80. display: -webkit-box;
  81. -webkit-box-orient: vertical;
  82. -webkit-line-clamp: 1;
  83. }
  84. @font-face {
  85. font-family: 'YouSheBiaoTiHei';
  86. src: url('https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/YouSheBiaoTiHei.ttf');
  87. }
  88. // 只有在app.vue里面定义的keyframes才能在style里面使用
  89. @keyframes moveLeft {
  90. 0% {
  91. -webkit-transform: translate3d(0, 0, 0);
  92. transform: translate3d(0, 0, 0);
  93. }
  94. 100% {
  95. -webkit-transform: translate3d(-100%, 0, 0);
  96. transform: translate3d(-100%, 0, 0);
  97. }
  98. }
  99. </style>