Просмотр исходного кода

feat(steam账号管理): 移除列表删除按钮后的等待时间提示

Made-with: Cursor
wuzilong 6 месяцев назад
Родитель
Сommit
dc6699ec73

+ 19 - 2
client-tauri/src/views/BuffSelectionView.vue

@@ -499,8 +499,20 @@
             :row-selection="{
               selectedRowKeys: Array.from(selectedBoundSteamUsernames),
               onChange: (keys: string[]) => {
-                selectedBoundSteamUsernames.clear()
-                keys.forEach((k: string) => selectedBoundSteamUsernames.add(k))
+                const newKeys = new Set(keys)
+                // 找出新增的(勾选)和移除的(取消勾选)
+                const addedKeys = keys.filter((k: string) => !prevSelectedBoundSteamKeys.value.has(k))
+                const removedKeys = Array.from(prevSelectedBoundSteamKeys.value).filter(k => !newKeys.has(k))
+                // 更新选中状态
+                selectedBoundSteamUsernames.value = newKeys
+                prevSelectedBoundSteamKeys.value = newKeys
+                // 显示提示
+                if (addedKeys.length > 0) {
+                  message.success(`已勾选 ${addedKeys.length} 个账号`)
+                }
+                if (removedKeys.length > 0) {
+                  message.info(`已取消勾选 ${removedKeys.length} 个账号`)
+                }
               }
             }"
             size="small"
@@ -1562,6 +1574,9 @@ const boundSteamColumns = [
 /** 已绑定 Steam 账号勾选状态 */
 const selectedBoundSteamUsernames = ref<Set<string>>(new Set())
 
+/** 上一次已绑定 Steam 账号选中的 keys(用于对比勾选/取消勾选) */
+const prevSelectedBoundSteamKeys = ref<Set<string>>(new Set())
+
 /** 全部已绑定 Steam 账号是否已勾选 */
 const allBoundSteamSelected = computed(() => {
   if (boundSteamAccounts.value.length === 0) return false
@@ -1606,6 +1621,8 @@ function toggleSelectBoundSteam(username: string, checked: boolean) {
 function initSelectedBoundSteamAccounts() {
   selectedBoundSteamUsernames.value.clear()
   boundSteamAccounts.value.forEach(a => selectedBoundSteamUsernames.value.add(a.steam_username))
+  // 同步更新 prevSelectedBoundSteamKeys
+  prevSelectedBoundSteamKeys.value = new Set(selectedBoundSteamUsernames.value)
 }
 
 /** 配置中的排除/指定 id 可能为字符串或数组,统一为换行分隔字符串 */

+ 0 - 48
client-tauri/src/views/SteamBindView.vue

@@ -154,9 +154,6 @@
                   >
                     删除
                   </a-button>
-                  <a-tooltip v-if="account.isBound" :title="getDeleteTimeTip(account)">
-                    <span class="delete-hint">{{ getDeleteTimeText(account) }}</span>
-                  </a-tooltip>
                   <a-button
                     type="primary"
                     size="small"
@@ -332,44 +329,6 @@ function balanceDisplay(account: DisplayAccount): string {
   return `${b.currency === 'USD' ? '$' : b.currency + ' '}${dollars}`
 }
 
-/** 计算距离可删除还剩多少时间 */
-function getRemainingDeleteTime(account: SteamAccount): number {
-  if (!account.bound_at) return 0
-  const boundTime = new Date(account.bound_at).getTime()
-  const deleteHours = configStore.config.steam_account_delete_hours || 168
-  const allowedMs = deleteHours * 60 * 60 * 1000
-  const remaining = allowedMs - (Date.now() - boundTime)
-  return Math.max(0, remaining)
-}
-
-/** 获取删除时间提示文本(tooltip) */
-function getDeleteTimeTip(account: SteamAccount): string {
-  const remaining = getRemainingDeleteTime(account)
-  if (remaining <= 0) {
-    return '该账号已满足删除条件'
-  }
-  const hours = Math.floor(remaining / (60 * 60 * 1000))
-  const minutes = Math.floor((remaining % (60 * 60 * 1000)) / (60 * 1000))
-  if (hours > 0) {
-    return `绑定满 ${configStore.config.steam_account_delete_hours || 168} 小时后可删除,还需 ${hours} 小时 ${minutes} 分钟`
-  }
-  return `绑定满 ${configStore.config.steam_account_delete_hours || 168} 小时后可删除,还需 ${minutes} 分钟`
-}
-
-/** 获取删除时间简短文本(界面显示) */
-function getDeleteTimeText(account: SteamAccount): string {
-  const remaining = getRemainingDeleteTime(account)
-  if (remaining <= 0) {
-    return '可删除'
-  }
-  const hours = Math.floor(remaining / (60 * 60 * 1000))
-  const minutes = Math.floor((remaining % (60 * 60 * 1000)) / (60 * 1000))
-  if (hours > 0) {
-    return `需等 ${hours}h${minutes}m`
-  }
-  return `需等 ${minutes}m`
-}
-
 /** 切换账号是否美国账号属性 */
 async function handleToggleUsAccount(account: DisplayAccount, isUs: boolean) {
   try {
@@ -880,11 +839,4 @@ function handleConfirmDialog() {
 .help-content p {
   margin: 4px 0;
 }
-
-.delete-hint {
-  font-size: 12px;
-  color: #999;
-  margin-left: 4px;
-  cursor: help;
-}
 </style>

BIN
steam-client/steamAPI/bin/Debug/net8.0/SteamAuth.dll


BIN
steam-client/steamAPI/bin/Debug/net8.0/SteamAuth.pdb


BIN
steam-client/steamAPI/bin/Debug/net8.0/steamAPI.dll


BIN
steam-client/steamAPI/bin/Debug/net8.0/steamAPI.exe


BIN
steam-client/steamAPI/bin/Debug/net8.0/steamAPI.pdb


BIN
steam-client/steamAPI/obj/Debug/net8.0/apphost.exe


BIN
steam-client/steamAPI/obj/Debug/net8.0/ref/steamAPI.dll


BIN
steam-client/steamAPI/obj/Debug/net8.0/refint/steamAPI.dll


+ 1 - 1
steam-client/steamAPI/obj/Debug/net8.0/steamAPI.AssemblyInfo.cs

@@ -14,7 +14,7 @@ using System.Reflection;
 [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
 [assembly: System.Reflection.AssemblyDescriptionAttribute("Steam login verification local service")]
 [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1c4c8fe5a0532c35669acf21160663a5e7aebd97")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b9c1dfa3d8aa14e410d4ac861f990f1b48a4500")]
 [assembly: System.Reflection.AssemblyProductAttribute("steamAPI")]
 [assembly: System.Reflection.AssemblyTitleAttribute("steamAPI")]
 [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

+ 1 - 1
steam-client/steamAPI/obj/Debug/net8.0/steamAPI.AssemblyInfoInputs.cache

@@ -1 +1 @@
-af6d7129d986a6dbf2f156abd62a5f9159cd783574345eb2c02cc14495fe1a90
+09fc026ea2ef8bbce2485b82a78c3837ec90595718ba59b0f66cc58a9766cbeb

BIN
steam-client/steamAPI/obj/Debug/net8.0/steamAPI.csproj.AssemblyReference.cache


BIN
steam-client/steamAPI/obj/Debug/net8.0/steamAPI.dll


BIN
steam-client/steamAPI/obj/Debug/net8.0/steamAPI.pdb