fix: fortune type
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
zzc
2026-01-24 19:26:30 +08:00
parent f6ae86557e
commit db2dcaf64e
7 changed files with 36 additions and 5 deletions

View File

@@ -20,6 +20,9 @@
<img alt="" :src="previewImageUrl" width="100%" />
</el-dialog>
</el-form-item>
<el-form-item v-if="hasType" label="类型">
<el-input v-model.trim="type" placeholder="请输入类型" />
</el-form-item>
<el-form-item label="是否启用">
<el-switch v-model="isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
</el-form-item>
@@ -41,11 +44,16 @@
type: Function,
required: true,
},
hasType: {
type: Boolean,
default: false,
},
},
data() {
return {
dialogVisible: false,
isEnabled: true,
type: '',
loading: false,
fileList: [],
previewVisible: false,
@@ -71,6 +79,7 @@
},
close() {
this.isEnabled = true
this.type = ''
this.loading = false
this.fileList = []
this.dialogVisible = false
@@ -102,13 +111,17 @@
try {
let successCount = 0
for (const url of urls) {
await this.doAdd({ imageUrl: url, isEnabled: this.isEnabled })
const data = { imageUrl: url, isEnabled: this.isEnabled }
if (this.hasType) {
data.type = this.type
}
await this.doAdd(data)
successCount++
}
this.$baseMessage(`成功添加 ${successCount} 条数据`, 'success')
this.$emit('fetch-data')
this.close()
} catch (error) {
console.error('批量添加失败:', error)
this.$baseMessage('部分或全部添加失败', 'error')
} finally {
this.loading = false