ZZJ
2022-04-02 45faaf27722588e92050e2e3eace9b3704377048
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,15 +76,7 @@
</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 {
  mounted() {
@@ -106,7 +98,7 @@
        { id: "bitmain", name: "bitmain" },
      ],
      targetPlatformId: "all",
      productLabelId: "",
      productLabelId: 0,
      elvChip: "all",
      size: 12,
      publishStatus: 1,
@@ -121,27 +113,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 +135,6 @@
      this.getProductList();
    },
    getProductList(v) {
      console.log("--------------");
      let param = {
        page: v === 1 ? 1 : this.page,
        size: this.size,
@@ -164,7 +142,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 +167,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) {