四零语境后端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.1 KiB

2 days ago
  1. <script lang="ts">
  2. import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app'
  3. import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
  4. import { beforEach } from '@/router/index'
  5. // #ifdef APP-PLUS
  6. import appUpdate from "@/common/appUpdate";
  7. // #endif
  8. export default {
  9. onLaunch: function (options) {
  10. console.log('App Launch')
  11. console.log('应用启动路径:', options.path)
  12. // #ifdef APP-PLUS
  13. // 检测升级
  14. appUpdate()
  15. // #endif
  16. },
  17. onShow: function (options) {
  18. console.log('App Show')
  19. console.log('应用启动路径:', options.path)
  20. // 首次进入页面时路由拦截
  21. setTimeout(() => {
  22. const currentPage = options.path
  23. beforEach({ path: '/' }, { path: currentPage, fullPath: currentPage }, (data) => {
  24. if (data?.path) {
  25. uni.redirectTo({ url: data.path })
  26. }
  27. })
  28. }, 100)
  29. },
  30. onHide: function () {
  31. console.log('App Hide')
  32. },
  33. // 全局变量
  34. globalData: {
  35. isLocalConfig: true,
  36. systemInfo: uni.getSystemInfoSync(),
  37. // 导航的高度
  38. navHeight: 44,
  39. },
  40. }
  41. </script>
  42. <style lang="scss">
  43. :root,
  44. page {
  45. font-size: 14px;
  46. color: #333333;
  47. font-family:
  48. Helvetica Neue,
  49. Helvetica,
  50. sans-serif;
  51. }
  52. uni-page-body {
  53. height: 100%;
  54. & > uni-view {
  55. height: 100%;
  56. }
  57. }
  58. .shadow-warp {
  59. position: relative;
  60. box-shadow: 0 0 5px rgba(168, 92, 92, 0.1);
  61. }
  62. /* stylelint-disable selector-type-no-unknown */
  63. button::after {
  64. border: none;
  65. }
  66. swiper,
  67. scroll-view {
  68. flex: 1;
  69. height: 100%;
  70. overflow: hidden;
  71. }
  72. image {
  73. width: 100%;
  74. height: 100%;
  75. vertical-align: middle;
  76. }
  77. // 单行省略,优先使用 unocss: text-ellipsis
  78. .ellipsis {
  79. overflow: hidden;
  80. text-overflow: ellipsis;
  81. white-space: nowrap;
  82. }
  83. // 两行省略
  84. .ellipsis-2 {
  85. display: -webkit-box;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. -webkit-line-clamp: 2;
  89. -webkit-box-orient: vertical;
  90. word-break: break-all;
  91. }
  92. // 三行省略
  93. .ellipsis-3 {
  94. display: -webkit-box;
  95. overflow: hidden;
  96. text-overflow: ellipsis;
  97. -webkit-line-clamp: 3;
  98. -webkit-box-orient: vertical;
  99. }
  100. </style>