| | |
| | | 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> |
| | |
| | | :data="item" |
| | | v-for="(item, index) in dataList" |
| | | :key="index" |
| | | :labels="getLabel(item.productLabelId)" |
| | | :labels="getLabel(item.productType)" |
| | | > |
| | | </productCard> |
| | | </div> |
| | |
| | | </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() { |
| | |
| | | { id: "bitmain", name: "bitmain" }, |
| | | ], |
| | | targetPlatformId: "all", |
| | | productLabelId: "", |
| | | productLabelId: 0, |
| | | elvChip: "all", |
| | | size: 12, |
| | | publishStatus: 1, |
| | |
| | | }, |
| | | 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; |
| | |
| | | this.getProductList(); |
| | | }, |
| | | getProductList(v) { |
| | | console.log("--------------"); |
| | | let param = { |
| | | page: v === 1 ? 1 : this.page, |
| | | size: this.size, |
| | |
| | | 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) => { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | 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) { |