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 () {
console.log("App Show");
console.log(window.location.href);
},
onHide: function () {
console.log("App Hide");

View File

@ -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`
);
</script>
@ -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;

View File

@ -1,84 +1,69 @@
<template>
<view class="content">
<navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
<navBar v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4"> 画筒详情 </navBar>
<view class="container-box" >
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 1">
确定要出库{{state.locateAddress}}
</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;" v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4">画筒号{{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>
<view class="painting-box" >
<span>画作名称{{ state.drawName }}</span>
<span style="margin-top: 20rpx;">画家{{ state.drawerName }}</span>
<span style="margin-top: 20rpx;">预览图</span>
<view class="image-container">
<up-image
:src=state.drawThumbnail
></up-image>
<view class="content">
<navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
<navBar v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"> 画筒详情 </navBar>
<view class="container-box">
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 1">
确定要出库{{ state.locateAddress }}
</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;"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4">画筒号{{ 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>
<view class="painting-box">
<span>画作名称{{ state.drawName }}</span>
<span style="margin-top: 20rpx;">画家{{ state.drawerName }}</span>
<span style="margin-top: 20rpx;">预览图</span>
<view class="image-container">
<up-image :src=state.drawThumbnail></up-image>
</view>
</view>
</view>
</view>
<view class="button-container">
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA"
throttleTime="5"
v-if="state.boxRelBucketStatus == 1"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx;"
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>
import { ref,reactive,onBeforeMount } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import useToast from "@/hooks/toast/useToast.js";
import { pbDetail,outbound } from "@/api/login.js";
const { showMessage } = useToast();
const isDetail = ref(false);
const loading = ref(false);
const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
</view>
<view class="button-container">
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5"
v-if="state.boxRelBucketStatus == 1">取消</up-button>
<up-button style="width: 336rpx; margin: auto; height: 80rpx;" 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>
import { ref, reactive, onBeforeMount } from "vue";
// import { closeWebview, runTimeEnv } from "@/utils/index.js"
import { onLoad } from "@dcloudio/uni-app";
import useToast from "@/hooks/toast/useToast.js";
import { pbDetail, outbound } from "@/api/login.js";
const { showMessage } = useToast();
const isDetail = ref(false);
const loading = ref(false);
const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
id: "",
pid: "",
containerName:"",
boxRelBucketStatus:"",
drawName:"",
drawerName:"",
drawThumbnail:"",
locateAddress:"",
boxUid:"",
containerName: "",
boxRelBucketStatus: "",
drawName: "",
drawerName: "",
drawThumbnail: "",
locateAddress: "",
boxUid: "",
});
onLoad((options) =>{
state.id = options.id;
state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail()
});
const paintingDetail = async () => {
onLoad((options) => {
state.id = options.id;
state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail()
});
const paintingDetail = async () => {
loading.value = true;
const res = await pbDetail({
id: state.id,
@ -90,7 +75,7 @@
state.drawThumbnail = res.data.drawThumbnail;
state.locateAddress = res.data.locateAddress;
state.boxUid = res.data.boxUid;
}
}
};
const doneSet = async () => {
@ -98,76 +83,77 @@ const doneSet = async () => {
const res = await outbound({
id: state.id,
pid: state.pid,
boxUid:state.boxUid,
boxUid: state.boxUid,
});
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;
};
</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;
}
.content {
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;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: 100%;
width: 98%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: 100%;
width: 98%;
display: flex;
flex-direction: column;
margin-top: 60rpx;
padding: 40rpx;
box-sizing: border-box;
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="margin-top: 40rpx"> 请放入 </span>
<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>
<span style="
<span
style="
color: #cf3050;
font-size: 24px;
text-align: center;
margin-top: 20rpx;
">
"
>
{{ state.boxName }}
</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 class="button-container">
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" 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>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA"
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>
</template>
@ -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 });
}
}
};
</script>
<style lang="scss" scoped>

View File

@ -32,14 +32,14 @@ const request = new Request({
// response.config.headers["Authorization"] = response.data.data.Token;
// }
if (response.data.code === 401) {
uni.clearStorageSync()//清缓存
const params = new URLSearchParams(window.location.search)//属性包含当前 URL 的查询字符串部分
const id = params.get('id')
const pid = params.get('pid')
uni.clearStorageSync(); //清缓存
const params = new URLSearchParams(window.location.search); //属性包含当前 URL 的查询字符串部分
const id = params.get("id");
const pid = params.get("pid");
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)) {
return response.config.responseType === "blob" ? response : response;