Browse Source

删除用户搜索记录

natasha 1 year ago
parent
commit
dc81df3f98

+ 13 - 3
src/views/dictionary/index.vue

@@ -20,7 +20,7 @@
         <ul>
           <li v-for="(item, index) in lastSearchList" :key="index">
             <b @click="goto(item)">{{ item }}</b>
-            <i class="el-icon-close" @click="handleDelete(index)"></i>
+            <i class="el-icon-close" @click="handleDelete(item, index)"></i>
           </li>
         </ul>
       </div>
@@ -68,8 +68,18 @@ export default {
   //方法集合
   methods: {
     // 删除热门查询某条
-    handleDelete(index) {
-      this.lastSearchList.splice(index, 1);
+    handleDelete(item, index) {
+      let MethodName = "/PaperServer/Client/Dict/DelUserSearchWord";
+      let data = {
+        word: item,
+      };
+      getLogin(MethodName, data).then((res) => {
+        if (res.status === 1 && res.data) {
+          this.lastSearchList.splice(index, 1);
+        } else {
+          this.$message.warning("请稍后重试");
+        }
+      });
     },
     goto(content) {
       this.$router.push({

+ 45 - 4
src/views/evaluation/evaluDetail.vue

@@ -27,7 +27,11 @@
           <template v-if="questionDetailList[activeIndex]">
             <!-- <template v-if="item.type==='single'"> -->
             <div class="title-box">
-              <b>{{ activeIndex + 1 }}.</b>
+              <b>{{
+                questionDetailList[activeIndex].content.contentArr.length > 1
+                  ? ""
+                  : activeIndex + 1 + "."
+              }}</b>
               <div>
                 <div
                   class="aduioLine-content aduioLine-box"
@@ -42,7 +46,30 @@
                     :colorObj="colorObj"
                   />
                 </div>
-                <h5>{{ questionDetailList[activeIndex].content.content }}</h5>
+                <template
+                  v-for="(items, indexs) in questionDetailList[activeIndex]
+                    .content.contentArr"
+                >
+                  <h5
+                    :key="indexs"
+                    :class="[
+                      questionDetailList[activeIndex].content.contentArr
+                        .length > 1
+                        ? indexs === 0 ||
+                          indexs ===
+                            questionDetailList[activeIndex].content.contentArr
+                              .length -
+                              1
+                          ? 'read-title'
+                          : indexs > 2
+                          ? 'margin-bottom'
+                          : ''
+                        : 'single-title',
+                    ]"
+                  >
+                    {{ items }}
+                  </h5>
+                </template>
               </div>
             </div>
             <el-radio-group v-model="userSelect[activeIndex]">
@@ -413,6 +440,9 @@ export default {
         id: this.question_list[index].question_id,
       }).then((res) => {
         if (res.status === 1) {
+          if (res.content && res.content.content) {
+            res.content.contentArr = res.content.content.split("\n");
+          }
           this.questionDetailList[index] = res;
           this.questionInfo = res;
         }
@@ -493,9 +523,20 @@ export default {
       h5 {
         margin: 0;
         color: #000;
-        font-size: 24px;
+        font-size: 14px;
         font-weight: 400;
-        line-height: 32px;
+        line-height: 26px;
+        &.single-title {
+          font-size: 24px;
+          line-height: 32px;
+          font-weight: 700;
+        }
+        &.read-title {
+          font-weight: 700;
+        }
+        &.margin-bottom {
+          margin: 0 0 16px 0;
+        }
       }
     }
     .el-radio-group {

+ 13 - 3
src/views/search/index.vue

@@ -24,7 +24,7 @@
         <ul>
           <li v-for="(item, index) in lastSearchList" :key="index">
             <b @click="goto(item)">{{ item }}</b>
-            <i class="el-icon-close" @click="handleDelete(index)"></i>
+            <i class="el-icon-close" @click="handleDelete(item, index)"></i>
           </li>
         </ul>
       </div>
@@ -79,8 +79,18 @@ export default {
   //方法集合
   methods: {
     // 删除热门查询某条
-    handleDelete(index) {
-      this.lastSearchList.splice(index, 1);
+    handleDelete(item, index) {
+      let MethodName = "/PaperServer/Client/Search/DelUserSearchWord";
+      let data = {
+        word: item,
+      };
+      getLogin(MethodName, data).then((res) => {
+        if (res.status === 1 && res.data) {
+          this.lastSearchList.splice(index, 1);
+        } else {
+          this.$message.warning("请稍后重试");
+        }
+      });
     },
     goto(content) {
       this.$router.push({

+ 36 - 53
src/views/search/searchDetail.vue

@@ -41,15 +41,12 @@
         </ul> -->
         <ul v-if="gradeList && gradeList.length > 0" class="gradelist">
           <li
-            :class="[
-              'gradeitem',
-              itemG.study_phase === gradeIndex ? 'active' : '',
-            ]"
+            :class="['gradeitem', itemG.id === gradeIndex ? 'active' : '']"
             v-for="(itemG, indeG) in gradeList"
             :key="indeG"
-            @click="handleTypeIndex('gradeIndex', itemG.study_phase)"
+            @click="handleTypeIndex('gradeIndex', itemG.id)"
           >
-            {{ itemG.study_phase_name }}
+            {{ itemG.name }}
           </li>
         </ul>
         <ul v-if="yearList && yearList.length > 0" class="gradelist">
@@ -166,7 +163,12 @@ export default {
         ? this.$route.query.selectIndex * 1
         : 0,
       typeIndex: 0,
-      gradeList: [],
+      gradeList: [
+        {
+          name: "全部",
+          id: null,
+        },
+      ],
       yearList: [
         {
           label: "全部",
@@ -262,50 +264,7 @@ export default {
       this.currentPage = val;
       this.searchArticle();
     },
-    // 学段列表
-    getStudyList() {
-      let MethodName = "/OrgServer/DictManager/GetStudyPhaseList";
-      getLogin(MethodName, {})
-        .then((res) => {
-          if (res.status === 1) {
-            let gradeList = [
-              {
-                study_phase: null,
-                study_phase_name: "全部",
-              },
-            ];
-            this.gradeList = gradeList.concat(res.study_phase_list);
-          }
-        })
-        .catch(() => {});
-    },
-    // 获取年份列表
-    getYearList() {
-      this.yearList = [
-        {
-          value: null,
-          label: "全部",
-        },
-      ];
-      let yearList = [];
-      let MethodName = "/ShopServer/Client/ShopHomeQuery/GetIssueYearLabelList";
-      getLogin(MethodName, {
-        goods_type: 2,
-      })
-        .then((res) => {
-          if (res.status === 1) {
-            res.year_label_list.forEach((nowYear) => {
-              let obj = {
-                value: nowYear,
-                label: nowYear,
-              };
-              yearList.push(obj);
-            });
-            this.yearList = this.yearList.concat(yearList);
-          }
-        })
-        .catch(() => {});
-    },
+
     // 查询搜索内容
     searchArticle() {
       this.loading = true;
@@ -337,6 +296,32 @@ export default {
           if (res.status === 1) {
             this.courseTotal = res.data.total;
             this.searchList = res.data.results;
+            this.yearList = [
+              {
+                value: null,
+                label: "全部",
+              },
+            ];
+            let yearList = [];
+            if (res.data.exData && res.data.exData.years) {
+              res.data.exData.years.forEach((nowYear) => {
+                let obj = {
+                  value: nowYear,
+                  label: nowYear,
+                };
+                yearList.push(obj);
+              });
+            }
+            this.yearList = this.yearList.concat(yearList);
+            if (res.data.exData && res.data.exData.studyPhases) {
+              let gradeList = [
+                {
+                  id: null,
+                  name: "全部",
+                },
+              ];
+              this.gradeList = gradeList.concat(res.study_phase_list);
+            }
           }
         })
         .catch(() => {
@@ -357,8 +342,6 @@ export default {
       this.headerBorder = arr[2];
       this.headerBg = arr[3];
     }
-    this.getStudyList();
-    this.getYearList();
     this.searchArticle();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)