bugfix
This commit is contained in:
parent
3eedb6f8b4
commit
c3e268c640
@ -267,7 +267,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init_company_category() {
|
||||
reqCompanyCategorySearch({ userid: '9KVhsVCJsW_29q3hRhMAr' }).then(res => {
|
||||
reqCompanyCategorySearch({url_link:window.location.href}).then(res => {
|
||||
if (res.status) {
|
||||
this.company_category_list = []
|
||||
for (let item of res.data) {
|
||||
@ -292,7 +292,7 @@ export default {
|
||||
},
|
||||
|
||||
init_product_category() {
|
||||
reqGetProductCategorySearch({ userid: '9KVhsVCJsW_29q3hRhMAr' }).then(res => {
|
||||
reqGetProductCategorySearch({ url_link: window.location.href,to_page: 'publish' }).then(res => {
|
||||
if (res.status) {
|
||||
this.typeList = buildCaTree(res.data)
|
||||
console.log("2@@", this.typeList);
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<!-- 新增的需求和商品radio按钮组 -->
|
||||
<div class="radio-group-container">
|
||||
<div class="radio-group">
|
||||
<label class="radio-item" :class="{ active: selectedType === 'product' }">
|
||||
<label class="radio-item" style="margin-right: 0px;" :class="{ active: selectedType === 'product' }">
|
||||
<input type="radio" v-model="selectedType" value="product" @change="handleTypeChange">
|
||||
<span class="radio-text">企业商品</span>
|
||||
</label>
|
||||
@ -48,9 +48,9 @@
|
||||
<div class="category-title">公司类别</div>
|
||||
<div class="category-tags">
|
||||
<span v-for="company in companies" :key="company.id"
|
||||
:class="['category-tag', { active: selectedCompany === company.id }]"
|
||||
@click="selectCompany(company.id)">
|
||||
{{ company.name }}
|
||||
:class="['category-tag', { active: selectedCompanies.includes(company.value) }]"
|
||||
@click="selectCompany(company.value)">
|
||||
{{ company.label }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,7 +66,8 @@
|
||||
</div>
|
||||
<!-- 返回 -->
|
||||
<div class="back-btn" @click="$router.push('/ncmatchHome/index')">
|
||||
<span><返回</span>
|
||||
<span>
|
||||
返回 </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -74,7 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reqGetProductCategorySearch, reqGetSupplyAndDemandSquareList } from '@/api/ncmatch'
|
||||
import { reqGetProductCategorySearch, reqGetSupplyAndDemandSquareList, reqCompanyCategorySearch } from '@/api/ncmatch'
|
||||
export default {
|
||||
name: 'supplyAndDemandSquare',
|
||||
components: {
|
||||
@ -82,43 +83,52 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page_size: 8,
|
||||
current_page: 1,
|
||||
typeList: [],
|
||||
selectedType: 'product', // 默认选中需求
|
||||
selectedCategory: '', // 默认选中项
|
||||
selectedCompany: 'company1', // 默认选中项
|
||||
categories: [
|
||||
{ id: 'category1', name: '云' },
|
||||
{ id: 'category2', name: '国产算力' },
|
||||
{ id: 'category3', name: 'NVIDIA' },
|
||||
{ id: 'category4', name: '网络服务' },
|
||||
{ id: 'category5', name: '一体机' },
|
||||
{ id: 'category6', name: '硬件' },
|
||||
{ id: 'category7', name: 'AI应用' },
|
||||
{ id: 'category8', name: '其他' }
|
||||
],
|
||||
companies: [
|
||||
{ id: 'company1', name: '龙头企业' },
|
||||
{ id: 'company2', name: '骨干企业' },
|
||||
{ id: 'company3', name: '科技型企业' },
|
||||
{ id: 'company4', name: '专精特新企业' },
|
||||
{ id: 'company5', name: '高新技术企业' },
|
||||
{ id: 'company6', name: '科技小巨人领军企业' },
|
||||
{ id: 'company7', name: '其他' }
|
||||
],
|
||||
selectedCompanies: [], // 默认选中项,改为数组支持多选
|
||||
categories: [],
|
||||
companies: [],
|
||||
productList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init_product_category()
|
||||
this.initAllData()
|
||||
},
|
||||
methods: {
|
||||
initAllData() {
|
||||
Promise.all([
|
||||
this.init_product_category(),
|
||||
this.init_company_category()
|
||||
]).then(() => {
|
||||
this.initData(this.selectedCategory)
|
||||
})
|
||||
|
||||
},
|
||||
init_company_category() {
|
||||
reqCompanyCategorySearch({ url_link: window.location.href }).then(res => {
|
||||
if (res.status) {
|
||||
this.company_category_list = []
|
||||
for (let item of res.data) {
|
||||
this.company_category_list.push({
|
||||
label: item.company_category,
|
||||
value: item.company_category
|
||||
})
|
||||
}
|
||||
|
||||
this.companies = this.company_category_list
|
||||
}
|
||||
})
|
||||
},
|
||||
selectCategory(categoryId) {
|
||||
if (categoryId === this.selectedCategory) return;
|
||||
this.selectedCategory = categoryId
|
||||
this.initData(this.selectedCategory)
|
||||
},
|
||||
init_product_category(product_category) {
|
||||
reqGetProductCategorySearch({ userid: '9KVhsVCJsW_29q3hRhMAr' }).then(res => {
|
||||
reqGetProductCategorySearch({ url_link: window.location.href, to_page: 'publish' }).then(res => {
|
||||
if (res.status) {
|
||||
let list = []
|
||||
for (let item of res.data) {
|
||||
@ -130,10 +140,8 @@ export default {
|
||||
}
|
||||
|
||||
}
|
||||
this.selectedCategory = list[0].value
|
||||
// this.selectedCategory = list[0].value
|
||||
this.typeList = list
|
||||
this.initData(this.selectedCategory)
|
||||
console.log("2@@", this.typeList);
|
||||
|
||||
}
|
||||
})
|
||||
@ -143,8 +151,16 @@ export default {
|
||||
console.log('切换到:', this.selectedType)
|
||||
// 这里可以根据类型重新加载数据
|
||||
},
|
||||
initData(product_category) {
|
||||
reqGetSupplyAndDemandSquareList({product_category,to_page:"square",url_link:window.location.href}).then(res => {
|
||||
initData() {
|
||||
let ploay = {
|
||||
product_category: this.selectedCategory,
|
||||
to_page: "square",
|
||||
url_link: window.location.href,
|
||||
page_size: this.page_size,
|
||||
current_page: this.current_page,
|
||||
company_type: this.selectedCompanies.length > 0 ? this.selectedCompanies.join(",") : ""
|
||||
}
|
||||
reqGetSupplyAndDemandSquareList(ploay).then(res => {
|
||||
if (res.status) {
|
||||
if (res.data.length === 0) {
|
||||
this.productList = []
|
||||
@ -157,7 +173,16 @@ export default {
|
||||
|
||||
},
|
||||
selectCompany(companyId) {
|
||||
this.selectedCompany = companyId
|
||||
const index = this.selectedCompanies.indexOf(companyId)
|
||||
if (index > -1) {
|
||||
// 如果已选中,则取消选中
|
||||
this.selectedCompanies.splice(index, 1)
|
||||
} else {
|
||||
// 如果未选中,则添加到选中列表
|
||||
this.selectedCompanies.push(companyId)
|
||||
}
|
||||
console.log("this.selectedCompanies", this.selectedCompanies);
|
||||
this.initData()
|
||||
},
|
||||
getProductList() {
|
||||
this.productList = [
|
||||
@ -229,11 +254,13 @@ export default {
|
||||
margin-top: 20px;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: #275AFF;
|
||||
}
|
||||
}
|
||||
|
||||
/* 新增的radio按钮组样式 */
|
||||
.radio-group-container {
|
||||
width: 100% !important;
|
||||
@ -423,6 +450,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-data {
|
||||
min-height: 500px;
|
||||
display: flex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user