nurseWeChatAppletUI/pages/Healthknowledge/Healthknowledge.vue

180 lines
3.8 KiB
Vue
Raw Normal View History

2023-02-20 16:22:42 +08:00
<template>
<view class="app">
<u-tabs :list="tabList" :current="tabcurrent" @change="change"></u-tabs>
2023-02-22 10:51:40 +08:00
<view class="Healthknowledge" v-if="informationCategoryVOList.length>0">
2023-02-20 16:22:42 +08:00
<!-- <view class="title">
健康常识
</view> -->
<view class="list">
<view class="item" v-for="(item,index) in informationCategoryVOList" :key="index"
@tap='gohealthitem(item)'>
<view class="text">
{{item.informationTitle}}
</view>
<view class="author"></view>
<image :src="item.leadThumbnailUrl" mode=""></image>
</view>
</view>
</view>
2023-02-22 10:51:40 +08:00
<view class="noorder" v-else>
2023-03-10 11:14:58 +08:00
<u-empty mode="data" icon-size='220' text='暂无内容'></u-empty>
2023-02-22 10:51:40 +08:00
</view>
2023-02-20 16:22:42 +08:00
<u-back-top :scroll-top="scrollTop"></u-back-top>
</view>
</template>
<script>
import {
getHeathHousingList
} from '@/api/Healthknowledge/index.js'
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
tabcurrent: 0,
tabList: [{
name: '健康常识'
}],
pageNum: 1,
pageSize: 10,
informationCategoryVOList: [],
total: 0,
scrollTop: 0,
};
},
2023-02-20 17:39:42 +08:00
onShow() {},
2023-02-20 17:38:00 +08:00
onLoad() {
this.pageNum = 1
2023-02-20 16:22:42 +08:00
this.getHeathHousing();
},
methods: {
//跳转健康咨询item
gohealthitem(item) {
uni.navigateTo({
url: `/pages/Healthitem/Healthitem?item=${encodeURIComponent(JSON.stringify(item))}`
})
},
getHeathHousing() {
getHeathHousingList(this.pageNum, this.pageSize).then(res => {
2023-02-20 17:08:22 +08:00
res.rows.forEach(e => {
e.leadThumbnailUrl = baseurl + e.leadThumbnailUrl
})
2023-02-20 16:22:42 +08:00
this.informationCategoryVOList = res.rows
this.total = res.total
})
},
2023-02-20 17:08:22 +08:00
change() {},
2023-02-20 16:22:42 +08:00
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
onReachBottom() { //下滑加载
if (this.informationCategoryVOList.length >= this.total) {} else {
this.pageNum++
getHeathHousingList(this.pageNum, this.pageSize).then(res => {
if (res.rows) {
res.rows.forEach(e => {
e.leadThumbnailUrl = baseurl + e.leadThumbnailUrl
this.informationCategoryVOList.push(e)
})
}
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.getHeathHousing();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-02-24 15:45:25 +08:00
//1.分享给朋友
onShareAppMessage(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
//2.分享到朋友圈
onShareTimeline(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
2023-02-20 16:22:42 +08:00
}
</script>
<style lang="scss">
.app {
padding: 0;
2023-02-22 10:51:40 +08:00
.noorder {
margin-top: 20%;
}
2023-02-20 16:22:42 +08:00
.Healthknowledge {
width: 94%;
margin: 20rpx auto;
2023-02-24 15:00:04 +08:00
padding: 0 30rpx 50rpx;
2023-02-20 16:22:42 +08:00
background-color: #fff;
position: relative;
line-height: 46rpx;
.list {
width: 100%;
margin: 20rpx auto 0;
.item {
width: 100%;
2023-03-03 10:04:13 +08:00
height: 250rpx;
2023-02-20 16:22:42 +08:00
position: relative;
border-bottom: 2rpx solid #CDC9C9;
image {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
2023-03-03 10:04:13 +08:00
width: 200rpx;
height: 200rpx;
2023-02-20 16:22:42 +08:00
border-radius: 10rpx;
}
.author {
position: absolute;
bottom: 20rpx;
left: 0;
font-size: 20rpx;
color: #969494;
}
.text {
position: absolute;
top: 20rpx;
left: 0;
2023-02-24 15:00:04 +08:00
width: 60%;
2023-02-20 16:22:42 +08:00
font-size: 30rpx;
2023-03-03 10:04:13 +08:00
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5; //行数需设置
line-clamp: 5;
-webkit-box-orient: vertical;
2023-02-20 16:22:42 +08:00
}
}
}
.title {
font-size: 38rpx;
font-weight: bold;
}
}
}
</style>