2022-07-28 10:19:08 +00:00
|
|
|
|
<script>
|
2022-03-14 09:09:10 +00:00
|
|
|
|
export default {
|
|
|
|
|
globalData:{
|
|
|
|
|
projectname:'', // 项目名称
|
|
|
|
|
lat:'', // 公司地址维度
|
2022-03-28 10:40:48 +00:00
|
|
|
|
lng:'' ,// 公司地址经度
|
2022-07-28 10:19:08 +00:00
|
|
|
|
hostapi:'https://7and5.cn' ,// 域名配置
|
2022-03-14 09:09:10 +00:00
|
|
|
|
},
|
|
|
|
|
// 优先于show方法
|
|
|
|
|
onLaunch: function() {
|
|
|
|
|
// 配置全局域名
|
2022-07-28 10:19:08 +00:00
|
|
|
|
// #ifdef H5 || APP-PLUS
|
|
|
|
|
this.globalData.bgmMusic = uni.createInnerAudioContext();
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
this.globalData.bgmMusic = wx.createInnerAudioContext();
|
2022-04-02 01:42:53 +00:00
|
|
|
|
// #endif
|
2022-08-19 07:11:56 +00:00
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
// this.checkNotification();
|
|
|
|
|
// #endif
|
2022-03-14 09:09:10 +00:00
|
|
|
|
},
|
|
|
|
|
onShow: function() {
|
2022-04-24 09:35:39 +00:00
|
|
|
|
if(uni.getStorageSync('token')){
|
2022-04-13 12:36:32 +00:00
|
|
|
|
// 每十分钟更新用户地理位置
|
|
|
|
|
this.$toolAll.tools.renewLocationEv();
|
2022-04-24 09:35:39 +00:00
|
|
|
|
// 检测是否开启GPS定位服务
|
|
|
|
|
this.$toolAll.tools.checkOpenGPSServiceByAndroidIOS();
|
|
|
|
|
}
|
2022-07-28 10:19:08 +00:00
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
|
2022-03-14 09:09:10 +00:00
|
|
|
|
},
|
|
|
|
|
onHide: function() {
|
2022-03-30 10:04:40 +00:00
|
|
|
|
|
2022-07-28 10:19:08 +00:00
|
|
|
|
},
|
|
|
|
|
methods:{
|
2022-08-18 06:21:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* 检测通知栏
|
|
|
|
|
*/
|
|
|
|
|
checkNotification:function(){
|
|
|
|
|
if(plus.os.name.toLowerCase() == 'ios'){
|
|
|
|
|
this.checkIosNotification();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.checkAndroidNotification();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
checkAndroidNotification:function(){
|
|
|
|
|
var main = plus.android.runtimeMainActivity();
|
|
|
|
|
var pkName = main.getPackageName();
|
|
|
|
|
var NotificationManagerCompat = plus.android.importClass("android.support.v4.app.NotificationManagerCompat");
|
|
|
|
|
var packageNames = NotificationManagerCompat.from(main);
|
|
|
|
|
if (packageNames.areNotificationsEnabled()) {
|
|
|
|
|
// console.log('已开启通知权限');
|
|
|
|
|
}else{
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '请先打开APP通知权限,否则无法收到消息推送',
|
|
|
|
|
showCancel: false,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
var Intent = plus.android.importClass('android.content.Intent');
|
|
|
|
|
var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS');//可设置表中所有Action字段
|
|
|
|
|
intent.putExtra('android.provider.extra.APP_PACKAGE', pkName);
|
|
|
|
|
main.startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
checkIosNotification:function(){
|
|
|
|
|
var UIApplication = plus.ios.import("UIApplication");
|
|
|
|
|
var app = UIApplication.sharedApplication();
|
|
|
|
|
var enabledTypes = 0;
|
|
|
|
|
if (app.currentUserNotificationSettings) {
|
|
|
|
|
var settings = app.currentUserNotificationSettings();
|
|
|
|
|
enabledTypes = settings.plusGetAttribute("types");
|
|
|
|
|
} else {
|
|
|
|
|
//针对低版本ios系统
|
|
|
|
|
enabledTypes = app.enabledRemoteNotificationTypes();
|
|
|
|
|
}
|
|
|
|
|
plus.ios.deleteObject(app);
|
|
|
|
|
if ( 0 == enabledTypes ) {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '请先打开APP通知权限,否则无法收到消息推送',
|
|
|
|
|
showCancel: false,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
var UIApplication = plus.ios.import("UIApplication");
|
|
|
|
|
var NSURL = plus.ios.import("NSURL");
|
|
|
|
|
var setting = NSURL.URLWithString("app-settings:");
|
|
|
|
|
var application = UIApplication.sharedApplication();
|
|
|
|
|
application.openURL(setting);
|
|
|
|
|
plus.ios.deleteObject(setting);
|
|
|
|
|
plus.ios.deleteObject(application);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-03-14 09:09:10 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
/*每个页面公共css */
|
2022-03-30 10:04:40 +00:00
|
|
|
|
|
2022-03-14 09:09:10 +00:00
|
|
|
|
/* 阿里巴巴矢量图标库 start */
|
|
|
|
|
@import url("./commons/icon-font.css");
|
|
|
|
|
/* 阿里巴巴矢量图标库 end */
|
2022-03-16 00:58:52 +00:00
|
|
|
|
/* 项目基础样式 start */
|
2022-03-14 09:09:10 +00:00
|
|
|
|
@import url("./commons/base.css");
|
2022-03-16 00:58:52 +00:00
|
|
|
|
/* 项目基础样式 end */
|
|
|
|
|
/* 项目页面样式 start */
|
|
|
|
|
@import url("./commons/flying-monkey.css");
|
|
|
|
|
/* 项目页面样式 end */
|
2022-03-17 05:47:40 +00:00
|
|
|
|
|
2022-03-14 09:09:10 +00:00
|
|
|
|
/* 动画样式 start */
|
|
|
|
|
@import url("./commons/animate.min.css");
|
|
|
|
|
/* 动画样式 end */
|
|
|
|
|
|
2022-03-17 07:49:07 +00:00
|
|
|
|
page {background-color: #f7f7f7;}
|
2022-03-14 09:09:10 +00:00
|
|
|
|
</style>
|