no message

This commit is contained in:
kuaifan 2025-04-09 13:42:19 +08:00
parent 6c519ebd61
commit da7dc477c8
5 changed files with 48 additions and 18 deletions

View File

@ -593,7 +593,6 @@ export default {
} }
this.$store.state.keyboardType = event.keyboardType; this.$store.state.keyboardType = event.keyboardType;
this.$store.state.keyboardHeight = event.keyboardHeight; this.$store.state.keyboardHeight = event.keyboardHeight;
this.$store.state.safeAreaBottom = event.safeAreaBottom;
$A.eeuiAppShakeToEditEnabled(this.$store.state.keyboardType === 'show') $A.eeuiAppShakeToEditEnabled(this.$store.state.keyboardType === 'show')
} }
// //

View File

@ -338,6 +338,14 @@ const $preload = async () => {
} }
return return
} }
$A.eeuiAppGetSafeAreaInsets().then(data => {
const proportion = data.height / window.outerHeight
store.state.safeAreaSize = {
top: Math.round(data.top / proportion * 100) / 100,
bottom: Math.round(data.bottom / proportion * 100) / 100,
data
}
}).catch(console.warn)
} }
await store.dispatch("preload"); await store.dispatch("preload");

View File

@ -18,6 +18,21 @@
return null; return null;
}, },
// 获取eeui模块Promise
eeuiModulePromise(name = 'eeui') {
return new Promise((resolve, reject) => {
try {
const eeui = this.eeuiModule(name);
if (!eeui) {
return reject({msg: "module not found"});
}
resolve(eeui);
} catch (e) {
reject({msg: e.message});
}
})
},
// 获取eeui版本号 // 获取eeui版本号
eeuiAppVersion() { eeuiAppVersion() {
return this.eeuiModule()?.getVersion(); return this.eeuiModule()?.getVersion();
@ -194,10 +209,7 @@
eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) { eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const eeui = this.eeuiModule(); const eeui = await this.eeuiModule();
if (!eeui) {
return reject({msg: "module not found"});
}
const timer = timeout > 0 ? setTimeout(() => { const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"}); reject({msg: "timeout"});
@ -222,7 +234,7 @@
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
reject({msg: e.message}); reject(e);
} }
}) })
}, },
@ -232,10 +244,7 @@
eeuiAppUploadPhoto(params, timeout = 30) { eeuiAppUploadPhoto(params, timeout = 30) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const eeui = this.eeuiModule(); const eeui = await this.eeuiModulePromise();
if (!eeui) {
return reject({msg: "module not found"});
}
const timer = timeout > 0 ? setTimeout(() => { const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"}); reject({msg: "timeout"});
@ -267,7 +276,7 @@
resolve(result.data.data); resolve(result.data.data);
}); });
} catch (e) { } catch (e) {
reject({msg: e.message}); reject(e);
} }
}) })
}, },
@ -276,10 +285,7 @@
eeuiAppCancelUploadPhoto(id) { eeuiAppCancelUploadPhoto(id) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const eeui = this.eeuiModule(); const eeui = await this.eeuiModulePromise();
if (!eeui) {
return reject({msg: "module not found"});
}
eeui.cancelUploadPhoto(id, result => { eeui.cancelUploadPhoto(id, result => {
if (result.status !== 'success') { if (result.status !== 'success') {
return reject({msg: result.error || "cancel failed"}); return reject({msg: result.error || "cancel failed"});
@ -287,7 +293,7 @@
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
reject({msg: e.message}); reject(e);
} }
}) })
}, },
@ -305,6 +311,23 @@
this.eeuiModule()?.removeNavMask(name) // 移除指定遮罩 this.eeuiModule()?.removeNavMask(name) // 移除指定遮罩
} }
}, },
// 获取导航栏和状态栏高度
eeuiAppGetSafeAreaInsets() {
return new Promise(async (resolve, reject) => {
try {
const eeui = await this.eeuiModulePromise();
eeui.getSafeAreaInsets(result => {
if (result.status !== 'success') {
return reject({msg: result.error || "get failed"});
}
resolve(result);
});
} catch (e) {
reject(e);
}
})
}
}); });
window.$A = $; window.$A = $;

View File

@ -21,6 +21,7 @@ export default {
// 浏览器尺寸信息 // 浏览器尺寸信息
windowWidth: windowWidth, windowWidth: windowWidth,
windowHeight: windowHeight, windowHeight: windowHeight,
safeAreaSize: {top: 0, bottom: 0, data: {}}, // 安全区域尺寸
// 浏览器窗口方向 // 浏览器窗口方向
windowOrientation: windowOrientation, windowOrientation: windowOrientation,
@ -37,7 +38,6 @@ export default {
// 键盘状态仅iOS // 键盘状态仅iOS
keyboardType: null, // show|hide keyboardType: null, // show|hide
keyboardHeight: 0, // 键盘高度 keyboardHeight: 0, // 键盘高度
safeAreaBottom: 0, // 安全区域底部高度
// 是否按下Ctrl/Command键 // 是否按下Ctrl/Command键
isModKey: false, isModKey: false,

@ -1 +1 @@
Subproject commit 3d609e7f8d6b0d78299cce82208e1bc98a955cdf Subproject commit c1afa36421ff425312ed9e3c09046a7ca73d8c28