App.vue 4.1 KB

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