App.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <script>
  2. import { initAppDatabase } from '@/utils/appDb';
  3. export default {
  4. onLaunch: (options) => {
  5. // #ifdef APP
  6. initAppDatabase();
  7. // #endif
  8. console.log('App Launch');
  9. console.log(options);
  10. // uni.onNetworkStatusChange((event) => {
  11. // console.log(event)
  12. // })
  13. // #ifdef H5
  14. // 保存钉钉消息传递的参数,参数可能存在path或query中
  15. if (options.query.type) {
  16. uni.setStorageSync('dingTalkJson', JSON.stringify(options.query));
  17. } else if (options.path && options.path.includes('type')) {
  18. const path = options.path;
  19. const args = path.split('&');
  20. const params = {};
  21. args.forEach((arg) => {
  22. const [key, value] = arg.split('=');
  23. if (key && value) {
  24. params[key] = value;
  25. }
  26. console.log(params);
  27. });
  28. uni.setStorageSync('dingTalkJson', JSON.stringify(params));
  29. }
  30. // #endif
  31. // #ifdef APP
  32. plus.globalEvent.addEventListener('newintent', () => {
  33. const args = plus.runtime.arguments;
  34. const parts = args.match(/^deepoil:\/\/([^/]+)\/([^/]+)$/);
  35. if (parts) {
  36. const type = parts[1];
  37. const id = parts[2];
  38. uni.setStorageSync('dingTalkJson', JSON.stringify({ type, id }));
  39. console.log('App: dingTalkJson -> ' + uni.getStorageSync('dingTalkJson'));
  40. }
  41. });
  42. // #endif
  43. },
  44. onExit: () => {
  45. // #ifdef APP
  46. // sqlite.closeDB('app')
  47. // #endif
  48. },
  49. onShow: function () {
  50. // console.log('App Show')
  51. },
  52. onHide: function () {
  53. // console.log('App Hide')
  54. }
  55. };
  56. </script>
  57. <style lang="scss">
  58. /*每个页面公共css */
  59. @import './style/common.scss';
  60. @import './style/fonts.scss';
  61. /* uniapp组件 样式覆盖 */
  62. uni-button[type='primary'] {
  63. background: #004098 !important;
  64. }
  65. uni-button[disabled][type='primary'] {
  66. background: rgba(0, 64, 152, 0.6) !important;
  67. }
  68. uni-button[type='primary'][plain] {
  69. color: #004098 !important;
  70. border: 1px solid #004098 !important;
  71. background-color: transparent !important;
  72. }
  73. uni-page-body,
  74. body {
  75. width: 100%;
  76. height: 100%;
  77. box-sizing: border-box;
  78. position: relative;
  79. }
  80. :deep(.uni-tabbar-bottom .uni-tabbar) {
  81. box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.1);
  82. // padding-top: 9px !important;
  83. // padding-bottom: 10px !important;
  84. box-sizing: border-box;
  85. .uni-tabbar__icon {
  86. margin-top: 4px;
  87. }
  88. }
  89. .page {
  90. position: relative;
  91. padding: 20rpx;
  92. padding-top: 0;
  93. box-sizing: border-box;
  94. background: #f3f5f9;
  95. width: 100%;
  96. height: 100%;
  97. font-family: PingFangSC, PingFang SC;
  98. overflow: hidden;
  99. }
  100. .page-nopadding {
  101. position: relative;
  102. box-sizing: border-box;
  103. background: #f3f5f9;
  104. width: 100%;
  105. height: 100%;
  106. font-family: PingFangSC, PingFang SC;
  107. overflow: hidden;
  108. }
  109. .page-back {
  110. background-image: url('/static/common/1.png');
  111. background-repeat: no-repeat;
  112. background-size: 100% 100%;
  113. position: fixed;
  114. top: 0;
  115. left: 0;
  116. width: 100%;
  117. height: 350px;
  118. z-index: 0;
  119. }
  120. .navgator {
  121. width: 100%;
  122. height: $header-height;
  123. line-height: 1;
  124. position: fixed;
  125. top: $header-top-height;
  126. left: 0;
  127. background-color: transparent !important;
  128. padding-top: calc(7px + env(safe-area-inset-top));
  129. box-sizing: border-box;
  130. z-index: 22;
  131. .nav-title {
  132. font-family: PingFang-SC, PingFang-SC;
  133. font-weight: bold;
  134. font-size: 16px;
  135. color: #ffffff;
  136. line-height: 22px;
  137. text-align: right;
  138. font-style: normal;
  139. }
  140. .nav-back {
  141. width: 40rpx;
  142. line-height: 1;
  143. position: absolute;
  144. left: 20rpx;
  145. .uni-icons {
  146. color: #fff !important;
  147. }
  148. }
  149. }
  150. .page-content {
  151. position: relative;
  152. box-sizing: border-box;
  153. width: 100%;
  154. height: calc(100% - $header-height - $header-top-height);
  155. margin-top: calc($header-height + $header-top-height);
  156. overflow: hidden;
  157. overflow-y: auto;
  158. }
  159. .item {
  160. box-sizing: border-box;
  161. }
  162. </style>