zhangjie vor 2 Wochen
Ursprung
Commit
aec7cf1f15
3 geänderte Dateien mit 47 neuen und 12 gelöschten Zeilen
  1. 1 1
      index.html
  2. 1 1
      src/store/modules/app/index.ts
  3. 45 10
      src/views/base/track-export/modifySet.vue

+ 1 - 1
index.html

@@ -7,7 +7,7 @@
   <meta http-equiv="Content-Security-Policy"
     content="script-src 'self'; style-src 'self' 'unsafe-inline';" />
   <title>
-    知学知考-图片导出工具-1.0.5
+    知学知考-图片导出工具-1.0.6
   </title>
 </head>
 

+ 1 - 1
src/store/modules/app/index.ts

@@ -3,7 +3,7 @@ import { AppState } from './types';
 
 const useAppStore = defineStore('app', {
   state: (): AppState => ({
-    version: '1.0.5',
+    version: '1.0.6',
     domain: '',
     device: 'desktop',
     trackConfig: {

+ 45 - 10
src/views/base/track-export/modifySet.vue

@@ -60,16 +60,26 @@
         </a-radio-group>
       </a-form-item>
       <a-form-item field="watermarkElements" label="水印元素">
-        <a-checkbox-group
-          v-model="formData.watermarkElements"
-          direction="vertical"
-        >
-          <template v-for="(option, index) in watermarkOptions" :key="index">
-            <a-checkbox :value="option.value">
-              {{ option.label }}
-            </a-checkbox>
-          </template>
-        </a-checkbox-group>
+        <a-space direction="vertical">
+          <a-checkbox
+            v-model="checkedAll"
+            :indeterminate="indeterminate"
+            @change="handleChangeAll"
+          >
+            全选
+          </a-checkbox>
+
+          <a-checkbox-group
+            v-model="formData.watermarkElements"
+            @change="handleChange"
+          >
+            <template v-for="(option, index) in watermarkOptions" :key="index">
+              <a-checkbox :value="option.value">
+                {{ option.label }}
+              </a-checkbox>
+            </template>
+          </a-checkbox-group>
+        </a-space>
       </a-form-item>
     </a-form>
 
@@ -162,6 +172,31 @@
     ],
   };
 
+  const indeterminate = ref(false);
+  const checkedAll = ref(false);
+  const handleChangeAll = () => {
+    indeterminate.value = false;
+    if (checkedAll.value) {
+      formData.watermarkElements = watermarkOptions.value.map(
+        (item) => item.value
+      ) as WatermarkElementTypeEnum[];
+    } else {
+      formData.watermarkElements = [];
+    }
+  };
+  const handleChange = () => {
+    if (formData.watermarkElements.length === watermarkOptions.value.length) {
+      checkedAll.value = true;
+      indeterminate.value = false;
+    } else if (formData.watermarkElements.length === 0) {
+      checkedAll.value = false;
+      indeterminate.value = false;
+    } else {
+      checkedAll.value = false;
+      indeterminate.value = true;
+    }
+  };
+
   async function toSelectDir() {
     const result = await window.electron.dialogSelectFile({
       title: '选择保存目录',