This commit is contained in:
Aiden 2024-10-22 13:37:33 +08:00
parent 00da50d7ff
commit 2a1f3f6876
4 changed files with 16 additions and 9 deletions

View File

@ -145,12 +145,14 @@ const backScan = () => {
closeWebview(); closeWebview();
}; };
const runTimeEnv = () => { const runTimeEnv = () => {
try {
if (plus) { if (plus) {
const currentWebView = plus.webview.getWebviewById("wv"); const currentWebView = plus.webview.getWebviewById("wv");
return currentWebView.RunTime === "app"; return currentWebView.RunTime === "app";
} else { } else {
return false; return false;
} }
} catch (e) {}
}; };
const getBtngetRules = async () => { const getBtngetRules = async () => {
const res = await getRules({}); const res = await getRules({});

View File

@ -128,7 +128,7 @@ onLoad((options) => {
// //
if ( if (
uni.getStorageSync("token") || uni.getStorageSync("token") ||
plus.webview.getWebviewById("wv").tokenScan || window?.plus?.webview.getWebviewById("wv").tokenScan ||
uni.getStorageSync("store-token") uni.getStorageSync("store-token")
) { ) {
paintingDetail(); paintingDetail();

View File

@ -111,6 +111,11 @@ const doneSet = async () => {
showMessage({ type: "sucess", message: "入库成功" }); showMessage({ type: "sucess", message: "入库成功" });
isButtonDisabled.value = true; isButtonDisabled.value = true;
buttonText.value = "已入库"; buttonText.value = "已入库";
if (runTimeEnv()) {
setTimeout(() => {
closeWebview();
}, 2000);
}
} else { } else {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }

View File

@ -7,7 +7,7 @@ console.log(
window?.plus?.storage.getItem("token"), window?.plus?.storage.getItem("token"),
uni.getStorageSync("token") uni.getStorageSync("token")
); );
console.log("webview", plus.webview.getWebviewById("wv").tokenScan); console.log("webview", window?.plus?.webview.getWebviewById("wv").tokenScan);
const request = new Request({ const request = new Request({
baseURL: baseURL:
OAorMc() === "MC" OAorMc() === "MC"
@ -24,7 +24,7 @@ const request = new Request({
const token = const token =
uni.getStorageSync("token") || uni.getStorageSync("token") ||
plus.webview.getWebviewById("wv").tokenScan || window?.plus?.webview.getWebviewById("wv").tokenScan ||
uni.getStorageSync("store-token") || uni.getStorageSync("store-token") ||
""; "";
if (config.isFormData) { if (config.isFormData) {