@2kog/kacha 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -2
- package/bin/clone-project.js +88 -0
- package/bin/init-project.js +18 -26
- package/bin/kacha.js +23 -1
- package/bin/lfs-setup.js +75 -0
- package/bin/lfs-transfer.js +235 -0
- package/package.json +3 -1
- package/server/index.js +6 -0
- package/server/oss-collab-local.js +318 -0
- package/server/oss-collab-plan.js +270 -0
- package/server/oss-collab-remote.js +288 -0
- package/server/oss-sync-engine.js +434 -0
- package/server/project-brand.js +93 -2
- package/server/project-global.js +83 -0
- package/server/project-oss-sync.js +200 -0
- package/server/project-storage.js +164 -0
- package/skills/manage-assets/SKILL.md +11 -0
- package/skills/sync-jimeng-assets/SKILL.md +27 -0
- package/src/assets/css/workbench.css +227 -20
- package/src/components/AssetTagInput.vue +0 -2
- package/src/components/ProjectOssSync.vue +486 -0
- package/src/i18n/en.json +118 -0
- package/src/i18n/index.js +2 -5
- package/src/layouts/WorkbenchLayout.vue +277 -7
- package/src/main.js +1 -1
- package/src/service/jimeng.js +8 -0
- package/src/views/assets/AudioAssets.vue +12 -11
- package/src/views/assets/CharacterAssets.vue +122 -19
- package/src/views/assets/ImageAssets.vue +112 -30
- package/templates/project/.gitattributes +49 -0
- package/templates/project/AGENTS.md +10 -0
- package/templates/project/README.md +9 -1
- package/vite.config.js +1 -0
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { ElOption, ElSelect } from 'element-plus'
|
|
3
3
|
import 'element-plus/es/components/select/style/css'
|
|
4
|
-
import { AudioLines, BookOpen, Box, ChevronRight,
|
|
4
|
+
import { AudioLines, BookOpen, Box, ChevronRight, CircleAlert, CircleCheck, Layers3, LoaderCircle, Mountain, Plug, Settings, Users, X } from 'lucide-vue-next'
|
|
5
5
|
import projectBrand from 'virtual:project-brand'
|
|
6
6
|
import { language, languages } from '@/i18n/index.js'
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
components: { AudioLines, BookOpen, Box, ChevronRight,
|
|
9
|
+
components: { ElOption, ElSelect, AudioLines, BookOpen, Box, ChevronRight, CircleAlert, CircleCheck, Layers3, LoaderCircle, Mountain, Plug, Settings, Users, X },
|
|
10
10
|
props: { sections: { type: Array, required: true } },
|
|
11
11
|
data() {
|
|
12
12
|
return {
|
|
13
|
-
language,
|
|
14
13
|
languages,
|
|
14
|
+
logoFile: null,
|
|
15
|
+
logoPreview: '',
|
|
16
|
+
configSaving: false,
|
|
17
|
+
configTab: 'basics',
|
|
18
|
+
localeDraft: language.locale,
|
|
19
|
+
localeError: false,
|
|
20
|
+
storageLoading: false,
|
|
21
|
+
storageDraft: { endpoint: '', bucket: '', prefix: '', keyId: '', secret: '' },
|
|
22
|
+
storageStatus: { hasKeyId: false, hasSecret: false },
|
|
23
|
+
storageError: '',
|
|
24
|
+
storageTesting: false,
|
|
25
|
+
storageTestResult: null,
|
|
26
|
+
configError: false,
|
|
27
|
+
configDraft: { name: '', description: '' },
|
|
15
28
|
projectLogo: projectBrand.logo,
|
|
16
29
|
}
|
|
17
30
|
},
|
|
@@ -19,10 +32,153 @@ export default {
|
|
|
19
32
|
projectName() {
|
|
20
33
|
return projectBrand.name || this.$t('制作项目')
|
|
21
34
|
},
|
|
35
|
+
storageLfsTarget() {
|
|
36
|
+
const { bucket, prefix } = this.storageDraft
|
|
37
|
+
if (!bucket) return ''
|
|
38
|
+
const directory = prefix.trim().replace(/^\/+|\/+$/g, '')
|
|
39
|
+
return [bucket, directory, '__kacha_lfs__', 'objects'].filter(Boolean).join('/') + '/'
|
|
40
|
+
},
|
|
22
41
|
projectDescription() {
|
|
23
42
|
return projectBrand.description || this.$t('制作工作台')
|
|
24
43
|
},
|
|
25
44
|
},
|
|
45
|
+
methods: {
|
|
46
|
+
clearLogoDraft() {
|
|
47
|
+
if (this.logoPreview) URL.revokeObjectURL(this.logoPreview)
|
|
48
|
+
this.logoPreview = ''
|
|
49
|
+
this.logoFile = null
|
|
50
|
+
},
|
|
51
|
+
selectLogo(event) {
|
|
52
|
+
const file = event.target.files[0]
|
|
53
|
+
event.target.value = ''
|
|
54
|
+
if (!file) return
|
|
55
|
+
this.configError = false
|
|
56
|
+
if (!/\.(svg|png|webp|avif|jpg|jpeg|gif|ico|bmp)$/i.test(file.name) || file.size === 0 || file.size > 2 * 1024 * 1024) {
|
|
57
|
+
this.configError = '请选择 2 MB 以内的受支持图片'
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
this.clearLogoDraft()
|
|
61
|
+
this.logoFile = file
|
|
62
|
+
this.logoPreview = URL.createObjectURL(file)
|
|
63
|
+
},
|
|
64
|
+
async selectConfigTab(tab) {
|
|
65
|
+
if (tab === this.configTab) return
|
|
66
|
+
this.configTab = tab
|
|
67
|
+
if (tab !== 'storage') return
|
|
68
|
+
this.storageTestResult = null
|
|
69
|
+
this.storageLoading = true
|
|
70
|
+
this.storageError = ''
|
|
71
|
+
try {
|
|
72
|
+
const response = await fetch('/api/project-storage')
|
|
73
|
+
if (!response.ok) throw new Error()
|
|
74
|
+
const { endpoint, bucket, prefix, hasKeyId, hasSecret } = await response.json()
|
|
75
|
+
this.storageDraft = { endpoint, bucket, prefix: prefix || '', keyId: '', secret: '' }
|
|
76
|
+
this.storageStatus = { hasKeyId, hasSecret }
|
|
77
|
+
} catch {
|
|
78
|
+
this.storageError = '无法读取存储设置'
|
|
79
|
+
} finally {
|
|
80
|
+
this.storageLoading = false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
async saveProjectLocale() {
|
|
84
|
+
if (this.configSaving) return
|
|
85
|
+
this.configSaving = true
|
|
86
|
+
this.localeError = false
|
|
87
|
+
try {
|
|
88
|
+
const response = await fetch('/api/project-global', {
|
|
89
|
+
method: 'PUT',
|
|
90
|
+
headers: { 'Content-Type': 'application/json' },
|
|
91
|
+
body: JSON.stringify({ locale: this.localeDraft }),
|
|
92
|
+
})
|
|
93
|
+
if (!response.ok) throw new Error()
|
|
94
|
+
language.locale = this.localeDraft
|
|
95
|
+
this.$refs.projectConfig.close()
|
|
96
|
+
} catch {
|
|
97
|
+
this.localeError = true
|
|
98
|
+
} finally {
|
|
99
|
+
this.configSaving = false
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
async testProjectStorage() {
|
|
103
|
+
if (this.storageTesting || this.storageLoading || this.configSaving) return
|
|
104
|
+
this.storageTesting = true
|
|
105
|
+
this.storageTestResult = null
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetch('/api/project-storage/test', {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
headers: { 'Content-Type': 'application/json' },
|
|
110
|
+
})
|
|
111
|
+
const result = await response.json()
|
|
112
|
+
this.storageTestResult = { ...result, ok: response.ok }
|
|
113
|
+
} catch {
|
|
114
|
+
this.storageTestResult = { ok: false }
|
|
115
|
+
} finally {
|
|
116
|
+
this.storageTesting = false
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
async saveProjectStorage() {
|
|
120
|
+
if (this.configSaving || this.storageLoading || this.storageTesting) return
|
|
121
|
+
this.configSaving = true
|
|
122
|
+
this.storageError = ''
|
|
123
|
+
try {
|
|
124
|
+
const response = await fetch('/api/project-storage', {
|
|
125
|
+
method: 'PUT',
|
|
126
|
+
headers: { 'Content-Type': 'application/json' },
|
|
127
|
+
body: JSON.stringify(this.storageDraft),
|
|
128
|
+
})
|
|
129
|
+
if (!response.ok) {
|
|
130
|
+
this.storageError = response.status === 400 ? '请检查 OSS 地址、Bucket 和访问凭据' : '无法保存存储设置'
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
this.$refs.projectConfig.close()
|
|
134
|
+
} catch {
|
|
135
|
+
this.storageError = '无法保存存储设置'
|
|
136
|
+
} finally {
|
|
137
|
+
this.configSaving = false
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
closeProjectConfig() {
|
|
141
|
+
this.clearLogoDraft()
|
|
142
|
+
this.storageDraft.keyId = ''
|
|
143
|
+
this.storageDraft.secret = ''
|
|
144
|
+
},
|
|
145
|
+
openProjectConfig() {
|
|
146
|
+
this.configTab = 'basics'
|
|
147
|
+
this.localeDraft = language.locale
|
|
148
|
+
this.localeError = false
|
|
149
|
+
this.configDraft = { name: projectBrand.name, description: projectBrand.description }
|
|
150
|
+
this.configError = false
|
|
151
|
+
this.$refs.projectConfig.showModal()
|
|
152
|
+
},
|
|
153
|
+
async saveProjectConfig() {
|
|
154
|
+
if (this.configSaving) return
|
|
155
|
+
this.configSaving = true
|
|
156
|
+
this.configError = false
|
|
157
|
+
try {
|
|
158
|
+
const payload = { ...this.configDraft }
|
|
159
|
+
if (this.logoFile) {
|
|
160
|
+
const file = this.logoFile
|
|
161
|
+
const dataUrl = await new Promise((resolve, reject) => {
|
|
162
|
+
const reader = new FileReader()
|
|
163
|
+
reader.onload = () => resolve(reader.result)
|
|
164
|
+
reader.onerror = reject
|
|
165
|
+
reader.readAsDataURL(file)
|
|
166
|
+
})
|
|
167
|
+
payload.logo = { extension: file.name.split('.').pop().toLowerCase(), data: dataUrl.split(',')[1] }
|
|
168
|
+
}
|
|
169
|
+
const response = await fetch('/api/project-config', {
|
|
170
|
+
method: 'PUT',
|
|
171
|
+
headers: { 'Content-Type': 'application/json' },
|
|
172
|
+
body: JSON.stringify(payload),
|
|
173
|
+
})
|
|
174
|
+
if (!response.ok) throw new Error()
|
|
175
|
+
window.location.reload()
|
|
176
|
+
} catch {
|
|
177
|
+
this.configError = '无法保存项目设置'
|
|
178
|
+
this.configSaving = false
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
},
|
|
26
182
|
}
|
|
27
183
|
</script>
|
|
28
184
|
|
|
@@ -46,11 +202,125 @@ export default {
|
|
|
46
202
|
<span>{{ $t($route.meta.group) }}</span>
|
|
47
203
|
<ChevronRight :size="14" aria-hidden="true" />
|
|
48
204
|
<strong>{{ $t($route.meta.label) }}</strong>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
205
|
+
<div class="topbar-actions">
|
|
206
|
+
<button type="button" class="topbar-icon-button project-config-trigger" :aria-label="$t('全局设置')"
|
|
207
|
+
:title="$t('全局设置')" aria-haspopup="dialog" @click="openProjectConfig">
|
|
208
|
+
<Settings :size="17" aria-hidden="true" />
|
|
209
|
+
</button>
|
|
210
|
+
</div>
|
|
53
211
|
</header>
|
|
212
|
+
<dialog ref="projectConfig" class="dialog asset-detail-dialog project-config-dialog"
|
|
213
|
+
aria-labelledby="project-config-title" @close="closeProjectConfig"
|
|
214
|
+
@cancel.prevent="!configSaving && !storageTesting && $refs.projectConfig.close()">
|
|
215
|
+
<header class="dialog-head">
|
|
216
|
+
<h2 id="project-config-title">{{ $t('全局设置') }}</h2>
|
|
217
|
+
<button type="button" class="icon-button" :aria-label="$t('关闭')" :disabled="configSaving || storageTesting"
|
|
218
|
+
@click="$refs.projectConfig.close()"><X :size="20" /></button>
|
|
219
|
+
</header>
|
|
220
|
+
<div class="tabs" role="tablist">
|
|
221
|
+
<button id="project-basics-tab" type="button" role="tab" :class="{ current: configTab === 'basics' }"
|
|
222
|
+
:aria-selected="configTab === 'basics'" aria-controls="project-basics-panel" :disabled="configSaving || storageLoading || storageTesting"
|
|
223
|
+
@click="selectConfigTab('basics')">{{ $t('基本信息') }}</button>
|
|
224
|
+
<button id="project-storage-tab" type="button" role="tab" :class="{ current: configTab === 'storage' }"
|
|
225
|
+
:aria-selected="configTab === 'storage'" aria-controls="project-storage-panel" :disabled="configSaving || storageLoading || storageTesting"
|
|
226
|
+
@click="selectConfigTab('storage')">{{ $t('存储设置') }}</button>
|
|
227
|
+
<button id="project-other-tab" type="button" role="tab" :class="{ current: configTab === 'other' }"
|
|
228
|
+
:aria-selected="configTab === 'other'" aria-controls="project-other-panel" :disabled="configSaving || storageLoading || storageTesting"
|
|
229
|
+
@click="selectConfigTab('other')">{{ $t('其它设置') }}</button>
|
|
230
|
+
</div>
|
|
231
|
+
<div v-show="configTab === 'basics'" id="project-basics-panel" class="dialog-body" role="tabpanel" aria-labelledby="project-basics-tab">
|
|
232
|
+
<form id="project-config-form" class="project-config-form" @submit.prevent="saveProjectConfig">
|
|
233
|
+
<label class="field">
|
|
234
|
+
<span>{{ $t('项目名称') }}</span>
|
|
235
|
+
<input v-model="configDraft.name" :disabled="configSaving" />
|
|
236
|
+
</label>
|
|
237
|
+
<label class="field">
|
|
238
|
+
<span>{{ $t('项目描述') }}</span>
|
|
239
|
+
<input v-model="configDraft.description" :disabled="configSaving" />
|
|
240
|
+
</label>
|
|
241
|
+
<div class="field">
|
|
242
|
+
<span>{{ $t('项目 Logo') }}</span>
|
|
243
|
+
<div class="project-logo-field">
|
|
244
|
+
<span class="brand-icon">
|
|
245
|
+
<img v-if="logoPreview || projectLogo" :src="logoPreview || projectLogo" alt="" />
|
|
246
|
+
<span v-else class="brand-rabbit" aria-hidden="true"></span>
|
|
247
|
+
</span>
|
|
248
|
+
<label class="secondary upload">
|
|
249
|
+
{{ $t('更换 Logo') }}
|
|
250
|
+
<input type="file" accept=".svg,.png,.webp,.avif,.jpg,.jpeg,.gif,.ico,.bmp" :disabled="configSaving" @change="selectLogo" />
|
|
251
|
+
</label>
|
|
252
|
+
<span v-if="logoFile">{{ logoFile.name }}</span>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
<p v-if="configError" class="project-config-error" role="alert">{{ $t(configError) }}</p>
|
|
256
|
+
</form>
|
|
257
|
+
</div>
|
|
258
|
+
<div v-if="configTab === 'storage'" id="project-storage-panel" class="dialog-body" role="tabpanel" aria-labelledby="project-storage-tab">
|
|
259
|
+
<form id="project-storage-form" class="project-config-form" autocomplete="off" @submit.prevent="saveProjectStorage">
|
|
260
|
+
<div class="storage-lfs-target">
|
|
261
|
+
<strong>{{ $t('Git LFS 存储目标') }}</strong>
|
|
262
|
+
<p>{{ $t('Git LFS 使用这里保存的 OSS 配置直传和下载媒体。') }}</p>
|
|
263
|
+
<code v-if="!storageLoading && storageLfsTarget">{{ storageLfsTarget }}</code>
|
|
264
|
+
</div>
|
|
265
|
+
<label class="field">{{ $t('OSS 地址') }}
|
|
266
|
+
<input v-model.trim="storageDraft.endpoint" placeholder="oss-cn-hangzhou.aliyuncs.com" required :disabled="storageLoading || configSaving" />
|
|
267
|
+
</label>
|
|
268
|
+
<label class="field">{{ $t('Bucket 名称') }}
|
|
269
|
+
<input v-model.trim="storageDraft.bucket" required :disabled="storageLoading || configSaving" />
|
|
270
|
+
</label>
|
|
271
|
+
<label class="field">{{ $t('路径') }}
|
|
272
|
+
<input v-model.trim="storageDraft.prefix" :placeholder="$t('留空使用 Bucket 根目录')" :disabled="storageLoading || configSaving" />
|
|
273
|
+
</label>
|
|
274
|
+
<label class="field">AccessKey ID
|
|
275
|
+
<input v-model.trim="storageDraft.keyId" :placeholder="storageStatus.hasKeyId ? $t('已配置,留空保留') : ''"
|
|
276
|
+
:required="!storageStatus.hasKeyId" :disabled="storageLoading || configSaving" />
|
|
277
|
+
</label>
|
|
278
|
+
<label class="field">AccessKey Secret
|
|
279
|
+
<input v-model.trim="storageDraft.secret" type="password" autocomplete="new-password"
|
|
280
|
+
:placeholder="storageStatus.hasSecret ? $t('已配置,留空保留') : ''"
|
|
281
|
+
:required="!storageStatus.hasSecret" :disabled="storageLoading || configSaving" />
|
|
282
|
+
</label>
|
|
283
|
+
<div v-if="storageTestResult" class="storage-test-result"
|
|
284
|
+
:class="{ 'is-success': storageTestResult.ok }" role="status">
|
|
285
|
+
<component :is="storageTestResult.ok ? 'CircleCheck' : 'CircleAlert'" :size="18" aria-hidden="true" />
|
|
286
|
+
<div class="storage-test-detail">
|
|
287
|
+
<p>
|
|
288
|
+
{{ $t(storageTestResult.ok ? '上传成功,读回内容一致。' : ({
|
|
289
|
+
config: '无法使用已保存的 OSS 配置,请检查设置。',
|
|
290
|
+
upload: 'OSS 测试文件上传失败。',
|
|
291
|
+
read: '测试文件已上传,但无法读回。',
|
|
292
|
+
verify: '读回内容与测试文件不一致。',
|
|
293
|
+
}[storageTestResult.step] || '测试连接失败。')) }}
|
|
294
|
+
<span v-if="storageTestResult.status">(HTTP {{ storageTestResult.status }})</span>
|
|
295
|
+
</p>
|
|
296
|
+
<code v-if="storageTestResult.object">{{ storageTestResult.bucket ? storageTestResult.bucket + '/' : '' }}{{ storageTestResult.object }}</code>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
<p v-if="storageError" class="project-config-error" role="alert">{{ $t(storageError) }}</p>
|
|
300
|
+
</form>
|
|
301
|
+
</div>
|
|
302
|
+
<div v-if="configTab === 'other'" id="project-other-panel" class="dialog-body" role="tabpanel" aria-labelledby="project-other-tab">
|
|
303
|
+
<form id="project-other-form" class="project-config-form" @submit.prevent="saveProjectLocale">
|
|
304
|
+
<div class="field">
|
|
305
|
+
<label for="project-locale">{{ $t('语言') }}</label>
|
|
306
|
+
<ElSelect id="project-locale" v-model="localeDraft" :teleported="false" :disabled="configSaving">
|
|
307
|
+
<ElOption v-for="(label, locale) in languages" :key="locale" :value="locale" :label="label" :lang="locale" />
|
|
308
|
+
</ElSelect>
|
|
309
|
+
</div>
|
|
310
|
+
<p v-if="localeError" class="project-config-error" role="alert">{{ $t('无法保存语言设置') }}</p>
|
|
311
|
+
</form>
|
|
312
|
+
</div>
|
|
313
|
+
<footer class="dialog-footer">
|
|
314
|
+
<button v-if="configTab === 'storage'" type="button" class="secondary storage-test-button"
|
|
315
|
+
:disabled="configSaving || storageLoading || storageTesting" @click="testProjectStorage">
|
|
316
|
+
<LoaderCircle v-if="storageTesting" class="storage-test-spinner" :size="16" aria-hidden="true" />
|
|
317
|
+
<Plug v-else :size="16" aria-hidden="true" />
|
|
318
|
+
{{ $t(storageTesting ? '正在测试…' : '测试连接') }}
|
|
319
|
+
</button>
|
|
320
|
+
<button type="button" class="secondary" :disabled="configSaving || storageTesting" @click="$refs.projectConfig.close()">{{ $t('取消') }}</button>
|
|
321
|
+
<button :form="configTab === 'basics' ? 'project-config-form' : 'project-' + configTab + '-form'" type="submit" class="primary" :disabled="configSaving || storageLoading || storageTesting">{{ $t('保存') }}</button>
|
|
322
|
+
</footer>
|
|
323
|
+
</dialog>
|
|
54
324
|
<RouterView v-slot="{ Component, route }">
|
|
55
325
|
<KeepAlive include="CharacterAssets">
|
|
56
326
|
<component :is="Component" :key="route.name" />
|
package/src/main.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import projectGlobal from 'virtual:project-global'
|
|
2
|
+
|
|
3
|
+
export function jimengSyncUrl(kind, assets, instruction) {
|
|
4
|
+
const paths = assets.map(({ id }) => 'assets/' + kind + '/' + id.split('\\').join('/'))
|
|
5
|
+
const prompt = [instruction, '资产路径(相对于项目根目录):', ...paths].join('\n')
|
|
6
|
+
const params = new URLSearchParams({ mode: 'codex', path: projectGlobal.projectRoot, prompt })
|
|
7
|
+
return 'codex://threads/new?' + params
|
|
8
|
+
}
|
|
@@ -201,7 +201,7 @@ export default {
|
|
|
201
201
|
</div>
|
|
202
202
|
|
|
203
203
|
<dialog ref="create" class="dialog small-dialog" @close="create = null" @cancel.prevent="!busy && $refs.create.close()">
|
|
204
|
-
<form v-if="create" @submit.prevent="createAudio">
|
|
204
|
+
<form class="dialog-form" v-if="create" @submit.prevent="createAudio">
|
|
205
205
|
<header class="dialog-head">
|
|
206
206
|
<h2>{{ $t('新建音频') }}</h2>
|
|
207
207
|
<button type="button" class="icon-button" :aria-label="$t('关闭')" :disabled="busy" @click="$refs.create.close()"><X :size="20" /></button>
|
|
@@ -212,14 +212,15 @@ export default {
|
|
|
212
212
|
<ElInput id="create-audio-name" v-model="create.name" required autofocus :disabled="busy" />
|
|
213
213
|
</div>
|
|
214
214
|
<p v-if="error" class="error" role="alert">{{ error }}</p>
|
|
215
|
-
<div class="dialog-actions create-actions">
|
|
216
|
-
<button class="primary" :disabled="busy">{{ $t('创建音频') }}</button>
|
|
217
|
-
</div>
|
|
218
215
|
</div>
|
|
216
|
+
<footer class="dialog-footer">
|
|
217
|
+
<button type="button" class="secondary" :disabled="busy" @click="$refs.create.close()">{{ $t('取消') }}</button>
|
|
218
|
+
<button type="submit" class="primary" :disabled="busy">{{ $t('创建音频') }}</button>
|
|
219
|
+
</footer>
|
|
219
220
|
</form>
|
|
220
221
|
</dialog>
|
|
221
222
|
|
|
222
|
-
<dialog ref="dialog" class="dialog" @close="close"
|
|
223
|
+
<dialog ref="dialog" class="dialog audio-detail-dialog" @close="close"
|
|
223
224
|
@cancel.prevent="!busy && !$event.currentTarget.querySelector('.asset-delete-message') && $refs.dialog.close()">
|
|
224
225
|
<header class="dialog-head">
|
|
225
226
|
<h2>{{ active?.name }}</h2>
|
|
@@ -228,7 +229,7 @@ export default {
|
|
|
228
229
|
<div class="dialog-body">
|
|
229
230
|
<p v-if="error" class="error" role="alert">{{ error }}</p>
|
|
230
231
|
<template v-if="active">
|
|
231
|
-
<form class="edit-form" @submit.prevent="submitOverview('PATCH', overview)">
|
|
232
|
+
<form id="audio-overview-form" class="edit-form" @submit.prevent="submitOverview('PATCH', overview)">
|
|
232
233
|
<div class="audio-field">
|
|
233
234
|
<label for="audio-name">{{ $t('名称') }}</label>
|
|
234
235
|
<ElInput id="audio-name" v-model="overview.name" required :disabled="busy" />
|
|
@@ -273,13 +274,14 @@ export default {
|
|
|
273
274
|
</section>
|
|
274
275
|
</details>
|
|
275
276
|
|
|
276
|
-
<div class="dialog-actions overview-actions">
|
|
277
|
-
<AssetDeleteButton :asset-name="active.name" :busy="busy" @confirm="submitOverview('DELETE', {})" />
|
|
278
|
-
<button class="primary overview-save-button" :disabled="busy">{{ $t('保存') }}</button>
|
|
279
|
-
</div>
|
|
280
277
|
</form>
|
|
281
278
|
</template>
|
|
282
279
|
</div>
|
|
280
|
+
<footer class="dialog-footer overview-actions" v-if="active">
|
|
281
|
+
<AssetDeleteButton :asset-name="active.name" :busy="busy" @confirm="submitOverview('DELETE', {})" />
|
|
282
|
+
<button type="button" class="secondary" :disabled="busy" @click="$refs.dialog.close()">{{ $t('取消') }}</button>
|
|
283
|
+
<button form="audio-overview-form" type="submit" class="primary overview-save-button" :disabled="busy">{{ $t('保存') }}</button>
|
|
284
|
+
</footer>
|
|
283
285
|
</dialog>
|
|
284
286
|
</section>
|
|
285
287
|
</template>
|
|
@@ -302,7 +304,6 @@ export default {
|
|
|
302
304
|
|
|
303
305
|
.dialog {
|
|
304
306
|
--form-focus-ring: rgb(91 92 245 / 16%);
|
|
305
|
-
--el-color-primary: var(--accent);
|
|
306
307
|
--el-border-radius-base: 7px;
|
|
307
308
|
}
|
|
308
309
|
|