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.keyboardHeight = event.keyboardHeight;
this.$store.state.safeAreaBottom = event.safeAreaBottom;
$A.eeuiAppShakeToEditEnabled(this.$store.state.keyboardType === 'show')
}
//

View File

@ -338,6 +338,14 @@ const $preload = async () => {
}
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");

View File

@ -18,6 +18,21 @@
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版本号
eeuiAppVersion() {
return this.eeuiModule()?.getVersion();
@ -194,10 +209,7 @@
eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) {
return new Promise(async (resolve, reject) => {
try {
const eeui = this.eeuiModule();
if (!eeui) {
return reject({msg: "module not found"});
}
const eeui = await this.eeuiModule();
const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"});
@ -222,7 +234,7 @@
resolve(result);
});
} catch (e) {
reject({msg: e.message});
reject(e);
}
})
},
@ -232,10 +244,7 @@
eeuiAppUploadPhoto(params, timeout = 30) {
return new Promise(async (resolve, reject) => {
try {
const eeui = this.eeuiModule();
if (!eeui) {
return reject({msg: "module not found"});
}
const eeui = await this.eeuiModulePromise();
const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"});
@ -267,7 +276,7 @@
resolve(result.data.data);
});
} catch (e) {
reject({msg: e.message});
reject(e);
}
})
},
@ -276,10 +285,7 @@
eeuiAppCancelUploadPhoto(id) {
return new Promise(async (resolve, reject) => {
try {
const eeui = this.eeuiModule();
if (!eeui) {
return reject({msg: "module not found"});
}
const eeui = await this.eeuiModulePromise();
eeui.cancelUploadPhoto(id, result => {
if (result.status !== 'success') {
return reject({msg: result.error || "cancel failed"});
@ -287,7 +293,7 @@
resolve(result);
});
} catch (e) {
reject({msg: e.message});
reject(e);
}
})
},
@ -305,6 +311,23 @@
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 = $;

View File

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

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