|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<view class="container">
|
|
<view class="container">
|
|
- <!-- <u-sticky>
|
|
|
|
|
|
+ <u-sticky>
|
|
<view class="search-box">
|
|
<view class="search-box">
|
|
<u-search
|
|
<u-search
|
|
v-model="searchForm.keyword"
|
|
v-model="searchForm.keyword"
|
|
@@ -10,10 +10,9 @@
|
|
placeholder="请输入搜索内容"
|
|
placeholder="请输入搜索内容"
|
|
@search="onSearchConfirm"
|
|
@search="onSearchConfirm"
|
|
@custom="onSearchConfirm"
|
|
@custom="onSearchConfirm"
|
|
- @clear="onSearchClear"
|
|
|
|
></u-search>
|
|
></u-search>
|
|
</view>
|
|
</view>
|
|
- </u-sticky> -->
|
|
|
|
|
|
+ </u-sticky>
|
|
<view class="list-box">
|
|
<view class="list-box">
|
|
<view class="list-item-box" v-for="item in list" :key="item.id" @click="onNoticeClick(item)">
|
|
<view class="list-item-box" v-for="item in list" :key="item.id" @click="onNoticeClick(item)">
|
|
<view class="main-box">
|
|
<view class="main-box">
|
|
@@ -21,29 +20,31 @@
|
|
<view class="iconfont icon-a-tongzhigonggao"></view>
|
|
<view class="iconfont icon-a-tongzhigonggao"></view>
|
|
<!-- <cover-image class="icon" :src="`${FILE_URL}/notice/icon-2.jpg`"></cover-image> -->
|
|
<!-- <cover-image class="icon" :src="`${FILE_URL}/notice/icon-2.jpg`"></cover-image> -->
|
|
</view>
|
|
</view>
|
|
- <view class="content-box">
|
|
|
|
- <view class="title">
|
|
|
|
- {{item.title}}
|
|
|
|
|
|
+ <view style="width: 100%;display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;gap: 10rpx;">
|
|
|
|
+ <view class="content-box">
|
|
|
|
+ <view class="title">
|
|
|
|
+ {{item.title}}
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
- <!-- <view class="text">
|
|
|
|
- {{item.desc}}
|
|
|
|
- </view> -->
|
|
|
|
- </view>
|
|
|
|
- <view class="other-box">
|
|
|
|
- <view class="date">
|
|
|
|
- {{item.date}}
|
|
|
|
|
|
+ <view class="other-box">
|
|
|
|
+ <view class="date">
|
|
|
|
+ {{item.date}}
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="line-box"></view>
|
|
<view class="line-box"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <u-loadmore :status="status" :load-text="loadText" style="margin: 20rpx 0;"/>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
+ import { onLoad, onReachBottom } from '@dcloudio/uni-app'
|
|
import { getNoticeList } from '@/api/notice.js'
|
|
import { getNoticeList } from '@/api/notice.js'
|
|
import configService from '@/utils/baseurl.js'
|
|
import configService from '@/utils/baseurl.js'
|
|
const FILE_URL = configService.FILE_URL;
|
|
const FILE_URL = configService.FILE_URL;
|
|
@@ -53,40 +54,18 @@
|
|
backgroundColor: '#E5E5E5'
|
|
backgroundColor: '#E5E5E5'
|
|
}
|
|
}
|
|
const searchForm = ref({
|
|
const searchForm = ref({
|
|
- keyword: ''
|
|
|
|
|
|
+ keyword: '',
|
|
|
|
+ pageNumber: 1,
|
|
|
|
+ pageSize: 20
|
|
})
|
|
})
|
|
- const list = ref([
|
|
|
|
- {
|
|
|
|
- id: '1',
|
|
|
|
- title: '2023年度团队建设活动',
|
|
|
|
- desc: '为了增强团队凝聚力,定于10月30日举行年度团队建设活动。请全员准时参加,期待大家的积极参与!',
|
|
|
|
- date: '2024-10-20'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '2',
|
|
|
|
- title: "新员工入职培训",
|
|
|
|
- date: "2024-10-18",
|
|
|
|
- desc: "欢迎新加入的同事们!我们将于10月25日举办入职培训,届时会介绍公司的文化及各部门职能。"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '3',
|
|
|
|
- title: "系统维护通知",
|
|
|
|
- date: "2023-10-15",
|
|
|
|
- desc: "为提升系统性能,我们将在10月22日进行系统维护,期间系统可能无法访问,请提前做好相关准备。"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '4',
|
|
|
|
- title: "年度业绩总结会议",
|
|
|
|
- date: "2023-11-01",
|
|
|
|
- desc: "请各部门准备年度业绩总结报告,并按时参加11月10日的总结会议,共同探讨未来发展计划。"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '5',
|
|
|
|
- title: "义务植树活动",
|
|
|
|
- date: "2023-10-12",
|
|
|
|
- desc: "我们将在10月28日组织义务植树活动,希望大家积极报名参加,一起为环境保护贡献一份力量。"
|
|
|
|
- }
|
|
|
|
- ])
|
|
|
|
|
|
+ const total = ref(0);
|
|
|
|
+ const status = ref('loadmore');
|
|
|
|
+ const loadText = ref({
|
|
|
|
+ loadmore: '点击或上拉加载更多',
|
|
|
|
+ loading: '努力加载中',
|
|
|
|
+ nomore: '已加载全部数据'
|
|
|
|
+ })
|
|
|
|
+ const list = ref([])
|
|
function init() {
|
|
function init() {
|
|
getNoticeList().then(res=>{
|
|
getNoticeList().then(res=>{
|
|
if(res?.data){
|
|
if(res?.data){
|
|
@@ -99,24 +78,52 @@
|
|
url: `/pages/notice/noticeDetail/noticeDetail?id=${notice.id}&title=${notice.title}`
|
|
url: `/pages/notice/noticeDetail/noticeDetail?id=${notice.id}&title=${notice.title}`
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- onLoad(()=>{
|
|
|
|
- init();
|
|
|
|
|
|
+ function onSearchConfirm() {
|
|
|
|
+ // console.log(searchForm.value.keyword, 1211)
|
|
|
|
+ searchForm.value.pageNumber = 1
|
|
|
|
+ search()
|
|
|
|
+ }
|
|
|
|
+ function search() {
|
|
|
|
+ status.value = 'loading'
|
|
|
|
+ list.value = searchForm.value.pageNumber === 1 ? [] : list.value
|
|
|
|
+ getNoticeList(searchForm.value).then(res => {
|
|
|
|
+ total.value = res.count
|
|
|
|
+ list.value = [...list.value, ...res.data]
|
|
|
|
+ searchForm.value.pageNumber = searchForm.value.pageNumber + 1
|
|
|
|
+ if(total.value === list.value.length){
|
|
|
|
+ status.value = 'nomore'
|
|
|
|
+ }else{
|
|
|
|
+ status.value = 'loadmore'
|
|
|
|
+ }
|
|
|
|
+ }).catch(err=>{
|
|
|
|
+ status.value = 'nomore'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ onLoad(() => {
|
|
|
|
+ searchForm.value.pageNumber = 1
|
|
|
|
+ search()
|
|
|
|
+ })
|
|
|
|
+ onReachBottom(()=>{
|
|
|
|
+ if(status.value === 'nomore'){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ search()
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.container {
|
|
.container {
|
|
- // height: 100vh;
|
|
|
|
width: 100vw;
|
|
width: 100vw;
|
|
background-color: #FFFFFF;
|
|
background-color: #FFFFFF;
|
|
padding: 0 20rpx env(safe-area-inset-bottom, 0);
|
|
padding: 0 20rpx env(safe-area-inset-bottom, 0);
|
|
-
|
|
|
|
|
|
+
|
|
.search-box {
|
|
.search-box {
|
|
margin-bottom: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
|
|
+
|
|
::v-deep(.u-search) {
|
|
::v-deep(.u-search) {
|
|
background-color: #e5e5e5;
|
|
background-color: #e5e5e5;
|
|
border-radius: 50rpx;
|
|
border-radius: 50rpx;
|
|
-
|
|
|
|
|
|
+
|
|
.u-action {
|
|
.u-action {
|
|
width: 18%;
|
|
width: 18%;
|
|
background-color: $uni-color-primary;
|
|
background-color: $uni-color-primary;
|
|
@@ -130,44 +137,52 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
.list-box {
|
|
.list-box {
|
|
padding: 0 20rpx;
|
|
padding: 0 20rpx;
|
|
|
|
+
|
|
.list-item-box {
|
|
.list-item-box {
|
|
.main-box {
|
|
.main-box {
|
|
display: flex;
|
|
display: flex;
|
|
- justify-content: space-between;
|
|
|
|
|
|
+ // justify-content: space-between;
|
|
align-items: center;
|
|
align-items: center;
|
|
padding: 30rpx 0;
|
|
padding: 30rpx 0;
|
|
-
|
|
|
|
|
|
+
|
|
&:active {
|
|
&:active {
|
|
background-color: $uni-bg-color-hover;
|
|
background-color: $uni-bg-color-hover;
|
|
}
|
|
}
|
|
|
|
+
|
|
.icon-box {
|
|
.icon-box {
|
|
|
|
+ flex: 0 0 auto;
|
|
width: 15%;
|
|
width: 15%;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
+
|
|
.icon {
|
|
.icon {
|
|
width: 70rpx;
|
|
width: 70rpx;
|
|
height: 70rpx;
|
|
height: 70rpx;
|
|
}
|
|
}
|
|
- .iconfont{
|
|
|
|
|
|
+
|
|
|
|
+ .iconfont {
|
|
font-size: 60rpx;
|
|
font-size: 60rpx;
|
|
color: #0069f6;
|
|
color: #0069f6;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.content-box {
|
|
.content-box {
|
|
- width: 67%;
|
|
|
|
|
|
+ // width: 67%;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
justify-content: space-around;
|
|
justify-content: space-around;
|
|
gap: 10rpx;
|
|
gap: 10rpx;
|
|
|
|
+
|
|
.title {
|
|
.title {
|
|
height: calc(70% - 5rpx);
|
|
height: calc(70% - 5rpx);
|
|
font-size: $uni-title-font-size-2;
|
|
font-size: $uni-title-font-size-2;
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
|
|
+
|
|
.text {
|
|
.text {
|
|
height: calc(30% - 5rpx);
|
|
height: calc(30% - 5rpx);
|
|
font-size: $uni-font-size-3;
|
|
font-size: $uni-font-size-3;
|
|
@@ -175,17 +190,21 @@
|
|
@include text-overflow();
|
|
@include text-overflow();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.other-box {
|
|
.other-box {
|
|
|
|
+ flex: 0 0 auto;
|
|
width: 18%;
|
|
width: 18%;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
justify-content: space-around;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
align-items: center;
|
|
gap: 10rpx;
|
|
gap: 10rpx;
|
|
|
|
+
|
|
.date {
|
|
.date {
|
|
font-size: $uni-font-size-3;
|
|
font-size: $uni-font-size-3;
|
|
color: $uni-text-color-grey;
|
|
color: $uni-text-color-grey;
|
|
}
|
|
}
|
|
|
|
+
|
|
.tag {
|
|
.tag {
|
|
font-size: $uni-font-size-3;
|
|
font-size: $uni-font-size-3;
|
|
width: 42rpx;
|
|
width: 42rpx;
|
|
@@ -196,6 +215,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.line-box {
|
|
.line-box {
|
|
height: 1rpx;
|
|
height: 1rpx;
|
|
width: 80%;
|
|
width: 80%;
|