|
|
|
@ -63,98 +63,6 @@ if (uni.restoreGlobal) {
|
|
|
|
|
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() {
|
|
|
|
|
const system = uni.getSystemInfoSync();
|
|
|
|
|
if (system.platform === "android") {
|
|
|
|
|
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 {
|
|
|
|
|
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,
|
|
|
|
|
success: (e2) => {
|
|
|
|
|
if (e2.confirm) {
|
|
|
|
|
openSettingsCallback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 打开安卓定位设置页面
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
// 开启后台持续获取定位功能
|
|
|
|
|
startLocationService(successCallBack = () => {
|
|
|
|
|
}, failCallBack = () => {
|
|
|
|
|
}, options) {
|
|
|
|
|
if (this.hasLocationPermission()) {
|
|
|
|
|
plus.geolocation.watchPosition(
|
|
|
|
|
(position) => successCallBack(position),
|
|
|
|
|
(error) => {
|
|
|
|
|
formatAppLog("log", "at utils/location.js:85", "定位失败", error);
|
|
|
|
|
failCallBack(error);
|
|
|
|
|
},
|
|
|
|
|
options
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 关闭定位功能
|
|
|
|
|
closeLocationService(locationWatcherId) {
|
|
|
|
|
plus.geolocation.clearWatch(locationWatcherId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
uni;
|
|
|
|
|
const _export_sfc = (sfc, props) => {
|
|
|
|
|
const target = sfc.__vccOpts || sfc;
|
|
|
|
|
for (const [key, val] of props) {
|
|
|
|
@ -165,8 +73,6 @@ if (uni.restoreGlobal) {
|
|
|
|
|
const _sfc_main$1 = {
|
|
|
|
|
__name: "index",
|
|
|
|
|
setup(__props) {
|
|
|
|
|
const webViewRef = vue.ref(null);
|
|
|
|
|
const systemInfo = uni.getSystemInfoSync();
|
|
|
|
|
const networkStatusChange = (res) => {
|
|
|
|
|
if (res.isConnected) {
|
|
|
|
|
uni.redirectTo({
|
|
|
|
@ -180,40 +86,23 @@ if (uni.restoreGlobal) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const webViewObj = vue.ref(null);
|
|
|
|
|
const handleBackButton = () => {
|
|
|
|
|
};
|
|
|
|
|
let LocationId = null;
|
|
|
|
|
onShow(() => {
|
|
|
|
|
plus.key.addEventListener("backbutton", handleBackButton, false);
|
|
|
|
|
uni.onNetworkStatusChange(networkStatusChange);
|
|
|
|
|
});
|
|
|
|
|
onHide(() => {
|
|
|
|
|
plus.geolocation.clearWatch(LocationId);
|
|
|
|
|
plus.key.removeEventListener("backbutton", handleBackButton, false);
|
|
|
|
|
uni.offNetworkStatusChange(networkStatusChange);
|
|
|
|
|
});
|
|
|
|
|
const webLoad = (e2) => {
|
|
|
|
|
const m2 = receiveWebView(e2);
|
|
|
|
|
switch (m2.action) {
|
|
|
|
|
var _a, _b;
|
|
|
|
|
const h5SendString = (_b = (_a = e2.detail.data) == null ? void 0 : _a[0]) == null ? void 0 : _b.action;
|
|
|
|
|
switch (h5SendString) {
|
|
|
|
|
case "load-complete": {
|
|
|
|
|
const { statusBarHeight } = uni.getSystemInfoSync();
|
|
|
|
|
const currentWebview = getCurrentPages().pop().$getAppWebview();
|
|
|
|
|
webViewObj.value = currentWebview.children()[0];
|
|
|
|
|
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
|
|
|
|
webViewObj.value.setStyle({
|
|
|
|
|
//设置web-view距离顶部的距离以及自己的高度,单位为px
|
|
|
|
|
top: statusBarHeight,
|
|
|
|
|
//此处是距离顶部的高度,应该是你页面的头部
|
|
|
|
|
bottom: 0
|
|
|
|
|
//webview的高度
|
|
|
|
|
});
|
|
|
|
|
LocationId = location$1.startLocationService((res) => {
|
|
|
|
|
const jsonString = JSON.stringify({ ...res, systemInfo });
|
|
|
|
|
webViewObj.value.evalJS(`window.onReceive(${jsonString})`);
|
|
|
|
|
}, () => {
|
|
|
|
|
}, {
|
|
|
|
|
geocode: true,
|
|
|
|
|
coordsType: "gcj02",
|
|
|
|
|
enableHighAccuracy: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -223,8 +112,7 @@ if (uni.restoreGlobal) {
|
|
|
|
|
class: "webview",
|
|
|
|
|
onMessage: webLoad,
|
|
|
|
|
style: { "flex": "1" },
|
|
|
|
|
ref_key: "webViewRef",
|
|
|
|
|
ref: webViewRef,
|
|
|
|
|
ref: "webViewRef",
|
|
|
|
|
src: vue.unref(config).h5Url
|
|
|
|
|
}, null, 40, ["src"]);
|
|
|
|
|
};
|
|
|
|
@ -558,7 +446,7 @@ if (uni.restoreGlobal) {
|
|
|
|
|
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";
|
|
|
|
|
O = "__UNI__70C49A3";
|
|
|
|
|
} catch (e2) {
|
|
|
|
|
}
|
|
|
|
|
let E = {};
|
|
|
|
|