Commit 70165636 authored by liujiangnan's avatar liujiangnan

feat

parent 96220e6b
...@@ -651,12 +651,17 @@ Atmosphere and Colors: [Fill in content] ...@@ -651,12 +651,17 @@ Atmosphere and Colors: [Fill in content]
handleAiGenerateDownload: async function () { handleAiGenerateDownload: async function () {
var _this = this; var _this = this;
try { try {
var indexParam = parseInt(new URLSearchParams(window.location.search).get('index'), 10);
var pageXxx = (isNaN(indexParam) ? 0 : indexParam) + 1;
var templateFilename = 'page_' + pageXxx + '_template.md';
var dataFilename = 'page_' + pageXxx + '_data.md';
var tplRes = await fetch('./ImagesActionsTemplate.md'); var tplRes = await fetch('./ImagesActionsTemplate.md');
if (!tplRes.ok) { if (!tplRes.ok) {
throw new Error('无法读取 ImagesActionsTemplate.md'); throw new Error('无法读取 ImagesActionsTemplate.md');
} }
var tplText = await tplRes.text(); var tplText = await tplRes.text();
_this.downloadTextFile('ImagesActionsTemplate.md', tplText); _this.downloadTextFile(templateFilename, tplText);
var dataRes = await fetch('./ImagesActionsTemplateData.md'); var dataRes = await fetch('./ImagesActionsTemplateData.md');
if (!dataRes.ok) { if (!dataRes.ok) {
...@@ -676,7 +681,7 @@ Atmosphere and Colors: [Fill in content] ...@@ -676,7 +681,7 @@ Atmosphere and Colors: [Fill in content]
throw new Error('ImagesActionsTemplateData.md 中未找到可替换的空 content(需为 content: {})'); throw new Error('ImagesActionsTemplateData.md 中未找到可替换的空 content(需为 content: {})');
} }
setTimeout(function () { setTimeout(function () {
_this.downloadTextFile('ImagesActionsTemplateData.md', filled); _this.downloadTextFile(dataFilename, filled);
}, 200); }, 200);
this.$message.success('已开始下载两个 MD 文件'); this.$message.success('已开始下载两个 MD 文件');
} catch (err) { } catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment