ソースを参照

```
feat(home): 更新平台项图标显示逻辑

- 将平台项图标从固定n8Icon改为使用item.coverImage
- 为平台图标添加bg_color_f5样式类

feat(home): 添加工作流标题搜索功能

- 在搜索输入框中添加v-model绑定workflowTitle
- 在组件中声明workflowTitle响应式变量
- 将workflowTitle作为查询参数传递到搜索平台页面
- 调整列表每页显示数量从10改为8

fix(learning-system): 修正价格单位显示

- 将价格单位从"米币"改为"包米币"

feat(search-platform): 处理工作流标题搜索参数

- 在页面挂载时初始化workflowTitle查询参数

feat(workflow-add): 增强工作流上传表单验证

- 为文件上传区域添加必填标记和表单项包装
- 添加workflowFile必填验证规则
- 在表单数据同步中添加workflowFile和previewImage字段
- 优化表单验证错误提示,显示第一个错误字段的信息
```

zhangningning 1 ヶ月 前
コミット
49d76dd978

+ 6 - 3
src/pages/Home.vue

@@ -26,7 +26,7 @@
         <div class="platform-item" v-for="item in categoryListTree" :key="item.categoryId"
            @click="activePlatform = item.categoryName; categoryId = item.categoryId;" 
            :class="{'active': categoryId === item.categoryId}">
-          <img :src="n8Icon" alt="" class="platform-icon n8n-icon">
+          <img :src="item.coverImage" alt="" class="platform-icon n8n-icon bg_color_f5">
           <span class="platform-name">{{item.categoryName}}</span>
         </div>
         <!-- <div class="platform-item" @click="activePlatform = 'n8n'" :class="{'active': activePlatform === 'n8n'}">
@@ -54,6 +54,7 @@
             type="text"
             :placeholder="$t('common.qingshuruyaosousuodegongzuoliu')"
             class="search-input"
+            v-model="workflowTitle"
           />
           <button class="search-btn gradient" @click.stop.prevent="goSearchPlatform">
             <img :src="searchIcon" alt="" class="icon-search">
@@ -107,6 +108,7 @@ const router = useRouter()
 const activePlatform = ref('');
 const categoryId = ref('');
 const list = ref([]);
+const workflowTitle = ref('');
 
 
 // 监听图片加载完成,动态设置轮播图高度
@@ -129,7 +131,8 @@ const goSearchPlatform = () => {
     query: {
       categoryId: categoryId.value,
       activePlatform: activePlatform.value,
-      metaTitle: activePlatform.value 
+      metaTitle: activePlatform.value ,
+      workflowTitle: workflowTitle.value,
     }
   })
 };
@@ -155,7 +158,7 @@ const getCategoryListTreeFn = () => {
 const getList = async (type) => {
   const res = await getPublishList({
     pageNum: 1,
-    pageSize: 10,
+    pageSize: 8,
   })
   if(res.code === 200){
     list.value = res.rows || [];

+ 1 - 1
src/pages/LearningSystem/LearningSystemDetail.vue

@@ -29,7 +29,7 @@
         <div class="border_radius_16 bg_color_fff flex-center-between" style="padding:0 16px">
           <div class="color_price">
             <span class="bold font_size36">{{info.coursePrice}}</span>
-            <span class="font_size18">{{$t('common.mibi')}}</span>
+            <span class="font_size18">{{$t('common.baomibi')}}</span>
           </div>
           <div class="flex-center-between" @click="goDetail(info)">
             <img :src="zuIcon" alt="" style="height:98px">

+ 1 - 0
src/pages/SearchPlatform.vue

@@ -123,6 +123,7 @@
   })
 
   onMounted(() => {
+    searchFom.workflowTitle = query.workflowTitle || '';
     getList();
     getCategoryListTreeFn();
   })

+ 29 - 17
src/pages/WorkflowAdd.vue

@@ -5,21 +5,23 @@
       <div class="padding16 bg_color_fff border_radius_10 box_shadow_card">
         <div class="gap10">
           <div class="line_vertical"></div>
-          <div class="font_size20 bold">文件上传</div>
+          <div class="font_size20 bold"><span class="color_required font_size16">*</span>文件上传</div>
           <div class="gray999 font_size14">支持格式:JSON、YAML、ZIP(最大10MB)</div>
         </div>
         <div class="mt10">
-          <!-- 上传 -->
-          <FileUploader
-            ref="fileUploader"
-            accept=".json,.yaml,.yml,.zip"
-            :multiple="false"
-            :limit="1"
-            :auto-upload="true"
-            :drag="true"
-            v-model="files"
-            tip="请上传JSON、YAML、ZIP格式的文件,最大10MB"
-          />
+          <el-form-item label="" prop="workflowFile">
+            <!-- 上传 -->
+            <FileUploader
+              ref="fileUploader"
+              accept=".json,.yaml,.yml,.zip"
+              :multiple="false"
+              :limit="1"
+              :auto-upload="true"
+              :drag="true"
+              v-model="files"
+              tip="请上传JSON、YAML、ZIP格式的文件,最大10MB"
+            />
+          </el-form-item>
         </div>
       </div>
       <div class="padding16 bg_color_fff border_radius_10 mt10 box_shadow_card">
@@ -178,11 +180,16 @@ watchEffect(() => {
   ruleForm.categoryId3 = categoryIdList.value[2] || ''
   // 将编辑器内容赋值给表单的workflowContent
   ruleForm.workflowContent = JSON.stringify(editorContent.value);
-  ruleForm.coverImage = coverImage.value.map(img => img.url).join(',');;
+  ruleForm.coverImage = coverImage.value.map(img => img.url).join(',');
+  ruleForm.workflowFile = files.value[0]?.url || '';
+  ruleForm.previewImage = images.value.map(img => img.url).join(',');
 
 })
 // 校验规则
 const rules = reactive({
+  workflowFile: [
+    { required: true, message: '请上传工作流文件', trigger: 'change' },
+  ],
   workflowTitle: [
     { required: true, message: '请输入工作流标题', trigger: 'blur' },
   ],
@@ -208,9 +215,12 @@ onMounted(() => {
 
 // 提交表单
 const submitForm = async () => {
-  ruleForm.workflowFile = files.value[0]?.url || '';
-  ruleForm.previewImage = images.value.map(img => img.url).join(',');
-  
+ 
+
+  // if(!ruleForm.workflowFile){
+  //   DGTMessage.warning('请上传工作流文件')
+  //   return
+  // }
   if(!editorContent.value || editorContent.value.length === 0){
     DGTMessage.warning('请输入工作流详情内容')
     return
@@ -225,7 +235,9 @@ const submitForm = async () => {
   await ruleFormRef.value.validate((valid, fields) => {
     console.log(valid, fields)
     if (!valid) {
-      DGTMessage.warning(fields.name[0].message)
+      //报错第一个key
+      let firstKey = Object.keys(fields)[0]
+      DGTMessage.warning(fields[firstKey][0].message)
       return
     }
     publishAdd(ruleForm).then(res => {