Просмотр исходного кода

完善轮播图传参、文章列表查询新增标题条件

yellowtaotao 3 лет назад
Родитель
Сommit
3b8949450c

+ 10 - 10
src/styles/components/index.less

@@ -193,17 +193,17 @@
   .exam-question-edit-row-left {
   }
   .exam-question-edit-row-right {
-    .exam-question-edit-search {
-      display: flex;
-      align-items: center;
-      .exam-question-edit-search-title {
-        flex-wrap: nowrap;
-        white-space: nowrap;
-      }
-    }
   }
-  .exam-question-edit-btn {
-    margin-left: @paddingMarginVal;
+}
+.exam-question-edit-btn {
+  margin-left: @paddingMarginVal;
+}
+.exam-question-edit-search {
+  display: flex;
+  align-items: center;
+  .exam-question-edit-search-title {
+    flex-wrap: nowrap;
+    white-space: nowrap;
   }
 }
 // 试题列表中的筛选条件样式--------end

+ 27 - 10
src/views/articleManagement/articleCarouselUpload.vue

@@ -126,6 +126,15 @@
                 >{{ item.name }}</a-select-option
               >
             </a-select>
+            <div class="exam-question-edit-search exam-question-edit-btn">
+              <span class="exam-question-edit-search-title">搜索:</span>
+              <a-input-search
+                v-model="searchInputVal"
+                placeholder="请输入试题内容关键字"
+                :maxLength="100"
+                @search="searchInputFun"
+              />
+            </div>
           </div>
         </div>
       </div>
@@ -188,6 +197,7 @@ export default {
         current: 1,
         total: 0,
       }, // 分页参数
+      searchInputVal: '', // 搜索name
     };
   },
   created() {
@@ -294,9 +304,9 @@ export default {
       };
       this.$_http
         .post(this.$_API.INTERFACE_POST_CAROUSELS_ADD, params)
-        .then(() => {
+        .then((res) => {
           this.loading = false;
-          this.handleShowDialog(data); // 操作:打开弹框
+          this.handleShowDialog(res.data, true); // 操作:打开弹框
         })
         .catch((err) => {
           this.$message.error(`${err.response.data}`);
@@ -304,22 +314,29 @@ export default {
         });
     },
     // 操作:打开弹框
-    handleShowDialog(data) {
+    handleShowDialog(data, isUpload) {
       if (!data) {
         return;
       }
       this.toBindCarouselData = data;
+      this.toBindCarouselData.isUpload = isUpload; // 是否是新建轮播图
       this.getArticleListFun(); // 查询:文章列表数据
       this.isVisible = true;
     },
     // 操作:关闭弹框
     handleCloseDialog() {
+      this.searchInputVal = '';
       this.toBindCarouselData = null;
       this.articleArticleType = this.articleTypeList[0].id;
       this.articleTypeChildrenList = [{ name: '全部', id: '' }];
       this.initPagination(); // 初始化分页参数
-      this.getCarouselListFun(); // 查询:轮播图列表
       this.isVisible = false;
+      this.getCarouselListFun(); // 查询:轮播图列表
+    },
+    // 操作:搜索
+    searchInputFun() {
+      this.initPagination(); // 初始化分页参数
+      this.getArticleListFun(); // 查询:试题列表数据
     },
     // 查询:文章分类-父类
     getArticleTypeFun() {
@@ -365,6 +382,7 @@ export default {
         engineertypeid: this.engineeringWorkChooseValue, // 工种ID
         page: this.pagination.current - 1,
         size: this.pagination.pageSize,
+        materialtitle: this.searchInputVal,
       };
       this.$_http
         .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })
@@ -456,19 +474,18 @@ export default {
       }
       this.loading = true;
       let params = {
+        id: this.toBindCarouselData.id,
         materialId: record.id,
-        imageUrl: this.toBindCarouselData.url
-          ? this.toBindCarouselData.url
-          : this.toBindCarouselData.imageUrl,
+        imageUrl: this.toBindCarouselData.imageUrl,
       };
       this.$_http
         .put(this.$_API.INTERFACE_POST_CAROUSELS_ADD, params)
         .then((res) => {
           if (res.success && res.data) {
-            if (this.toBindCarouselData.id) {
-              this.$message.success(`修改绑定文章成功`);
-            } else {
+            if (this.toBindCarouselData.isUpload) {
               this.$message.success(`成功上传一张轮播图并绑定了文章`);
+            } else {
+              this.$message.success(`修改绑定文章成功`);
             }
           } else {
             this.$message.error(`${res.data || res.message}`);

+ 16 - 0
src/views/articleManagement/articleList.vue

@@ -51,6 +51,15 @@
               >
             </a-select>
             <!-- <a-button type="primary" style="margin-left: 16px;" @click="handleAddArticleItem()">添加文章</a-button> -->
+            <div class="exam-question-edit-search exam-question-edit-btn">
+              <span class="exam-question-edit-search-title">搜索:</span>
+              <a-input-search
+                v-model="searchInputVal"
+                placeholder="请输入试题内容关键字"
+                :maxLength="100"
+                @search="searchInputFun"
+              />
+            </div>
           </div>
         </div>
       </div>
@@ -158,6 +167,7 @@ export default {
         current: 1,
         total: 0,
       }, // 分页参数
+      searchInputVal: '', // 搜索name
     };
   },
   created() {},
@@ -220,6 +230,11 @@ export default {
           this.loading = false;
         });
     },
+    // 操作:搜索
+    searchInputFun() {
+      this.initPagination(); // 初始化分页参数
+      this.getArticleListFun(); // 查询:试题列表数据
+    },
     // 查询:文章列表数据
     getArticleListFun() {
       this.loading = true;
@@ -228,6 +243,7 @@ export default {
         engineertypeid: this.engineeringWorkChooseValue, // 工种ID
         page: this.pagination.current - 1,
         size: this.pagination.pageSize,
+        materialtitle: this.searchInputVal,
       };
       this.$_http
         .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })