update:修复bug
This commit is contained in:
@@ -22,8 +22,8 @@ import {
|
||||
import { useOtaUpdate } from "@/composables/useOtaUpdate";
|
||||
|
||||
const store = useStore();
|
||||
const { updateDevice, clearDevice } = store;
|
||||
const { user, device, deviceStatus, online } = storeToRefs(store);
|
||||
const { updateDevice, updateDeviceUsageDuration, clearDevice } = store;
|
||||
const { user, device, deviceStatus, deviceUsageDuration, online } = storeToRefs(store);
|
||||
const DEVICE_NAME_MAX_LENGTH = 10;
|
||||
|
||||
const formatBindingDate = (value) => {
|
||||
@@ -97,8 +97,10 @@ const {
|
||||
user,
|
||||
device,
|
||||
deviceStatus,
|
||||
deviceUsageDuration,
|
||||
online,
|
||||
updateDevice,
|
||||
updateDeviceUsageDuration,
|
||||
clearDevice,
|
||||
unbindDialogVisible,
|
||||
});
|
||||
@@ -112,6 +114,28 @@ const bindingDateText = computed(() =>
|
||||
formatBindingDate(deviceDetails.value.bindTime)
|
||||
);
|
||||
|
||||
// 固件版本统一以大写 V 开头,避免接口返回格式不一致影响弹窗展示。
|
||||
const formatFirmwareVersion = (value) => {
|
||||
const version = String(value ?? "").trim();
|
||||
if (!version) return "";
|
||||
return /^v/i.test(version) ? `V${version.slice(1)}` : `V${version}`;
|
||||
};
|
||||
|
||||
const firmwareConfirmContent = computed(() => {
|
||||
const currentVersion = formatFirmwareVersion(deviceStatus.value.version);
|
||||
const latestVersion = formatFirmwareVersion(
|
||||
pendingOtaInfo.value?.versionNumber
|
||||
);
|
||||
|
||||
if (currentVersion && latestVersion) {
|
||||
return `当前固件版本为 ${currentVersion},发现新固件版本 ${latestVersion},是否立即更新固件?`;
|
||||
}
|
||||
if (latestVersion) {
|
||||
return `发现新固件版本 ${latestVersion},是否立即更新固件?`;
|
||||
}
|
||||
return "发现新固件版本,是否立即更新固件?";
|
||||
});
|
||||
|
||||
const deviceIdText = computed(() =>
|
||||
showDeviceId.value && device.value.deviceName
|
||||
? device.value.deviceName
|
||||
@@ -519,7 +543,7 @@ onShow(async () => {
|
||||
class="device-bow"
|
||||
:class="{ 'device-bow--online': isDeviceOnline }"
|
||||
:src="isDeviceOnline
|
||||
? 'https://static.shelingxingqiu.com/shootmini/static/home-device/device-bow--online.png'
|
||||
? 'https://static.shelingxingqiu.com/shootmini/static/home-device/device-bow.png'
|
||||
: 'https://static.shelingxingqiu.com/shootmini/static/home-device/device-bow.png'"
|
||||
:mode="isDeviceOnline ? 'aspectFit' : 'widthFix'"
|
||||
/>
|
||||
@@ -697,9 +721,9 @@ onShow(async () => {
|
||||
<ModalDialog
|
||||
:show="firmwareConfirmVisible"
|
||||
title="固件更新"
|
||||
content="是否现在进行固件更新?"
|
||||
cancelText="取消"
|
||||
confirmText="确定"
|
||||
:content="firmwareConfirmContent"
|
||||
cancelText="暂不更新"
|
||||
confirmText="立即更新"
|
||||
:onCancel="closeFirmwareConfirm"
|
||||
:onConfirm="confirmFirmwareUpdate"
|
||||
></ModalDialog>
|
||||
@@ -975,7 +999,7 @@ onShow(async () => {
|
||||
|
||||
.device-bow {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -2rpx;
|
||||
left: 50%;
|
||||
z-index: 4;
|
||||
width: 562rpx;
|
||||
|
||||
Reference in New Issue
Block a user