stu_ft_list.vue 7.0 KB
<template>
	<view class="wrap_box">
		<u-sticky>
			<view class="bz_box">
				<view class="bz_tab">
					<view v-for="(item,index) in tabs" :key="index" class="tab_li" :class="{active:active==index}" @click="setac_fuc(index)">
						{{item.title}}
					</view>
				</view>
				<view class="search_box">
					<u-icon name="search" color="#979797" size="28" @click="onRetry"></u-icon>
					<u-input
						class="search_box-input"
						placeholder="请输入搜索内容"
						v-model="name_s"
						suffixIconStyle="color: #909399"
						placeholder-style="color: #C3C3C3"
						@confirm="onRetry"
					></u-input>
					
				</view>
			</view>
		</u-sticky>
	
		<view class="list">
			<view class="item" v-for="(item,index) in datas" :key="index" @click="jump_fuc(item)">
				<view class="name">
					{{item.name}}
				</view>
				<view class="tirm">
					{{item.add_time}}
				</view>
				<text class="icon icon-arrow-right-copy"></text>
			</view>
		</view>
		<view class="bz_add" >
			<view class="" @click="$service.jump" :data-url="'/pagesA/stu_ft_add/stu_ft_add?type='+active">
				添加
			</view>
		</view>
	</view>
</template>

<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	var that
	export default {
		data() {
			return {
				options: '',
				datas: '',
				tabs: [{
						title: '入学关怀'
					},
					{
						title: '常规访谈'
					},
				],
				stu_datas: [],
				active:0,
				name_s:''
			}
		},
		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.vio_time=this.getDate('end')
			// that.getdata()
		},
		onShow() {
			that.onRetry()
		},
		onReachBottom() {
			that.getdata()
		},
		methods: {
			// ...mapMutations(['wxshouquan','login']),
			test(){},
			
			onRetry(){
				that.page=1
				that.datas = []
				that.getdata()
			},
			getdata() {
			
				var jkurl="/teacher/interview"
				
				var datas={
					name:that.name_s,
					page:that.page,
				}
				if(that.active==1){
					jkurl="/teacher/interviewr"
					
				}
				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.data
						
						} else {
							if (datas.data.length == 0) {
								that.data_last = true
								return
							}
							that.data_last = false
							that.datas = that.datas.concat(datas.data)
						}
						that.allnum=datas.allnum
						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: '操作失败'
					})
				})
			},
			jump_fuc(item){
				if(that.active==0){
					uni.navigateTo({
						url:'/pagesA/stu_ft_xq/stu_ft_xq?id='+item.id
					})
				}else{
					uni.navigateTo({
						url:'/pagesA/stu_ft_xq_cg/stu_ft_xq_cg?id='+item.id
					})
				}
			},
			setac_fuc(index){
				that.active=index
				that.name_s=''
				that.onRetry()
			},
			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
			},
			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;
		
		padding-bottom: 150rpx;
	}

	.bz_box{
		width: 100%;
		position: relative;
		background: #F8F8F8;
	}
	.bz_tab{
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-around;
		background-color: #fff;
		border-top:1rpx solid #f3f4f6;
	}
	.tab_li{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #323232;
		padding:30rpx;
		position: relative;
		&.active{
			color: #2D81FF;
			&:after{
				content: '';
				position: absolute;
				bottom: 8rpx;
				left: 50%;
				background-image: url(@/static/imagesV2/icon23.png);
				background-size: 100% 100%;
				transform: translateX(-50%);
				height: 24rpx;
				width: 24rpx;
			}
		}
	}
	
	.search_box {
		background-color:#fff;
		display: flex;
		border-radius: 36rpx;
		align-items: center;
		padding: 0 20rpx 0 30rpx;
		margin: 25rpx;
		&-input {
			flex-grow: 1;
		}
	}
	
	.list {
		padding: 0 25rxp 25rpx;
		.item {
			display: flex;
			align-items: center;
			background-color: #fff;
			padding: 30rpx;
			& + .item {
				margin-top: 20rpx;
			}
			.name {
				flex: 1;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #323232;
			}
				
			.time {
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #646464;
				margin: 0 20rpx;
			}
			.icon {
				color: #ACACAC;
				font-size: 30rpx;
			}
		}
	}
	
	.bz_add {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		padding: 16rpx 25rpx;
		background-color: #fff;
		view {
			background: #2D81FF;
			border-radius: 44rpx;
			font-size: 34rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
		}
	}
	
</style>