App.uvue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <script lang="uts">
  2. let firstBackTime = 0
  3. export default {
  4. onLaunch: function () {
  5. console.log('App Launch')
  6. },
  7. onShow: function () {
  8. console.log('App Show')
  9. },
  10. onHide: function () {
  11. console.log('App Hide')
  12. },
  13. // #ifdef APP-ANDROID
  14. onLastPageBackPress: function () {
  15. console.log('App LastPageBackPress')
  16. // #ifdef APP-ANDROID
  17. UTSAndroid.getUniActivity()?.moveTaskToBack(true)
  18. // #endif
  19. // #ifdef APP-HARMONY
  20. UTSHarmony.getUIAbilityContext().moveAbilityToBackground()
  21. // #endif
  22. // if (firstBackTime == 0) {
  23. // uni.showToast({
  24. // title: '再按一次退出应用',
  25. // position: 'bottom',
  26. // })
  27. // firstBackTime = Date.now()
  28. // setTimeout(() => {
  29. // firstBackTime = 0
  30. // }, 2000)
  31. // } else if (Date.now() - firstBackTime < 2000) {
  32. // firstBackTime = Date.now()
  33. // uni.exit()
  34. // }
  35. },
  36. // #endif
  37. onExit: function () {
  38. console.log('App Exit')
  39. },
  40. }
  41. </script>
  42. <style lang="scss">
  43. @import './static/css/form.scss';
  44. /*每个页面公共css */
  45. /* 布局 */
  46. .uni-row {
  47. flex-direction: row;
  48. }
  49. .uni-column {
  50. flex-direction: column;
  51. }
  52. /* 文字颜色 */
  53. .text-primary {
  54. color: #333333;
  55. }
  56. .text-secondary {
  57. color: #666666;
  58. }
  59. .text-placeholder {
  60. color: #999999;
  61. }
  62. /* 背景色 */
  63. .bg-white {
  64. background-color: #ffffff;
  65. }
  66. .bg-gray {
  67. background-color: #f5f5f5;
  68. }
  69. /* 间距 */
  70. .padding-sm {
  71. padding: 15rpx;
  72. }
  73. .padding-md {
  74. padding: 20rpx;
  75. }
  76. .padding-lg {
  77. padding: 30rpx;
  78. }
  79. .margin-sm {
  80. margin: 15rpx;
  81. }
  82. .margin-md {
  83. margin: 20rpx;
  84. }
  85. .margin-lg {
  86. margin: 30rpx;
  87. }
  88. /* 圆角 */
  89. .radius-sm {
  90. border-radius: 4rpx;
  91. }
  92. .radius-md {
  93. border-radius: 8rpx;
  94. }
  95. .radius-lg {
  96. border-radius: 12rpx;
  97. }
  98. </style>
  99. <style>
  100. /* #ifdef APP-HARMONY */
  101. /* 鸿蒙平台全局样式 */
  102. .l-input__placeholder {
  103. font-weight: 400 !important;
  104. font-size: 28rpx !important;
  105. color: #999999 !important;
  106. }
  107. .l-textarea__placeholder {
  108. font-weight: 400 !important;
  109. font-size: 28rpx !important;
  110. color: #999999 !important;
  111. }
  112. .l-input__control {
  113. font-weight: 400 !important;
  114. font-size: 28rpx !important;
  115. color: #131415 !important;
  116. }
  117. .l-textarea__control {
  118. font-weight: 400 !important;
  119. font-size: 28rpx !important;
  120. color: #131415 !important;
  121. }
  122. .uni-input-input {
  123. font-weight: 400 !important;
  124. font-size: 28rpx !important;
  125. color: #131415 !important;
  126. }
  127. .uni-textarea-textarea {
  128. font-weight: 400 !important;
  129. font-size: 28rpx !important;
  130. color: #131415 !important;
  131. }
  132. .uni-input-placeholder,
  133. .uni-textarea-placeholder {
  134. font-weight: 400 !important;
  135. font-size: 28rpx !important;
  136. color: #999999 !important;
  137. }
  138. /* #endif */
  139. </style>