SmartStorage/pages/moreNotice/moreNotice.vue

105 lines
1.9 KiB
Vue
Raw Normal View History

2024-03-13 17:55:34 +08:00
<template>
<view>
<view class="search-bar">
<uni-easyinput class="uni-mt-5" suffixIcon="search" v-model="iptVal" placeholder="请输入关键字" @iconClick="iconClick"></uni-easyinput>
</view>
<view
class="single-notice"
v-for="(notice, index) in noticeList"
:key="index"
@click="seeDetail(notice.noticeId)"
>
<view class="notice-lef">
<image src="/static/notice.png" mode=""></image>
</view>
<view class="notice-rig">
<h4>{{ notice.noticeTitle }}</h4>
<h5>{{ notice.createTime }}</h5>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
noticeList: [],
iptVal: ''
}
},
methods: {
iconClick () {
let that = this
console.log(that.iptVal);
that.fetchAllNotice(that.iptVal)
},
// 获取所有公告
fetchAllNotice (keyword) {
let that = this
that.$api.index.noticeCont({
keyword
}).then(res => {
console.log(res);
if (res.data.code == 200) {
that.noticeList = res.data.data
}
}).catch(err => {
console.log(err);
})
},
seeDetail (noticeId) {
uni.navigateTo({
url: `/pages/noticeDetail/noticeDetail?noticeId=${noticeId}`
})
}
},
onShow() {
let that = this
that.fetchAllNotice('')
}
}
</script>
<style lang="scss">
.search-bar{
width: 90%;
margin: 20rpx auto;
}
.single-notice{
width: 90%;
margin: 0 auto;
border-bottom: 1px solid #DEE3EA;
box-sizing: border-box;
padding: 20rpx 0;
display: flex;
background-color: #fff;
.notice-lef{
width: 12%;
height: 5.5vh;
border-radius: 50%;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.notice-rig{
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
box-sizing: border-box;
padding-left: 20rpx;
h4{
font-size: 14px;
}
h5{
font-size: 12px;
color: #8F9298;
font-weight: normal;
}
}
}
</style>