App.vue 3.9 KB

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