feat: page config upload button for normal sites, add cloud upload endpoint
- SitePagesController: add PUT /admin/site-pages/{siteId}/upload for uploading normal site pages to cloud storage
- SitePages.vue: show upload button for both default templates and normal sites
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<h2 style="margin:0">编辑: {{ editSiteId }}</h2>
|
||||
<div style="display:flex;gap:8px">
|
||||
<el-button size="small" type="primary" @click="savePages" :loading="saving">保存</el-button>
|
||||
<el-button v-if="isDefaultEditor" size="small" @click="uploadPages" :loading="uploading">上传</el-button>
|
||||
<el-button size="small" @click="uploadPages" :loading="uploading">上传</el-button>
|
||||
<el-button size="small" type="danger" @click="deletePages" :loading="deleting">删除</el-button>
|
||||
<el-button size="small" @click="editSiteId=''">返回列表</el-button>
|
||||
</div>
|
||||
@@ -222,8 +222,12 @@ const deletePages = async () => {
|
||||
const uploadPages = async () => {
|
||||
uploading.value = true
|
||||
try {
|
||||
const type = editSiteId.value.replace('default:','')
|
||||
await api.raw.put('/admin/default-pages/'+type+'/upload', { entries: parsed.value })
|
||||
if (editSiteId.value.startsWith('default:')) {
|
||||
const type = editSiteId.value.replace('default:','')
|
||||
await api.raw.put('/admin/default-pages/'+type+'/upload', { entries: parsed.value })
|
||||
} else {
|
||||
await api.raw.put('/admin/site-pages/'+editSiteId.value+'/upload', { entries: parsed.value, authType: authType.value })
|
||||
}
|
||||
ElMessage.success('已上传到云存储')
|
||||
} catch { ElMessage.error('上传失败') }
|
||||
finally { uploading.value = false }
|
||||
|
||||
Reference in New Issue
Block a user