NurseStationPersonAppletUl/pages/Learningtraining/Learningtraining.vue
2023-04-27 11:49:30 +08:00

97 lines
2.3 KiB
Vue

<template>
<view class="app">
<view class="card">
<view class="item" v-for='(item,index) in list' :key="index" @click.stop='gographicvideo(item)'>
<image :src="baseurl + item.trainingItemCoverUrl" mode=""></image>
<view class="title">
{{item.trainingItemTitle}}
</view>
<view class="text">
{{item.trainingItemDetails}}
</view>
<view class="price" v-if="item.trainingItemPrice">
{{item.trainingItemPrice}}
</view>
<view class="price" v-else>
0
</view>
</view>
</view>
<view v-if='list.length == 0' class="" style="padding-top: 100rpx;">
<u-empty text="暂无" mode="list" icon-size='240' font-size='32'></u-empty>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
selectNurseAppletPersonTrainingParent,
} from '@/api/Learningtraining/index.js'
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
nursePersonId: null, //护理员id
baseurl: undefined,
pageNum: 1,
pageSize: 10,
list: [],
total: 0,
};
},
onShow() {},
onLoad() {
const that = this
this.baseurl = baseurl
this.pageNum = 1
const value = uni.getStorageSync('personRoleLoginFlag');
const nursePersonId = uni.getStorageSync('nursePersonId');
if (value) {
that.nursePersonId = nursePersonId
that.info();
} else {
that.$refs.uToast.show({
title: '您未登录',
type: 'error',
duration: '1000'
})
}
},
methods: {
info() {
selectNurseAppletPersonTrainingParent(this.pageNum, this.pageSize, this.nursePersonId).then(res => {
this.list = res.rows
this.total = res.total
})
},
//跳转图文或者视频学习
gographicvideo(item) {
uni.navigateTo({
url: `/pages/learning/learning?trainingParentId=${item.id}`
})
},
},
onReachBottom() { //下滑加载
if (this.list.length >= this.total) {} else {
this.pageNum++
selectNurseAppletPersonTrainingParent(this.pageNum, this.pageSize, this.nursePersonId).then(res => {
res.rows.forEach(e => {
this.list.push(e)
})
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1
this.info();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import "./Learningtraining.scss";
</style>