Преглед изворни кода

10.28 按照文档修复内容:
1. 专升本、对口类科目专属属性attr_type 1: "文化基础", 2: '19专业大类'
2. 单招类提醒科目专属属性attr_type 3: '职业适应性测试视频课'
3. 修复高校管理,编辑新增数据问题
4. 智能回答管理增加下载模板功能
10.29 文档修复内容
1. 修改智能回复内容,去除作者必填

罗永浩 пре 5 месеци
родитељ
комит
5cc8f56827

+ 22 - 7
addons/admin/src/views/exam/component/SubjectManager.vue

@@ -14,9 +14,10 @@
                         </template>
                     </el-table-column>
                     <el-table-column prop="attr_type" label="类别属性" width="120"
-                        v-if="defaultType === 2 || defaultType === 3">
+                        v-if="defaultType === 1 || defaultType === 2 || defaultType === 3">
                         <template slot-scope="{ row }">
-                            <el-tag type="success" v-if="row.attr_type">{{ attrTypeOptions[row.attr_type] || '未知'
+                            <el-tag type="success" v-if="row.attr_type">{{ currentAttrTypeOptions[row.attr_type] ||
+                                attrTypeOptions[row.attr_type] || '未知'
                                 }}</el-tag>
                             <span v-else>-</span>
                         </template>
@@ -57,9 +58,10 @@
                     <uploadImage :limit="1" v-model="formData.icon" @upload-success="onImageUploadSuccess">
                     </uploadImage>
                 </el-form-item>
-                <el-form-item label="类别属性" prop="attr_type" v-if="defaultType === 2 || defaultType === 3">
+                <el-form-item label="类别属性" prop="attr_type"
+                    v-if="defaultType === 1 || defaultType === 2 || defaultType === 3">
                     <el-select v-model="formData.attr_type" placeholder="请选择类别属性" clearable>
-                        <el-option v-for="(label, key) in attrTypeOptions" :key="key" :label="label"
+                        <el-option v-for="(label, key) in currentAttrTypeOptions" :key="key" :label="label"
                             :value="Number(key)" />
                     </el-select>
                 </el-form-item>
@@ -106,7 +108,7 @@ export default {
                 id: null,
                 subject_name: '',
                 type: this.defaultType,
-                attr_type: null,
+                attr_type: this.defaultType === 1 ? 3 : null,
                 description: '',
                 icon: '',
                 sort: 0,
@@ -116,7 +118,20 @@ export default {
                 subject_name: [{ required: true, message: '请输入科目名称', trigger: 'blur' }],
                 type: [{ required: true, message: '请选择所属栏目', trigger: 'change' }]
             },
-            attrTypeOptions: { 1: "文化基础", 2: '19专业大类' },
+            attrTypeOptions: { 1: "文化基础", 2: '19专业大类', 3: '职业适应性测试视频课' },
+        }
+    },
+    computed: {
+        // 根据默认类型动态获取类别属性选项
+        currentAttrTypeOptions() {
+            if (this.defaultType === 1) {
+                // 单招:只显示职业适应性测试视频课
+                return { 3: '职业适应性测试视频课' };
+            } else if (this.defaultType === 2 || this.defaultType === 3) {
+                // 对口和专升本:显示文化基础和19专业大类
+                return { 1: "文化基础", 2: '19专业大类' };
+            }
+            return {};
         }
     },
     watch: {
@@ -197,7 +212,7 @@ export default {
                 id: null,
                 subject_name: '',
                 type: this.defaultType, // 使用父组件传入默认栏目
-                attr_type: this.defaultType === 1 ? 0 : null, // 单招默认为0,对口和专升本为null
+                attr_type: this.defaultType === 1 ? 3 : null, // 单招默认为3(职业适应性测试视频课),对口和专升本为null
                 description: '',
                 icon: '',
                 sort: 0,

+ 39 - 14
addons/admin/src/views/subject/subject.vue

@@ -20,7 +20,7 @@
                     <el-col :md="6" :sm="12">
                         <el-form-item label="类别属性">
                             <el-select v-model="table.where.attr_type" placeholder="请选择类别属性" clearable>
-                                <el-option v-for="(label, key) in attrTypeOptions" :key="key" :label="label"
+                                <el-option v-for="(label, key) in searchAttrTypeOptions" :key="key" :label="label"
                                     :value="key" />
                             </el-select>
                         </el-form-item>
@@ -77,7 +77,7 @@
                     <el-table-column prop="attr_type" label="类别属性" width="120" v-if="showAttrTypeColumn">
                         <template slot-scope="{ row }">
                             <el-tag type="success" v-if="row.attr_type">{{ attrTypeOptions[row.attr_type] || '未知'
-                            }}</el-tag>
+                                }}</el-tag>
                             <span v-else>-</span>
                         </template>
                     </el-table-column>
@@ -120,7 +120,7 @@
                 </el-form-item>
                 <el-form-item label="类别属性" prop="attr_type" v-if="showAttrTypeField">
                     <el-select v-model="formData.attr_type" placeholder="请选择类别属性" clearable>
-                        <el-option v-for="(label, key) in attrTypeOptions" :key="key" :label="label"
+                        <el-option v-for="(label, key) in currentAttrTypeOptions" :key="key" :label="label"
                             :value="Number(key)" />
                     </el-select>
                 </el-form-item>
@@ -155,7 +155,7 @@ export default {
                 where: { keyword: "", type: null, attr_type: null, status: null }
             },
             choose: [],
-            formData: { id: null, subject_name: "", type: 1, attr_type: null, description: "", icon: "", sort: 0, status: 1 },
+            formData: { id: null, subject_name: "", type: 1, attr_type: 3, description: "", icon: "", sort: 0, status: 1 },
             isEdit: false,
             formVisible: false,
             formRules: {
@@ -163,7 +163,7 @@ export default {
                 type: [{ required: true, message: "请选择所属栏目", trigger: "change" }]
             },
             typeOptions: { 1: "单招", 2: "对口", 3: "专升本" },
-            attrTypeOptions: { 1: "文化基础", 2: '19专业大类' },
+            attrTypeOptions: { 1: "文化基础", 2: '19专业大类', 3: '职业适应性测试视频课' },
             permissionMap: {
                 delete: "sys:subject:delete",
                 edit: "sys:subject:edit",
@@ -174,23 +174,48 @@ export default {
     },
     computed: {
         ...mapGetters(["permission"]),
-        // 是否显示类别属性列(只有对口和专升本才显示)
+        // 是否显示类别属性列
         showAttrTypeColumn() {
-            return this.table.where.type === 2 || this.table.where.type === 3;
+            // 所有类型都显示类别属性列
+            return this.table.where.type === 1 || this.table.where.type === 2 || this.table.where.type === 3;
         },
-        // 是否显示类别属性字段(只有对口和专升本才显示)
+        // 是否显示类别属性字段
         showAttrTypeField() {
-            return this.formData.type === 2 || this.formData.type === 3;
+            // 所有类型都显示类别属性字段
+            return this.formData.type === 1 || this.formData.type === 2 || this.formData.type === 3;
+        },
+        // 根据当前表单类型动态获取类别属性选项
+        currentAttrTypeOptions() {
+            if (this.formData.type === 1) {
+                // 单招:只显示职业适应性测试视频课
+                return { 3: '职业适应性测试视频课' };
+            } else if (this.formData.type === 2 || this.formData.type === 3) {
+                // 对口和专升本:显示文化基础和19专业大类
+                return { 1: "文化基础", 2: '19专业大类' };
+            }
+            return {};
+        },
+        // 搜索表单的类别属性选项(根据搜索的类型)
+        searchAttrTypeOptions() {
+            if (this.table.where.type === 1) {
+                // 单招:只显示职业适应性测试视频课
+                return { 3: '职业适应性测试视频课' };
+            } else if (this.table.where.type === 2 || this.table.where.type === 3) {
+                // 对口和专升本:显示文化基础和19专业大类
+                return { 1: "文化基础", 2: '19专业大类' };
+            }
+            // 未选择类型时显示所有
+            return this.attrTypeOptions;
         }
     },
     watch: {
         // 监听类型变化,自动设置 attr_type
         'formData.type'(newType) {
             if (newType === 1) {
-                // 单招时设置为0
-                this.formData.attr_type = 0;
+                // 单招时默认设置为职业适应性测试视频课
+                this.formData.attr_type = 3;
             } else if (newType === 2 || newType === 3) {
-                // 对口和专升本时设置为null(可选)
+                // 对口和专升本时清空,让用户自己选择
                 this.formData.attr_type = null;
             }
         }
@@ -206,13 +231,13 @@ export default {
                 this.formData = {
                     ...row,
                     type: Number(row.type),
-                    attr_type: row.attr_type ? Number(row.attr_type) : (Number(row.type) === 1 ? 0 : null),
+                    attr_type: row.attr_type ? Number(row.attr_type) : (Number(row.type) === 1 ? 3 : null),
                     description: row.description || "",
                     icon: row.icon || ""
                 }; // 转成数字
             } else {
                 this.isEdit = false;
-                this.formData = { id: null, subject_name: "", type: 1, attr_type: 0, description: "", icon: "", sort: 0, status: 1 };
+                this.formData = { id: null, subject_name: "", type: 1, attr_type: 3, description: "", icon: "", sort: 0, status: 1 };
             }
             this.formVisible = true;
         },

+ 23 - 7
addons/admin/src/views/system/article/components/ArticleForm.vue

@@ -12,7 +12,7 @@
                     <el-form-item label="标题:" prop="title">
                         <el-input v-model="formData.title" placeholder="请输入标题" clearable />
                     </el-form-item>
-                    <el-form-item label="作者:" prop="author">
+                    <el-form-item label="作者:" prop="author" v-if="!isSmartReply">
                         <el-input v-model="formData.author" placeholder="请输入作者" clearable />
                     </el-form-item>
                     <el-form-item label="状态:" prop="status">
@@ -61,15 +61,31 @@ export default {
                 { id: 4, name: 'VIP购买协议' },
                 { id: 9, name: '智能问答' },
             ],
-            rules: {
-                title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
-                author: [{ required: true, message: '请输入标题', trigger: 'blur' }],
-                type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
-                content: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
-            },
         }
     },
     computed: {
+        // 判断是否为智能问答类型
+        isSmartReply() {
+            const currentType = this.defaultType || this.formData.type;
+            const b = currentType == 9;
+            console.log('isSmartReply', b, this.defaultType)
+            return b;
+        },
+        // 动态验证规则
+        rules() {
+            const baseRules = {
+                title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
+                type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
+                content: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
+            };
+
+            // 智能问答不需要验证作者
+            if (!this.isSmartReply) {
+                baseRules.author = [{ required: true, message: '请输入作者', trigger: 'blur' }];
+            }
+
+            return baseRules;
+        },
         editorConfig() {
             return {
                 menubar: false,