NurseStationPersonApp/pages/Healthknowledge/Healthknowledge.vue

160 lines
3.3 KiB
Vue
Raw Normal View History

2023-04-13 16:02:47 +08:00
<template>
<view class="app">
2023-05-08 10:05:43 +08:00
<u-tabs :list="tabList" :current="tabcurrent" @change="change"></u-tabs>
<view class="Healthknowledge" v-if="NurseNewslist">
2023-04-13 16:02:47 +08:00
<view class="list">
2023-05-08 10:05:43 +08:00
<view class="item" v-for="(item,index) in NurseNewslist" :key="index" @tap='gohealthitem(item)'>
2023-04-13 16:02:47 +08:00
<view class="text">
{{item.informationTitle}}
</view>
<view class="author"></view>
<image :src="item.leadThumbnailUrl" mode=""></image>
</view>
</view>
</view>
2023-05-08 10:05:43 +08:00
<view class="noorder" v-else>
2023-04-13 16:02:47 +08:00
<u-empty mode="data" icon-size='220' text='暂无内容'></u-empty>
2023-05-08 10:05:43 +08:00
</view>
2023-04-13 16:02:47 +08:00
<u-back-top :scroll-top="scrollTop"></u-back-top>
</view>
</template>
<script>
2023-05-08 10:05:43 +08:00
import {
selectNurseNews
} from '@/api/homepage/index.js'
2023-04-13 16:02:47 +08:00
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
tabcurrent: 0,
tabList: [{
name: '护理新闻'
}],
pageNum: 1,
pageSize: 10,
total: 0,
scrollTop: 0,
2023-05-08 10:05:43 +08:00
NurseNewslist: null,
2023-04-13 16:02:47 +08:00
};
},
onLoad() {
2023-05-08 10:05:43 +08:00
this.selectNurseNewsinfo();
2023-04-13 16:02:47 +08:00
},
methods: {
//跳转item
gohealthitem(item) {
uni.navigateTo({
url: `/pages/Healthitem/Healthitem?item=${encodeURIComponent(JSON.stringify(item))}`
})
},
2023-05-08 10:05:43 +08:00
selectNurseNewsinfo() {
selectNurseNews(this.pageNum, this.pageSize).then(res => {
2023-04-13 16:02:47 +08:00
if (res.rows.length > 0) {
res.rows.forEach(e => {
e.leadThumbnailUrl = baseurl + e.leadThumbnailUrl
})
2023-05-08 10:05:43 +08:00
this.NurseNewslist = res.rows
2023-04-13 16:02:47 +08:00
}
this.total = res.total
})
},
change() {},
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
onReachBottom() { //下滑加载
2023-05-08 10:05:43 +08:00
if (this.NurseNewslist.length >= this.total) {} else {
2023-04-13 16:02:47 +08:00
this.pageNum++
2023-05-08 10:05:43 +08:00
selectNurseNews(this.pageNum, this.pageSize).then(res => {
2023-04-13 16:02:47 +08:00
if (res.rows) {
res.rows.forEach(e => {
e.leadThumbnailUrl = baseurl + e.leadThumbnailUrl
2023-05-08 10:05:43 +08:00
this.NurseNewslist.push(e)
2023-04-13 16:02:47 +08:00
})
}
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
2023-05-08 10:05:43 +08:00
this.selectNurseNewsinfo();
2023-04-13 16:02:47 +08:00
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
.app {
padding: 0;
text-align: justify;
.noorder {
margin-top: 20%;
}
.Healthknowledge {
width: 94%;
margin: 20rpx auto;
padding: 0 30rpx 50rpx;
background-color: #fff;
position: relative;
line-height: 46rpx;
.list {
width: 100%;
margin: 20rpx auto 0;
.item {
width: 100%;
height: 250rpx;
position: relative;
border-bottom: 2rpx solid #CDC9C9;
image {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 200rpx;
height: 200rpx;
border-radius: 10rpx;
}
.author {
position: absolute;
bottom: 20rpx;
width: 65%;
left: 0;
font-size: 20rpx;
color: #969494;
}
.text {
position: absolute;
top: 20rpx;
left: 0;
width: 65%;
font-size: 30rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5; //行数需设置
line-clamp: 5;
-webkit-box-orient: vertical;
}
}
}
.title {
font-size: 38rpx;
font-weight: bold;
}
}
}
</style>