|
@@ -90,7 +90,11 @@ export const api =
|
|
|
fileUrl = (params.realPath || params.m) + fileUrl
|
|
|
console.error("处理后url:" + fileUrl)
|
|
|
|
|
|
- if (import.meta.env.DEV) {
|
|
|
+ const paths = fileUrl.split("/")
|
|
|
+ const notBase64 = paths[paths.length - 1].includes(".png") ||
|
|
|
+ paths[paths.length - 1].includes(".jpg")
|
|
|
+
|
|
|
+ if (import.meta.env.DEV || !notBase64) {
|
|
|
return await new Promise<string>((resolve) => {
|
|
|
const apiName = `getImageCallback${count++}`
|
|
|
global[apiName] = (base64) => {
|
|
@@ -101,12 +105,8 @@ export const api =
|
|
|
global.android.getImage(fileUrl, apiName);
|
|
|
});
|
|
|
} else {
|
|
|
- // console.log("请求文件" + fileUrl)
|
|
|
- const data = await axios.get(fileUrl, { responseType: "blob" });
|
|
|
- console.log("axios请求文件" + fileUrl, "结果为" + data.status)
|
|
|
- const base64 = await blobToBase64(data.data);
|
|
|
- return base64
|
|
|
- // return Promise.resolve(fileUrl);
|
|
|
+ console.log("图片文件直接文件系统读取", fileUrl)
|
|
|
+ return fileUrl
|
|
|
}
|
|
|
},
|
|
|
uploadImage(file: File) {
|
|
@@ -205,6 +205,19 @@ const syncSceneStore = () => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+if (global.android) {
|
|
|
+ document.documentElement.addEventListener('focusin', ev => {
|
|
|
+ console.log("获得焦点")
|
|
|
+ console.log(ev.target)
|
|
|
+ global.android.inputMethodManager(true);
|
|
|
+ })
|
|
|
+ document.documentElement.addEventListener('focusout', ev => {
|
|
|
+ console.log("失去焦点")
|
|
|
+ console.log(ev.target)
|
|
|
+ global.android.inputMethodManager(false);
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
loadStore().catch((e) => {
|
|
|
console.error(e);
|
|
|
alert("场景数据加载失败");
|