You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
5.7 KiB

<template>
<view class="container">
<view class="search-bar">
<u-search placeholder="请输入关键词" v-model="keyword" :show-action="false"></u-search>
</view>
<u-tabs :list="tabs" :is-scroll="false" :current="currentTab" @change="changeTab"></u-tabs>
<view class="list-container">
<view v-for="item in filteredList" :key="item.id" class="list-item">
<view class="item-header">
<view :class="['type-badge', item.type === 'supply' ? 'supply' : 'demand']">{{ item.type === 'supply' ? '供应' : '需求' }}</view>
<text class="time">{{ item.time }}</text>
</view>
<text class="title">{{ item.title }}</text>
<text class="description">{{ item.description }}</text>
<view class="tags">
<text v-for="tag in item.tags" :key="tag" class="tag">{{ tag }}</text>
</view>
<u-line color="#e8e8e8" margin="20rpx 0" />
<view class="item-footer">
<view class="user-info">
<u-avatar :src="item.user.avatar" size="60"></u-avatar>
<text class="user-name">{{ item.user.name }}</text>
</view>
<view class="actions">
<view class="view-button view-button-check" @click="goToDetail(item.id)">
<text class="button-text">查看</text>
</view>
<view class="view-button view-button-msg" @click="goToChat(item.user)">
<text class="button-text">私信</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="status" nomore-text="~" />
</view>
<image class="publish-image" :src="base.imgHost('publish.png')" @click="goToPublish"></image>
</view>
</template>
<script>
import uSearch from '@/uview-ui/components/u-search/u-search.vue';
import uLoadmore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
export default {
components: {
uSearch,
uLoadmore
},
data() {
return {
keyword: '',
currentTab: 0,
tabs: [{
name: '全部'
}, {
name: '供应'
}, {
name: '需求'
}],
list: [{
id: 1,
type: 'supply',
time: '2小时前',
title: '提供企业管理咨询服务',
description: '专业企业管理咨询团队具有10年以上行业经验擅长企业战略规划、组织架构优化、流程梳理等。已服务过多家上市公司...',
tags: ['管理咨询', '战略规划', '管理咨询'],
user: {
name: '张云',
avatar: 'https://via.placeholder.com/60'
}
},
{
id: 2,
type: 'demand',
time: '2小时前',
title: '提供企业管理咨询服务',
description: '我们是一家初创公司目前在开发一款AI智能客服产品需要寻找有经验的技术合作伙伴共同推进项目发展...',
tags: ['AI', '技术合作', '客服系统'],
user: {
name: '李经理',
avatar: 'https://via.placeholder.com/60'
}
}
],
status: 'nomore'
}
},
computed: {
filteredList() {
let list = this.list;
if (this.currentTab === 1) {
list = list.filter(item => item.type === 'supply');
} else if (this.currentTab === 2) {
list = list.filter(item => item.type === 'demand');
}
if (this.keyword) {
list = list.filter(item => item.title.includes(this.keyword) || item.description.includes(this.keyword));
}
return list;
}
},
methods: {
changeTab(index) {
this.currentTab = index;
},
goToPublish() {
uni.navigateTo({
url: '/packages/supply/publish'
})
},
goToDetail(id) {
uni.navigateTo({
url: `/packages/supply/detail?id=${id}`
})
},
goToChat(user) {
// 假设私信需要用户id
uni.navigateTo({
url: `/packages/chat/chatWindow?userId=${user.id}`
})
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #f5f5f5;
min-height: 100vh;
}
.search-bar {
padding: 20rpx;
background-color: #fff;
}
.list-container {
background: linear-gradient(to bottom, #e9f2fa, #e9f2fa);
padding: 20rpx;
min-height: calc(100vh - 180rpx);
/* Adjust as needed */
}
.list-item {
background-color: #fff;
border-radius: 20rpx;
padding: 25rpx;
margin-bottom: 20rpx;
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.type-badge {
font-size: 24rpx;
padding: 8rpx 15rpx;
border-radius: 10rpx;
}
.supply {
background-color: #fff0e6;
color: #f29100;
}
.demand {
background-color: #e6f0ff;
color: #007aff;
}
.time {
font-size: 24rpx;
color: #999;
}
.title {
font-size: 32rpx;
font-weight: bold;
display: block;
margin-bottom: 10rpx;
}
.description {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 30rpx;
display: block;
}
.tags {
display: flex;
flex-wrap: wrap;
}
.tag {
background-color: #f5f5f5;
color: #666;
font-size: 24rpx;
padding: 8rpx 15rpx;
border-radius: 30rpx;
margin-right: 15rpx;
margin-bottom: 10rpx;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.user-info {
display: flex;
align-items: center;
}
.user-name {
font-size: 28rpx;
margin-left: 15rpx;
}
.actions {
display: flex;
align-items: center;
}
.view-button {
width: 150rpx;
height: 60rpx;
border-radius: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.view-button-check {
background: linear-gradient(to right, #e3ccb2, #cba579);
margin-right: 20rpx;
}
.view-button-msg {
background: linear-gradient(to right, #5d5ebc, #12099a);
}
.button-text {
color: white;
font-size: 26rpx;
}
.publish-image {
position: fixed;
bottom: 80rpx;
right: 0rpx;
width: 180rpx;
height: 140rpx;
z-index: 99;
}
</style>