You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oa-base/unpackage/dist/build/app-plus/app-service.js

2 lines
86 KiB
JavaScript

3 months ago
if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";const t={apiBaseUrl:"https://oa-a.szjixun.cn",h5Url:"https://oa-a.szjixun.cn/#/"};function n(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}const s=t=>(n,s=e.getCurrentInstance())=>{!e.isInSSRComponentSetup&&e.injectHook(t,n,s)},r=s("onShow"),o=s("onHide"),i=s("onLaunch"),a={hasLocationPermission(){const e=uni.getSystemInfoSync();return"android"===e.platform?this.checkAndroidLocationPermission():"ios"===e.platform&&this.checkiOSLocationPermission()},checkAndroidLocationPermission(){const e=plus.android.importClass("android.content.Context"),t=plus.android.importClass("android.location.LocationManager");return!!plus.android.runtimeMainActivity().getSystemService(e.LOCATION_SERVICE).isProviderEnabled(t.GPS_PROVIDER)||(this.showLocationServiceModal("请开启位置服务功能",this.openAndroidLocationSettings),!1)},checkiOSLocationPermission(){const e=plus.ios.import("CLLocationManager"),t=e.locationServicesEnabled(),n=e.authorizationStatus();return plus.ios.deleteObject(e),!(!t||2===n)||(this.showLocationServiceModal("请前往设置-定位服务打开定位服务功能",this.openiOSLocationSettings),!1)},showLocationServiceModal(e,t){uni.showModal({title:"友情提示",content:e,success:e=>{e.confirm&&t()}})},openAndroidLocationSettings(){const e=plus.android.importClass("android.content.Intent"),t=plus.android.importClass("android.provider.Settings"),n=plus.android.runtimeMainActivity(),s=new e(t.ACTION_LOCATION_SOURCE_SETTINGS);n.startActivity(s)},openiOSLocationSettings(){const e=plus.ios.import("UIApplication").sharedApplication(),t=plus.ios.import("NSURL"),n=t.URLWithString("app-settings:");e.openURL(n),plus.ios.deleteObject(n),plus.ios.deleteObject(t),plus.ios.deleteObject(e)},startLocationService(e=(()=>{}),t=(()=>{}),s){this.hasLocationPermission()&&plus.geolocation.watchPosition((t=>e(t)),(e=>{n("log","at utils/location.js:85","定位失败",e),t(e)}),s)},closeLocationService(e){plus.geolocation.clearWatch(e)}};uni;const c={__name:"index",setup(n){const s=e.ref(null),i=uni.getSystemInfoSync(),c=e=>{e.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"网络无连接",icon:"none"})},u=e.ref(null),l=()=>{};let h=null;r((()=>{plus.key.addEventListener("backbutton",l,!1),uni.onNetworkStatusChange(c)})),o((()=>{plus.geolocation.clearWatch(h),plus.key.removeEventListener("backbutton",l,!1),uni.offNetworkStatusChange(c)}));const d=e=>{const t=(e=>e.detail.data[0])(e);if("load-complete"===t.action){const e=getCurrentPages().pop().$getAppWebview();u.value=e.children()[0];let t=uni.getSystemInfoSync().statusBarHeight;u.value.setStyle({top:t,bottom:0}),h=a.startLocationService((e=>{const t=JSON.stringify({...e,systemInfo:i});u.value.evalJS(`window.onReceive(${t})`)}),(()=>{}),{geocode:!0,coordsType:"gcj02",enableHighAccuracy:!0})}};return(n,r)=>(e.openBlock(),e.createElementBlock("web-view",{class:"webview",onMessage:d,style:{flex:"1"},ref_key:"webViewRef",ref:s,src:e.unref(t).h5Url},null,40,["src"]))}};__definePage("pages/index/index",c);const u={__name:"App",setup:e=>(i((()=>{})),r((()=>{})),o((()=>{n("log","at App.vue:23","App Hide")})),uni.onPushMessage((e=>{n("log","at App.vue:35",JSON.stringify(e))})),()=>{})},l={pages:[{path:"pages/index/index",style:{navigationStyle:"custom","app-plus":{titleNView:!1}}}],uniIdRouter:{}};