stumsg_list.vue 5.1 KB
<template>
	<view class="wrap_box">
		<view class="stu_list">
			<view class="stu_search">
				<u-icon name="search" size="30" color="#979797"></u-icon>
				<input v-model="keywords" confirm-type="search" @confirm="confirm" class="stu_search-input" type="text"
					placeholder="搜索姓名" placeholder-style="color: #C3C3C3">
			</view>
			<view class="stu_num">
				共<text class="stu_num-text">{{datas.length}}</text>人
			</view>
			<scroll-view style="height: 1200rpx;" :scroll-y="true">
				<view class="stu_item" v-for="(item,index) in datas">
					<view class="info">
						<view class="name" >
							{{item.name}}
						</view>
						<image class="gender" v-if="item.sex!=1" src="/static/imagesV2/stu_selection/icon_female.png" mode="aspectFit"></image>
						<image class="gender" v-else src="/static/imagesV2/stu_selection/icon_male.png" mode="aspectFit"></image>
					</view>
					<view class="operate">
						<view class="btn" @click="$service.jump" :data-url="'/pagesA/stu_bz_index/stu_bz_index?id='+item.id">
							<view class="icon">
								<image src="/static/imagesV2/tch_index/icon11.png" mode=""></image>
							</view>
							备注信息
						</view>
						<view class="btn" @click="$service.jump" :data-url="'/pagesA/stu_msg/stu_msg?id='+item.id">
							<view class="icon">
								<image src="/static/imagesV2/tch_index/icon10.png" mode=""></image>
							</view>
							查看档案
						</view>
					</view>
				</view>
			</scroll-view>
		</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;
	}

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

		.stu_search {
			background-color:#fff;
			display: flex;
			border-radius: 36rpx;
			align-items: center;
			padding: 10rpx 20rpx 10rpx 30rpx;
			border-radius: 36rpx;
			.stu_search-input {
				flex-grow: 1;
			}
		}
		
		.stu_num {
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #323232;
			padding: 20rpx 0;
			.stu_num-text {
				color: #2D81FF;
			}
		}

		.stu_item {
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 30rpx;
			display: flex;
			align-items: center;
			
			& + .stu_item {
				margin-top: 20rpx;
			}
			.info {
				flex: 1;
				display: flex;
				align-items: center;
			}
			.gender {
				width: 29rpx !important;
				height: 24rpx !important;
				margin-left: 20rpx;
			}
			
			.operate {
				display: flex;
				align-items: center;
				justify-content: flex-end;
				.btn {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #646464;
					margin-left: 30rpx;
					.icon {
						margin-right: 10rpx;
						width: 30rpx;
						height: 30rpx;
					}
				}
			}
		}
	}
</style>