App.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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(
  40. "App: dingTalkJson -> " + uni.getStorageSync("dingTalkJson")
  41. );
  42. }
  43. });
  44. // #endif
  45. },
  46. onExit: () => {
  47. // #ifdef APP
  48. // sqlite.closeDB('app')
  49. // #endif
  50. },
  51. onShow: function () {
  52. // console.log('App Show')
  53. },
  54. onHide: function () {
  55. // console.log('App Hide')
  56. },
  57. };
  58. </script>
  59. <style lang="scss">
  60. /*每个页面公共css */
  61. @import "./style/common.scss";
  62. @import "./style/fonts.scss";
  63. /* uniapp组件 样式覆盖 */
  64. uni-button[type="primary"] {
  65. background: #004098 !important;
  66. }
  67. uni-button[disabled][type="primary"] {
  68. background: rgba(0, 64, 152, 0.6) !important;
  69. }
  70. uni-button[type="primary"][plain] {
  71. color: #004098 !important;
  72. border: 1px solid #004098 !important;
  73. background-color: transparent !important;
  74. }
  75. uni-page-body,
  76. body {
  77. width: 100%;
  78. height: 100%;
  79. box-sizing: border-box;
  80. position: relative;
  81. }
  82. :deep(.uni-tabbar-bottom .uni-tabbar) {
  83. box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.1);
  84. // padding-top: 9px !important;
  85. // padding-bottom: 10px !important;
  86. box-sizing: border-box;
  87. .uni-tabbar__icon {
  88. margin-top: 4px;
  89. }
  90. }
  91. .page {
  92. position: relative;
  93. padding: 20rpx;
  94. padding-top: 0;
  95. box-sizing: border-box;
  96. background: #f3f5f9;
  97. width: 100%;
  98. height: 100%;
  99. font-family: PingFangSC, PingFang SC;
  100. overflow: hidden;
  101. }
  102. .page-nopadding {
  103. position: relative;
  104. box-sizing: border-box;
  105. background: #f3f5f9;
  106. width: 100%;
  107. height: 100%;
  108. font-family: PingFangSC, PingFang SC;
  109. overflow: hidden;
  110. }
  111. .page-back {
  112. background-image: url("/static/common/1.png");
  113. background-repeat: no-repeat;
  114. background-size: 100% 100%;
  115. position: fixed;
  116. top: 0;
  117. left: 0;
  118. width: 100%;
  119. height: 350px;
  120. z-index: 0;
  121. }
  122. .navgator {
  123. width: 100%;
  124. height: $header-height;
  125. line-height: 1;
  126. position: fixed;
  127. top: $header-top-height;
  128. left: 0;
  129. background-color: transparent !important;
  130. padding-top: calc(7px + env(safe-area-inset-top));
  131. box-sizing: border-box;
  132. z-index: 22;
  133. .nav-title {
  134. font-family: PingFang-SC, PingFang-SC;
  135. font-weight: bold;
  136. font-size: 16px;
  137. color: #ffffff;
  138. line-height: 22px;
  139. text-align: right;
  140. font-style: normal;
  141. }
  142. .nav-back {
  143. width: 40rpx;
  144. line-height: 1;
  145. position: absolute;
  146. left: 20rpx;
  147. .uni-icons {
  148. color: #fff !important;
  149. }
  150. }
  151. }
  152. .page-content {
  153. position: relative;
  154. box-sizing: border-box;
  155. width: 100%;
  156. height: calc(100% - $header-height - $header-top-height);
  157. margin-top: calc($header-height + $header-top-height);
  158. overflow: hidden;
  159. overflow-y: auto;
  160. }
  161. .item {
  162. box-sizing: border-box;
  163. }
  164. </style>