nfc提交绑定和设备操作

This commit is contained in:
WindowBird 2025-11-25 14:46:15 +08:00
parent ed8e49f4d6
commit 60529f5d84
2 changed files with 22 additions and 12 deletions

View File

@ -98,12 +98,22 @@
<!-- <text class="label">绑定单元 ID</text>--> <!-- <text class="label">绑定单元 ID</text>-->
<!-- <text class="unit-value">{{ unitId }}</text>--> <!-- <text class="unit-value">{{ unitId }}</text>-->
<!-- </view>--> <!-- </view>-->
<view style="display: flex; gap: 10px">
<view <view
:class="['primary-btn', { disabled: !canSubmit || binding }]" :class="['primary-btn', { disabled: !canSubmit || binding }]"
@click="handleBind" style="flex: 1"
> @click="handleBind"
{{ binding ? "提交中..." : "提交绑定" }} >
{{ binding ? "提交中..." : "提交绑定" }}
</view>
<view
v-if="cardNo"
:class="['primary-btn']"
style="flex: 1"
@click="reportSwipeCard(cardNo)"
>
设备操作
</view>
</view> </view>
</view> </view>
</view> </view>
@ -642,6 +652,7 @@ export default {
async handleBind() { async handleBind() {
if (!this.canSubmit || this.binding) return; if (!this.canSubmit || this.binding) return;
this.binding = true; this.binding = true;
uni.showLoading({ title: "提交中...", mask: true }); uni.showLoading({ title: "提交中...", mask: true });
try { try {
const payload = { const payload = {
@ -846,7 +857,7 @@ export default {
// duration: 1500, // duration: 1500,
// }); // });
console.log("NFC 读取到的卡号:", cardNo); console.log("NFC 读取到的卡号:", cardNo);
this.reportSwipeCard(cardNo); // this.reportSwipeCard(cardNo);
} else { } else {
console.warn("无法从 NFC 标签中提取卡号:", res); console.warn("无法从 NFC 标签中提取卡号:", res);
uni.showToast({ uni.showToast({
@ -896,10 +907,9 @@ export default {
}); });
}, },
async reportSwipeCard(cardNo) { async reportSwipeCard(cardNo) {
return; if (!cardNo || this.reportingSwipe) {
// if (!cardNo || this.reportingSwipe) { return;
// return; }
// }
this.reportingSwipe = true; this.reportingSwipe = true;
uni.showLoading({ uni.showLoading({
title: "处理中...", title: "处理中...",

View File

@ -6,7 +6,7 @@ import debounce from "uview-ui/libs/function/debounce";
const ENV_CONFIG = { const ENV_CONFIG = {
release: { release: {
// 正式版 // 正式版
// baseUrl: "http://192.168.1.4:4501", // baseUrl: "http://192.168.1.2:4501",
baseUrl: "https://tech-ape.top/prod-api", baseUrl: "https://tech-ape.top/prod-api",
// baseUrl: "https://tech-ape.top/prod-api", // baseUrl: "https://tech-ape.top/prod-api",
appId: 1, appId: 1,