main
zouyanyan 8 months ago
parent 42084bb341
commit ec90555905

@ -1,13 +1,25 @@
<template>
<view class="easy-scancode" v-if="show">
<view id="reader"></view>
<!-- 装饰区域 -->
<view class="scan-mask">
<view class="scan-box">
<view class="line"></view>
<view class="corner top-left"></view>
<view class="corner top-right"></view>
<view class="corner bottom-left"></view>
<view class="corner bottom-right"></view>
</view>
</view>
<!-- 扫码提示区域 -->
<view class="scan-tip-overlay">
<view class="scan-tip"> 请将二维码放入框内 </view>
</view>
<view class="scan-back">
<button class="action-btn" @tap="stop">返回</button>
</view>
<!-- 扫码提示区域 -->
<view class="scan-tip-overlay">
<view class="scan-tip"> 请将二维码放入框内 </view>
</view>
</view>
</template>
@ -22,7 +34,7 @@ export default {
fail: () => {},
},
show: false,
html5QrCode: null,
html5QrCode: null
};
},
methods: {
@ -94,16 +106,13 @@ export default {
// console.log(devices)
that.html5QrCode = new Html5Qrcode("reader");
let windowInfo = uni.getWindowInfo();
// console.log(windowInfo);
let windowInfo = uni.getWindowInfo();
const width = windowInfo&&windowInfo.windowWidth?windowInfo.windowWidth:375;
const height = windowInfo&&windowInfo.windowHeight?windowInfo.windowHeight:720;
const height = windowInfo&&windowInfo.windowHeight?windowInfo.windowHeight:720;
// 横屏
const aspectRatio = width / height;
// 竖屏
const reverseAspectRatio = height / width;
const mobileAspectRatio =
reverseAspectRatio > 1.5
? reverseAspectRatio + (reverseAspectRatio * 12) / 100
@ -116,10 +125,15 @@ export default {
} else {
cameraId = devices[0].id;
}
// 计算二维码扫描框大小 - 使用宽度/高度中较小的值来确保方框适合屏幕
// 并在扫描区域周围留出一些边距
// 计算二维码扫描框大小 - 使用宽度/高度中较小的值来确保方框适合屏幕
// 并在扫描区域周围留出一些边距
const qrboxSize = Math.min(width, height) * 0.7;
console.log(qrboxSize);
console.log(aspectRatio);
console.log(width,mobileAspectRatio);
that.$forceUpdate();
// 使用这个来开始扫描
that.html5QrCode
.start(
@ -127,18 +141,32 @@ export default {
facingMode: "environment",
},
{
fps: 10, // 可选,二维码扫描的每秒帧数
aspectRatio: aspectRatio,
qrbox: { width: qrboxSize, height: qrboxSize }, // 可选,如果你想要边界框UI
videoConstraints: {
facingMode: "environment",
aspectRatio: width < 600 ? mobileAspectRatio : aspectRatio,
},
autofocus:true, //自动对焦 但使用的时候没有体会到
colorDark: '#0000ff', //加深二维码黑色部分的颜色提高识别度
colorLight: '#ffffff',//这个应该是提高非黑即白部分的亮度 提高识别度
visualFeedback:true, //开启视觉反馈 没有体会到
halfSample:true,//缩小二维码提高识别精度吧
fps: 10, // 可选,二维码扫描的每秒帧数
aspectRatio: aspectRatio,
qrbox: { width: qrboxSize, height: qrboxSize }, // 可选,如果你想要边界框UI
videoConstraints: {
facingMode: "environment",
aspectRatio: width < 600 ? mobileAspectRatio : aspectRatio,
},
// fps: 15, // 帧率:平衡性能与流畅度
// aspectRatio: 1.0, // 1:1比例,更适合二维码
// qrbox: {
// width: 280,
// height: 280
// }, // 扫描框尺寸
// videoConstraints: {
// focusMode: "continuous", // 尝试启用连续对焦
// width: { ideal: 1280 }, // 理想分辨率
// height: { ideal: 720 },
// frameRate: { ideal: 30 }
// },
// disableFlip: false, // 允许图像翻转检测
// rememberLastUsedCamera: true, // 记住上次使用的摄像头
// showTorchButtonIfSupported: true,
// showZoomSliderIfSupported: true,
// defaultZoomValueIfSupported: 2,
// // 高级配置
},
(decodedText, decodedResult) => {
// 当码被读取时执行操作
@ -180,15 +208,14 @@ export default {
z-index: 1000;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.4);
}
#reader {
top: 50%;
left: 0;
transform: translateY(-50%);
width: 100vw;
height: 100vh;
position: relative;
}
.scan-tip-overlay {
@ -227,4 +254,80 @@ export default {
padding: 10px;
border-radius: 5px;
}
/* 装饰层 */
.scan-mask {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.3);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.scan-box {
position: relative;
width: 480rpx;
height: 480rpx;
box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4);
/* 形成中间镂空感 */
background: transparent;
}
.corner {
position: absolute;
width: 30rpx;
height: 30rpx;
border: 6rpx solid #ffffff;
}
.top-left {
top: 0;
left: 0;
border-right: none;
border-bottom: none;
}
.top-right {
top: 0;
right: 0;
border-left: none;
border-bottom: none;
}
.bottom-left {
bottom: 0;
left: 0;
border-right: none;
border-top: none;
}
.bottom-right {
bottom: 0;
right: 0;
border-left: none;
border-top: none;
}
.line {
position: absolute;
width: 100%;
height: 2px;
background: linear-gradient(to right, transparent, #ffffff, transparent);
animation: scanMove 2s infinite linear;
}
@keyframes scanMove {
0% {
top: 0;
}
100% {
top: 100%;
}
}
</style>

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuapx5FMYvAIoG
7suhSGoUFiACFmAiCGCrmL1cg9CCtPODAMF+JumfGyzusDj03qZitUa5/VFkeB3P
RWjeoX51i1KmMeXcg/qyRWS1x84U/XpuhdcQDUm0R7wmNhlEOVsZqmxwfCuODAPA
sEaJOgkerSSEXtXWG/M/eyxWWk3z4WMyVweLGziGzuQ6kT/zWg2hU6befpUC2GO0
5Fo0rFWzIdy0V95oGk6WkAZY8O/G1dVjheAl91MUbcdOYEvX5+h63N2WrtP+gtBa
CN383/HJvVk+9Duao342x85X6rKvmAfdqLIQRJ61ntropVYH7/CW6RcZqOMjlE6B
ZvmYCszvAgMBAAECggEAJmgzQ8gmcvztv1cpo5Y0TH8R8fQj0WezFwGYg7ZSWTQI
RHLTONzQ5sosb1khG8VgXWdheOXHfl1hQ/ok/jRa2Fm020QPiPoT4TMPmb8Rwkzh
M7vI3POfC3VA6JDveg+ZTuWm6Wn/ZDcoRZrACiw4uuHej5ptbTv8cB4KEvEiPKaj
Qk3MevmSMaOloAhLyXH9fV1kB5gcQiwOQy1eNw/XKQuFI3CW4kCcyE8dAlkDcY+L
dDP9uLypzGcHBK9o1v4BpCwGQmVVcbNs3BdmXSTR7z6ZlsHLVkcI+wbD4G2iUpWD
cW18FCk8T1HNFdHf3OOq12b+deYynkhf9TdX6Ye4BQKBgQD9Xvqx2oW3G14Erb+x
Nff6kF1uWqDOwJR4igkzNZ8lP6u/dyQ626VFWuA2o1GYEu/Zwr1yMGJxGfrI1bBU
Zx5PD0EVW/m53BOFt9QMwMVCWNsm+aIBUzqOCnd9CUfIy3Jo2RLQ8JzdfqMFHd1J
7g1HSEt1SzfhF5ho/WYBUGII2wKBgQDw4+idl1DwlI66e37EP+d9TQ05AzbaiRxf
F5yq3AkrubQ1lc+kygX6h06kKSPgQSTrLon+CU9sScsdIMoeG03n+uYnJpRGIch/
ws068Y+Yj62LpypWTt6MMkjy0ctgs7DjzJw+j3fUNj3REqqFTJZrZlvTa7YQ+/Go
ccYkA7mOfQKBgAin+Qqge5cA4VppkTX9sQYnbnm5sOq/W5MurBfKyjAcl8KH0H4O
SPwwmZ5kQAJhCz62T4CaNJLGn3HDEy4fA8MRs1iGduappSUZXa49279jh8EyIB3J
eSOnKePksEYk5Ti9yc3HmqRakjk3hvriniOETcepFTSkeLmFhrmexGqnAoGADsas
Gh6SBG/YYW/50qfo1zLGwNyFnNoUN3EHVyOwHFKDz1WlKwKJY1ixZjhvzu2wCg0M
wdxoVsggAWVlgHtESBqHy5b+OV8RIWUdmaP/nugRSSOz4R9tX0QmXV6pDwF2tEJ0
wxGh1A6PtCdk9lBAWc4pi8prnJcXt7Fi6gqgczECgYEAgCE/87+aUsb374IU3Ta3
fKVkMSRO2JgONdskBwm72fdQBcnJMjcJQlbE3rClxznDoWVSLkL0w9Xc5gdYEPX+
EmJrWUXq66arEA35J00Gu1lQPlNmPWb2Gq+WneHkRsSTJElpi6gSqQWRYEQTbIYt
SQuJZof0xt8gUYLPF8jJRTY=
-----END PRIVATE KEY-----

@ -203,24 +203,11 @@
"landscape-primary",
"landscape-secondary"
],
"h5" : {},
// "title" : "工装托盘管理",
// "template" : "template.h5.html",
// // h5跨域配置
// "devServer" : {
// "port" : 8080,
// "disableHostCheck" : true, //禁用 Host 检查
// "proxy" : {
// "/api" : {
// "target" :"http://pallet.dsic.cn", // "http://tpapp.runpengsoft.com",
// "changeOrigin" : true,
// "secure" : false,
// "pathRewrite" : {
// "^/api" : ""
// }
// }
// }
// }
"h5" : {
// "devServer" : {
// "https" : true
// }
},
// "h5" : {
// "title" : "工装托盘管理",
// "template" : "template.h5.html",

@ -1043,7 +1043,7 @@ export default {
// 配送地址requireAddress
this.itemList.requireAddress=firstpallet?firstpallet.requireAddress:'';
// 联系人(联系人requireName+‘ ‘+联系电话requirePhone)
this.itemList.requireName=firstpallet?firstpallet.requireName:''+' '+firstpallet?firstpallet.requirePhone:'';
this.itemList.requireName=firstpallet&&firstpallet.requireName?firstpallet.requireName:''+' '+firstpallet&&firstpallet.requirePhone?firstpallet.requirePhone:'';
// 配送日期deliveryDate
this.itemList.deliveryDate=firstpallet?firstpallet.deliveryDate:'';
// 配送车辆deliveryCar

Loading…
Cancel
Save