stu_hddk_list.vue 6.9 KB
<template>
	<view class="wrap_box">
		<!-- <uParse v-if="datas" :content="datas"></uParse> -->
		<!-- stu_bz_index -->
		<view class="tel_index_bg"></view>
		<view class="bz_box">
			<view class="stu_num">
				<!-- <picker mode="date" :value="sx_time" :start="startDate" :end="endDate" @change="bindDateChange">
					<view class="">
						核对时间:{{sx_time}}<text class="icon icon-arrow-right-copy-copy"></text>
					</view>
				</picker> -->
				<picker @change="bindPickerChange" :value="index" :range="tabs" range-key="create_time">
					<view class="">
						核对时间:
						{{sxtitle||'请选择时间'}}
						<text class="icon icon-arrow-right-copy-copy"></text>
					</view>
				</picker>
			</view>

			<view class="stu_list">
				<view class="stu_li" v-for="(item,index) in datas">
					<view class="stu_li_name">
						{{item.name}}
						<image v-if="item.sex!=1" src="/static/images/tch/icon_female.png" mode="aspectFit"></image>
						<image v-else src="/static/images/tch/icon_male.png" mode="aspectFit"></image>
					</view>
					<view class="flex_1"></view>
					<view class="sf_v">
						<text>是否到课:</text>
						<view class="sf_v_btn" v-if="item.dk==1">

						</view>
						<view class="sf_v_btn" v-else>

						</view>
					</view>
				</view>
				<u-empty v-if="datas.length==0"
								mode="data"
								text="暂无记录"
								icon="/static/images/tch/img_blank.png"
				>
				</u-empty>
			</view>
		</view>
		<!-- 阻止滑动 -->
		<!-- <view @touchmove.stop.prevent='test'></view> -->
	</view>
</template>

<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	var that
	export default {
		data() {
			return {
				options: '',
				tabs: [],
				datas: [],
				sx_time: '2022-02-15',
				index: 0,
				sxtitle:'',
				sxid:''
			}
		},
		computed: {
			...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo', 'nowtime']),
			startDate() {
					return this.getDate('start');
			},
			endDate() {
					return this.getDate('end');
			}
		},
		onLoad(e) {
			that = this
			that.options = e || {}
			console.log(e)

			// that.getdata()
			///teacher/sign_history
		},
		onShow() {
			that.onRetry()
		},
		onReachBottom() {
			that.getdata()
		},
		methods: {
			// ...mapMutations(['wxshouquan','login']),
			test(){},
			onRetry(){
				that.page=1
				that.datas = []
				that.getdata()
			},
			getdata() {
			
				var jkurl="/teacher/sign_history"
				
				var datas={
					id:that.sxid,
				}
				if (that.btnkg == 1) {
					return
				} else {
					that.btnkg = 1
				}
				
				that.$service.P_post(jkurl, datas).then(res => {
					that.btnkg = 0
					console.log(res)
					if (res.code == 1) {
						var datas = res.data
						console.log(typeof datas)
				
						if (typeof datas == 'string') {
							datas = JSON.parse(datas)
						}
					
						that.datas = datas.list
						that.tabs=datas.select
				
					} else {
						if (res.msg) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '操作失败'
							})
						}
					}
				}).catch(e => {
					that.btnkg = 0
					console.log(e)
					uni.showToast({
						icon: 'none',
						title: '操作失败'
					})
				})
			},
			set_fuc(item, num) {
				that.$set(item, 'dk', num)
			},
			save_fuc() {
				uni.showToast({
					icon: 'none',
					title: '保存成功'
				})
				setTimeout(function() {
					uni.navigateBack({
						delta: 1
					})
				}, 1000)
			},
			bindDateChange(e) {
				this.sx_time = e.detail.value
			},
			bindPickerChange: function(e) {
					console.log('picker发送选择改变,携带值为', e.detail.value)
					this.index = e.detail.value
					that.sxtitle=that.tabs[that.index].create_time
					that.sxid=that.tabs[that.index].id
					that.onRetry()
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			del_fuc(item) {
				uni.showModal({
					title: '提示',
					content: '是否删除该备注',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.showToast({
								icon: 'none',
								title: '删除成功'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			
			getimg(img) {
				return service.getimg(img)
			},
			jump(e) {
				var that = this
				if (that.btnkg == 1) {
					return
				} else {
					that.btnkg = 1
					setTimeout(function() {
						that.btnkg = 0
					}, 2000)
				}
				console.log(e.currentTarget.dataset.type)
				service.jump(e)
			},
			goback() {
				uni.navigateBack()
			},
			func() {
				// that.$store.commit('setSystem',datas.system)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap_box {
		width: 100%;
		// padding: 30rpx;
		min-height: 100vh;
		// #ifdef H5
		min-height: calc(100vh - 44px);
		// #endif
		background: #F8F8F8;
		position: relative;
	}

	.tel_index_bg {
		position: absolute;
		top: 0;
		z-index: 1;
		width: 100%;
		min-height: 220rpx;
		background: linear-gradient(0deg, #f8f8f8 0%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%);
	}

	.bz_box {
		width: 100%;
		position: relative;
		z-index: 2;
		padding:0 30rpx 30rpx;

		.stu_num {
			width: 100%;
			height: 80rpx;
			display: flex;
			align-items: center;
			font-size: 28rpx;
			color: #fff;
			justify-content: space-between;
			.icon{
				font-size: 24rpx;
				margin-left: 10rpx;
			}
		}
	}

	.stu_list {
		width: 100%;
		min-height: 100rpx;
		background: #FFFFFF;
		border-radius: 10rpx;

		.stu_li {
			width: 100%;
			height: 100rpx;
			display: flex;
			align-items: center;
			padding: 0 30rpx;

			&+.stu_li {
				border-top: 1px solid #eee;
			}

			.stu_li_name {
				font-size: 30rpx;
				color: #545D71;
				margin-bottom: 10rpx;

				image {
					width: 28rpx;
					height: 28rpx;
					margin-left: 5rpx;
				}
			}

			.sf_v {
				font-size: 30rpx;
				color: #A9B1C0;
				display: flex;
				align-items: center;

				.sf_v_btn {
					display: flex;
					align-items: center;
					margin-left: 20rpx;
					font-size: 30rpx;
					color: #A9B1C0;

					.sf_v_btn_b {
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 18rpx;
						color: #fff;
						width: 32rpx;
						height: 32rpx;
						border: 1px solid #DDDDDD;
						border-radius: 50%;
						margin-left: 8rpx;

						&.active {
							background: #2D81FF;
							border: 1px solid #2D81FF;
						}
				}
					}
			}
		}
	}

	.save_btn {
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 32rpx;
		color: #FFFFFF;
		width: 100%;
		height: 90rpx;
		background: #2D81FF;
		border-radius: 10rpx;
		margin-top: 40rpx;
	}
</style>