123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <style lang="scss">
- /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
- @import "uview-ui/index.scss";
- </style>
- <script>
- import store from "@/store";
- import socket from "@/config/socket";
- import DB from "@/common/sqlite";
- export default {
- onLaunch: function(e) {
- //取出缓存数据
- store.commit("setCacheData");
- if (store.state.token) {
- socket.init();
- } else {
- var url = window.location.href;
- if ((url.indexOf("pages/carInsure/payVerify") >
- 0) || (url
- .indexOf("pages/carInsure1/yonganCode") > 0)) {
- uni.navigateTo({
- url: url
- })
- } else {}
- }
- // #ifdef H5
- if (store.state.token) {
- socket.init();
- } else {
- var url = window.location.href;
- if ((url.indexOf("pages/carInsure/payVerify") >
- 0) || (url
- .indexOf("pages/carInsure1/yonganCode") > 0)) {
- uni.navigateTo({
- url: url
- })
- } else {
- }
- }
- // #endif
- // #ifdef APP-PLUS
- this.launch()
- if (store.state.token) {} else {
- var url = window.location.href;
- if ((url.indexOf("pages/carInsure/payVerify") >
- 0) || (url
- .indexOf("pages/carInsure1/yonganCode") > 0)) {
- uni.navigateTo({
- url: url
- })
- } else {
- }
- }
- // #endif
- },
- onShow: function(e) {
- // uni.authorize({
- // scope: 'scope.userLocation',
- // success() {
- // uni.getLocation()
- // }
- // })
- // uni.getLocation({
- // type: 'gcj02',
- // geocode: true,
- // success: function(res) {
- // console.log(res);
- // uni.setStorage({
- // key: 'location',
- // data: {
- // latitude: res.latitude,
- // longitude: res.longitude,
- // },
- // success: function() {
- // console.log('位置信息保存成功');
- // }
- // });
- // },
- // fail: function(err) {
- // console.log(err);
- // // #ifdef APP-PLUS
- // uni.showModal({
- // title: '提示',
- // content: '请打开定位服务',
- // success: ({
- // confirm,
- // cancel
- // }) => {
- // if (confirm) {
- // // android平台
- // if (uni.getSystemInfoSync().platform == 'android') {
- // var Intent = plus.android.importClass(
- // 'android.content.Intent');
- // var Settings = plus.android.importClass(
- // 'android.provider.Settings');
- // var intent = new Intent(Settings
- // .ACTION_LOCATION_SOURCE_SETTINGS);
- // var main = plus.android.runtimeMainActivity();
- // main.startActivity(intent); // 打开系统设置GPS服务页面
- // }
- // }
- // 用户取消前往开启定位服务
- // if (cancel) {
- // uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
- // delta: 1
- // });
- // }
- // }
- // });
- // // #endif
- // }
- // });
- },
- onHide: function() {},
- methods: {
- // TODO 开屏广告 后续优化添加
- launch() {
- try {
- var date = new Date();
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- var currentdate = year + '' + month + '' + strDate + '' + plus.runtime.version;
- // 获取本地存储中launchFlag标识(不可动)
- const value = uni.getStorageSync("launchFlag");
- if (value == currentdate) {} else {
- //app启动时打开启动广告页
- var w = plus.webview.open(
- "/hybrid/html/advertise/advertise.html",
- "本地地址", {
- top: 0,
- bottom: 0,
- zindex: 999,
- },
- "fade-in",
- 500
- );
- //设置定时器,4s后关闭启动
- setTimeout(function() {
- uni.setStorage({
- key: "launchFlag",
- data: currentdate
- });
- plus.webview.close(w);
- }, 3000);
- }
- } catch (e) {
- // error
- uni.setStorage({
- key: "launchFlag",
- data: currentdate,
- success: function() {
- console.log("error时存储launchFlag");
- },
- });
- }
- },
- }
- };
- </script>
- <style>
- /* #ifndef APP-NVUE */
- @import "/style/uni.css";
- /* 官方ui库 */
- /* @import "/style/animate.min.css"; */
- /* 第三方动画库 */
- @import "/style/icon.css";
- /* 自定义图标库 */
- /* @import 'https://at.alicdn.com/t/font_1807257_t3nqcuysmns.css'; */
- @import "/style/common.css";
- /* 公共样式库 */
- @import "/style/zcm-main.css";
- /* UI基础库 */
- /* @import "/style/input.scss"; */
- /* 基础表单样式*/
- /* #endif */
- /* #ifdef H5 */
- /* 修复H5底部导航挡住内容bug */
- uni-app {
- height: auto;
- }
- /* 修复H5输入框上下不居中bug */
- .uni-input-form {
- height: 100%;
- }
- /* 去除地图上高德地图标识符 */
- .amap-copyright {
- display: none !important;
- }
- .amap-logo {
- display: none !important;
- }
- .amap-ui-control-zoom {
- width: 60upx !important;
- }
- .amap-ui-control-zoom>* {
- width: 60upx !important;
- height: 60upx !important;
- line-height: 60upx !important;
- }
- .amap-ui-control-theme-dark {
- display: none !important;
- }
- /* #endif */
- </style>
|