App.vue 3.9 KB

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