<template>
|
<view class="safe_index">
|
<view class="safe_list">
|
<scroll-view
|
scroll-y="true"
|
class="incom_index_scroll"
|
:scroll-top="scrollTop"
|
refresher-enabled="true"
|
refresher-background="#EAEAEA"
|
:refresher-triggered="triggered"
|
@refresherpulling="refresherrefresh"
|
@scrolltolower="scrolltoLower">
|
<view class="safe_cards" v-for="(item,index) in trainList" :key="index">
|
<view class="safe_cards_left">
|
<view class="safe_cards_titles">{{item.secureName}}</view>
|
<view class="safe_cards_time"><span>培训日期:</span>{{item.secureTime}}</view>
|
</view>
|
<view class="safe_cards_right">
|
<view class="safe_cards_types"><span>类型:</span>{{item.dictName}}</view>
|
<view class="safe_cards_arrows" @click="detailsClick(item)"></view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public.js';
|
export default{
|
data(){
|
return{
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: 0,
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
trainList:[],//培训列表
|
}
|
},
|
onLoad() {
|
this.searchTrainList()
|
},
|
methods:{
|
//查询列表
|
searchTrainList(){
|
this.triggered = true;
|
this.trainList = [];
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.getAllTrainingList(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.trainList = res.data.list
|
this.loadPage = res.data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchTrainList();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
},1000)
|
return
|
} else {
|
this.pageNum+=1
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.getAllTrainingList(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.trainList.push(...res.data.list)
|
this.loadPage = res.data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
}
|
}, 1500),
|
//跳转详情
|
detailsClick(val){
|
uni.navigateTo({
|
url: `./trainDetails?secureId=${val.secureId}&totals=${val.totals}&completes=${val.completes}`
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.safe_index{
|
height: 100vh;
|
background-color: #F6F6F6;
|
.safe_list{
|
height: 100%;
|
padding: 10px 15px 0px;
|
.incom_index_scroll{
|
height: 90%;
|
.safe_cards{
|
height: 15vh;
|
border-radius: 6px;
|
background-color: #FFFFFF;
|
margin-bottom: 15px;
|
display: flex;
|
justify-content: space-between;
|
|
.safe_cards_left{
|
width: 50%;
|
height: 100%;
|
margin-left: 15px;
|
display: flex;
|
justify-content: center;
|
flex-direction: column;
|
.safe_cards_titles{
|
font-weight: 500;
|
font-size: 17px;
|
color: #333333;
|
}
|
.safe_cards_time{
|
margin-top: 15px;
|
font-size: 13px;
|
color: #999999;
|
}
|
}
|
.safe_cards_right{
|
width: 50%;
|
height: 100%;
|
margin-top: -17px;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-direction: column;
|
position: relative;
|
.safe_cards_types{
|
color: #1977FF;
|
font-size:15px ;
|
span{
|
color: #999999;
|
}
|
}
|
.safe_cards_arrows{
|
position: absolute;
|
top: 68px;
|
left: 85%;
|
width: 100%;
|
height: 20px;
|
background: url('../../static/back.png') no-repeat;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|