Kaynağa Gözat

修改视频宣讲内容

yangg 3 hafta önce
ebeveyn
işleme
54039950fa
2 değiştirilmiş dosya ile 169 ekleme ve 72 silme
  1. 2 2
      .env.development
  2. 167 70
      src/views/position/detail/index.vue

+ 2 - 2
.env.development

@@ -6,8 +6,8 @@ ENV = 'development'
 # 本地环境接口地址 121.36.251.245
 
 
-VITE_API_URL = 'https://backend.qicai321.com'
-#VITE_API_URL = 'http://192.168.100.109:8083'
+#VITE_API_URL = 'https://backend.qicai321.com'
+VITE_API_URL = 'http://192.168.100.109:8083'
 VITE_API_WX_URL='https://api.weixin.qq.com/'
 VITE_API_URL_MINLONG='http://117.185.80.170:7861'
 # 是否启用按钮权限

+ 167 - 70
src/views/position/detail/index.vue

@@ -879,7 +879,7 @@
     </el-drawer>
 
     <!-- 在 template 中添加视频宣讲弹窗 -->
-    <el-dialog title="新增视频宣讲" v-model="showVideoLectureDialog" width="35%" :close-on-click-modal="false"
+    <el-dialog :title="videoLectureDialogTitle" v-model="showVideoLectureDialog" width="35%" :close-on-click-modal="false"
       class="video-lecture-dialog">
       <div class="video-lecture-form">
         <!--  <div class="form-item">
