App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. updateManager.onCheckForUpdate(res => {
  17. // 请求完新版本信息的回调
  18. // console.log(res.hasUpdate)
  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. </script>
  45. <style lang="scss">
  46. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  47. @import "@/uni_modules/uview-ui/index.scss";
  48. // 设置整个项目的背景色
  49. page {
  50. background-color: #F9F7F5;
  51. font-size: 14px;
  52. color: #333;
  53. }
  54. view {
  55. box-sizing: border-box;
  56. word-break: break-all;
  57. }
  58. .container {
  59. background-color: #fff;
  60. font-size: 14px;
  61. color: #333;
  62. padding: 10px;
  63. }
  64. .flex {
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. }
  69. .ells{
  70. overflow: hidden;
  71. text-overflow: ellipsis;
  72. display: -webkit-box;
  73. -webkit-box-orient: vertical;
  74. -webkit-line-clamp: 2;
  75. }
  76. .ells-one{
  77. overflow: hidden;
  78. text-overflow: ellipsis;
  79. display: -webkit-box;
  80. -webkit-box-orient: vertical;
  81. -webkit-line-clamp: 1;
  82. }
  83. @font-face {
  84. font-family: 'YouSheBiaoTiHei';
  85. src: url('https://mp-public-test-1307117429.cos.ap-shanghai.myqcloud.com/YouSheBiaoTiHei.ttf');
  86. }
  87. // 只有在app.vue里面定义的keyframes才能在style里面使用
  88. @keyframes moveLeft {
  89. 0% {
  90. -webkit-transform: translate3d(0, 0, 0);
  91. transform: translate3d(0, 0, 0);
  92. }
  93. 100% {
  94. -webkit-transform: translate3d(-100%, 0, 0);
  95. transform: translate3d(-100%, 0, 0);
  96. }
  97. }
  98. </style>