App.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <style lang="scss">
  2. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  3. @import "uview-ui/index.scss";
  4. </style>
  5. <script>
  6. import store from "@/store";
  7. import socket from "@/config/socket";
  8. import DB from "@/common/sqlite";
  9. export default {
  10. onLaunch: function(e) {
  11. //取出缓存数据
  12. store.commit("setCacheData");
  13. if (store.state.token) {
  14. socket.init();
  15. } else {
  16. var url = window.location.href;
  17. if ((url.indexOf("pages/carInsure/payVerify") >
  18. 0) || (url.indexOf("pages/login/mimi") > 0) || (url.indexOf("pages/login/xieyi") > 0) || (url
  19. .indexOf("pages/carInsure1/yonganCode") > 0)) {
  20. uni.navigateTo({
  21. url: url
  22. })
  23. } else {}
  24. }
  25. // #ifdef H5
  26. if (store.state.token) {
  27. socket.init();
  28. } else {
  29. var url = window.location.href;
  30. if ((url.indexOf("pages/carInsure/payVerify") >
  31. 0) || (url.indexOf("pages/login/mimi") > 0) || (url.indexOf("pages/login/xieyi") > 0) || (url
  32. .indexOf("pages/carInsure1/yonganCode") > 0)) {
  33. uni.navigateTo({
  34. url: url
  35. })
  36. } else {
  37. }
  38. }
  39. // #endif
  40. // #ifdef APP-PLUS
  41. this.launch()
  42. if (store.state.token) {} else {
  43. var url = window.location.href;
  44. if ((url.indexOf("pages/carInsure/payVerify") >
  45. 0) || (url.indexOf("pages/login/mimi") > 0) || (url.indexOf("pages/login/xieyi") > 0) || (url
  46. .indexOf("pages/carInsure1/yonganCode") > 0)) {
  47. uni.navigateTo({
  48. url: url
  49. })
  50. } else {
  51. }
  52. }
  53. // #endif
  54. },
  55. onShow: function(e) {
  56. },
  57. onHide: function() {},
  58. methods: {
  59. // TODO 开屏广告 后续优化添加
  60. launch() {
  61. try {
  62. var date = new Date();
  63. var year = date.getFullYear();
  64. var month = date.getMonth() + 1;
  65. var strDate = date.getDate();
  66. var currentdate = year + '' + month + '' + strDate + '' + plus.runtime.version;
  67. // 获取本地存储中launchFlag标识(不可动)
  68. const value = uni.getStorageSync("launchFlag");
  69. if (value == currentdate) {} else {
  70. //app启动时打开启动广告页
  71. var w = plus.webview.open(
  72. "/hybrid/html/advertise/advertise.html",
  73. "本地地址", {
  74. top: 0,
  75. bottom: 0,
  76. zindex: 999,
  77. },
  78. "fade-in",
  79. 500
  80. );
  81. //设置定时器,4s后关闭启动
  82. setTimeout(function() {
  83. uni.setStorage({
  84. key: "launchFlag",
  85. data: currentdate
  86. });
  87. plus.webview.close(w);
  88. }, 3000);
  89. }
  90. } catch (e) {
  91. // error
  92. uni.setStorage({
  93. key: "launchFlag",
  94. data: currentdate,
  95. success: function() {
  96. console.log("error时存储launchFlag");
  97. },
  98. });
  99. }
  100. },
  101. }
  102. };
  103. </script>
  104. <style>
  105. /* #ifndef APP-NVUE */
  106. @import "/style/uni.css";
  107. /* 官方ui库 */
  108. @import "/style/animate.min.css";
  109. /* 第三方动画库 */
  110. /* @import "/style/icon.css"; */
  111. /* 自定义图标库 */
  112. @import 'http://at.alicdn.com/t/font_1807257_t3nqcuysmns.css';
  113. @import "/style/common.css";
  114. /* 公共样式库 */
  115. @import "/style/zcm-main.css";
  116. /* UI基础库 */
  117. /* @import "/style/input.scss"; */
  118. /* 基础表单样式*/
  119. /* #endif */
  120. /* #ifdef H5 */
  121. /* 修复H5底部导航挡住内容bug */
  122. uni-app {
  123. height: auto;
  124. }
  125. /* 修复H5输入框上下不居中bug */
  126. .uni-input-form {
  127. height: 100%;
  128. }
  129. /* 去除地图上高德地图标识符 */
  130. .amap-copyright {
  131. display: none !important;
  132. }
  133. .amap-logo {
  134. display: none !important;
  135. }
  136. .amap-ui-control-zoom {
  137. width: 60upx !important;
  138. }
  139. .amap-ui-control-zoom>* {
  140. width: 60upx !important;
  141. height: 60upx !important;
  142. line-height: 60upx !important;
  143. }
  144. .amap-ui-control-theme-dark {
  145. display: none !important;
  146. }
  147. /* #endif */
  148. </style>