Vue + Element UI——大学课程表(包括普通课和实践课)解决方案

解决方案

<template>
    <div class="course-table" >
        <el-scrollbar style="height: 100%" >
            <div class="course-table-content" >
                <div class="top":style="{width:courseWidth * weekTable.length + 'px'}">
                    <div v-for="item in weekTable" class="top-text" :style="{width: courseWidth + 'px'}">周{{item}}</div>
                </div>
                <div class="main" :style="{ width:courseWidth * weekTable.length + 35 + 'px',
                                            height:courseHeight * timeTable.length +'px'}">
                    <div class="period">
                        <div v-for="item in timeTable" class="left-text" :style="{height: courseHeight + 'px'}">{{item}}</div>
                    </div>
                    <!--课表-->
                    <div v-for="(item,index) in usualCourses">
                        <div class="flex-item kcb-item" @click="selectedCourseIndex = index;showUsualCourseDialog=true"
                             :style="{  marginLeft:(item.day-1) * courseWidth + 'px',
                                        marginTop:(item.period-1) * courseHeight + 5+ 'px',
                                        width:courseWidth + 'px',
                                        height:item.length * courseHeight - 5 +'px',
                                        backgroundColor:colorArrays[index%9]}">
                            <div class="small-text" >{{item.name+'@'+item.room}}</div>
                        </div>
                    </div>
                    <!--事件课显示按钮-->
                    <el-button type="primary" @click="showPracticeCourseDialog = true" class="btn_practice_course">实践课</el-button>
                </div>
            </div>
        </el-scrollbar>

        <el-dialog
                title="我的实践课"
                :visible.sync="showPracticeCourseDialog"
                width="30%"
                center>
            <el-scrollbar style="height: 500px;"  wrap-style="overflow-x:hidden;">
                <div class="dialog-content">
                    <div v-for="(item,index) in practiceCourses">
                        <div>课程名称: {{item.name}}</div>
                        <div>上课教师: {{item.teacher}}</div>
                    </div>
                    <div class="tip" v-if="practiceCourses.length < 1">本学期没有实践课哦</div>
                </div>
            </el-scrollbar>
        </el-dialog>
        <el-dialog
                title="课程信息"
                :visible.sync="showUsualCourseDialog"
                width="30%"
                center>
            <div class="dialog-content">
                <div v-if="typeof(selectedCourse) != 'undefined'" >
                    <div>课程名称: {{selectedCourse.name}}</div>
                    <div>上课时间: {{selectedCourse.week + ' ' +
                        '第' + selectedCourse.period +
                        '-' + (Number(selectedCourse.period) + Number(selectedCourse.length) - 1) + '节'}}</div>
                    <div>上课教师: {{selectedCourse.teacher}}</div>
                    <div>上课地点: {{selectedCourse.room}}</div>
                </div>
                <div v-else class="tip" >本学期没有课哦</div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="showUsualCourseDialog = false">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        name: "CourseTable",
        data(){
            return {
                showUsualCourseDialog:false,
                showPracticeCourseDialog:false,
                selectedCourseIndex:0
            }
        },
        props:{
            width:{
                type:Number,
                default:385
            },
            height:{
                type:Number,
                default:635
            },
            usualCourses:{
                type:Array,
                default:()=>[]
            },
            practiceCourses:{
                type:Array,
                default:()=>[]
            },
            weekTable:{
                type:Array,
                default:()=>['一','二','三','四','五','六','日']
            },
            timeTable:{
                type:Array,
                default:()=>[1,2,3,4,5,6,7,8,9,10,11,12]
            },
            colorArrays: {
                type:Array,
                default:()=>['#ef5b9c','#f15b6c', '#f26522', '#ffd400', '#8552a1', '#7fb80e', '#65c294', '#78cdd1', '#33a3dc']
            }
        },
        computed:{
            courseWidth(){
                return Math.max((this.width - 35) / this.weekTable.length,50)
            },
            courseHeight(){
                return Math.max((this.height - 35) / this.timeTable.length,50)
            },
            selectedCourse(){
                return this.usualCourses[this.selectedCourseIndex];
            }
        },
        created(){

        },
        mounted(){

        },
        methods:{

        }
    }
</script>

<style scoped>
    .course-table{
        border-radius: 12px;
    }
    .top {
        display: flex;
        flex-direction: row;
        padding-left: 35px;
        background-color: #31c27c;
        color: #fff;
    }
    .top-text {
        width: 100px;
        height: 35px;
        font-size: 26px;
        justify-content: center;
        display: flex;
        align-items: center;
    }
    .main{
        height:1200px;
        width:730px;
        display:flex;
        position: relative;
    }
    .flex-item {
        width: 95px;
        height: 200px;
    }
    .kcb-item {
        position: absolute;
        justify-content: center;
        display: flex;
        align-items: center;
        border-radius: 12px;
        overflow: hidden;
    }
    .period{
        background-color:#31c27c;
        color:#fff;
    }
    .small-text {
        font-size: 22px;
        color: #fff;
        text-align: center;
    }
    .left-text {
        width: 35px;
        height: 100px;
        font-size: 26px;
        justify-content: center;
        display: flex;
        align-items: center;
    }
    .btn_practice_course{
        position: absolute;
        z-index: 110;
        top: 35px;
        right: 0px;
        width: 100px;
        height: 100px;
        line-height: 24px;
        background: #31c27c;
        border-radius: 50px;
        font-size: 24px;
        text-align: center;
        color: #fff;
        opacity: 0.7;
        padding: 12px;
    }
    .el-dialog .dialog-content{
        color: #000;
        line-height: 60px;

    }
    .el-dialog .dialog-content .tip{
        color: #000;
        line-height: 60px;
        text-align: center;
    }
</style>

运行结果

参考文章

http://www.jq22.com/jquery-info20282

  • 4
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
毕业设计是高等教育阶段学生在完成学业前所进行的一项重要学术任务,旨在检验学生通过学习所获得的知识、技能以及对特定领域的深刻理解能力。这项任务通常要求学生运用所学专业知识,通过独立研究和创新,完成一个实际问题的解决方案或者开展一项有价值的项目。 首先,毕业设计的选择通常由学生根据个人兴趣、专业方向以及实际需求来确定。学生需要在导师的指导下明确研究目标、问题陈述,确立研究的范围和深度。毕业设计可以包括文献综述、需求分析、方案设计、实施与测试等多个阶段,以确保整个过程的科学性和系统性。 其次,毕业设计的完成通常需要学生具备一定的独立思考和解决问题的能力。在研究过程中,学生可能需要采用各种研究方法,如实验、调查、案例分析等,以获取必要的数据和信息。通过这些活动,学生能够培养扎实的专业技能,提升解决实际问题的实际能力。 第三,毕业设计的撰写是整个过程的重要组成部分。学生需要将研究过程、方法、结果以及结论等详细记录在毕业论文中,以展示其研究的全貌和成果。同时,撰写毕业设计还有助于提高学生的学术写作水平,培养清晰、逻辑的表达能力。 最后,毕业设计的评价通常由导师和相关专业人士进行。评价标准包括研究的创新性、实用性、方法的科学性以及论文的质量等方面。学生在毕业设计中获得的成绩也将直接影响其最终的学业成绩和学位授予。 总的来说,毕业设计是高等教育中的一项重要环节,通过此过程,学生不仅能够巩固所学知识,还能培养独立思考和解决问题的能力,为将来的职业发展奠定坚实的基础。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Starzkg

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值