twoCurriculum.vue 5.6 KB
<template>
	<view class="twoCurriculum">
		<!-- 课程表 -->
		<view class="tabs-wrap flex">
			<view class="tabs-item" :class="current==index?'tabs-active':''" v-for="(item,index) in tabs" :key="index"
				@tap="tabsClick(item,index)">
				{{item.title}}
			</view>
		</view>

		<view class="wrap area flex">
			<view class="civil_tabs flex"  v-if="tabs[current].list&&tabs[current].list.length>0">
				<view class="civil_tabs_item" :class="current2==index?'civil_tabs_active':''"
					v-for="(item,index) in tabs[current].list" :key="index" @tap="civilTabsClick(item,index,'current2')">
					{{item.title}}
				</view>
			</view>

			<view class="">
				<swiper class="from-curriculum" circular :indicator-dots="false" :autoplay="false">
					<swiper-item v-for="(item,index) in datas">
						<!-- <view class="from-curriculum" @tap="seeClick($service.getimg(item))"> -->
						<view class="from-curriculum" @tap="$service.pveimg" :data-src="$service.getimg(item)" :data-array="datas">
							<image :src="$service.getimg(item)" mode="scaleToFill"></image>
						</view>
					</swiper-item>
				</swiper>
				
				<view class="btn-wrap" >
					<!-- 点击查看大图 -->
					左右滑动查看
				</view>
			</view>
		</view>



	</view>
</template>

<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	var that
	export default {
		data() {
			return {
				tabs: [
					{
						title:'公务员',
						id:'1',
						list:[
							{
								title:'封闭班',
								id:'1',
							},
							{
								title:'走读班',
								id:'2',
							},
						]
					}, 
					{
						title:'事业单位',
						id:'3',
						list:[
							{
								title:'封闭班',
								id:'3',
							},
							{
								title:'走读班',
								id:'4',
							},
						]
					}, 
					{
						title:'特岗教师',
						id:'5'
					}, 
					{
						title:'面试',
						id:'6'
					},
					{
						title:'其他',
						id:'7'
					}, ],
				current: 0,
				curriculumImg: "",
				curriculumImg5: "/static/images/kcb2.png",
				civilTabs: ['封闭班', '走读班'], //公务员和事业单位 的二级分类
				current2: 0, //公务员
				current3: 0, //事业单位
				id:1,
				datas:[]
			}
		},
		onLoad() {
			that=this
			this.getdata()
		},
		methods: {
			getdata(){
				///study/letter_wx
				var datas = {
					id:this.id
				}
				var jkurl = '/study/curriculum'
							
				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)
						that.curriculumImg=datas
						that.datas=res.arr
					} 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: '获取数据失败,请检查您的网络连接'
					})
				})
			},
			
			tabsClick(item, index) { //选项卡点击
				this.current = index
				this.id=item.id
				this.getdata()
			},
			async loadCurriculum() { //请求课程表
				// 可简写,直接取data,省略res
				const {
					data
				} = await api.getCurriculum()
				console.log(data);
			},
			seeClick(e) { //点击查看大图
				let imgUrl = []
				imgUrl.push(e)
				uni.previewImage({
					urls: imgUrl,
				})
			},
			civilTabsClick(item,index,name){//公务员和事业单位下 二级分类
				this[name]=index
				this.id=item.id
				this.getdata()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.twoMailbox {
		position: relative;
	}

	.tabs-wrap {
		height: 88rpx;
		justify-content: space-around;
		align-items: center;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #323232;
		background-color: #fff;
		border-top:1rpx solid #f3f4f6;
		.tabs-item {
			height: 100%;
			display: flex;
			align-items: center;
		}
		.tabs-active {
			color: #2D81FF;
			position: relative;
		}
	
		.tabs-active::after {
			content: '';
			position: absolute;
			left: 50%;
			bottom: 0rpx;
			transform: translate(-50%, 0);
			background-image: url(@/static/imagesV2/icon23.png);
			background-size: 100% 100%;
			height: 24rpx;
			width: 24rpx;
		}
	}
	
	.wrap {
		min-height: 1152rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding-bottom: 20rpx;
		position: absolute;
		top: 120rpx;
		left: 50%;
		transform: translate(-50%, 0);
		margin-bottom: 40rpx;
		justify-content: center;
		flex-direction: column;
		align-items: center;
	}

	.from-curriculum {
		width: 622rpx;
		height: 1014rpx;
		border-radius: 10rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
		}
	}

	.btn-wrap {
		width: 100%;
		height: auto;
		text-align: center;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #9497A8;
		margin-top: 22rpx;
	}

	.civil_tabs {
		width: 100%;
		justify-content: space-around;
		align-items: center;
		padding: 30rpx 0;
		.civil_tabs_item {
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #646464;
			padding: 20rpx 60rpx;
		}

		.civil_tabs_active {
			color: #2D81FF;
			position: relative;
			background: rgba(45, 129, 255, 0.1);
			border-radius: 32px;
		}

		// .civil_tabs_active::after {
		// 	content: '';
		// 	width: 50rpx;
		// 	height: 8rpx;
		// 	background-color: #0F9CFF;
		// 	opacity: 0.9;
		// 	border-radius: 6rpx;
		// 	position: absolute;
		// 	bottom: -18rpx;
		// 	left: 50%;
		// 	transform: translate(-50%, 0);
		// }
	}
</style>