no message

This commit is contained in:
kuaifan 2025-04-08 18:27:33 +08:00
parent 88e859817b
commit 6c519ebd61
4 changed files with 90 additions and 153 deletions

View File

@ -60,7 +60,7 @@
"stylus-loader": "^7.1.0", "stylus-loader": "^7.1.0",
"tinymce": "^5.10.3", "tinymce": "^5.10.3",
"tui-calendar-hi": "^2.1.3-3", "tui-calendar-hi": "^2.1.3-3",
"view-design-hi": "^4.7.0-73", "view-design-hi": "^4.7.0-74",
"vite": "^2.9.15", "vite": "^2.9.15",
"vite-plugin-file-copy": "^1.0.0", "vite-plugin-file-copy": "^1.0.0",
"vite-plugin-require": "^1.1.10", "vite-plugin-require": "^1.1.10",

View File

@ -132,6 +132,7 @@
.scrollbar-content { .scrollbar-content {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
will-change: transform;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
&.scrollbar-disable-x { &.scrollbar-disable-x {

View File

@ -6,27 +6,12 @@
/** /**
* ============================================================================= * =============================================================================
* ******************************* App extra ******************************* * **************************** EEUI App extra *****************************
* ============================================================================= * =============================================================================
*/ */
$.extend({ $.extend({
eeuiModule(name, count = 0) { // 获取eeui模块
return new Promise((resolve) => { eeuiModule(name = 'eeui') {
if (typeof requireModuleJs === "function") {
resolve(requireModuleJs(name));
return;
}
setTimeout(() => {
if (count < 20) {
resolve(this.eeuiModuleJs(name, ++count));
} else {
resolve(null);
}
}, 500)
});
},
eeuiModuleSync(name) {
if (typeof requireModuleJs === "function") { if (typeof requireModuleJs === "function") {
return requireModuleJs(name); return requireModuleJs(name);
} }
@ -35,48 +20,37 @@
// 获取eeui版本号 // 获取eeui版本号
eeuiAppVersion() { eeuiAppVersion() {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getVersion();
return $A.eeuiModuleSync("eeui").getVersion();
}, },
// 获取本地软件版本号 // 获取本地软件版本号
eeuiAppLocalVersion() { eeuiAppLocalVersion() {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getLocalVersion();
return $A.eeuiModuleSync("eeui").getLocalVersion();
}, },
// alert // Alert
eeuiAppAlert(object, callback) { eeuiAppAlert(object, callback) {
if (!$A.isEEUiApp) return;
if (typeof callback !== "function") callback = _ => {}; if (typeof callback !== "function") callback = _ => {};
$A.eeuiModule("eeui").then(obj => { this.eeuiModule()?.alert(object, callback);
obj.alert(object, callback);
})
}, },
// toast // Toast
eeuiAppToast(object) { eeuiAppToast(object) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.toast(object);
$A.eeuiModule("eeui").then(obj => {
obj.toast(object);
})
}, },
// 相对地址基于当前地址补全 // 相对地址基于当前地址补全
eeuiAppRewriteUrl(val) { eeuiAppRewriteUrl(val) {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.rewriteUrl(val);
return $A.eeuiModuleSync("eeui").rewriteUrl(val);
}, },
// 获取页面信息 // 获取页面信息
eeuiAppGetPageInfo(pageName) { eeuiAppGetPageInfo(pageName) {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getPageInfo(pageName);
return $A.eeuiModuleSync("eeui").getPageInfo(pageName);
}, },
// 打开app新页面 // 打开app新页面
eeuiAppOpenPage(object, callback) { eeuiAppOpenPage(object, callback) {
if (!$A.isEEUiApp) return;
if (typeof callback !== "function") { if (typeof callback !== "function") {
callback = _ => {}; callback = _ => {};
} }
@ -84,199 +58,151 @@
callback = object.callback; callback = object.callback;
delete object.callback delete object.callback
} }
$A.eeuiModule("eeui").then(obj => { this.eeuiModule()?.openPage(Object.assign({
obj.openPage(Object.assign({ softInputMode: "resize",
softInputMode: "resize", }, object), callback);
}, object), callback);
})
}, },
// 使用系统浏览器打开网页 // 使用系统浏览器打开网页
eeuiAppOpenWeb(url) { eeuiAppOpenWeb(url) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.openWeb(url)
$A.eeuiModule("eeui").then(obj => {
obj.openWeb(url)
})
}, },
// 拦截返回按键事件仅支持android、iOS无效 // 拦截返回按键事件仅支持android、iOS无效
eeuiAppSetPageBackPressed(object, callback) { eeuiAppSetPageBackPressed(object, callback) {
if (!$A.isEEUiApp) return;
if (typeof callback !== "function") callback = _ => {}; if (typeof callback !== "function") callback = _ => {};
$A.eeuiModule("eeui").then(obj => { this.eeuiModule()?.setPageBackPressed(object, callback);
obj.setPageBackPressed(object, callback);
})
}, },
// 返回手机桌面 // 返回手机桌面
eeuiAppGoDesktop() { eeuiAppGoDesktop() {
if (!$A.isEEUiApp) return; this.eeuiModule()?.goDesktop();
$A.eeuiModule("eeui").then(obj => {
obj.goDesktop();
})
}, },
// 打开屏幕常亮 // 打开屏幕常亮
eeuiAppKeepScreenOn() { eeuiAppKeepScreenOn() {
if (!$A.isEEUiApp) return; this.eeuiModule()?.keepScreenOn();
$A.eeuiModule("eeui").then(obj => {
obj.keepScreenOn();
})
}, },
// 关闭屏幕常亮 // 关闭屏幕常亮
eeuiAppKeepScreenOff() { eeuiAppKeepScreenOff() {
if (!$A.isEEUiApp) return; this.eeuiModule()?.keepScreenOff();
$A.eeuiModule("eeui").then(obj => {
obj.keepScreenOff();
})
}, },
// 隐藏软键盘 // 隐藏软键盘
eeuiAppKeyboardHide() { eeuiAppKeyboardHide() {
if (!$A.isEEUiApp) return; this.eeuiModule()?.keyboardHide();
$A.eeuiModule("eeui").then(obj => {
obj.keyboardHide();
})
}, },
// 给app发送消息 // 给app发送消息
eeuiAppSendMessage(object) { eeuiAppSendMessage(object) {
if (!$A.isEEUiApp) return; this.eeuiModule("webview")?.sendMessage(object);
$A.eeuiModule("webview").then(obj => {
obj.sendMessage(object);
})
}, },
// 设置浏览器地址 // 设置浏览器地址
eeuiAppSetUrl(url) { eeuiAppSetUrl(url) {
if (!$A.isEEUiApp) return; this.eeuiModule("webview")?.setUrl(url);
$A.eeuiModule("webview").then(obj => {
obj.setUrl(url);
})
}, },
// 扫码 // 扫码
eeuiAppScan(callback) { eeuiAppScan(callback) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.openScaner({}, (res) => {
$A.eeuiModule("eeui").then(obj => { switch (res.status) {
obj.openScaner({}, (res) => { case "success":
switch (res.status) { callback(res.text);
case "success": break;
callback(res.text); }
break; });
}
});
})
}, },
// 检查更新 // 检查更新
eeuiAppCheckUpdate() { eeuiAppCheckUpdate() {
if (!$A.isEEUiApp) return; this.eeuiModule()?.checkUpdate();
$A.eeuiModule("eeui").then(obj => {
obj.checkUpdate();
})
}, },
// 获取主题名称 light|dark // 获取主题名称 light|dark
eeuiAppGetThemeName() { eeuiAppGetThemeName() {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getThemeName();
return $A.eeuiModuleSync("eeui").getThemeName();
}, },
// 判断软键盘是否可见 // 判断软键盘是否可见
eeuiAppKeyboardStatus() { eeuiAppKeyboardStatus() {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.keyboardStatus();
return $A.eeuiModuleSync("eeui").keyboardStatus();
}, },
// 设置全局变量 // 设置全局变量
eeuiAppSetVariate(key, value) { eeuiAppSetVariate(key, value) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.setVariate(key, value);
$A.eeuiModuleSync("eeui").setVariate(key, value);
}, },
// 获取全局变量 // 获取全局变量
eeuiAppGetVariate(key, defaultVal = "") { eeuiAppGetVariate(key, defaultVal = "") {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getVariate(key, defaultVal);
return $A.eeuiModuleSync("eeui").getVariate(key, defaultVal);
}, },
// 设置缓存数据 // 设置缓存数据
eeuiAppSetCachesString(key, value, expired = 0) { eeuiAppSetCachesString(key, value, expired = 0) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.setCachesString(key, value, expired);
$A.eeuiModuleSync("eeui").setCachesString(key, value, expired);
}, },
// 获取缓存数据 // 获取缓存数据
eeuiAppGetCachesString(key, defaultVal = "") { eeuiAppGetCachesString(key, defaultVal = "") {
if (!$A.isEEUiApp) return; return this.eeuiModule()?.getCachesString(key, defaultVal);
return $A.eeuiModuleSync("eeui").getCachesString(key, defaultVal);
}, },
// 长按内容震动仅支持android、iOS无效 // 长按内容震动仅支持android、iOS无效
eeuiAppSetHapticBackEnabled(val) { eeuiAppSetHapticBackEnabled(val) {
if (!$A.isEEUiApp) return; this.eeuiModule("webview").setHapticBackEnabled(val);
$A.eeuiModuleSync("webview").setHapticBackEnabled(val);
}, },
// 禁止长按选择仅支持android、iOS无效 // 禁止长按选择仅支持android、iOS无效
eeuiAppSetDisabledUserLongClickSelect(val) { eeuiAppSetDisabledUserLongClickSelect(val) {
if (!$A.isEEUiApp) return; const webview = this.eeuiModule("webview");
$A.__disabledUserLongClickSelectTimer && clearTimeout($A.__disabledUserLongClickSelectTimer); this.__disabledUserLongClickSelectTimer && clearTimeout(this.__disabledUserLongClickSelectTimer);
if (/^\d+$/.test(val)) { if (!/^\d+$/.test(val)) {
$A.eeuiModuleSync("webview").setDisabledUserLongClickSelect(true); webview.setDisabledUserLongClickSelect(val);
$A.__disabledUserLongClickSelectTimer = setTimeout(() => { return;
$A.__disabledUserLongClickSelectTimer = null;
$A.eeuiModuleSync("webview").setDisabledUserLongClickSelect(false);
}, val);
} else {
$A.eeuiModuleSync("webview").setDisabledUserLongClickSelect(val);
} }
webview.setDisabledUserLongClickSelect(true);
this.__disabledUserLongClickSelectTimer = setTimeout(() => {
this.__disabledUserLongClickSelectTimer = null;
webview.setDisabledUserLongClickSelect(false);
}, val);
}, },
__disabledUserLongClickSelectTimer: null, __disabledUserLongClickSelectTimer: null,
// 复制文本 // 复制文本
eeuiAppCopyText(text) { eeuiAppCopyText(text) {
if (!$A.isEEUiApp) return; this.eeuiModule()?.copyText(text)
$A.eeuiModuleSync("eeui").copyText(text)
}, },
// 设置是否允许滚动 // 设置是否允许滚动
eeuiAppSetScrollEnabled(enabled) { eeuiAppSetScrollEnabled(enabled) {
if (!$A.isEEUiApp) return; this.eeuiModule("webview")?.setScrollEnabled(enabled);
$A.eeuiModule("webview").then(obj => {
obj.setScrollEnabled(enabled);
})
}, },
// 设置应用程序级别的摇动撤销仅支持iOS、android无效 // 设置应用程序级别的摇动撤销仅支持iOS、android无效
eeuiAppShakeToEditEnabled(enabled) { eeuiAppShakeToEditEnabled(enabled) {
if (!$A.isEEUiApp) return; if (enabled) {
$A.eeuiModule("eeui").then(obj => { this.eeuiModule()?.shakeToEditOn();
if (enabled) { } else {
obj.shakeToEditOn(); this.eeuiModule()?.shakeToEditOff();
} else { }
obj.shakeToEditOff();
}
})
}, },
// 获取最新一张照片 // 获取最新一张照片
eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) { eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (!$A.isEEUiApp) {
return reject({msg: "not eeui app"});
}
try { try {
const eeui = await $A.eeuiModule("eeui") const eeui = this.eeuiModule();
if (!eeui) { if (!eeui) {
return reject({msg: "not eeui module"}); return reject({msg: "module not found"});
} }
const timer = timeout > 0 ? setTimeout(() => { const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"}); reject({msg: "timeout"});
}, timeout * 1000) : null; }, timeout * 1000) : null;
//
eeui.getLatestPhoto(result => { eeui.getLatestPhoto(result => {
timer && clearTimeout(timer); timer && clearTimeout(timer);
if ( if (
@ -289,10 +215,10 @@
if (expiration > 0 && (result.created + expiration) < $A.dayjs().unix()) { if (expiration > 0 && (result.created + expiration) < $A.dayjs().unix()) {
return reject({msg: "photo expired"}); return reject({msg: "photo expired"});
} }
if ($A.__latestPhotoCreated && $A.__latestPhotoCreated === result.created) { if (this.__latestPhotoCreated && this.__latestPhotoCreated === result.created) {
return reject({msg: "photo expired"}); return reject({msg: "photo expired"});
} }
$A.__latestPhotoCreated = result.created; this.__latestPhotoCreated = result.created;
resolve(result); resolve(result);
}); });
} catch (e) { } catch (e) {
@ -305,33 +231,32 @@
// 上传照片(通过 eeuiAppGetLatestPhoto 获取到的pathparams 参数:{url,data,headers,path,fieldName} // 上传照片(通过 eeuiAppGetLatestPhoto 获取到的pathparams 参数:{url,data,headers,path,fieldName}
eeuiAppUploadPhoto(params, timeout = 30) { eeuiAppUploadPhoto(params, timeout = 30) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (!$A.isEEUiApp) {
return reject({msg: "not eeui app"});
}
try { try {
const eeui = await $A.eeuiModule("eeui") const eeui = this.eeuiModule();
if (!eeui) { if (!eeui) {
return reject({msg: "not eeui module"}); return reject({msg: "module not found"});
} }
const timer = timeout > 0 ? setTimeout(() => { const timer = timeout > 0 ? setTimeout(() => {
reject({msg: "timeout"}); reject({msg: "timeout"});
}, timeout * 1000) : null; }, timeout * 1000) : null;
//
if (!$A.isJson(params)) { if (!$A.isJson(params)) {
return reject({msg: "params error"}); return reject({msg: "params error"});
} }
let onReady = () => {};
let onReady = null;
if (typeof params.onReady !== "undefined") { if (typeof params.onReady !== "undefined") {
if (typeof params.onReady === "function") { onReady = params.onReady;
onReady = params.onReady;
}
delete params.onReady; delete params.onReady;
} }
eeui.uploadPhoto(params, result => { eeui.uploadPhoto(params, result => {
if (result.status === 'ready') { if (result.status === 'ready') {
onReady(result.id) typeof onReady === "function" && onReady(result.id)
return return
} }
timer && clearTimeout(timer); timer && clearTimeout(timer);
if (result.status !== 'success') { if (result.status !== 'success') {
return reject({msg: result.error || "upload failed"}); return reject({msg: result.error || "upload failed"});
@ -350,13 +275,10 @@
// 取消上传照片 // 取消上传照片
eeuiAppCancelUploadPhoto(id) { eeuiAppCancelUploadPhoto(id) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (!$A.isEEUiApp) {
return reject({msg: "not eeui app"});
}
try { try {
const eeui = await $A.eeuiModule("eeui") const eeui = this.eeuiModule();
if (!eeui) { if (!eeui) {
return reject({msg: "not eeui module"}); return reject({msg: "module not found"});
} }
eeui.cancelUploadPhoto(id, result => { eeui.cancelUploadPhoto(id, result => {
if (result.status !== 'success') { if (result.status !== 'success') {
@ -368,7 +290,21 @@
reject({msg: e.message}); reject({msg: e.message});
} }
}) })
} },
// 添加导航栏遮罩
eeuiAppAddNavMask(color) {
return this.eeuiModule()?.addNavMask(color)
},
// 移除导航栏遮罩
eeuiAppRemoveNavMask(name = null) {
if (name === true) {
this.eeuiModule()?.removeAllNavMasks() // 移除所有遮罩
} else if (name) {
this.eeuiModule()?.removeNavMask(name) // 移除指定遮罩
}
},
}); });
window.$A = $; window.$A = $;

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