refactor: 合并上传到保存按钮,去掉上传按钮
1. 后端 saveRules/saveDefaultRules 接口直接包含 CDN 上传逻辑 2. 移除独立的 /upload 端点(风险规则 + 默认规则) 3. 前端去掉上传按钮和 uploadRules 函数 4. 现在只需保存→发布正式版两步即可完成
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
<div style="display:flex;gap:8px">
|
||||
<el-button v-if="snapshotStatus" size="small" type="primary" @click="savePreview" :loading="savingPreview">保存</el-button>
|
||||
<el-button v-if="hasUnsavedChanges" size="small" @click="resetEditor" type="warning">重置</el-button>
|
||||
<el-button size="small" @click="uploadRules" :loading="uploading">上传</el-button>
|
||||
<el-button v-if="snapshotStatus?.draft.exists" size="small" type="success" @click="publishSnapshot" :loading="publishing">发布正式版</el-button>
|
||||
<el-button v-if="snapshotStatus?.draft.exists" size="small" type="danger" @click="discardDraft" :loading="discardingDraft">丢弃预览版</el-button>
|
||||
<el-button size="small" @click="editType=''">返回列表</el-button>
|
||||
@@ -280,7 +279,7 @@ const presets = [
|
||||
]
|
||||
|
||||
// ============ 状态 ============
|
||||
const loading = ref(false), saving = ref(false), uploading = ref(false), savingPreview = ref(false), publishing = ref(false), discardingDraft = ref(false)
|
||||
const loading = ref(false), saving = ref(false), savingPreview = ref(false), publishing = ref(false), discardingDraft = ref(false)
|
||||
const sites = ref([]), rulesMap = ref({})
|
||||
const editType = ref(''), editorJson = ref('[]'), originalJson = ref('')
|
||||
const snapshotStatus = ref(null)
|
||||
@@ -492,15 +491,6 @@ const saveRules = async () => {
|
||||
finally { saving.value = false }
|
||||
}
|
||||
|
||||
const uploadRules = async () => {
|
||||
uploading.value = true
|
||||
try {
|
||||
await api.raw.post('/risk-rules/'+editType.value+'/upload', { rules: parsed.value })
|
||||
ElMessage.success('已上传')
|
||||
fetchSnapshotStatus()
|
||||
} catch { ElMessage.error('上传失败') }
|
||||
finally { uploading.value = false }
|
||||
}
|
||||
|
||||
onMounted(fetchAll)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user