diff --git a/src/views/novel/index.vue b/src/views/novel/index.vue index 363a7de..e67649a 100644 --- a/src/views/novel/index.vue +++ b/src/views/novel/index.vue @@ -159,7 +159,7 @@ const columns = reactive[]>([ width: 120, render(scope) { - return 封面; + return 封面; } }, diff --git a/src/views/site/drawer.vue b/src/views/site/drawer.vue index 0d7043b..6bc138e 100644 --- a/src/views/site/drawer.vue +++ b/src/views/site/drawer.vue @@ -118,10 +118,18 @@ +
+ + + + + +
+
- + @@ -150,17 +158,32 @@ type Options = { value: string | number; }; +function countNovelInfoUrl(array) { + return array.filter(item => item.sfg_name.includes('排行榜URL')).length; +} + const templateList = ref(); // 获取分组ID列表 getAllList().then(res => { templateList.value = res.data.items; }); + +var urlSubjectFomartGroup = ref(); const subjectFomartGroup = ref(); // 获取替换分组模板列表 getSubjectFomartGroup().then(res => { subjectFomartGroup.value = res.data.items; + + const intUrlTotal = countNovelInfoUrl(res.data.items); + + urlSubjectFomartGroup = Array.from({ length: intUrlTotal }, (_, index) => ({ + name: `URL 模板 ${index+=1}`, + id: index // id 循环生成 1, 2, 3, 4, 5, 6 + })); }); + + const actions = ref([]); // 添加参数配置 const addParams = () => { @@ -482,6 +505,7 @@ const drawerProps = ref({ // 接收父组件传过来的参数 const acceptParams = (params: DrawerProps) => { drawerProps.value = params; + drawerProps.value.row['url_type'] = 1; rules.value = generateRules(formColumns.value); drawerVisible.value = true; actions.value = []; @@ -495,11 +519,26 @@ const acceptParams = (params: DrawerProps) => { // } }; const handleSelectChange = (value) => { - console.log("选中的模板 ID:", value); const matchedTemplate = templateList.value.find(item => item.t_id === value); - // console.log(matchedTemplate.t_cfg_template) drawerProps.value.row.t_cfg = matchedTemplate.t_cfg_template } +const handleSelectChangeUrl = (value) => { + var strKey = '模板'; + var temp = drawerProps.value.row.t_cfg; + for (const key in temp) { + if (key.includes("_URL") && key != 'PC_URL_PATH') { + var newKey = temp[key].description.replace(/模板(\d+)/g, `模板${value}`); + subjectFomartGroup.value.forEach((item) => { + if (item.sfg_description === newKey) { + temp[key].sfg_id = item.sfg_id; + temp[key].description = item.sfg_name; + } + }); + } + } + drawerProps.value.row.t_cfg = temp +} + // 提交数据(新增/编辑)