This commit is contained in:
Aiden 2024-10-15 16:45:54 +08:00
parent 59e59bd37e
commit bea133759f
2 changed files with 51 additions and 54 deletions

View File

@ -5,18 +5,14 @@
<span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span> <span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span>
<span style="margin-top: 40rpx"> 请放入 </span> <span style="margin-top: 40rpx"> 请放入 </span>
<view class="painting-box"> <view class="painting-box">
<span style="font-weight: bold; text-align: center" <span style="font-weight: bold; text-align: center">{{ state.containerName }}货架</span>
>{{ state.containerName }}货架</span
>
<up-line style="margin-top: 20rpx"></up-line> <up-line style="margin-top: 20rpx"></up-line>
<span <span style="
style="
color: #cf3050; color: #cf3050;
font-size: 24px; font-size: 24px;
text-align: center; text-align: center;
margin-top: 20rpx; margin-top: 20rpx;
" ">
>
{{ state.boxName }} {{ state.boxName }}
</span> </span>
<span style="text-align: center; margin-top: 20rpx"> {{ state.column }}{{ state.row }} </span> <span style="text-align: center; margin-top: 20rpx"> {{ state.column }}{{ state.row }} </span>
@ -24,23 +20,10 @@
</view> </view>
</view> </view>
<view class="button-container"> <view class="button-container">
<up-button <up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5"
style="width: 336rpx; margin: auto; height: 80rpx" disabled="isButtonDisabled" @click="closeFn" v-if="runTimeEnv()">取消</up-button>
color="#BABABA" <up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#EFC54E" throttleTime="5" @click="doneSet"
throttleTime="5" disabled="closeButton" :loading="loading">{{ buttonText }}</up-button>
disabled="isButtonDisabled"
@click="closeFn"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
disabled="closeButton"
:loading="loading"
>{{ buttonText }}</up-button
>
</view> </view>
</template> </template>
@ -49,6 +32,7 @@ import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js"; import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app"; 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 { showMessage } = useToast();
const loading = ref(false); const loading = ref(false);
const isButtonDisabled = ref(false); const isButtonDisabled = ref(false);
@ -113,6 +97,10 @@ const closeFn = async () => {
boxUid: state.boxUid boxUid: state.boxUid
}); });
if (res.status === 0) { if (res.status === 0) {
// console.log(123123123, runTimeEnv())
// if (runTimeEnv()) {
// closeWebview()
// }
} else { } else {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
isButtonDisabled.value = true; isButtonDisabled.value = true;
@ -169,6 +157,7 @@ page {
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5); box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
} }
} }
.button-container { .button-container {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

8
utils/index.js Normal file
View File

@ -0,0 +1,8 @@
const currentWebView = plus.webview.getWebviewById("wv");
export const runTimeEnv = () => {
return currentWebView.RunTime === "app";
};
export const closeWebview = () => {
currentWebView.close();
};