合同小程序前端代码仓库
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.

81 lines
1.6 KiB

3 months ago
3 months ago
3 months ago
  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. if (firstBackTime == 0) {
  17. uni.showToast({
  18. title: '再按一次退出应用',
  19. position: 'bottom',
  20. })
  21. firstBackTime = Date.now()
  22. setTimeout(() => {
  23. firstBackTime = 0
  24. }, 2000)
  25. } else if (Date.now() - firstBackTime < 2000) {
  26. firstBackTime = Date.now()
  27. uni.exit()
  28. }
  29. },
  30. // #endif
  31. onExit: function () {
  32. console.log('App Exit')
  33. },
  34. }
  35. </script>
  36. <style>
  37. @import "@/static/iconfont.css";
  38. /*每个页面公共css */
  39. body{
  40. background-color: #ffffff;
  41. }
  42. body {
  43. font-family: Arial, sans-serif;
  44. margin: 0;
  45. padding: 0;
  46. }
  47. @media only screen and (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){
  48. .uni-hairline{
  49. border-width: 0.5px !important;
  50. }
  51. .uni-nbfc {
  52. background-color: transparent !important;
  53. }
  54. }
  55. @media screen and (min-width: 320px) {
  56. html {font-size: 14px;}
  57. }
  58. @media screen and (min-width: 360px) {
  59. html {font-size: 16px;}
  60. }
  61. @media screen and (min-width: 400px) {
  62. html {font-size: 18px;}
  63. }
  64. @media screen and (min-width: 440px) {
  65. html {font-size: 20px;}
  66. }
  67. @media screen and (min-width: 480px) {
  68. html {font-size: 22px;}
  69. }
  70. @media screen and (min-width: 640px) {
  71. html {font-size: 28px;}
  72. }
  73. </style>