|
@@ -58,6 +58,7 @@ const CHAR_MAP: Record<string, Record<string, string>> = {
|
|
|
const MARKET_TYPE_ORDER = ['2', '1', '0'];
|
|
const MARKET_TYPE_ORDER = ['2', '1', '0'];
|
|
|
|
|
|
|
|
const clients = ref<SyncClient[]>([]);
|
|
const clients = ref<SyncClient[]>([]);
|
|
|
|
|
+const latestClientVersion = ref('');
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
const autoRefresh = ref(true);
|
|
const autoRefresh = ref(true);
|
|
|
const editClient = ref<SyncClient>();
|
|
const editClient = ref<SyncClient>();
|
|
@@ -147,6 +148,10 @@ const displayMappedValue = (
|
|
|
return CHAR_MAP[type]?.[String(value)] ?? value;
|
|
return CHAR_MAP[type]?.[String(value)] ?? value;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const isClientVersionOutdated = (version?: string) => {
|
|
|
|
|
+ return !!version && !!latestClientVersion.value && version !== latestClientVersion.value;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const getDeviceUrl = (deviceId?: number) => {
|
|
const getDeviceUrl = (deviceId?: number) => {
|
|
|
if (!Number.isInteger(deviceId)) {
|
|
if (!Number.isInteger(deviceId)) {
|
|
|
return '';
|
|
return '';
|
|
@@ -375,6 +380,20 @@ const fetchClients = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const fetchLatestClientVersion = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await fetch('https://bwh.841024.xyz/chrome_update/versions?names=events_sync');
|
|
|
|
|
+ const data = await response.json();
|
|
|
|
|
+ const version = data?.data?.[0];
|
|
|
|
|
+ if (data?.state === 1 && typeof version === 'string') {
|
|
|
|
|
+ latestClientVersion.value = version;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (error) {
|
|
|
|
|
+ console.error('Failed to fetch latest client version:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const openEditClient = (client: SyncClientRow) => {
|
|
const openEditClient = (client: SyncClientRow) => {
|
|
|
editClient.value = client;
|
|
editClient.value = client;
|
|
|
editDeviceId.value = client.deviceId;
|
|
editDeviceId.value = client.deviceId;
|
|
@@ -426,6 +445,7 @@ const handleAutoRefreshChange = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ fetchLatestClientVersion();
|
|
|
fetchClients();
|
|
fetchClients();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -468,7 +488,11 @@ onUnmounted(() => {
|
|
|
{{ isOnline(record.lastRequestTime) ? '在线' : '离线' }}
|
|
{{ isOnline(record.lastRequestTime) ? '在线' : '离线' }}
|
|
|
</Tag>
|
|
</Tag>
|
|
|
<span>{{ record.title }}</span>
|
|
<span>{{ record.title }}</span>
|
|
|
- <span v-if="record.rowType === 'client' && record.version" class="version-text">
|
|
|
|
|
|
|
+ <span
|
|
|
|
|
+ v-if="record.rowType === 'client' && record.version"
|
|
|
|
|
+ class="version-text"
|
|
|
|
|
+ :class="{ outdated: isClientVersionOutdated(record.version) }"
|
|
|
|
|
+ >
|
|
|
{{ record.version }}
|
|
{{ record.version }}
|
|
|
</span>
|
|
</span>
|
|
|
<span v-if="record.rowType !== 'client'" class="group-count">
|
|
<span v-if="record.rowType !== 'client'" class="group-count">
|
|
@@ -563,6 +587,10 @@ onUnmounted(() => {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.version-text.outdated {
|
|
|
|
|
+ color: #fa8c16;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.device-link {
|
|
.device-link {
|
|
|
display: inline-flex;
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
align-items: center;
|