traineeInterList.vue 4.2 KB
<template>
	<view class="current2" :style="vuex_theme">
		<view v-if="list.length > 0" >
			<view class="list">
				<view v-for="(item,index) in list" :key="index" @click="handelClick(item)">
					<view class="list-item">
						<view style="display: flex; align-items: center;">
							<text>实习单号:</text>
							<text class="green">{{item.number}}</text>
						</view>
						<view style="display: flex; align-items: center; margin-top: 15rpx;">
							<text>实习时间: {{`${timeFormat(item.startTime,'yyyy/mm/dd')} - ${timeFormat(item.endTime,'yyyy/mm/dd')}`}}</text>
						</view>
						<view style="display: flex; align-items: center; margin-top: 15rpx;">
							<text>实习企业: {{item.companyName}}</text>
						</view>
						<view style="display: flex; align-items: center; margin-top: 15rpx;">
							<text>实习岗位: {{item.jobName}}</text>
						</view>
					</view>
				</view>
			</view>
			<view style="height: 40rpx;"></view>
			<c-loading :loading="loading"></c-loading>
			<view style="height: 40rpx;"></view>
		</view>
		<view v-else style="width: 100%; height: 100%;">
			<view style="margin: 150px auto 0; width: 187px;height: 110px;">
				<image style="width: 187px;height: 110px;" :src="'/static/img/home/nodata.png'"></image>
			</view>
			<view style="width: 100%; margin-top: 10px; text-align: center; font-size: 13px; color: #121212;">暂无数据</view>
		</view>
	</view>
</template>

<script>
	import {
		getforminternshipInfoApi
	} from '@/config/api.js';
	import listMixin from "@/common/mixins/list-mixin.js";
	
	export default {
		mixins: [listMixin],
		data() {
			return {
				id: '',
				list: []
			}
		},
	
		onLoad(e) {
			console.log(e)
			this.id = e.id
			
			this.finished = false;
			this.loading = "loadmore";
			this.page = 0;
			this.list = [];
			this._getList();
		},
	
		methods: {
			loadData() {
				scoredetailUrl(this.id).then(res => {
					if (res) {
						this.detailObj = res;
						this.detailObj.form.endTime = this.timeFormat(this.detailObj.form.endTime,'yyyy-mm-dd')
						this.stuhandleDataspdf()
						this.comhandleDataspdf()
						this.schhandleDataspdf()
					}
				})
			},
			
			timeFormat(timestamp, format = 'yyyy-mm-dd hh:MM') {
				return timestamp > 0 ? uni.$u.timeFormat(timestamp, format) : '--'
			},
			
			handelClick(e) {
				// this.$u.route({
				// 	url: `pages/main/home/achievementDetail/achievementDetail?&id=${e.id}`
				// })
				this.$u.route({
					url: `pages/main/internship/intershipInfo/intershipInfo?id=${e.id}`
				})
			},
			
			// 模拟后端分页
			async getData(requestParams) {
				const {
					search = {}
				} = requestParams;
			
				let params = {};
				params.pageNumber = requestParams.page + 1;
				params.pageSize = 10;
				params.entryId = this.id;
				
				console.log(12312312,params)
				return await getforminternshipInfoApi(params);
			},
			
			// 数据请求(没错就是这么少的代码)
			async _getList() {
				if (this.page == 0) {
					this.list = [];
				}
			
				uni.showLoading({
					title: '数据加载中~',
					mask: true
				})
			
				// 根据实际情况修改自己修改key
				let result = await this.getData({
					page: this.page, // 传入页码
					size: this.size, // 传入每页条数
					search: this.search, // 传入搜索的对象
				});
			
				// console.log(result.records)
			
				this.total = result.total;
			
				result.records.map((item) => {
					this.list.push(item);
				});
				
				if (this.list.length == this.total) {
					this.finished = true;
					this.loading = 'nomore';
				}
			
				uni.hideLoading();
			},
		}
	}
</script>

<style>
	page {
		background-color: #F7F7F7;
	}
</style>

<style lang="scss" scoped>	
	.current2 {
		padding: 20rpx 20rpx 0;
		
		.list-item {
			// width: 100%;
			// height: 150px;
			padding: 36rpx 40rpx;
			background: #FFFFFF;
			margin-bottom: 10px;
			
			text {
				font-size: 14px;
				font-family: PingFangSC-Light, PingFang SC;
				font-weight: 300;
				color: rgba(0,0,0,0.65);
				max-width: 90%;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
			
			.green {
				margin-left: 5px;
				color: var(--primary-color);
			}
		}
	}
</style>