diff --git a/src/pages/painting/index.vue b/src/pages/painting/index.vue
index 1f72669..6e7abda 100644
--- a/src/pages/painting/index.vue
+++ b/src/pages/painting/index.vue
@@ -5,42 +5,25 @@
已扫画筒号:{{ state.pid }}
请放入:
- {{ state.containerName }}货架
+ {{ state.containerName }}货架
-
- {{state.boxName}}
+ ">
+ {{ state.boxName }}
- {{state.column}}列{{state.row}}行
+ {{ state.column }}列{{ state.row }}行
- 取消
- {{ buttonText }}
+ 取消
+ {{ buttonText }}
@@ -48,7 +31,8 @@
import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app";
-import { freebox,bind,check_freebox,cancel} from "@/api/login.js";
+import { freebox, bind, check_freebox, cancel } from "@/api/login.js";
+import { closeWebview, runTimeEnv } from "@/utils/index.js"
const { showMessage } = useToast();
const loading = ref(false);
const isButtonDisabled = ref(false);
@@ -58,9 +42,9 @@ const state = reactive({
id: "",
pid: "",
containerName: "",
- boxName:"",
- boxUid:"",
- containerUid:'',
+ boxName: "",
+ boxUid: "",
+ containerUid: '',
});
onLoad((options) => {
@@ -75,15 +59,15 @@ const bindShelfHole = async () => {
if (res.status === 0) {
state.containerName = res.data.containerName;
state.boxName = res.data.boxName;
- state.containerUid=res.data.containerUid;
- state.boxUid=res.data.boxUid;
+ state.containerUid = res.data.containerUid;
+ state.boxUid = res.data.boxUid;
check()
if (state.boxName) {
- const parts = state.boxName.split(/(\d+)/);
+ const parts = state.boxName.split(/(\d+)/);
state.column = parts[0]; // 字母部分
state.row = parts[1]; // 数字部分
}
-
+
}
loading.value = false;
};
@@ -93,41 +77,45 @@ const doneSet = async () => {
const res = await bind({
paintingBucketId: state.id,
paintingBucketUid: state.pid,
- boxUid:state.boxUid,
- containerUid:state.containerUid,
- containerName:state.containerName,
- boxName:state.boxName,
+ boxUid: state.boxUid,
+ containerUid: state.containerUid,
+ containerName: state.containerName,
+ boxName: state.boxName,
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "入库成功" });
- isButtonDisabled.value = true;
+ isButtonDisabled.value = true;
buttonText.value = "已入库";
- }else{
+ } else {
showMessage({ type: "error", message: res.msg });
- }
- loading.value = false;
+ }
+ loading.value = false;
};
//入库取消
const closeFn = async () => {
const res = await cancel({
- boxUid : state.boxUid
+ boxUid: state.boxUid
});
- if(res.status === 0){
- }else{
- showMessage({ type: "error", message: res.msg });
- isButtonDisabled.value = true;
- closeButton.value = true;
- }
+ if (res.status === 0) {
+ // console.log(123123123, runTimeEnv())
+ // if (runTimeEnv()) {
+ // closeWebview()
+ // }
+ } else {
+ showMessage({ type: "error", message: res.msg });
+ isButtonDisabled.value = true;
+ closeButton.value = true;
+ }
}
//查孔洞是否能用
const check = async () => {
const res = await check_freebox({
- boxUid : state.boxUid
+ boxUid: state.boxUid
});
- if(res.status === 0){
- }else{
- showMessage({ type: "error", message: res.msg });
- }
+ if (res.status === 0) {
+ } else {
+ showMessage({ type: "error", message: res.msg });
+ }
}
@@ -169,6 +157,7 @@ page {
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
}
}
+
.button-container {
display: flex;
justify-content: space-between;
diff --git a/utils/index.js b/utils/index.js
new file mode 100644
index 0000000..078cc8a
--- /dev/null
+++ b/utils/index.js
@@ -0,0 +1,8 @@
+const currentWebView = plus.webview.getWebviewById("wv");
+
+export const runTimeEnv = () => {
+ return currentWebView.RunTime === "app";
+};
+export const closeWebview = () => {
+ currentWebView.close();
+};