zhongshujie
1 天以前 ce7cf2f67ec29aef55a889574942c58c8d7737bd
src/views/achievements/index.vue
@@ -144,7 +144,7 @@
              <li class="main-name">
                <p>{{ item.name }}</p>
                <p>
                  <el-button @click="goPage(item)">详情</el-button>
                  <el-button @click="goPage(item.id)">详情</el-button>
                  <el-button>AI智能阅读</el-button>
                </p>
              </li>
@@ -157,11 +157,11 @@
              <li class="main-author">
                {{ item.author }}
              </li>
              <li class="main-title" :title="item.abstract">
              <li class="main-title" :title="item.cleanAbstract" v-if="item.abstract">
                <span>摘要: </span>
                <span class="page-main-abstract" v-html="item.abstract"></span>
              </li>
              <li class="main-keyword">
              <li class="main-keyword" v-if="item.keyWords && item.keyWords.length > 0">
                <span>关键词:</span>
                <span class="keyWord" v-for="(citem, cindex) in item.keyWords" :key="cindex">
                  {{ citem }}
@@ -175,6 +175,7 @@
              </el-pagination>
            </div>
          </div>
        </div>
      </div>
    </div>
@@ -195,6 +196,7 @@
  },
  data() {
    return {
      relatedList: [],
      // 输入框的内容
      inputValue: "",
      // 选择的类型
@@ -446,8 +448,6 @@
    };
  },
  mounted() {
    this.getSelectContent();
    this.getLeftCheckbox()
    this.getSelectData();
  },
@@ -458,9 +458,8 @@
      // this.onSearch("");
    },
    // 页面跳转
    goPage(key) {
      console.log(key, "key");
      this.$router.push({ name: "details", params: { key: key } });
    goPage(id) {
      this.$router.push({ name: "details", query: { id } });
    },
    // 收起和展示
    shrinkClick(key, name) {
@@ -479,11 +478,6 @@
        this.professionIndex = 4;
        this.activeBox = this.activeBox === "b" ? null : "b";
      }
    },
    // 获取左侧checkbox数据
    getLeftCheckbox() {
    },
    //获取下拉选择框的内容
@@ -515,7 +509,6 @@
        .getProductTypeField(requestData)
        .then((res) => {
          const selestList = JSON.parse(res[0].config);
          console.log(selestList, "下拉框数据");
          return selestList;
        })
        .catch((error) => {
@@ -530,13 +523,13 @@
        (item) => item.content !== value
      );
      this.inputValue = "";
      // 通知父组件数据已改变
      this.getItemList()
    },
    // 搜索
    handleSearch(isText) {
      console.log(1234);
      console.log(isText, "搜索123");
      this.associationList = []
      if (isText.text != "") {
        this.inputValue = isText.text
        this.inputType = isText.type
@@ -548,29 +541,30 @@
      }
    },
    // getTtem
    // 请求数据
    getItemList() {
      let searchData = {};
      if (this.inputValue) {
        if (this.inputType != "all") {
      let searchData = {}; // 初始化一个空对象来存储搜索数据
      if (this.inputValue) { // 如果输入值存在
        if (this.inputType != "all") { // 如果输入类型不是"all"
          // 将输入值与输入类型关联,并添加一个星号(*)作为后缀
          searchData[this.inputType + "*"] = this.inputValue;
        } else {
        } else { // 如果输入类型是"all"
          // 遍历输入选项
          for (let index = 0; index < this.inputOptions.length; index++) {
            const item = this.inputOptions[index];
            if (item.value !== "all" ) {
              console.log(item.value, "987");
              if (!Object.keys(searchData).length) {
                searchData[item.value + "*"] = this.inputValue
              } else {
                searchData["||" + item.value + "*"] = this.inputValue
            const item = this.inputOptions[index]; // 获取当前选项
            if (item.value !== "all") { // 如果当前选项的值不是"all"
              if (!Object.keys(searchData).length) { // 如果searchData是空的
                // 将第一个选项的值与输入值关联,并添加一个星号(*)作为后缀
                searchData[item.value + "*"] = this.inputValue;
              } else { // 如果searchData不是空的
                // 使用"||"作为前缀,将后续选项的值与输入值关联,并添加一个星号(*)作为后缀
                // 这通常用于构建一个逻辑或(OR)查询
                searchData["||" + item.value + "*"] = this.inputValue;
              }
            }
          }
        }
        console.log(searchData, "搜索数据123");
      }
      debugger
      MG.resource
        .getItem({
          path: "*",
@@ -595,7 +589,8 @@
          },
        })
        .then((res) => {
          console.log(res, "全部数据");
          console.log(res, "全部内容");
          res.datas.forEach((item) => {
            item.year = moment(item.year).format("YYYY-MM-DD")
            if (typeof item.keyWords === 'string') {
@@ -604,18 +599,29 @@
              // 设置一个默认值或者进行其他错误处理
              item.keyWords = [];
            }
            item.resourceTypeName = this.category.list.find((citem) => citem.value == item.cmsItemType).name
            // item.cleanAbstract = item.abstract.replace(/<[^>]+>/g, "");
            const foundItem = this.category.list.find((citem) => citem.value == item.cmsItemType);
            item.resourceTypeName = foundItem ? foundItem.name : '';
          })
          this.resultList = res.datas
          this.total = res.total;
          this.loading = false;
        })
    },
    // 处理页码变化
    handleCurrentChange(newPage) {
      this.paginationPage = newPage;
      this.getItemList(); // 重新获取数据
      // 滚动到页面顶部
      this.$nextTick(() => {
        const pageMain = document.querySelector('.page-main-father');
        if (pageMain) {
          pageMain.scrollTo({
            top: 0,
            behavior: 'smooth'
          });
        }
      });
    },
  },
@@ -660,7 +666,7 @@
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 1292px;
  min-width: 1250px;
  overflow: auto;
  padding-top: 1%;
  padding-bottom: 2%;
@@ -741,6 +747,7 @@
        background-color: transparent;
        color: #937950;
        border: 1px solid #6f5a3a;
        cursor: pointer;
        &:hover {
          background-color: #6f5a3a;
@@ -1132,4 +1139,4 @@
  border-radius: 5px;
  border: 1px solid #cccccc;
}
</style>
</style>