From bea133759f2371ca931d434b9bfdc6b27b567de1 Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Tue, 15 Oct 2024 16:45:54 +0800 Subject: [PATCH 01/16] fix --- src/pages/painting/index.vue | 97 ++++++++++++++++-------------------- utils/index.js | 8 +++ 2 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 utils/index.js 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(); +}; From a2ec8f55c37bda2a99effa489de253ca21bb4eb8 Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 17 Oct 2024 10:59:23 +0800 Subject: [PATCH 02/16] fix --- src/App.vue | 2 + src/components/navBar/index.vue | 9 +- src/pages/detail/index.vue | 262 +++++++++++++++----------------- src/pages/painting/index.vue | 54 ++++--- utils/service/index.js | 12 +- 5 files changed, 173 insertions(+), 166 deletions(-) diff --git a/src/App.vue b/src/App.vue index f9768a5..61d4597 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,6 +5,8 @@ export default { }, onShow: function () { console.log("App Show"); + console.log(window.location.href); + }, onHide: function () { console.log("App Hide"); diff --git a/src/components/navBar/index.vue b/src/components/navBar/index.vue index c8573a6..ef05cd6 100644 --- a/src/components/navBar/index.vue +++ b/src/components/navBar/index.vue @@ -39,10 +39,9 @@ const currentWebView = plus.webview.getWebviewById("wv"); const root = document.documentElement; root.style.setProperty( "--statusBarHeight", - `${ - currentWebView.RunTime === "app" - ? plus.navigator.getStatusbarHeight() - : 0 ?? 0 + `${currentWebView.RunTime === "app" + ? plus.navigator.getStatusbarHeight() + : 0 ?? 0 }px` ); @@ -51,9 +50,11 @@ root.style.setProperty( .status_bar { height: var(--status-bar-height); } + :deep(.u-status-bar) { margin-top: var(--statusBarHeight); } + @mixin flex($direction: row) { /* #ifndef APP-NVUE */ display: flex; diff --git a/src/pages/detail/index.vue b/src/pages/detail/index.vue index be2efd0..5bb342f 100644 --- a/src/pages/detail/index.vue +++ b/src/pages/detail/index.vue @@ -1,84 +1,69 @@ - - - - - - \ No newline at end of file + + + .painting-box { + height: 100%; + width: 100%; + display: flex; + flex-direction: column; + margin-top: 60rpx; + padding: 20rpx; + box-sizing: border-box; + background-color: #fff; + box-shadow: 0 0 6px rgba(219, 218, 218, 0.5); + } + + .image-container { + display: flex; + justify-content: center; + align-items: center; + margin-top: 20rpx; + height: auto; + } +} + +.button-container { + display: flex; + justify-content: space-between; + width: 100%; + position: fixed; + bottom: 1rpx; + left: 0; + padding: 0 20rpx; + box-sizing: border-box; + background-color: #fff; + height: 8%; +} + \ No newline at end of file diff --git a/src/pages/painting/index.vue b/src/pages/painting/index.vue index 0432925..fe40840 100644 --- a/src/pages/painting/index.vue +++ b/src/pages/painting/index.vue @@ -5,25 +5,45 @@ 已扫画筒号:{{ state.pid }} 请放入: - {{ state.containerName }}货架 + {{ state.containerName }}货架 - + " + > {{ state.boxName }} - {{ state.column }}列{{ state.row }}行 + + {{ state.column }}列{{ state.row }}行 + - 取消 - {{ buttonText }} + 取消 + {{ buttonText }} @@ -32,7 +52,7 @@ 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 { closeWebview, runTimeEnv } from "@/utils/index.js" +import { closeWebview, runTimeEnv } from "@/utils/index.js"; const { showMessage } = useToast(); const loading = ref(false); const isButtonDisabled = ref(false); @@ -44,10 +64,9 @@ const state = reactive({ containerName: "", boxName: "", boxUid: "", - containerUid: '', + containerUid: "", }); onLoad((options) => { - state.id = options.id; state.pid = options.pid; bindShelfHole(); @@ -61,13 +80,12 @@ const bindShelfHole = async () => { state.boxName = res.data.boxName; state.containerUid = res.data.containerUid; state.boxUid = res.data.boxUid; - check() + check(); if (state.boxName) { const parts = state.boxName.split(/(\d+)/); state.column = parts[0]; // 字母部分 state.row = parts[1]; // 数字部分 } - } loading.value = false; }; @@ -86,6 +104,7 @@ const doneSet = async () => { showMessage({ type: "sucess", message: "入库成功" }); isButtonDisabled.value = true; buttonText.value = "已入库"; + closeWebview(); } else { showMessage({ type: "error", message: res.msg }); } @@ -95,7 +114,7 @@ const doneSet = async () => { const closeFn = async () => { loading.value = true; const res = await cancel({ - boxUid: state.boxUid + boxUid: state.boxUid, }); if (res.status === 0) { showMessage({ type: "error", message: "取消入库" }); @@ -105,18 +124,17 @@ const closeFn = async () => { showMessage({ type: "error", message: res.msg }); } loading.value = false; -} +}; //查孔洞是否能用 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 }); } -} - +}; \ No newline at end of file + From 71807e8b76119a1912dd2a30a6c14687a45cb5ff Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 17 Oct 2024 11:28:59 +0800 Subject: [PATCH 05/16] fix --- src/pages/detail/index.vue | 1 + src/pages/index/index.vue | 336 +++++++++++++++++++---------------- src/pages/painting/index.vue | 1 + 3 files changed, 185 insertions(+), 153 deletions(-) diff --git a/src/pages/detail/index.vue b/src/pages/detail/index.vue index 7db5f8c..deb8c2a 100644 --- a/src/pages/detail/index.vue +++ b/src/pages/detail/index.vue @@ -45,6 +45,7 @@ color="#BABABA" throttleTime="5" v-if="state.boxRelBucketStatus == 1" + @click="backScan" >取消 添加画作 - - 已扫画筒号:{{state.pid }} - - - @@ -50,26 +76,27 @@ style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5" + @click="backScan" >取消 - {{ buttonText }} - + + {{ buttonText }} + - diff --git a/src/pages/painting/index.vue b/src/pages/painting/index.vue index 84c8ab4..04bb60b 100644 --- a/src/pages/painting/index.vue +++ b/src/pages/painting/index.vue @@ -120,6 +120,7 @@ const closeFn = async () => { showMessage({ type: "error", message: "取消入库" }); closeButton.value = true; isButtonDisabled.value = true; + closeWebview(); } else { showMessage({ type: "error", message: res.msg }); } From 36d0ef2e3160ae1b417fe20ac51391bf3fd24847 Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 17 Oct 2024 11:39:04 +0800 Subject: [PATCH 06/16] fix --- src/pages/detail/index.vue | 7 +++++-- src/pages/index/index.vue | 3 +++ src/pages/painting/index.vue | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/pages/detail/index.vue b/src/pages/detail/index.vue index deb8c2a..51d517e 100644 --- a/src/pages/detail/index.vue +++ b/src/pages/detail/index.vue @@ -44,7 +44,7 @@ style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5" - v-if="state.boxRelBucketStatus == 1" + v-if="state.boxRelBucketStatus == 1 && runTimeEnv()" @click="backScan" >取消 @@ -63,7 +63,10 @@ color="#EFC54E" throttleTime="5" @click="backScan" - v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4" + v-if=" + (state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4) && + runTimeEnv() + " >返回继续扫码 diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index fe46d12..19ce9e2 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -77,6 +77,7 @@ color="#BABABA" throttleTime="5" @click="backScan" + v-if="runTimeEnv()" >取消 取消 { showMessage({ type: "sucess", message: "入库成功" }); isButtonDisabled.value = true; buttonText.value = "已入库"; - closeWebview(); + if (runTimeEnv()) { + closeWebview(); + } } else { showMessage({ type: "error", message: res.msg }); } @@ -120,7 +123,9 @@ const closeFn = async () => { showMessage({ type: "error", message: "取消入库" }); closeButton.value = true; isButtonDisabled.value = true; - closeWebview(); + if (runTimeEnv()) { + closeWebview(); + } } else { showMessage({ type: "error", message: res.msg }); } From 15fc542f6f11ee1770dde0f8d1ad074a740e417c Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 17 Oct 2024 13:07:22 +0800 Subject: [PATCH 07/16] fix --- utils/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/index.js b/utils/index.js index 078cc8a..f510ff3 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,7 +1,11 @@ const currentWebView = plus.webview.getWebviewById("wv"); export const runTimeEnv = () => { - return currentWebView.RunTime === "app"; + if (plus) { + return currentWebView.RunTime === "app"; + } else { + return false; + } }; export const closeWebview = () => { currentWebView.close(); From 511a73f92f3a5ccfc436f5b30f01a19d6e30e5f8 Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 17 Oct 2024 13:36:41 +0800 Subject: [PATCH 08/16] fix --- src/pages/detail/index.vue | 10 +++++++++- src/pages/index/index.vue | 12 +++++++++++- src/pages/painting/index.vue | 10 +++++++++- utils/index.js | 23 ++++++++++++++--------- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/pages/detail/index.vue b/src/pages/detail/index.vue index 51d517e..66c4808 100644 --- a/src/pages/detail/index.vue +++ b/src/pages/detail/index.vue @@ -74,7 +74,7 @@