| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <style lang="scss">
- /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
- @import "uview-ui/index.scss";
- </style>
- <script>
- import store from "@/store";
- import DB from "@/common/sqlite";
- export default {
- data() {
- return {
- locationInterval: null, // 用于存储定时器ID
- errorNotified: false // 用于跟踪错误通知是否已经发送
- };
- },
- onLaunch: function(e) {
- //取出缓存数据
- store.commit("setCacheData");
- 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 {}
- }
- // #ifdef H5
- 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
- // #ifdef APP-PLUS
- 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) {
- // #ifdef APP-PLUS
- // this.launch()
- // #endif
- },
- onHide: function() {},
- methods: {
- // getLocation() {
- // uni.getLocation({
- // type: 'gcj02', // 根据需要选择坐标类型
- // geocode: true,
- // success: (res) => {
- // this.saveLocation(res);
- // if (this.locationInterval) {
- // clearInterval(this.locationInterval);
- // }
- // // 设置每小时重新获取坐标
- // this.locationInterval = setInterval(() => {
- // this.updateLocation();
- // }, 3600000); // 3600000毫秒 = 1小时
- // // 重置错误通知状态
- // this.errorNotified = false;
- // },
- // fail: (err) => {
- // if (!this.errorNotified) {
- // this.handleLocationError(err);
- // this.errorNotified = true;
- // }
- // }
- // });
- // },
- // updateLocation() {
- // uni.getLocation({
- // type: 'gcj02',
- // geocode: true,
- // success: (res) => {
- // this.saveLocation(res);
- // },
- // fail: (err) => {
- // if (!this.errorNotified) {
- // this.handleLocationError(err);
- // this.errorNotified = true;
- // }
- // }
- // });
- // },
- // saveLocation(res) {
- // uni.setStorage({
- // key: 'location',
- // data: {
- // latitude: res.latitude,
- // longitude: res.longitude,
- // province: res.address.province,
- // city: res.address.city,
- // district: res.address.district,
- // street: res.address.street,
- // streetNum: res.address.streetNum,
- // poiName: res.address.poiName,
- // cityCode: res.address.cityCode
- // },
- // success: () => {}
- // });
- // },
- // handleLocationError(err) {
- // uni.showModal({
- // title: '获取权限',
- // content: '晋掌柜有道路救援服务,需要获取位置信息',
- // success: ({
- // confirm,
- // cancel
- // }) => {
- // setTimeout(() => {
- // if (confirm) {
- // this.openLocationSettings();
- // }
- // if (cancel) {
- // this.exitApp();
- // }
- // }, 0);
- // }
- // });
- // },
- // openLocationSettings() {
- // 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);
- // }
- // },
- // exitApp() {
- // if (plus.os.name === "Android") {
- // plus.runtime.quit();
- // } else {
- // plus.ios.import("UIApplication").sharedApplication().performSelector("exit");
- // }
- // },
- // 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);
- }, 4000);
- // }
- } catch (e) {
- // error
- uni.setStorage({
- key: "launchFlag",
- data: currentdate,
- success: function() {},
- });
- }
- },
- }
- };
- </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;
- }
- .uni-tabbar-bottom {
- .uni-tabbar {
- box-shadow: 0px -2px 5px 0px rgba(218, 227, 244, 0.2);
- }
- }
- /* #endif */
- </style>
|