stumsg_list.vue 5.2 KB
<template>
	<view class="wrap_box">
		<!-- <uParse v-if="datas" :content="datas"></uParse> -->
		<view class="tel_index_bg"></view>
		<view class="stu_list">
			<view class="stu_search">
				<u-icon name="search" size="30" color="#659ff5"></u-icon>
				<input v-model="keywords" confirm-type="search" @confirm="confirm" class="stu_search-input" type="text"
					placeholder="搜索姓名" placeholder-style="color: #428DFE">
			</view>
			<view class="stu_num">
				<image class="stu_num-icon" src="@/static/images/xh_icon13.png"></image>
				<text class="stu_num-text">共{{datas.length}}人</text>
				<image class="stu_num-icon" src="@/static/images/xh_icon13.png"></image>
			</view>
			<scroll-view style="height: 1200rpx;" :scroll-y="true">
				<view class="stuli_box">
					<view v-for="(item,index) in datas" class="stu_li dis_flex">
						<view class="flex_1">
							<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>
						<view class="stu_bz" @click="$service.jump"
							:data-url="'/pagesA/stu_bz_index/stu_bz_index?id='+item.id">
							备注信息
						</view>
						<view class="stu_bz" @click="$service.jump" :data-url="'/pagesA/stu_msg/stu_msg?id='+item.id">
							查看档案
						</view>
					</view>
				</view>
			</scroll-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: '',
				datas: [],
				page: 1,
				keywords: ''
			}
		},
		computed: {
			...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo', 'nowtime']),
		},
		onLoad(e) {
			that = this
			that.options = e || {}
			console.log(e)
			that.getdata()
		},
		onShow() {

		},
		methods: {
			// ...mapMutations(['wxshouquan','login']),
			test() {},
			onRetry() {
				that.page = 1
				that.datas = []
				that.getdata()
			},
			confirm() {
				this.onRetry()
			},
			getdata() {
				var jkurl = "/teacher/student"
				var datas = {
					page: that.page,
					keywords: that.keywords
				}
				// if(that.data_last == true){
				// 	return
				// }
				if (that.btnkg == 1) {
					return
				} else {
					that.btnkg = 1
				}
				var page_now = that.page
				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)
						}

						if (page_now == 1) {

							that.datas = datas

						} else {
							// if (datas.data.length == 0) {
							// 	that.data_last = true
							// 	return
							// }
							// that.data_last = false
							// that.datas = that.datas.concat(datas.data)
						}
						that.page++

					} 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: '操作失败'
					})
				})
			},

			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%);
	}

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

		.stu_search {
			background-color: rgba(#fff, 0.4);
			height: 68rpx;
			display: flex;
			border-radius: 200rpx;
			align-items: center;
			padding: 0 20rpx;

			.stu_search-input {
				flex-grow: 1;
			}
		}

		.stu_num {
			width: 100%;
			height: 80rpx;
			display: flex;
			align-items: center;
			font-size: 30rox;
			color: #477FF6;
			justify-content: center;

			.stu_num-icon {
				height: 12rpx;
				width: 50rpx;
			}

			.stu_num-text {
				color: #477FF6;
				margin: 0 20rpx;
			}
		}

		.stuli_box {
			border-radius: 10rpx;
			background: #FFFFFF;
		}

		.stu_li {
			width: 100%;
			min-height: 120rpx;
			// border-radius: 10rpx;
			padding: 24rpx 30rpx;
			align-items: center;

			&+.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;
				}
			}

			.stu_bz {
				font-size: 30rpx;
				color: #9699A9;
				margin-left: 35rpx;
			}
		}
	}
</style>