mark
2022-10-25 f20a554bdb24e9dfde9dc6a69d78595944f61d15
src/views/product/components/ProductContent.vue
@@ -13,9 +13,9 @@
            size="mini"
            v-for="(item, index) in types"
            :key="index + 't'"
            :class="productLabelId == item.id ? 'selected' : ''"
            :class="productLabelId == item.productType ? 'selected' : ''"
            class="type-label"
            @click="selectType(item.id)"
            @click="selectType(item.productType)"
            >{{ item.name }}</el-button
          >
        </div>
@@ -59,7 +59,7 @@
        :data="item"
        v-for="(item, index) in dataList"
        :key="index"
        :labels="getLabel(item.productLabelId)"
        :labels="getLabel(item.productType)"
      >
      </productCard>
    </div>
@@ -76,17 +76,14 @@
</template>
<script>
import {
  findAllCenterProduct,
  findDicByType,
  // getReleaseProduct,
} from "@/api/product";
// import { activeByCode, showDetail } from "../api/code";
// import { findDevListByUser } from "../api/device";
// import { addShopcartProd, resumeOrder } from "../api/shopcart";
// import request from "../api/index";
import { findAllCenterProduct, findDicByType } from "@/api/product";
import productCard from "@/views/product/components/productCard";
export default {
  created() {
    if (this.$route.query.keyWord) {
      this.inputText = this.$route.query.keyWord;
    }
  },
  mounted() {
    this.getDic();
    this.getProductList();
@@ -106,7 +103,7 @@
        { id: "bitmain", name: "bitmain" },
      ],
      targetPlatformId: "all",
      productLabelId: "",
      productLabelId: 0,
      elvChip: "all",
      size: 12,
      publishStatus: 1,
@@ -121,27 +118,14 @@
  },
  methods: {
    getDic() {
      findDicByType()
        .then((res) => {
          let dics = res.data.dics.filter(
            (item) => item.type === "PRODUCTLABEL"
          );
          this.types = dics;
          this.types.unshift({
            id: "",
            name: "全部",
          });
          this.labelDics = res.data.dics;
        })
        .catch((err) => {
          console.log(err);
          this.$notify({
            type: "error",
            message: "标签获取失败",
            duration: 2500,
            offset: 57,
          });
      findDicByType().then((res) => {
        this.types = res.data.list;
        this.types.unshift({
          productType: 0,
          name: "全部",
        });
        this.labelDics = res.data.list;
      });
    },
    selectType(id) {
      this.productLabelId = id;
@@ -156,7 +140,6 @@
      this.getProductList();
    },
    getProductList(v) {
      console.log("--------------");
      let param = {
        page: v === 1 ? 1 : this.page,
        size: this.size,
@@ -164,7 +147,7 @@
        archType: this.targetPlatformId == "all" ? "" : this.targetPlatformId,
        gpuType: this.elvChip == "all" ? "" : this.elvChip,
        publishStatus: this.publishStatus,
        productLabelId: this.productLabelId,
        productType: this.productLabelId,
      };
      findAllCenterProduct(param)
        .then((res) => {
@@ -189,14 +172,12 @@
          });
        });
    },
    getLabel(ids) {
    getLabel(id) {
      let arr = [];
      ids.forEach((id) => {
        let obj = this.labelDics.filter((item) => item.id == id);
        if (obj.length > 0) {
          arr.push(obj[0].name);
        }
      });
      let obj = this.labelDics.filter((item) => item.productType == id);
      if (obj.length > 0) {
        arr.push(obj[0].name);
      }
      return arr;
    },
    refresh(page) {
@@ -215,6 +196,7 @@
.Content {
  position: relative;
  width: 1280px;
  min-height: calc(100vh - 148px);
  margin: 0 auto;
  .searchCard {
@@ -282,6 +264,7 @@
        font-size: 14px;
        border-radius: 0;
        border: 1px solid #fff;
        color: #3d3d3d;
        &.selected {
          border: 1px solid #0065ff;