stu_js_list.vue 5.1 KB
<template>
	<view class="wrap_box">
		<view class="wrap_boxV2">
			<view class="wrap_boxV2-item" v-for="(item,index) in datas" @click="go_jspf(item)" :data-url="'/pages_v2/stu_js_pj/stu_js_pj?id='+item.id">
				<view class="wrap_boxV2-item-l">{{item.title}}-{{item.sub_title}}</view>
				<u-icon name="arrow-right" color="#2D81FF"></u-icon>
			</view>
			<u-empty v-if="datas.length==0"
			        mode="data"
							text="暂无数据"
			        icon="/static/imagesV2/icon24.png"
			>
			</u-empty>
		</view>
	</view>
</template>

<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	var that 
	export default {
		data() {
			return {
				options:'',
				datas:[],
				page:1
			}
		},
		computed: {
		...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo','nowtime']),
		},
		onLoad(e) {
			that=this
			that.options=e||{}
			console.log(e)
			
			that.onRetry()
		},
		onShow() {
			
		},
		methods: {
			// ...mapMutations(['wxshouquan','login']),
			test(){},
			go_jspf(item){
				var datas={
					id:item.id,
					type:1
				}
				if(that.btnkg==1){
					return
				}
				that.btnkg=1
				var jkurl='/content/verif'
				
				that.$service.P_post(jkurl, datas).then(res => {
					that.btnkg = 0
					console.log(res)
					if (res.code == 1) {
						that.htmlReset = 0
						var datas = res.data
						console.log(typeof datas)
				
						// if (typeof datas == 'string') {
						// 	datas = JSON.parse(datas)
						// }
						console.log(res)
						uni.navigateTo({
							url:'/pages_v2/stu_js_pj/stu_js_pj?title='+res.data+'&id='+item.id
						})
						
					} else {
					
						if (res.msg) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '获取数据失败'
							})
						}
					}
				}).catch(e => {
					that.htmlReset = 1
					that.btnkg = 0
					// that.$refs.htmlLoading.htmlReset_fuc(1)
					console.log(e)
					uni.showToast({
						icon: 'none',
						title: '获取数据失败,请检查您的网络连接'
					})
				})
			},
			onRetry(){
				that.page=1
				// return
				that.getdata()
			},
			getdata(){
				var datas={
					page:that.page,
					limit:20
				}
				if(that.btnkg==1){
					return
				}
				that.btnkg=1
				var nowpage=that.page
				var jkurl='/content/lecturer'
				
				that.$service.P_post(jkurl, datas).then(res => {
					that.btnkg = 0
					console.log(res)
					if (res.code == 1) {
						that.htmlReset = 0
						var datas = res.data
						console.log(typeof datas)
				
						if (typeof datas == 'string') {
							datas = JSON.parse(datas)
						}
						console.log(res)
						if(nowpage==1){
							that.datas = datas.data
						}else{
							if (datas.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.htmlReset = 1
					that.btnkg = 0
					// that.$refs.htmlLoading.htmlReset_fuc(1)
					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: #fff;
}
.wrap_boxV2{
	padding: 20rpx 25rpx;
	padding-bottom: calc(env(safe-area-inset-bottom) + 30rpx);
	.wrap_boxV2-item{
		display: flex;
		justify-content: space-between;
		height: 110rpx;
		background-color: #F7F8FA;
		border-radius: 20rpx;
		align-items: center;
		padding: 0 30rpx;
		box-sizing: border-box;
		margin-bottom: 10rpx;
		.wrap_boxV2-item-l{
			font-size: 28rpx;
			color: #323232;
		}
	}
}
.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: 30rpx;
}
.js_list{
	width: 100%;
	background: #FFFFFF;
	border-radius: 10rpx;
	.js_li{
		width: 100%;
		height: 90rpx;
		padding: 0 30rpx;
		&+.js_li{
			border-top: 1px solid #eee;
		}
		.js_name{
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #545D71;
		}
		.js_go{
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #A9B1C0;
			text{
				margin-left: 10rpx;
				font-size: 26rpx;
			}
		}
	}
}
</style>