|
|
@@ -178,7 +178,9 @@
|
|
|
|
|
|
<div class="template-tips c-333 fs-14 line-20 te-l mar-top-20 flex left">
|
|
|
<el-icon><WarningFilled /></el-icon>
|
|
|
- <span class="mar-left-10">该模版图片顺序说明:{{form.selectTemplate?.template_image_order}}</span>
|
|
|
+ <span class="mar-left-10">该模版要求拍摄图片:{{form.selectTemplate?.template_image_order}}
|
|
|
+ <template v-if="form.selectTemplate?.template_image_order">,共{{form.selectTemplate?.template_image_order.split(',').length}}张。</template>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
|
|
|
<!-- 模板下:一键上架 和 电商平台(多选) -->
|
|
|
@@ -505,6 +507,7 @@ const viewTemplate = (template) => {
|
|
|
// 获取模版列表
|
|
|
const getCompanyTemplates = async () => {
|
|
|
const { data } = await getCompanyTemplatesApi()
|
|
|
+ console.log(data);
|
|
|
templates.value = data.list
|
|
|
// 获取电商平台列表 - 支持新的数据结构
|
|
|
if (data.online_store_temp_list) {
|
|
|
@@ -539,7 +542,7 @@ const toggleService = (key: string) => {
|
|
|
const idx = form.services.indexOf(key)
|
|
|
if (idx > -1) form.services.splice(idx, 1)
|
|
|
else form.services.push(key)
|
|
|
-
|
|
|
+
|
|
|
// 保存服务选择状态到缓存
|
|
|
saveServicesToCache(form.services)
|
|
|
}
|
|
|
@@ -854,6 +857,61 @@ const openOutputDir = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 检测参数是否有效
|
|
|
+const checkParams = async function () {
|
|
|
+ const useConfigInfoStore = configInfo();
|
|
|
+ const tokenInfoStore = tokenInfo();
|
|
|
+ const token = tokenInfoStore.getToken;
|
|
|
+ let temp_list = []
|
|
|
+ templates.value.map(item => {
|
|
|
+ temp_list.push({
|
|
|
+ template_id: item.template_id,
|
|
|
+ template_local_classes: item.template_local_classes,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 根据选择的服务内容设置参数
|
|
|
+ const isDetail = form.services.includes('is_detail') ? 1 : 0
|
|
|
+ const isProductScene = form.services.includes('is_product_scene') ? 1 : 0
|
|
|
+ const isUpperFooter = form.services.includes('is_upper_footer') ? 1 : 0
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ goods_art_no: JSON.parse(JSON.stringify(goods_art_nos.value)),
|
|
|
+ logo_path: form.logo_path || '',
|
|
|
+ temp_name: form.selectTemplate?.template_id || '',
|
|
|
+ excel_path: form.dataType == '1' ? form.excel_path : '',
|
|
|
+ template_image_order: form.selectTemplate?.template_image_order,
|
|
|
+ temp_list,
|
|
|
+ token,
|
|
|
+ uuid: uuidStore.getUuid || '',
|
|
|
+ // 新增服务参数 - 合并国内和国外平台
|
|
|
+ online_stores: [...(domesticPlatforms.value || []), ...(foreignPlatforms.value || [])],
|
|
|
+ is_detail: isDetail,
|
|
|
+ is_product_scene: isProductScene,
|
|
|
+ is_upper_footer: isUpperFooter,
|
|
|
+ upper_footer_params: selectedModels.value ? {
|
|
|
+ man_id: selectedModels.value.male?.id || "",
|
|
|
+ women_id: selectedModels.value.female?.id || ""
|
|
|
+ } : {},
|
|
|
+ product_scene_prompt: scenePrompt.value || '',
|
|
|
+ is_check: 1 // 仅检测,不生成
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 直接调用API进行检测,因为检测模式会直接返回结果
|
|
|
+ const response = await clientStore.ipc.invoke(icpList.generate.generatePhotoDetail, params);
|
|
|
+ console.log('=======checkParamscheckParamscheckParamscheckParams===========');
|
|
|
+ console.log(params);
|
|
|
+ console.log(response);
|
|
|
+ if (response.code === 0) {
|
|
|
+ return response;
|
|
|
+ } else {
|
|
|
+ throw new Error(response.msg || '检测失败');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ throw new Error(error.message || '检测失败');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 开始生成操作
|
|
|
const generate = async function () {
|
|
|
|
|
|
@@ -897,12 +955,19 @@ const generate = async function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // 先进行检测
|
|
|
+ try {
|
|
|
+ // ElMessage.info('正在检测参数,请稍候...');
|
|
|
+ await checkParams();
|
|
|
+ // ElMessage.success('检测通过,开始生成...');
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error(error.message || '检测失败,请检查参数');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
const useConfigInfoStore = configInfo();
|
|
|
console.log(useConfigInfoStore.appConfig);
|
|
|
|
|
|
-
|
|
|
const tokenInfoStore = tokenInfo();
|
|
|
const token = tokenInfoStore.getToken; // 使用 getToken() 获取 token
|
|
|
let temp_list = []
|
|
|
@@ -935,7 +1000,8 @@ const generate = async function () {
|
|
|
man_id: selectedModels.value.male?.id || "",
|
|
|
women_id: selectedModels.value.female?.id || ""
|
|
|
} : {},
|
|
|
- product_scene_prompt: scenePrompt.value || ''
|
|
|
+ product_scene_prompt: scenePrompt.value || '',
|
|
|
+ is_check: 0 // 正式生成
|
|
|
}
|
|
|
|
|
|
console.log(params)
|