OA/pages/users/article/index.vue

276 lines
5.1 KiB
Vue
Raw Normal View History

2023-11-05 00:11:08 +08:00
<template>
<!-- 公司公示文档 -->
<view class="all_box">
<view class="content-middle-title">
<view class="content-middle-search">
<text class='iconfont icon-sousuo2'></text>
<input type='text' :value='keyword' placeholder='搜索关键字' placeholder-class='placeholder'
@input="setValue"></input>
</view>
<view class="search" @click="search">
搜索
</view>
</view>
<!-- 公司公告详情 -->
<view class="notice_box" v-for="item in list" :key="item.id">
<view class="title">{{item.title}}</view>
<view class="row"></view>
<view class="info">{{item.desc}}
</view>
<view class="notice_bottom">
<view class="n_left">
<!--<text class="chapter">{{item.sections}}</text>
<text>浏览{{item.is_share}}</text> -->
</view>
<view class="n_right">
<view class="btn" @click="detail(item)">详情</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { articleindex ,articleview } from '@/api/oa.js'
export default {
data() {
return {
keyword: '',
list: [],
loadConfig: {
page: 1,
limit: 5,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
keyword: '',
};
},
onLoad() {
},
onShow() {
this.initList()
},
onReachBottom() {
this.getDocumentList()
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
//查询
search() {
this.getDocumentList()
},
//输入监听
setValue(e) {
this.keyword = e.detail.value
if (this.keyword.length == 0) {
this.getDocumentList()
}
},
async initList(){
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list = [];
await this.getDocumentList();
},
//获取项目
async getDocumentList() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await articleindex({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
keyword: this.keyword
})
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res.data?.data]
},
//详情
detail(item){
uni.navigateTo({
url:'/pages/users/article/detail?data='+ encodeURIComponent(JSON.stringify(item))
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.u-search {
width: 527rpx;
}
/deep/.u-search__action--active {
display: none;
}
.content-middle-title {
width: 100%;
background-color: #FFFFFF;
padding-top: 20rpx;
padding-bottom: 20rpx;
display: flex;
padding-left: 20rpx;
.search {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
width: 149rpx;
line-height: 63rpx;
height: 63rpx;
background: #FFFFFF;
text-align: center;
border-radius: 35rpx 35rpx;
border: 2rpx solid #E6E5E5;
margin-left: 18rpx;
}
.content-middle-search {
display: flex;
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
background: #F7F7F7;
border-radius: 35rpx 35rpx;
font-size: 25rpx;
input {
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
}
.placeholder {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
padding-left: 30rpx;
}
}
}
.all_box{
padding-bottom: 21rpx;
}
.nav_box {
width: 750rpx;
height: 98rpx;
background: #FFFFFF;
.task_box {
margin: 0 auto;
width: 750rpx;
height: 98rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 28rpx;
.newly_built {
width: 149rpx;
height: 63rpx;
background: #34A853;
border-radius: 35rpx;
color: #fff;
text-align: center;
line-height: 63rpx;
margin-left: 17.5rpx;
}
}
}
.notice_box {
margin: 0 auto;
margin-top: 21rpx;
width: 694rpx;
// height: 342rpx;
background: #FFFFFF;
border-radius: 7rpx;
padding: 0 24.5rpx;
padding-bottom: 25rpx;
padding-top: 24.5rpx;
.title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 624rpx;
height: 44rpx;
font-size: 32rpx;
}
.row {
margin: 14rpx 0;
width: 646rpx;
height: 0rpx;
opacity: 1;
border-bottom: 1rpx solid #CCCCCC;
}
.info {
width: 645rpx;
color: #999999;
font-size: 25rpx;
}
.notice_bottom {
display: flex;
justify-content: space-between;
align-items: center;
.n_left {
color: #999999;
font-size: 25rpx;
.chapter {
margin-right: 60rpx;
}
}
.n_right {
.btn {
display: inline-block;
width: 158rpx;
height: 53rpx;
line-height: 53rpx;
text-align: center;
background: $theme-oa-color;
border-radius: 4rpx;
color: #fff;
}
.btn_1 {
background: #34A853;
margin-right: 14rpx;
}
}
}
}
</style>