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

@ -19,10 +19,10 @@ onShow(() => {
}) })
onHide(() => { onHide(() => {
plus.geolocation.clearWatch(LocationId) /* plus.geolocation.clearWatch(LocationId) */
console.log("App Hide") console.log("App Hide")
}) })
uni.getPushClientId({ /* uni.getPushClientId({
success: (res) => { success: (res) => {
let push_clientid = res.cid let push_clientid = res.cid
console.log('客户端推送标识cid:',push_clientid) console.log('客户端推送标识cid:',push_clientid)
@ -30,7 +30,7 @@ uni.getPushClientId({
fail(err) { fail(err) {
console.log(err) console.log(err)
} }
}) }) */
uni.onPushMessage((res)=>{ uni.onPushMessage((res)=>{
console.log(JSON.stringify(res),); console.log(JSON.stringify(res),);
}) })

@ -2,7 +2,7 @@ const env = 'dev';
const configs = { const configs = {
dev: { dev: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
h5Url: 'http://192.168.88.49:8080/#/' h5Url: 'http://192.168.88.37:8080/#/'
}, },
test: { test: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',

@ -1,7 +1,7 @@
;(function(){ ;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[]; let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
const __uniConfig = {"pages":[],"globalStyle":{"navigationBar":{},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"oa考勤系统","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; const __uniConfig = {"pages":[],"globalStyle":{"navigationBar":{},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"泰丰考勤","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"navigationBar":{"style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute)); const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"navigationBar":{"style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles __uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});

File diff suppressed because one or more lines are too long

@ -5,10 +5,10 @@
"iPad" "iPad"
], ],
"id": "__UNI__4796942", "id": "__UNI__4796942",
"name": "oa考勤系统", "name": "泰丰考勤",
"version": { "version": {
"name": "1.1.7", "name": "1.0.0",
"code": 117 "code": 100
}, },
"description": "", "description": "",
"developer": { "developer": {
@ -19,7 +19,6 @@
"permissions": { "permissions": {
"Camera": {}, "Camera": {},
"Geolocation": {}, "Geolocation": {},
"Push": {},
"UniNView": { "UniNView": {
"description": "UniNView原生渲染" "description": "UniNView原生渲染"
} }
@ -148,14 +147,7 @@
"UniversalLinks": "" "UniversalLinks": ""
} }
}, },
"push": { "push": {},
"unipush": {
"version": "2",
"offline": true,
"hms": {},
"vivo": {}
}
},
"audio": { "audio": {
"mp3": { "mp3": {
"description": "Android平台录音支持MP3格式文件" "description": "Android平台录音支持MP3格式文件"
@ -163,22 +155,7 @@
} }
} }
}, },
"nativePlugins": { "nativePlugins": {},
"KJ-WebView": {
"__plugin_info__": {
"name": "官方WebView全能扩展、支持plus、vue、nvue里的WebView - [试用版,仅用于自定义调试基座]",
"description": "WebView与原生双向通信交互、传值、js注入、设置获取UserAgent(桌面网站)、原生侧滑返回 、媒体播放自动播放、请试用合适再购买、请试用合适再购买、请试用合适再购买",
"platforms": "Android,iOS",
"url": "https://ext.dcloud.net.cn/plugin?id=9832",
"android_package_name": "",
"ios_bundle_id": "",
"isCloud": true,
"bought": 0,
"pid": "9832",
"parameters": {}
}
}
},
"uniStatistics": { "uniStatistics": {
"enable": false "enable": false
}, },

@ -31,29 +31,11 @@ if (uni.restoreGlobal) {
} }
(function(vue) { (function(vue) {
"use strict"; "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 env = "dev";
const configs = { const configs = {
dev: { dev: {
apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend", apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
h5Url: "http://192.168.88.49:8080/#/" h5Url: "http://192.168.88.37:8080/#/"
}, },
test: { test: {
apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend", apiBaseUrl: "https://warehouse.szjixun.cn/oa_backend",
@ -65,98 +47,106 @@ if (uni.restoreGlobal) {
} }
}; };
const config = configs[env]; const config = configs[env];
const sendWebWiew = (refValue, paramValue, callName = "onReceive") => { const ON_SHOW = "onShow";
if (!refValue) { const ON_HIDE = "onHide";
formatAppLog("error", "at utils/communicate/index.js:3", "evalJs: The reference to the webview is not provided or is null."); const ON_LAUNCH = "onLaunch";
return; function formatAppLog(type, filename, ...args) {
} if (uni.__log__) {
formatAppLog("log", "at utils/communicate/index.js:6", "测试", refValue.evalJs); uni.__log__(type, filename, ...args);
if (typeof refValue.evalJs !== "function") { } else {
formatAppLog("error", "at utils/communicate/index.js:8", "evalJs: The evalJs method is not available on the provided reference."); console[type].apply(console, [...args, filename]);
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 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) => { const receiveWebView = (e2) => {
return e2.detail.data[0]; return e2.detail.data[0];
}; };
const location$1 = { const location$1 = {
// 检测是否开启系统定位权限 // 检测是否开启系统定位权限
hasLocationPermission() { hasLocationPermission() {
let system = uni.getSystemInfoSync(); const system = uni.getSystemInfoSync();
if (system.platform === "android") { if (system.platform === "android") {
let context = plus.android.importClass("android.content.Context"); return this.checkAndroidLocationPermission();
let locationManager = plus.android.importClass("android.location.LocationManager"); } else if (system.platform === "ios") {
let main = plus.android.runtimeMainActivity(); return this.checkiOSLocationPermission();
let service = main.getSystemService(context.LOCATION_SERVICE); }
if (service.isProviderEnabled(locationManager.GPS_PROVIDER)) 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; 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({ uni.showModal({
title: "友情提示", title: "友情提示",
content: "请开启位置服务功能", content,
success: (e2) => { success: (e2) => {
if (e2.confirm) { if (e2.confirm) {
let Intent = plus.android.importClass("android.content.Intent"); openSettingsCallback();
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"); openAndroidLocationSettings() {
let enable = cllocationManger.locationServicesEnabled(); const Intent = plus.android.importClass("android.content.Intent");
let status = cllocationManger.authorizationStatus(); const Settings = plus.android.importClass("android.provider.Settings");
plus.ios.deleteObject(cllocationManger); const main = plus.android.runtimeMainActivity();
if (enable && status != 2) const intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
return true; main.startActivity(intent);
else { },
uni.showModal({ // 打开iOS定位设置页面
title: "友情提示", openiOSLocationSettings() {
content: "请前往设置-定位服务打开定位服务功能", const UIApplication = plus.ios.import("UIApplication");
success: (e2) => { const application = UIApplication.sharedApplication();
if (e2.confirm) { const NSURL = plus.ios.import("NSURL");
let UIApplication = plus.ios.import("UIApplication"); const setting = NSURL.URLWithString("app-settings:");
let application = UIApplication.sharedApplication();
let NSURL = plus.ios.import("NSURL");
let setting = NSURL.URLWithString("app-settings:");
application.openURL(setting); application.openURL(setting);
plus.ios.deleteObject(setting); plus.ios.deleteObject(setting);
plus.ios.deleteObject(NSURL); plus.ios.deleteObject(NSURL);
plus.ios.deleteObject(application); plus.ios.deleteObject(application);
}
}
});
}
}
return false;
}, },
/** // 开启后台持续获取定位功能
* successCallBack:成功回调函数
*failCallBack:失败回调函数
*maximumAge获取定位间隔时间
*/
startLocationService(successCallBack = () => { startLocationService(successCallBack = () => {
}, failCallBack = () => { }, failCallBack = () => {
}, options) { }, options) {
if (this.hasLocationPermission()) { if (this.hasLocationPermission()) {
let locationWatcherId = plus.geolocation.watchPosition((position) => { plus.geolocation.watchPosition(
successCallBack({ (position) => successCallBack(position),
locationWatcherId, (error) => {
position: position.coords formatAppLog("log", "at utils/location.js:85", "定位失败", error);
}); failCallBack(error);
}, function(e2) { },
formatAppLog("log", "at utils/location.js:68", e2, "定位失败"); options
failCallBack(e2); );
}, options);
} }
}, },
// 关闭定位功能 // 关闭定位功能
@ -176,7 +166,7 @@ if (uni.restoreGlobal) {
__name: "index", __name: "index",
setup(__props) { setup(__props) {
const webViewRef = vue.ref(null); const webViewRef = vue.ref(null);
uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const networkStatusChange = (res) => { const networkStatusChange = (res) => {
if (res.isConnected) { if (res.isConnected) {
uni.redirectTo({ uni.redirectTo({
@ -190,18 +180,15 @@ if (uni.restoreGlobal) {
} }
}; };
const webViewObj = vue.ref(null); const webViewObj = vue.ref(null);
onLoad(() => {
});
const handleBackButton = () => { const handleBackButton = () => {
sendWebWiew(webViewObj.value, { turnBack: 1 });
}; };
let LocationId2 = null; let LocationId = null;
onShow(() => { onShow(() => {
plus.key.addEventListener("backbutton", handleBackButton, false); plus.key.addEventListener("backbutton", handleBackButton, false);
uni.onNetworkStatusChange(networkStatusChange); uni.onNetworkStatusChange(networkStatusChange);
}); });
onHide(() => { onHide(() => {
plus.geolocation.clearWatch(LocationId2); plus.geolocation.clearWatch(LocationId);
plus.key.removeEventListener("backbutton", handleBackButton, false); plus.key.removeEventListener("backbutton", handleBackButton, false);
uni.offNetworkStatusChange(networkStatusChange); uni.offNetworkStatusChange(networkStatusChange);
}); });
@ -219,10 +206,8 @@ if (uni.restoreGlobal) {
bottom: 0 bottom: 0
//webview的高度 //webview的高度
}); });
const systemInfo = uni.getSystemInfoSync(); LocationId = location$1.startLocationService((res) => {
LocationId2 = location$1.startLocationService((res) => { const jsonString = JSON.stringify({ ...res, systemInfo });
const jsonString = JSON.stringify({ ...res.position, systemInfo });
formatAppLog("log", "at pages/index/index.vue:96", "测试", jsonString);
webViewObj.value.evalJS(`window.onReceive(${jsonString})`); webViewObj.value.evalJS(`window.onReceive(${jsonString})`);
}, () => { }, () => {
}, { }, {
@ -255,18 +240,8 @@ if (uni.restoreGlobal) {
onShow(() => { onShow(() => {
}); });
onHide(() => { onHide(() => {
plus.geolocation.clearWatch(LocationId);
formatAppLog("log", "at App.vue:23", "App Hide"); 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) => { uni.onPushMessage((res) => {
formatAppLog("log", "at App.vue:35", JSON.stringify(res)); formatAppLog("log", "at App.vue:35", JSON.stringify(res));
}); });
@ -580,7 +555,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.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 = ""; let O = "";
try { try {
O = "__UNI__4796942"; O = "__UNI__4796942";

Loading…
Cancel
Save