@@ -2218,6 +2218,7 @@ const positionData = reactive({
 
 // 招聘流程数据 - 修改为普通数组而非 ref 对象,添加type字段用于重复检查
 const recruitmentProcess = reactive([
+  { id: 1, name: '视频宣讲', description: '视频宣讲', active: true, type: 'video_presentation', visible: true },
   { id: 6, name: '简历收集', description: '简历收集', active: true, type: 'resume_collection', visible: true },
   { id: 5, name: '资料收集', description: '资料收集', active: true, type: 'data_collection', visible: true },
   { id: 2, name: 'AI考察', description: 'AI考察', active: true, type: 'ai_video', visible: true },
@@ -2825,33 +2826,48 @@ const cancelResumeCollection = () => {
 
 // 确认添加简历收集
 const confirmResumeCollection = () => {
-  // 创建新的简历收集步骤
-  const newStep = {
-    id: Date.now(),
-    name: resumeCollectionForm.title,
-    description: '简历收集',
-    active: true,
-    type: 'resume_collection',
-    config: {
+  // 检查是否已存在简历收集步骤
+  const existingResumeStep = recruitmentProcess.find(step => step.type === 'resume_collection');
+  
+  if (existingResumeStep) {
+    // 如果已存在,只需要更新配置并显示该步骤
+    existingResumeStep.visible = true;
+    existingResumeStep.name = resumeCollectionForm.title;
+    existingResumeStep.config = {
       ...resumeCollectionForm
-    },
-    visible: true
-  };
-
-  // 添加到流程中
-  recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
+    };
+  } else {
+    // 如果不存在,创建新的简历收集步骤
+    const newStep = {
+      id: Date.now(),
+      name: resumeCollectionForm.title,
+      description: '简历收集',
+      active: true,
+      type: 'resume_collection',
+      config: {
+        ...resumeCollectionForm
+      },
+      visible: true
+    };
+    
+    // 添加到流程中
+    recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
+  }
 
   UpdateConfig({
     id: getConfigId.value,
-    require_resume_upload: true // 删除综合素质考察时,将enable_scoring_questions设置为false
+    require_resume_upload: true
   }).then((res: any) => {
     if (res.code == 2000) {
-      recruitmentProcess[0].visible = true;
       // ElMessage.success('新增成功');
     } else {
-      ElMessage.error('删除失败');
+      ElMessage.error('添加简历收集失败');
     }
+  }).catch((error: any) => {
+    console.error('添加简历收集失败:', error);
+    ElMessage.error('添加简历收集失败');
   })
+  
   // 关闭弹窗
   showResumeCollectionDialog.value = false;
 
@@ -3138,6 +3154,19 @@ const deleteProcessStep = (step: any, index: number) => {
       }
     })
   }
+  if (step.type == 'video_presentation') {
+    UpdateConfig({
+      id: getConfigId.value,
+      enable_video_presentation: false
+    }).then((res: any) => {
+      if (res.code == 2000) {
+        ElMessage.success('删除成功');
+        return
+      } else {
+        ElMessage.error('删除失败');
+      }
+    })
+  }
   recruitmentProcess.splice(index, 1);
   console.log('recruitmentProcess', recruitmentProcess);
 };
@@ -3154,7 +3183,8 @@ const addProcessStepAt = (index: number) => {
     name: '新步骤',
     description: '新步骤',
     active: true,
-    type: 'custom' // 自定义步骤类型
+    type: 'custom', // 自定义步骤类型
+    visible: true
   };
 
   recruitmentProcess.splice(index, 0, newStep);
@@ -3226,15 +3256,16 @@ const showStepOptions = (index: number, event: MouseEvent) => {
 };
 // 修改添加选定类型的步骤方法
 const addSelectedStepType = async (type: string, label: string) => {
+  console.log('type', type === 'video_presentation');
   // 检查是否已存在相同类型的步骤,防止重复添加
-  if (type === 'video_presentation') {
+ /*  if (type === 'video_presentation') {
     const exists = recruitmentProcess.some((s: any) => s.type === 'video_presentation' && s.visible !== false);
     if (exists) {
       ElMessage.warning('已存在一个“视频宣讲”步骤');
       showOptionsMenu.value = false;
       return;
     }
-  }
+  } */
   if (type === 'ai_video') {
     UpdateConfig({
       id: getConfigId.value,
@@ -3310,8 +3341,11 @@ const addSelectedStepType = async (type: string, label: string) => {
     return;
   }
 
-  if (type == 'resume_collection') {
-
+  // 添加简历收集类型的处理
+  if (type === 'resume_collection') {
+    showResumeCollectionConfig();
+    showOptionsMenu.value = false;
+    return;
   }
   //肢体检测
   if (type === 'posture_check') {
@@ -3329,7 +3363,22 @@ const addSelectedStepType = async (type: string, label: string) => {
     })
   }
 
+  // 添加视频宣讲类型的处理
+  if (type === 'video_presentation') {
+    // 重置编辑索引,表示这是新增模式
+    editingVideoLectureIndex.value = -1;
+    showVideoLectureDialog.value = true;
+    showOptionsMenu.value = false;
+    return;
+  }
+
+  // 检查是否已存在相同类型的步骤
   const existingStep = recruitmentProcess.find(step => {
+    // 对于简历收集和视频宣讲,只检查是否已存在且visible为true的步骤
+    if (type === 'resume_collection' || type === 'video_presentation') {
+      return step.type === type && step.visible === true;
+    }
+    // 对于其他类型,检查是否存在相同类型或相同名称的步骤
     if (step.type && step.type === type) {
       return true;
     }
@@ -3340,7 +3389,7 @@ const addSelectedStepType = async (type: string, label: string) => {
   });
 
   if (existingStep) {
-    /*  ElMessage.warning(`"${label}"步骤已存在,不能重复添加`); */
+    ElMessage.warning(`"${label}"步骤已存在,不能重复添加`);
     showOptionsMenu.value = false;
     return;
   }
@@ -3352,13 +3401,6 @@ const addSelectedStepType = async (type: string, label: string) => {
     return;
   }
 
-  // 添加视频宣讲类型的处理
-  if (type === 'video_presentation') {
-    showVideoLectureConfig();
-    showOptionsMenu.value = false;
-    return;
-  }
-
   // 添加资料收集类型的处理
   if (type === 'data_collection') {
     const response = await GetConfig(route.query.id);
@@ -3374,12 +3416,6 @@ const addSelectedStepType = async (type: string, label: string) => {
     return;
   }
 
-  // 添加简历收集类型的处理
-  if (type === 'resume_collection') {
-    showResumeCollectionConfig();
-    showOptionsMenu.value = false;
-    return;
-  }
   //添加肢体检测
   if (type === 'posture_check') {
     // showPostureCheckConfig();
@@ -3663,6 +3699,8 @@ const jumpToStep = (step: number) => {
 
 // 显示视频宣讲配置弹窗
 const showVideoLectureConfig = () => {
+  // 重置编辑索引,表示这是新增模式
+  editingVideoLectureIndex.value = -1;
   showVideoLectureDialog.value = true;
 };
 
@@ -3697,29 +3735,49 @@ const confirmVideoLecture = () => {
       broadcastType: videoLectureForm.broadcastType
     };
     ElMessage.success('视频宣讲步骤已更新');
+    showVideoLectureDialog.value = false;
+    // 重置编辑索引与表单
+    editingVideoLectureIndex.value = -1;
+    cancelVideoLecture();
   } else {
-    // 新增模式
-    const newStep = {
-      id: Date.now(),
-      name: videoLectureForm.title || '视频宣讲',
-      description: videoLectureForm.description || '视频宣讲',
-      active: true,
-      type: 'video_presentation',
-      visible: true,
-      config: {
-        video_url: videoLectureForm.video_url,
-        description: videoLectureForm.description,
-        broadcastType: videoLectureForm.broadcastType
+    // 新增模式 - 先调用UpdateConfig接口
+    UpdateConfig({
+      id: getConfigId.value,
+      enable_video_presentation: true,
+      video_presentation_url: videoLectureForm.video_url,
+      video_presentation_description: videoLectureForm.description
+    }).then((res: any) => {
+      if (res.code == 2000) {
+        // 创建新的视频宣讲步骤
+        const newStep = {
+          id: Date.now(),
+          name: videoLectureForm.title || '视频宣讲',
+          description: videoLectureForm.description || '视频宣讲',
+          active: true,
+          type: 'video_presentation',
+          visible: true,
+          config: {
+            video_url: videoLectureForm.video_url,
+            description: videoLectureForm.description,
+            broadcastType: videoLectureForm.broadcastType
+          }
+        };
+        // 添加到流程中
+        recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
+        ElMessage.success('视频宣讲步骤已添加');
+        
+        showVideoLectureDialog.value = false;
+        // 重置编辑索引与表单
+        editingVideoLectureIndex.value = -1;
+        cancelVideoLecture();
+      } else {
+        ElMessage.error('添加视频宣讲失败');
       }
-    };
-    recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
-    ElMessage.success('视频宣讲步骤已添加');
+    }).catch((error: any) => {
+      console.error('添加视频宣讲失败:', error);
+      ElMessage.error('添加视频宣讲失败');
+    });
   }
-
-  showVideoLectureDialog.value = false;
-  // 重置编辑索引与表单
-  editingVideoLectureIndex.value = -1;
-  cancelVideoLecture();
 };
 
 // 上传前校验
@@ -4209,19 +4267,21 @@ const initializeConfigState = async () => {
           questionSettings.enableColorBlindQuestions = config.data.enable_color_blind_test;
         }
         interviewSettings.positionDetection = config.data.enable_emotion_analysis;
-        // 同步AI考察(开放问题)开关状态
-        recruitmentProcess[2].visible = config.data.question_form_switches.enable_open_questions;
-        recruitmentProcess[3].visible = config.data.question_form_switches.enable_single_choice ||
+        // 同步AI考察(开放3问题)开关状态
+        recruitmentProcess[3].visible = config.data.question_form_switches.enable_open_questions;
+        recruitmentProcess[4].visible = config.data.question_form_switches.enable_single_choice ||
           config.data.question_form_switches.enable_multiple_choice ||
           config.data.question_form_switches.enable_image_choice ||
           config.data.question_form_switches.enable_fill_blank;
-        recruitmentProcess[4].visible = config.data.question_form_switches.enable_scoring_questions;
-        recruitmentProcess[5].visible = config.data.enable_posture_check;
-        recruitmentProcess[6].visible = config.data.question_form_switches.enable_candidate_questions;
+        recruitmentProcess[5].visible = config.data.question_form_switches.enable_scoring_questions;
+        recruitmentProcess[6].visible = config.data.enable_posture_check;
+        recruitmentProcess[7].visible = config.data.question_form_switches.enable_candidate_questions;
 
 
         // 可以在这里添加其他配置状态的同步
-        recruitmentProcess[0].visible = config.data.require_resume_upload;
+        recruitmentProcess[1].visible = config.data.require_resume_upload;
+        recruitmentProcess[0].visible = config.data.enable_video_presentation;
+        console.log('recruitmentProcess', recruitmentProcess);
       }
     }
   } catch (error) {
@@ -6723,13 +6783,50 @@ const editProcessStep = (step: any, index: number) => {
 
 // 编辑视频宣讲
 const editingVideoLectureIndex = ref(-1);
-const editVideoLecture = (step: any, index: number) => {
+
+// 视频宣讲弹窗标题计算属性
+const videoLectureDialogTitle = computed(() => {
+  return editingVideoLectureIndex.value >= 0 ? '修改视频宣讲' : '新增视频宣讲';
+});
+
+const editVideoLecture = async (step: any, index: number) => {
   editingVideoLectureIndex.value = index;
-  // 将已有配置回填到表单
-  videoLectureForm.title = step.name || '视频宣讲';
-  videoLectureForm.description = step?.config?.description || '';
-  videoLectureForm.broadcastType = step?.config?.broadcastType || 'required';
-  videoLectureForm.video_url = step?.config?.video_url || '';
+  
+  try {
+    // 请求接口获取最新的配置数据
+    const response = await GetConfig(route.query.id);
+    if (response && response.data) {
+      // 从接口返回的数据中获取视频宣讲配置
+      const configData = response.data;
+      
+      // 回填表单数据
+      videoLectureForm.title = step.name || '视频宣讲';
+      videoLectureForm.description = configData.video_presentation_description || step?.config?.description || '';
+      videoLectureForm.broadcastType = step?.config?.broadcastType || 'required';
+      videoLectureForm.video_url = configData.video_presentation_url || step?.config?.video_url || '';
+      
+      console.log('视频宣讲配置数据:', {
+        title: videoLectureForm.title,
+        description: videoLectureForm.description,
+        video_url: videoLectureForm.video_url,
+        broadcastType: videoLectureForm.broadcastType
+      });
+    } else {
+      // 如果接口请求失败,使用步骤中的现有数据
+      videoLectureForm.title = step.name || '视频宣讲';
+      videoLectureForm.description = step?.config?.description || '';
+      videoLectureForm.broadcastType = step?.config?.broadcastType || 'required';
+      videoLectureForm.video_url = step?.config?.video_url || '';
+    }
+  } catch (error) {
+    console.error('获取视频宣讲配置失败:', error);
+    // 请求失败时使用步骤中的现有数据
+    videoLectureForm.title = step.name || '视频宣讲';
+    videoLectureForm.description = step?.config?.description || '';
+    videoLectureForm.broadcastType = step?.config?.broadcastType || 'required';
+    videoLectureForm.video_url = step?.config?.video_url || '';
+  }
+  
   showVideoLectureDialog.value = true;
 };