杨磊
3 天以前 a5abb70a428f59894fc9ee4330f0033d6fe93a8b
src/views/achievements/index.vue
@@ -10,7 +10,7 @@
        <!-- 搜索框 -->
        <ul class="page-input">
          <li class="input-main">
            <SearchBox />
            <SearchBox @search="handleSearch" />
          </li>
          <li class="input-txt" @click="isDisplay = !isDisplay">
            高级检索
@@ -131,7 +131,7 @@
            <!-- 共xx条 -->
            <ul class="right-number">
              <ul class="number-number">
                共找到<span>{{ resultList.length }}</span>条结果
                共找到<span>{{ this.total }}</span>条结果
              </ul>
              <ul class="number-time">
                发表时间
@@ -148,27 +148,28 @@
                </p>
              </li>
              <li class="main-sources">
                <span>{{ item.type }}</span>
                <span>{{ item.sources }}</span>
                <span>{{ item.time }}</span>
                <span>{{ item.resourceTypeName }}</span>
                <span>{{ item.source }}</span>
                <span>{{ item.year }}</span>
              </li>
              <li class="main-author">
                {{ item.author }}
              </li>
              <li class="main-title" :title="item.title">
                <span>摘要: </span>{{ item.title }}
              <li class="main-title" :title="item.abstract">
                <span>摘要: </span>
                <span class="page-main-abstract" v-html="item.abstract"></span>
              </li>
              <li class="main-keyword">
                <span>关键词:</span>
                <span class="keyWord" v-for="(citem, cindex) in item.keyword" :key="cindex">
                  {{ citem.name }}
                <span class="keyWord" v-for="(citem, cindex) in item.keyWords" :key="cindex">
                  {{ citem }}
                </span>
              </li>
            </ul>
            <!-- 分页 -->
            <div class="pagination">
              <el-pagination class="msg-pagination-container" :background="isBackground" layout="prev, pager, next"
                :total="200">
              <el-pagination @current-change="handleCurrentChange" class="msg-pagination-container"
                :background="isBackground" layout="prev, pager, next" :total="total">
              </el-pagination>
            </div>
          </div>
@@ -181,6 +182,8 @@
<script>
import MyForm from "@/components/form/form.vue";
import SearchBox from "@/views/home/components/searchBox.vue";
import MG from "@/assets/js/middleGround/WebMiddleGroundApi.js";
import moment from "moment";
/* eslint-disable vue/no-unused-components */
export default {
  name: "achievements",
@@ -190,6 +193,8 @@
  },
  data() {
    return {
      subjectAffiliationRefCode: "subjectAffiliation",
      resourceTypeRefCode: "resourceType",
      errorIcon: require("@/assets/images/achievements/errorIcon.png"),
      topIcon: require("@/assets/images/achievements/top-Icon.png"),
      bottomIcon: require("@/assets/images/achievements/bottom-Icon.png"),
@@ -571,7 +576,16 @@
          ],
        },
      ],
      total: 0,
      currentPage: 1,
      loading: false,
    };
  },
  mounted() {
    this.getSelectContent();
    this.getLeftCheckbox()
    this.getSelectData();
    this.getItemList()
  },
  methods: {
@@ -582,6 +596,7 @@
    },
    // 页面跳转
    goPage(key) {
      console.log(key,"key");
      this.$router.push({ name: "details", params: { key: key } });
    },
    // 收起和展示
@@ -602,6 +617,88 @@
        this.activeBox = this.activeBox === "b" ? null : "b";
      }
    },
    // 获取左侧checkbox数据
    getLeftCheckbox() {
    },
    //获取下拉选择框的内容
    async getSelectData() {
      try {
        // 同时发起两个异步请求,并等待它们的结果
        const [subjectListResult, resourceListResult] = await Promise.all([
          this.getSelectContent(this.subjectAffiliationRefCode),
          this.getSelectContent(this.resourceTypeRefCode),
        ]);
        this.subject.list = subjectListResult.option
        this.category.list = resourceListResult.option;
      } catch (error) {
        console.error("获取下拉框数据失败:", error);
      }
    },
    //获取选择内容
    getSelectContent(refCode) {
      let requestData = { refCodes: [refCode] };
      return MG.store
        .getProductTypeField(requestData)
        .then((res) => {
          const selestList = JSON.parse(res[0].config);
          this.getLeftCheckbox()
          return selestList;
        })
        .catch((error) => {
          console.error("获取荣誉失败:", error);
          return null;
        });
    },
    // 搜索
    handleSearch(text, type) {
      console.log(1234);
      console.log(text, type, "搜索123");
    },
    // getTtem
    getItemList() {
      this.loading = true;
      MG.resource
        .getItem({
          path: "*",
          queryType: "*",
          paging: {
            start: (this.currentPage - 1) * 6,
            size: 6
          },
          fields: {
            cmsType: ["cmsItem"],
            resourceType: [],
            source: [],
            year: [],
            abstract: [],
            keyWords: [],
          },
        })
        .then((res) => {
          console.log(res, "全部数据");
          res.datas.forEach((item) => {
            item.year = moment(item.year).format("YYYY-MM-DD")
            item.keyWords = item.keyWords.split(";;")
            item.resourceTypeName = this.category.list.find((citem) => citem.value == item.resourceType).name
          })
          this.resultList = res.datas
          this.total = res.total;
          this.loading = false;
        })
    },
    // 处理页码变化
    handleCurrentChange(newPage) {
      this.currentPage = newPage;
      this.getItemList(); // 重新获取数据
    },
  },
};
</script>
@@ -644,6 +741,7 @@
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 1292px;
  overflow: auto;
  padding-top: 1%;
  padding-bottom: 2%;
@@ -1029,6 +1127,14 @@
        }
      }
      .page-main-abstract {
      font-family: Source Han Sans !important;
      font-size: 14px !important;
      font-weight: 350 !important;
      line-height: 26px !important;
      color: #333333 !important;
    }
      .main-keyword {
        span:nth-child(1) {
          font-family: Source Han Sans;