Files
jurong_circle_front_app/pages/program/program.vue

314 lines
7.0 KiB
Vue
Raw Normal View History

2025-09-12 17:23:03 +08:00
<template>
<view class="message-container">
<!-- 可滚动的内容区域 -->
<view class="content-container" :style="'height:'+height+'px'">
2025-09-28 09:21:15 +08:00
<view class="searchFilter" id="searchFilterId">
<view class="search">
2025-09-28 09:21:15 +08:00
<u-search :show-action="false" placeholder="输入项目名称、企业名称" v-model="params.keyword" bgColor="#CADBFF"
@search="handleSearch"></u-search>
</view>
2025-09-28 09:21:15 +08:00
<u-dropdown :duration="0" class="dropdown">
2025-09-17 09:31:58 +08:00
<u-dropdown-item class="u-dropdown" v-model="areaFilter" title="区域筛选"
:options="areaOptions"></u-dropdown-item>
<u-dropdown-item class="u-dropdown" v-model="timeFilter" title="时间筛选"
:options="timeOptions"></u-dropdown-item>
<u-dropdown-item class="u-dropdown" v-model="typeFilter" title="类型筛选"
:options="typeOptions"></u-dropdown-item>
</u-dropdown>
</view>
2025-09-28 09:21:15 +08:00
<view class="program-list" :style="'height:'+scrollHeight+'px'">
<scroll-view scroll-y="true" style="height: 100%;" v-if="programList.length!=0" @scrolltolower="loadData">
<view class="program-item" v-for="item in programList" @click="handleDetail(item)">
<view class="program-avatar">
<image style="width: 100%;height: 100%;border-radius: 50%;"
:src="getImageUrl(item.user.avatar)" mode=""></image>
</view>
2025-09-28 09:21:15 +08:00
<view class="program-info">
<view class="program-name">
{{item.name}}
</view>
<view class="company-name">
{{item.company}}
</view>
<view class="program-address">
项目地点{{item.address}}
</view>
<view class="program-contact">
项目联系人{{maskPhoneNumber(item.user.username)}}
</view>
<view class="program-introduction">
项目简介{{item.introduction}}
</view>
</view>
</view>
2025-09-28 09:21:15 +08:00
<u-loadmore :status="status" />
<view class="box-div"></view>
</scroll-view>
2025-09-12 17:23:03 +08:00
2025-09-28 09:21:15 +08:00
<view style="height: 100%;" v-else>
<u-empty></u-empty>
</view>
</view>
</view>
<Tabbar id="tabbarId"></Tabbar>
</view>
</template>
2025-09-12 17:23:03 +08:00
<script setup lang="ts">
2025-09-28 09:21:15 +08:00
import { ref, computed, getCurrentInstance, onMounted } from 'vue';
import {
onReady
} from '@dcloudio/uni-app';
2025-09-28 09:21:15 +08:00
import { onReady as onUniReady, onPullDownRefresh } from '@dcloudio/uni-app';
import { programAPI } from '../../api/program';
import { getImageUrl, maskPhoneNumber } from '../../util/common';
const instance = getCurrentInstance();
const height = ref(0)
2025-09-28 09:21:15 +08:00
const scrollHeight = ref(0)
const loadHeight = () => {
uni.getSystemInfo({
success(res) {
let screenHeight = res.screenHeight
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
height.value = screenHeight - data.height
}).exec()
2025-09-28 09:21:15 +08:00
uni.createSelectorQuery().in(instance.proxy).select("#searchFilterId").boundingClientRect((data : any) => {
scrollHeight.value = height.value - data.height
}).exec()
}
})
}
// 筛选
const keyword = ref('')
const areaFilter = ref('')
const timeFilter = ref('')
const typeFilter = ref('')
const areaOptions = [
{
label: '默认排序',
value: 1,
},
{
label: '距离优先',
value: 2,
},
{
label: '价格优先',
value: 3,
}]
const timeOptions = [
{
label: '默认排序',
value: 1,
},
{
label: '距离优先',
value: 2,
},
{
label: '价格优先',
value: 3,
}]
const typeOptions = [
{
label: '默认排序',
value: 1,
},
{
label: '距离优先',
value: 2,
},
{
label: '价格优先',
value: 3,
}]
// 列表
const programList = ref([])
2025-09-28 09:21:15 +08:00
const defaultSize = 5
const params = ref({
page: 1,
size: defaultSize,
keyword: ''
})
const status = ref('loadmore')
const maxPage = ref()
2025-09-28 09:21:15 +08:00
// 加载数据
const loadData = () => {
if (status.value == 'nomore') return
programAPI.getList(params.value).then(res => {
programList.value = programList.value.concat(res.data.list)
maxPage.value = res.data.pages
params.value.page++
if (params.value.page > maxPage.value) {
status.value = 'nomore'
}
}).finally(() => {
uni.stopPullDownRefresh()
})
}
2025-09-28 09:21:15 +08:00
// 查看详情
const handleDetail = (item) => {
uni.navigateTo({
2025-09-28 09:21:15 +08:00
url: '/pages/program/programDetail?programId=' + item.id
})
}
2025-09-28 09:21:15 +08:00
// 查询
const handleSearch = () => {
params.value = {
page: 1,
size: defaultSize,
keyword: params.value.keyword
}
programList.value = []
loadData()
}
// 刷新
onPullDownRefresh(async () => {
// 全局刷新
params.value = {
page: 1,
size: defaultSize,
keyword: ''
}
programList.value = []
loadData()
})
onMounted(() => {
loadData()
})
onUniReady(() => {
loadHeight()
})
2025-09-12 17:23:03 +08:00
</script>
<style lang="scss" scoped>
.message-container {
width: 100%;
2025-09-28 09:21:15 +08:00
height: 100vh;
background: linear-gradient(270deg, #65A7FF 0%, #458CF9 23.08%, #3F82FF 50%, #458CF9 71.15%, #65A7FF 100%);
/* 内容滚动区域 */
.content-container {
width: 100%;
.searchFilter {
2025-09-28 09:21:15 +08:00
background-color: transparent;
2025-09-16 18:04:51 +08:00
.search {
padding: 60rpx 42rpx 0;
}
}
2025-09-28 09:21:15 +08:00
::v-deep .dropdown {
.u-dropdown__menu__item__text {
color: #fff !important;
}
}
.program-list {
margin-top: 20rpx;
.program-item {
2025-09-28 09:21:15 +08:00
background-color: #F0F3FF;
border-radius: 20rpx;
padding: 20rpx 42rpx;
margin-bottom: 20rpx;
display: flex;
.program-avatar {
width: 20%;
width: 100rpx;
height: 100rpx;
}
.program-info {
width: 80%;
margin-left: 20rpx;
.program-name {
font-family: SF Pro;
font-weight: 400;
font-style: Regular;
font-size: 32rpx;
leading-trim: NONE;
line-height: 48rpx;
letter-spacing: 0%;
margin-bottom: 10rpx;
}
.company-name {
font-family: Work Sans;
font-weight: 400;
font-size: 26rpx;
leading-trim: NONE;
line-height: 100%;
letter-spacing: -2%;
margin-bottom: 10rpx;
}
.program-address {
font-family: Work Sans;
font-weight: 300;
font-style: Light;
font-size: 24rpx;
leading-trim: NONE;
line-height: 100%;
letter-spacing: -2%;
2025-09-17 09:31:58 +08:00
color: #000;
margin-bottom: 10rpx;
}
.program-contact {
font-family: Work Sans;
font-weight: 300;
font-style: Light;
font-size: 20rpx;
leading-trim: NONE;
line-height: 100%;
letter-spacing: -2%;
2025-09-17 09:31:58 +08:00
color: #000;
margin-bottom: 10rpx;
}
.program-introduction {
font-family: Work Sans;
font-weight: 400;
font-size: 20rpx;
leading-trim: NONE;
line-height: 100%;
letter-spacing: -2%;
2025-09-17 09:31:58 +08:00
color: #000;
margin-bottom: 10rpx;
2025-09-12 17:23:03 +08:00
/* 关键样式 */
white-space: nowrap;
/* 不换行 */
overflow: hidden;
/* 超出隐藏 */
text-overflow: ellipsis;
/* 显示省略号 */
}
}
}
2025-09-28 09:21:15 +08:00
.box-div {
padding: 30rpx 0rpx;
}
}
}
}
2025-09-12 17:23:03 +08:00
</style>