This commit is contained in:
Aiden 2024-10-17 10:59:23 +08:00
parent 2159256e53
commit a2ec8f55c3
5 changed files with 173 additions and 166 deletions

View File

@ -5,6 +5,8 @@ export default {
}, },
onShow: function () { onShow: function () {
console.log("App Show"); console.log("App Show");
console.log(window.location.href);
}, },
onHide: function () { onHide: function () {
console.log("App Hide"); console.log("App Hide");

View File

@ -39,10 +39,9 @@ const currentWebView = plus.webview.getWebviewById("wv");
const root = document.documentElement; const root = document.documentElement;
root.style.setProperty( root.style.setProperty(
"--statusBarHeight", "--statusBarHeight",
`${ `${currentWebView.RunTime === "app"
currentWebView.RunTime === "app" ? plus.navigator.getStatusbarHeight()
? plus.navigator.getStatusbarHeight() : 0 ?? 0
: 0 ?? 0
}px` }px`
); );
</script> </script>
@ -51,9 +50,11 @@ root.style.setProperty(
.status_bar { .status_bar {
height: var(--status-bar-height); height: var(--status-bar-height);
} }
:deep(.u-status-bar) { :deep(.u-status-bar) {
margin-top: var(--statusBarHeight); margin-top: var(--statusBarHeight);
} }
@mixin flex($direction: row) { @mixin flex($direction: row) {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;

View File

@ -1,84 +1,69 @@
<template> <template>
<view class="content"> <view class="content">
<navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar> <navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
<navBar v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4"> 画筒详情 </navBar> <navBar v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"> 画筒详情 </navBar>
<view class="container-box" > <view class="container-box">
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 1"> <span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 1">
确定要出库{{state.locateAddress}} 确定要出库{{ state.locateAddress }}
</span> </span>
<span style="font-weight: bold;text-align: center;margin-top: 20rpx;" v-if="state.boxRelBucketStatus == 1"> {{state.pid}}画筒吗</span> <span style="font-weight: bold;text-align: center;margin-top: 20rpx;" v-if="state.boxRelBucketStatus == 1">
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4">画筒号{{state.pid}}</span> {{ state.pid }}画筒吗</span>
<span style="font-weight: bold;text-align: center;margin-top: 20rpx;" v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4">所在位置{{ state.locateAddress }}</span> <span style="font-weight: bold;text-align: center;"
<view class="painting-box" > v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4">画筒号{{ state.pid }}</span>
<span>画作名称{{ state.drawName }}</span> <span style="font-weight: bold;text-align: center;margin-top: 20rpx;"
<span style="margin-top: 20rpx;">画家{{ state.drawerName }}</span> v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4">所在位置{{ state.locateAddress }}</span>
<span style="margin-top: 20rpx;">预览图</span> <view class="painting-box">
<view class="image-container"> <span>画作名称{{ state.drawName }}</span>
<up-image <span style="margin-top: 20rpx;">画家{{ state.drawerName }}</span>
:src=state.drawThumbnail <span style="margin-top: 20rpx;">预览图</span>
></up-image> <view class="image-container">
<up-image :src=state.drawThumbnail></up-image>
</view> </view>
</view>
</view> </view>
</view> </view>
<view class="button-container"> </view>
<up-button <view class="button-container">
style="width: 336rpx; margin: auto; height: 80rpx" <up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5"
color="#BABABA" v-if="state.boxRelBucketStatus == 1">取消</up-button>
throttleTime="5" <up-button style="width: 336rpx; margin: auto; height: 80rpx;" color="#EFC54E" throttleTime="5" @click="doneSet"
v-if="state.boxRelBucketStatus == 1" v-if="state.boxRelBucketStatus == 1" :disabled="isButtonDisabled"> {{ buttonText }}</up-button>
>取消</up-button <up-button style="width: 426rpx; margin: auto; height: 86rpx;" color="#EFC54E" throttleTime="5" @click="login"
> v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4">返回继续扫码</up-button>
<up-button </view>
style="width: 336rpx; margin: auto; height: 80rpx;" </template>
color="#EFC54E"
throttleTime="5"
@click="doneSet"
v-if="state.boxRelBucketStatus == 1"
:disabled="isButtonDisabled"
> {{ buttonText }}</up-button
>
<up-button
style="width: 426rpx; margin: auto; height: 86rpx;"
color="#EFC54E"
throttleTime="5"
@click="login"
v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4"
>返回继续扫码</up-button
>
</view>
</template>
<script setup> <script setup>
import { ref,reactive,onBeforeMount } from "vue"; import { ref, reactive, onBeforeMount } from "vue";
import { onLoad } from "@dcloudio/uni-app"; // import { closeWebview, runTimeEnv } from "@/utils/index.js"
import useToast from "@/hooks/toast/useToast.js";
import { pbDetail,outbound } from "@/api/login.js"; import { onLoad } from "@dcloudio/uni-app";
const { showMessage } = useToast(); import useToast from "@/hooks/toast/useToast.js";
const isDetail = ref(false); import { pbDetail, outbound } from "@/api/login.js";
const loading = ref(false); const { showMessage } = useToast();
const isButtonDisabled = ref(false); const isDetail = ref(false);
const buttonText = ref("确认"); const loading = ref(false);
const state = reactive({ const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
id: "", id: "",
pid: "", pid: "",
containerName:"", containerName: "",
boxRelBucketStatus:"", boxRelBucketStatus: "",
drawName:"", drawName: "",
drawerName:"", drawerName: "",
drawThumbnail:"", drawThumbnail: "",
locateAddress:"", locateAddress: "",
boxUid:"", boxUid: "",
}); });
onLoad((options) =>{ onLoad((options) => {
state.id = options.id; state.id = options.id;
state.pid = options.pid; state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus; state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail() paintingDetail()
}); });
const paintingDetail = async () => { const paintingDetail = async () => {
loading.value = true; loading.value = true;
const res = await pbDetail({ const res = await pbDetail({
id: state.id, id: state.id,
@ -90,7 +75,7 @@
state.drawThumbnail = res.data.drawThumbnail; state.drawThumbnail = res.data.drawThumbnail;
state.locateAddress = res.data.locateAddress; state.locateAddress = res.data.locateAddress;
state.boxUid = res.data.boxUid; state.boxUid = res.data.boxUid;
} }
}; };
const doneSet = async () => { const doneSet = async () => {
@ -98,76 +83,77 @@ const doneSet = async () => {
const res = await outbound({ const res = await outbound({
id: state.id, id: state.id,
pid: state.pid, pid: state.pid,
boxUid:state.boxUid, boxUid: state.boxUid,
}); });
if (res.status === 0) { if (res.status === 0) {
showMessage({ type: "sucess", message: "出库成功" }); showMessage({ type: "sucess", message: "出库成功" });
isButtonDisabled.value = true; isButtonDisabled.value = true;
buttonText.value = "已出库"; buttonText.value = "已出库";
}else{ } else {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
}
loading.value = false;
};
</script>
<style lang="scss" scoped>
page {
background: url("@/static/bgp.png") no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
height: 100vh;
box-sizing: border-box;
} }
loading.value = false;
};
</script>
.content { <style lang="scss" scoped>
page {
background: url("@/static/bgp.png") no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
height: 100vh;
box-sizing: border-box;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: 100%;
width: 98%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; margin-top: 60rpx;
justify-content: center; padding: 40rpx;
box-sizing: border-box;
.container-box {
height: 100%;
width: 98%;
display: flex;
flex-direction: column;
margin-top: 60rpx;
padding: 40rpx;
box-sizing: border-box;
}
.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%;
}
</style>
.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%;
}
</style>

View File

@ -5,25 +5,45 @@
<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">{{ state.containerName }}货架</span> <span style="font-weight: bold; text-align: center"
>{{ state.containerName }}货架</span
>
<up-line style="margin-top: 20rpx"></up-line> <up-line style="margin-top: 20rpx"></up-line>
<span style=" <span
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>
</view> </view>
</view> </view>
</view> </view>
<view class="button-container"> <view class="button-container">
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5" <up-button
:disabled="closeButton" @click="closeFn" :loading="loading">取消</up-button> style="width: 336rpx; margin: auto; height: 80rpx"
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#EFC54E" throttleTime="5" @click="doneSet" color="#BABABA"
:disabled="isButtonDisabled" :loading="loading">{{ buttonText }}</up-button> throttleTime="5"
:disabled="closeButton"
@click="closeFn"
:loading="loading"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
:disabled="isButtonDisabled"
:loading="loading"
>{{ buttonText }}</up-button
>
</view> </view>
</template> </template>
@ -32,7 +52,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" 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);
@ -44,10 +64,9 @@ const state = reactive({
containerName: "", containerName: "",
boxName: "", boxName: "",
boxUid: "", boxUid: "",
containerUid: '', containerUid: "",
}); });
onLoad((options) => { onLoad((options) => {
state.id = options.id; state.id = options.id;
state.pid = options.pid; state.pid = options.pid;
bindShelfHole(); bindShelfHole();
@ -61,13 +80,12 @@ const bindShelfHole = async () => {
state.boxName = res.data.boxName; state.boxName = res.data.boxName;
state.containerUid = res.data.containerUid; state.containerUid = res.data.containerUid;
state.boxUid = res.data.boxUid; state.boxUid = res.data.boxUid;
check() check();
if (state.boxName) { if (state.boxName) {
const parts = state.boxName.split(/(\d+)/); const parts = state.boxName.split(/(\d+)/);
state.column = parts[0]; // state.column = parts[0]; //
state.row = parts[1]; // state.row = parts[1]; //
} }
} }
loading.value = false; loading.value = false;
}; };
@ -86,6 +104,7 @@ const doneSet = async () => {
showMessage({ type: "sucess", message: "入库成功" }); showMessage({ type: "sucess", message: "入库成功" });
isButtonDisabled.value = true; isButtonDisabled.value = true;
buttonText.value = "已入库"; buttonText.value = "已入库";
closeWebview();
} else { } else {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
@ -95,7 +114,7 @@ const doneSet = async () => {
const closeFn = async () => { const closeFn = async () => {
loading.value = true; loading.value = true;
const res = await cancel({ const res = await cancel({
boxUid: state.boxUid boxUid: state.boxUid,
}); });
if (res.status === 0) { if (res.status === 0) {
showMessage({ type: "error", message: "取消入库" }); showMessage({ type: "error", message: "取消入库" });
@ -105,18 +124,17 @@ const closeFn = async () => {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
loading.value = false; loading.value = false;
} };
// //
const check = async () => { const check = async () => {
const res = await check_freebox({ const res = await check_freebox({
boxUid: state.boxUid boxUid: state.boxUid,
}); });
if (res.status === 0) { if (res.status === 0) {
} else { } else {
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -32,14 +32,14 @@ const request = new Request({
// response.config.headers["Authorization"] = response.data.data.Token; // response.config.headers["Authorization"] = response.data.data.Token;
// } // }
if (response.data.code === 401) { if (response.data.code === 401) {
uni.clearStorageSync()//清缓存 uni.clearStorageSync(); //清缓存
const params = new URLSearchParams(window.location.search)//属性包含当前 URL 的查询字符串部分 const params = new URLSearchParams(window.location.search); //属性包含当前 URL 的查询字符串部分
const id = params.get('id') const id = params.get("id");
const pid = params.get('pid') const pid = params.get("pid");
uni.navigateTo({ uni.navigateTo({
url: "/pages/login/index?id="+id+'&pid='+pid, url: "/pages/login/index?id=" + id + "&pid=" + pid,
}); });
return false return false;
} }
if ([200, 201, 204].includes(response.status)) { if ([200, 201, 204].includes(response.status)) {
return response.config.responseType === "blob" ? response : response; return response.config.responseType === "blob" ? response : response;