outside-the-system
Phoenix 3 months ago
parent ee45b1339e
commit 1245e825e3

@ -1,4 +1,4 @@
const env = 'test'; const env = 'dev';
const configs = { const configs = {
dev: { dev: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
@ -9,7 +9,7 @@ const configs = {
h5Url: 'http://114.218.158.24:8042/#/' h5Url: 'http://114.218.158.24:8042/#/'
}, },
prod: { prod: {
apiBaseUrl: 'https://oa-a.szjixun.cn/#/', apiBaseUrl: 'https://oa-a.szjixun.cn',
h5Url: 'https://oa-a.szjixun.cn/#/' h5Url: 'https://oa-a.szjixun.cn/#/'
}, },
} }

@ -49,7 +49,7 @@ if (uni.restoreGlobal) {
const onHide = /* @__PURE__ */ createHook(ON_HIDE); const onHide = /* @__PURE__ */ createHook(ON_HIDE);
const onLaunch = /* @__PURE__ */ createHook(ON_LAUNCH); const onLaunch = /* @__PURE__ */ createHook(ON_LAUNCH);
const onLoad = /* @__PURE__ */ createHook(ON_LOAD); const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
const env = "test"; const env = "dev";
const configs = { const configs = {
dev: { dev: {
apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend", apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
@ -60,14 +60,110 @@ if (uni.restoreGlobal) {
h5Url: "http://114.218.158.24:8042/#/" h5Url: "http://114.218.158.24:8042/#/"
}, },
prod: { prod: {
apiBaseUrl: "https://oa-a.szjixun.cn/#/", apiBaseUrl: "https://oa-a.szjixun.cn",
h5Url: "https://oa-a.szjixun.cn/#/" h5Url: "https://oa-a.szjixun.cn/#/"
} }
}; };
const config = configs[env]; 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;
}
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 receiveWebView = (e2) => { const receiveWebView = (e2) => {
return e2.detail.data[0]; return e2.detail.data[0];
}; };
const location$1 = {
//检测是否开启系统定位权限
hasLocationPermission() {
let 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 true;
else {
uni.showModal({
title: "友情提示",
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);
}
}
});
}
} 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:");
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);
}
},
//关闭定位功能
closeLocationService(locationWatcherId) {
plus.geolocation.clearWatch(locationWatcherId);
}
};
uni; uni;
const _export_sfc = (sfc, props) => { const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc; const target = sfc.__vccOpts || sfc;
@ -96,10 +192,17 @@ if (uni.restoreGlobal) {
const webViewObj = vue.ref(null); const webViewObj = vue.ref(null);
onLoad(() => { onLoad(() => {
}); });
const handleBackButton = () => {
sendWebWiew(webViewObj.value, { turnBack: 1 });
};
let LocationId2 = null;
onShow(() => { onShow(() => {
plus.key.addEventListener("backbutton", handleBackButton, false);
uni.onNetworkStatusChange(networkStatusChange); uni.onNetworkStatusChange(networkStatusChange);
}); });
onHide(() => { onHide(() => {
plus.geolocation.clearWatch(LocationId2);
plus.key.removeEventListener("backbutton", handleBackButton, false);
uni.offNetworkStatusChange(networkStatusChange); uni.offNetworkStatusChange(networkStatusChange);
}); });
const webLoad = (e2) => { const webLoad = (e2) => {
@ -117,17 +220,15 @@ if (uni.restoreGlobal) {
//webview的高度 //webview的高度
}); });
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
uni.getLocation({ LocationId2 = location$1.startLocationService((res) => {
type: "gcj02", const jsonString = JSON.stringify({ ...res.position, systemInfo });
geocode: false, formatAppLog("log", "at pages/index/index.vue:96", "测试", jsonString);
isHighAccuracy: false, webViewObj.value.evalJS(`window.onReceive(${jsonString})`);
success: async (res) => { }, () => {
const jsonString = JSON.stringify({ ...res, systemInfo }); }, {
webViewObj.value.evalJS(`window.onReceive(${jsonString})`); geocode: true,
}, coordsType: "gcj02",
fail: (e3) => { enableHighAccuracy: true
formatAppLog("log", "at pages/index/index.vue:111", e3);
}
}); });
} }
} }
@ -479,7 +580,7 @@ if (uni.restoreGlobal) {
function I(e2) { function I(e2) {
return e2 && "string" == typeof e2 ? JSON.parse(e2) : 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.23"\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"}]') || []; 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"}]') || [];
let O = ""; let O = "";
try { try {
O = "__UNI__4796942"; O = "__UNI__4796942";

Loading…
Cancel
Save