diff --git a/frontend/desktop/src/config/i18n/cn.js b/frontend/desktop/src/config/i18n/cn.js index fcb76bf51..fd5ac3658 100644 --- a/frontend/desktop/src/config/i18n/cn.js +++ b/frontend/desktop/src/config/i18n/cn.js @@ -1828,7 +1828,9 @@ const cn = { '场景名称重复:': '场景名称重复:', '场景名称长度最小3个字符': '场景名称长度最小3个字符', '请输入群 ID,多个 ID 以分号隔开': '请输入群 ID,多个 ID 以分号隔开', - '当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': '当前环境配置周期任务间隔不低于 {n} 分钟,如有特殊需求请联系管理员配置' + '当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': '当前环境配置周期任务间隔不低于 {n} 分钟,如有特殊需求请联系管理员配置', + '仅支持上传.mp4,.mov文件': '仅支持上传.mp4,.mov文件', + '选择视频文件': '选择视频文件' } export default cn diff --git a/frontend/desktop/src/config/i18n/en.js b/frontend/desktop/src/config/i18n/en.js index 815308e92..0d0712cfc 100644 --- a/frontend/desktop/src/config/i18n/en.js +++ b/frontend/desktop/src/config/i18n/en.js @@ -1862,7 +1862,9 @@ const en = { '场景名称重复:': 'Duplicate scene name:', '场景名称长度最小3个字符': 'The scene name must be at least 3 characters long', '请输入群 ID,多个 ID 以分号隔开': 'Please enter group IDs, separated by semicolons if there are multiple IDs', - '当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': 'In the current environment, the interval for scheduled tasks is no less than {n} minutes. If you have special requirements, please contact the administrator for configuration' + '当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': 'In the current environment, the interval for scheduled tasks is no less than {n} minutes. If you have special requirements, please contact the administrator for configuration', + '仅支持上传.mp4,.mov文件': 'Only .mp4 and .mov files are supported for upload', + '选择视频文件': 'Select video file' } export default en diff --git a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue index f44713a47..53de08220 100644 --- a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue +++ b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue @@ -60,7 +60,7 @@ :name="option.name"> -

+

{{ $t('场景名称重复:') }} {{ repeatSceneInfo.scene_name }} @@ -151,6 +151,17 @@ project_id: [String, Number] }, data () { + const defaultEditorContent = [ + '## 1. 背景', + '*为什么要开发这个场景*', + '## 2. 适用场景', + '*这个场景解决什么问题*', + '## 3.使用流程', + '### 3.1 前置条件', + '*如有*', + '### 3.2 xxx', + '## 4. FAQ' + ] const formData = { id: undefined, type: 'create', @@ -158,7 +169,7 @@ category: '', labels: [], risk_level: '', - usage_content: { content: '' } + usage_content: { content: defaultEditorContent.join('\n\n') } } return { formData: tools.deepClone(formData), @@ -224,8 +235,8 @@ this.loadMarkedRiskLevel() ]) this.categoryList = resp1.data - this.tagList = resp2.data.results - this.riskLevelList = resp3.data.results + this.tagList = resp2.data + this.riskLevelList = resp3.data } catch (error) { console.warn(error) } finally { @@ -272,7 +283,7 @@ try { this.recordLoading = true const resp = await this.loadSharedTemplateRecord() - this.recordList = resp.data.data + this.recordList = resp.data } catch (error) { console.warn(error) } finally { @@ -336,10 +347,12 @@ params.templates = [...new Set(selectedTplIds)] const resp = await this.sharedTemplateRecord(params) - if (!resp.result) { - this.repeatSceneInfo = resp.data - return + this.repeatSceneInfo = { + ...resp.data, + result: resp.result } + if (!resp.result) return + this.showSuccessMessage() this.$emit('close') } catch (error) { @@ -357,7 +370,9 @@ tag: 'div' }, on: { - click: this.jumpSreStore + click: () => { + window.open(this.repeatSceneInfo.scene_url, '_target') + } } }, [ h('span', { diff --git a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue index db5655508..c79b77cfc 100644 --- a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue +++ b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue @@ -1,14 +1,41 @@ + diff --git a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/videoUpload.vue b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/videoUpload.vue new file mode 100644 index 000000000..ce7e03686 --- /dev/null +++ b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/videoUpload.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/frontend/desktop/src/pages/template/TemplatePreview/index.vue b/frontend/desktop/src/pages/template/TemplatePreview/index.vue index 17ba75196..43ef32998 100644 --- a/frontend/desktop/src/pages/template/TemplatePreview/index.vue +++ b/frontend/desktop/src/pages/template/TemplatePreview/index.vue @@ -15,7 +15,8 @@ }, props: { project_id: [Number, String], - template_id: [Number, String] + template_id: [Number, String], + common: String }, data () { return { @@ -40,7 +41,8 @@ this.templateLoading = true const resp = await this.loadTemplatePreviewData({ template_id: this.template_id, - project_id: this.project_id + project_id: this.project_id, + template_source: this.common === '1' ? 'common' : undefined }) const pipelineTree = JSON.parse(resp.data.pipeline_tree) this.templateData = formatCanvasData('perview', pipelineTree) diff --git a/frontend/desktop/src/store/modules/templateMarket.js b/frontend/desktop/src/store/modules/templateMarket.js index cad91c4e9..cf91090a8 100644 --- a/frontend/desktop/src/store/modules/templateMarket.js +++ b/frontend/desktop/src/store/modules/templateMarket.js @@ -16,6 +16,20 @@ const templateMarket = { getFileUploadAddr ({ commit }, params) { return axios.get('/template_market/api/templates_scene/get_file_upload_addr/', { params }).then(response => response.data.data) }, + uploadFileToUrl ({ commit }, params) { + const { upload_url, blob } = params + return axios({ + url: upload_url, + method: 'put', + data: blob, // 直接将 File 对象作为请求体 + withCredentials: false, + headers: { + 'content-Type': blob.type // 使用文件本身的类型 + // 如果需要添加额外的请求头,可以在这里添加 + // 'Authorization': 'Bearer your-token', + } + }) + }, createLabel ({ commit }, params) { return axios.post('/template_market/api/templates_scene/add_scene_label/', params).then(response => response.data) },