@ -31,29 +31,11 @@ if (uni.restoreGlobal) {
}
( function ( vue ) {
"use strict" ;
const ON _SHOW = "onShow" ;
const ON _HIDE = "onHide" ;
const ON _LAUNCH = "onLaunch" ;
const ON _LOAD = "onLoad" ;
function formatAppLog ( type , filename , ... args ) {
if ( uni . _ _log _ _ ) {
uni . _ _log _ _ ( type , filename , ... args ) ;
} else {
console [ type ] . apply ( console , [ ... args , filename ] ) ;
}
}
const createHook = ( lifecycle ) => ( hook , target = vue . getCurrentInstance ( ) ) => {
! vue . isInSSRComponentSetup && vue . injectHook ( lifecycle , hook , target ) ;
} ;
const onShow = /* @__PURE__ */ createHook ( ON _SHOW ) ;
const onHide = /* @__PURE__ */ createHook ( ON _HIDE ) ;
const onLaunch = /* @__PURE__ */ createHook ( ON _LAUNCH ) ;
const onLoad = /* @__PURE__ */ createHook ( ON _LOAD ) ;
const env = "dev" ;
const configs = {
dev : {
apiBaseUrl : "https://warehouse.szjixun.cn/oa_backend" ,
h5Url : "http://192.168.88. 49 :8080/#/"
h5Url : "http://192.168.88.37:8080/#/"
} ,
test : {
apiBaseUrl : "https://warehouse.szjixun.cn/oa_backend" ,
@ -65,98 +47,106 @@ if (uni.restoreGlobal) {
}
} ;
const config = configs [ env ] ;
const sendWebWiew = ( refValue , paramValue , callName = "onReceive" ) => {
if ( ! refValue ) {
formatAppLog ( "error" , "at utils/communicate/index.js:3" , "evalJs: The reference to the webview is not provided or is null." ) ;
return ;
}
formatAppLog ( "log" , "at utils/communicate/index.js:6" , "测试" , refValue . evalJs ) ;
if ( typeof refValue . evalJs !== "function" ) {
formatAppLog ( "error" , "at utils/communicate/index.js:8" , "evalJs: The evalJs method is not available on the provided reference." ) ;
return ;
const ON _SHOW = "onShow" ;
const ON _HIDE = "onHide" ;
const ON _LAUNCH = "onLaunch" ;
function formatAppLog ( type , filename , ... args ) {
if ( uni . _ _log _ _ ) {
uni . _ _log _ _ ( type , filename , ... args ) ;
} else {
console [ type ] . apply ( console , [ ... args , filename ] ) ;
}
try {
const jsonString = JSON . stringify ( paramValue ) ;
const jsCode = ` window. ${ callName } ( ${ jsonString } ) ` ;
refValue . evalJs ( jsCode ) ;
} catch ( error ) {
formatAppLog ( "error" , "at utils/communicate/index.js:18" , "evalJs: An error occurred while trying to stringify the parameter value or while invoking evalJs." , error ) ;
}
const createHook = ( lifecycle ) => ( hook , target = vue . getCurrentInstance ( ) ) => {
! vue . isInSSRComponentSetup && vue . injectHook ( lifecycle , hook , target ) ;
} ;
const onShow = /* @__PURE__ */ createHook ( ON _SHOW ) ;
const onHide = /* @__PURE__ */ createHook ( ON _HIDE ) ;
const onLaunch = /* @__PURE__ */ createHook ( ON _LAUNCH ) ;
const receiveWebView = ( e2 ) => {
return e2 . detail . data [ 0 ] ;
} ;
const location$1 = {
// 检测是否开启系统定位权限
hasLocationPermission ( ) {
le t system = uni . getSystemInfoSync ( ) ;
cons t system = uni . getSystemInfoSync ( ) ;
if ( system . platform === "android" ) {
let context = plus . android . importClass ( "android.content.Context" ) ;
let locationManager = plus . android . importClass ( "android.location.LocationManager" ) ;
let main = plus . android . runtimeMainActivity ( ) ;
let service = main . getSystemService ( context . LOCATION _SERVICE ) ;
if ( service . isProviderEnabled ( locationManager . GPS _PROVIDER ) )
return this . checkAndroidLocationPermission ( ) ;
} else if ( system . platform === "ios" ) {
return this . checkiOSLocationPermission ( ) ;
}
return false ;
} ,
// 检查安卓系统定位权限
checkAndroidLocationPermission ( ) {
const context = plus . android . importClass ( "android.content.Context" ) ;
const locationManager = plus . android . importClass ( "android.location.LocationManager" ) ;
const main = plus . android . runtimeMainActivity ( ) ;
const service = main . getSystemService ( context . LOCATION _SERVICE ) ;
if ( service . isProviderEnabled ( locationManager . GPS _PROVIDER ) ) {
return true ;
else {
} else {
this . showLocationServiceModal ( "请开启位置服务功能" , this . openAndroidLocationSettings ) ;
return false ;
}
} ,
// 检查iOS系统定位权限
checkiOSLocationPermission ( ) {
const CLLocationManager = plus . ios . import ( "CLLocationManager" ) ;
const enabled = CLLocationManager . locationServicesEnabled ( ) ;
const status = CLLocationManager . authorizationStatus ( ) ;
plus . ios . deleteObject ( CLLocationManager ) ;
if ( enabled && status !== 2 ) {
return true ;
} else {
this . showLocationServiceModal ( "请前往设置-定位服务打开定位服务功能" , this . openiOSLocationSettings ) ;
return false ;
}
} ,
// 提示用户启用位置服务
showLocationServiceModal ( content , openSettingsCallback ) {
uni . showModal ( {
title : "友情提示" ,
content : "请开启位置服务功能" ,
content ,
success : ( e2 ) => {
if ( e2 . confirm ) {
let Intent = plus . android . importClass ( "android.content.Intent" ) ;
let Settings = plus . android . importClass ( "android.provider.Settings" ) ;
let intent = new Intent ( Settings . ACTION _LOCATION _SOURCE _SETTINGS ) ;
main . startActivity ( intent ) ;
openSettingsCallback ( ) ;
}
}
} ) ;
}
} else if ( system . platform === "ios" ) {
let cllocationManger = plus . ios . import ( "CLLocationManager" ) ;
let enable = cllocationManger . locationServicesEnabled ( ) ;
let status = cllocationManger . authorizationStatus ( ) ;
plus . ios . deleteObject ( cllocationManger ) ;
if ( enable && status != 2 )
return true ;
else {
uni . showModal ( {
title : "友情提示" ,
content : "请前往设置-定位服务打开定位服务功能" ,
success : ( e2 ) => {
if ( e2 . confirm ) {
let UIApplication = plus . ios . import ( "UIApplication" ) ;
let application = UIApplication . sharedApplication ( ) ;
let NSURL = plus . ios . import ( "NSURL" ) ;
let setting = NSURL . URLWithString ( "app-settings:" ) ;
} ,
// 打开安卓定位设置页面
openAndroidLocationSettings ( ) {
const Intent = plus . android . importClass ( "android.content.Intent" ) ;
const Settings = plus . android . importClass ( "android.provider.Settings" ) ;
const main = plus . android . runtimeMainActivity ( ) ;
const intent = new Intent ( Settings . ACTION _LOCATION _SOURCE _SETTINGS ) ;
main . startActivity ( intent ) ;
} ,
// 打开iOS定位设置页面
openiOSLocationSettings ( ) {
const UIApplication = plus . ios . import ( "UIApplication" ) ;
const application = UIApplication . sharedApplication ( ) ;
const NSURL = plus . ios . import ( "NSURL" ) ;
const setting = NSURL . URLWithString ( "app-settings:" ) ;
application . openURL ( setting ) ;
plus . ios . deleteObject ( setting ) ;
plus . ios . deleteObject ( NSURL ) ;
plus . ios . deleteObject ( application ) ;
}
}
} ) ;
}
}
return false ;
} ,
/ * * 开 启 后 台 持 续 获 取 定 位 功 能
* successCallBack : 成功回调函数
* failCallBack : 失败回调函数
* maximumAge : 获取定位间隔时间
* /
// 开启后台持续获取定位功能
startLocationService ( successCallBack = ( ) => {
} , failCallBack = ( ) => {
} , options ) {
if ( this . hasLocationPermission ( ) ) {
let locationWatcherId = plus . geolocation . watchPosition ( ( position ) => {
successCallBack ( {
locationWatcherId ,
position : position . coords
} ) ;
} , function ( e2 ) {
formatAppLog ( "log" , "at utils/location.js:68" , e2 , "定位失败" ) ;
failCallBack ( e2 ) ;
} , options ) ;
plus . geolocation . watchPosition (
( position ) => successCallBack ( position ) ,
( error ) => {
formatAppLog ( "log" , "at utils/location.js:85" , "定位失败" , error ) ;
failCallBack ( error ) ;
} ,
options
) ;
}
} ,
// 关闭定位功能
@ -176,7 +166,7 @@ if (uni.restoreGlobal) {
_ _name : "index" ,
setup ( _ _props ) {
const webViewRef = vue . ref ( null ) ;
uni . getSystemInfoSync ( ) ;
const systemInfo = uni . getSystemInfoSync ( ) ;
const networkStatusChange = ( res ) => {
if ( res . isConnected ) {
uni . redirectTo ( {
@ -190,18 +180,15 @@ if (uni.restoreGlobal) {
}
} ;
const webViewObj = vue . ref ( null ) ;
onLoad ( ( ) => {
} ) ;
const handleBackButton = ( ) => {
sendWebWiew ( webViewObj . value , { turnBack : 1 } ) ;
} ;
let LocationId 2 = null ;
let LocationId = null ;
onShow ( ( ) => {
plus . key . addEventListener ( "backbutton" , handleBackButton , false ) ;
uni . onNetworkStatusChange ( networkStatusChange ) ;
} ) ;
onHide ( ( ) => {
plus . geolocation . clearWatch ( LocationId 2 ) ;
plus . geolocation . clearWatch ( LocationId ) ;
plus . key . removeEventListener ( "backbutton" , handleBackButton , false ) ;
uni . offNetworkStatusChange ( networkStatusChange ) ;
} ) ;
@ -219,10 +206,8 @@ if (uni.restoreGlobal) {
bottom : 0
//webview的高度
} ) ;
const systemInfo = uni . getSystemInfoSync ( ) ;
LocationId2 = location$1 . startLocationService ( ( res ) => {
const jsonString = JSON . stringify ( { ... res . position , systemInfo } ) ;
formatAppLog ( "log" , "at pages/index/index.vue:96" , "测试" , jsonString ) ;
LocationId = location$1 . startLocationService ( ( res ) => {
const jsonString = JSON . stringify ( { ... res , systemInfo } ) ;
webViewObj . value . evalJS ( ` window.onReceive( ${ jsonString } ) ` ) ;
} , ( ) => {
} , {
@ -255,18 +240,8 @@ if (uni.restoreGlobal) {
onShow ( ( ) => {
} ) ;
onHide ( ( ) => {
plus . geolocation . clearWatch ( LocationId ) ;
formatAppLog ( "log" , "at App.vue:23" , "App Hide" ) ;
} ) ;
uni . getPushClientId ( {
success : ( res ) => {
let push _clientid = res . cid ;
formatAppLog ( "log" , "at App.vue:28" , "客户端推送标识cid:" , push _clientid ) ;
} ,
fail ( err ) {
formatAppLog ( "log" , "at App.vue:31" , err ) ;
}
} ) ;
uni . onPushMessage ( ( res ) => {
formatAppLog ( "log" , "at App.vue:35" , JSON . stringify ( res ) ) ;
} ) ;
@ -580,7 +555,7 @@ if (uni.restoreGlobal) {
function I ( e2 ) {
return e2 && "string" == typeof e2 ? JSON . parse ( e2 ) : e2 ;
}
const S = true , b = "app" , A = I ( define _process _env _UNI _SECURE _NETWORK _CONFIG _default ) , P = b , T = I ( '{\n "address": [\n "127.0.0.1",\n "192.168.56.1",\n "192.168.88. 49"\n ],\n "debugPort": 9001,\n "initialLaunchType": "local",\n "servePort": 7001 ,\n "skipFiles": [\n "<node_internals>/**",\n "C:/Users/37363/Downloads/HBuilderX.4.08.2024040127/HBuilderX/plugins/unicloud/**/*.js"\n ]\n}\n') , C = I ( '[{"provider":"aliyun","spaceName":"oabase","spaceId":"mp-edf38b0d-bc9a-4e81-9a15-f55995ccca70","clientSecret":"ty1X79FB2pMuAQUzaQBKXA==","endpoint":"https://api.next.bspapp.com"}]' ) || [ ] ;
const S = true , b = "app" , A = I ( define _process _env _UNI _SECURE _NETWORK _CONFIG _default ) , P = b , T = I ( '{\n "address": [\n "127.0.0.1",\n "192.168.56.1",\n "192.168.88. 37"\n ],\n "debugPort": 9000,\n "initialLaunchType": "local",\n "servePort": 7000 ,\n "skipFiles": [\n "<node_internals>/**",\n "C:/Users/37363/Downloads/HBuilderX.4.08.2024040127/HBuilderX/plugins/unicloud/**/*.js"\n ]\n}\n') , C = I ( '[{"provider":"aliyun","spaceName":"oabase","spaceId":"mp-edf38b0d-bc9a-4e81-9a15-f55995ccca70","clientSecret":"ty1X79FB2pMuAQUzaQBKXA==","endpoint":"https://api.next.bspapp.com"}]' ) || [ ] ;
let O = "" ;
try {
O = "__UNI__4796942" ;