From f7f0e44c4be8eb0e77fd310296c3b43bde21e4f9 Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期四, 23 六月 2022 14:17:01 +0800
Subject: [PATCH] 新增联动场景
---
src/views/product/components/ProductContent.vue | 62 ++++++++++---------------------
1 files changed, 20 insertions(+), 42 deletions(-)
diff --git a/src/views/product/components/ProductContent.vue b/src/views/product/components/ProductContent.vue
index 193763d..d7280ee 100644
--- a/src/views/product/components/ProductContent.vue
+++ b/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) {
@@ -215,6 +191,7 @@
.Content {
position: relative;
width: 1280px;
+ min-height: calc(100vh - 148px);
margin: 0 auto;
.searchCard {
@@ -282,6 +259,7 @@
font-size: 14px;
border-radius: 0;
border: 1px solid #fff;
+ color: #3d3d3d;
&.selected {
border: 1px solid #0065ff;
--
Gitblit v1.8.0