<template>
	<view class="workSituationpage">
		<navbar class="navbarSticky" bg="#F6F6F6">
			<view class="index-header-box">
				<view class="index-header-img">
					<van-image width="100%" height="100%" fit="cover" class="img"
					src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1653464014000_713.png" />
				</view>
				<view class="index-header-tetx">
					<view class="index-header-title">
						welcome
					</view>
					<view class="index-header-name">周一围</view>
				</view>
			</view>
		</navbar>
		<view style="margin: 40rpx 0 10rpx 0;">
			<view style="padding:0 50rpx;font-weight: 800;color: #282828;">
				<view style="font-size: 36rpx;">Good afternoon，</view>
				<view style="font-size: 50rpx;">李老师</view>
			</view>
		</view>
        <course-card></course-card>
        <view class="index-student-information">
            <view class="workSituation-title-box flex">
                <view class="workSituation-title flex"
                :class="tabNme==t.name?'active':''"
                v-for="(t,index) in titleList" :key="index"
                @click="toggleTitle(t.name)">
                    <text class="name">{{t.name}}</text>
                    <view class="num">({{t.num}})</view>
                    <view class="current-title-box flex" v-show="tabNme==t.name">
                        <text class="name">{{t.name}}</text>
                        <view class="num">({{t.num}})</view> 
                    </view>
                </view>
            </view>
            <operation v-if="tabNme=='作业情况'"></operation>
            <studentList v-if="tabNme=='学生列表'"></studentList>
            <examList v-if="tabNme=='考试信息'"></examList>
		</view>
	</view>
</template>

<script>
    import courseCard from '../../components/index/course-card'
    import operation from '@/components/index/workSituation/operation'
    import studentList from '@/components/index/workSituation/studentList'
    import examList from '@/components/index/workSituation/examList'
	import vue, {
		ref,
		reactive,
		toRefs,
		toRef,
		getCurrentInstance,
		watch,
		computed,
		onMounted,
		provide,
		nextTick,
	} from "vue";

	 import {
		 getSweepCode
	 } from '../../api/index.js'
	import {
		getImageColor
	} from '../../utils/index.js'
	import indexassembly from './components/indexassembly.vue'
	import navbar from '../../components/navbar.vue'
	import bottom from '../../components/bottom.vue'
	export default {
		components: {
			navbar,
            courseCard,
            operation,
            studentList,
            examList
		},
		setup(props) {
			let {
				proxy
			} = getCurrentInstance();
			let data = reactive({
				titleList:[
                    {name:'学生列表',num:18},
                    {name:'作业情况',num:5},
                    {name:'考试信息',num:18},
                ],
                tabNme:'作业情况'
			});

			let methods = {
				back() {
					uni.navigateTo({
                        url: '/pages/index/index'
                    });
				},
                toggleTitle(t) {
                    data.tabNme = t
                }
			};

			onMounted(() => {

			});
			return {
				...toRefs(data),
				...methods,
			};
		},
		onShow() {
			this.userData = uni.getStorageSync('userInfo');
		},
		onShareAppMessage() {
			return {
				title: "甲小鹤",
				query: "/pages/index/index",
				imageUrl: "",
			};
		},
		onShareTimeline() {
			return {
				title: "甲小鹤",
				query: "/pages/index/index",
				imageUrl: "",
			};
		},
	};
</script>

<style scoped>
    .num{
        font-size: 20rpx;
        display: inline-block;
        margin-top: 5rpx;
    }
    .current-title-box{
        color: #FFFFFF;
        background: #282828;
        padding: 26rpx 36rpx;
        width: 80%;
        position: absolute;
        left: -18%;
        right: 0;
        top: -28rpx;
        border-radius: 39rpx;
        justify-content: center;
    }
    .workSituation-title.active{
        position: relative;
    }
    .workSituation-title{
        flex: 1;
        color: #282828;
        font-size: 26rpx;
        font-weight: bold;
        align-items: center;
        letter-spacing: 1px;
    }
    .workSituation-title-box{
        margin-bottom: 50rpx;
        margin: 0 50rpx 50rpx;
        padding: 17rpx 0 17rpx 28rpx;
        background: #F0F0F0;
        border-radius: 30rpx;
    }
    .index-student-information{
        min-height: 500rpx;
		background: rgba(255,255,255,.7);
		border-radius: 50rpx 50rpx 0 0;
        padding: 50rpx 0 30rpx 0;
	}
    .index-header-name{
		font-size: 30rpx;
		color: #474747;
	}
	.index-header-tetx{
		color: #D0D0D0;
		font-size: 24rpx;
	}
    .index-header-img .img{
		display: block;
		border: 2rpx solid rgba(164, 164, 164, 0.32);
		border-radius: 50%;
		overflow: hidden;
		width: 60rpx;
		height: 60rpx;
		box-sizing: border-box;
		margin: 4rpx;
	}
	.index-header-img{
		width: 68rpx;
		height: 68rpx;
		border-radius: 50%;
		overflow: hidden;
		text-align: center;
		margin-right: 20rpx;
		background: #FFFFFF;
	}
    .workSituationpage {
		min-height: 100vh;
		background-color: #f6f6f6;
		box-sizing: border-box;
		background-image: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1653464014000_398.png');
		background-position: 0 200rpx;
		background-repeat: no-repeat;
		background-size: 100% auto;
	}
	.index-header-box{
		display: flex;
		flex-direction: row;
		align-items: center;
		padding:0rpx 42rpx ;
	}
	.index-header-box .index-header-title{
		font-size: 24rpx;
		font-weight: 400;
		color: #B8B8B8;
	}
	.index-header-box .index-header-name{
		font-size: 30rpx;
		font-weight: 800;
		color: #282828;
	}
	.navbarSticky {
		display: sticky;
		top: 0;
		z-index: 9;
	}
	
</style>
