首页 > 其他分享 >vue + element 表设计

vue + element 表设计

时间:2023-08-17 14:34:50浏览次数:38  
标签:default vue center color height item selectedCourse 设计 element

<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>

标签:default,vue,center,color,height,item,selectedCourse,设计,element
From: https://blog.51cto.com/u_16150721/7122359

相关文章

  • vue el-form 多种校验
    rules:Object.freeze({name1:[{required:true,message:'请输入发放计划编码',trigger:'blur'},{pattern:/^(?!\s+).*(?<!\s)$/,message:'首尾不能为空格',trigger:'blur'}],name2:[{required:true,mess......
  • VUE后台管理系统(三)
    SKU管理模块开发先完成静态组件###Sku.index.vue<template><div><el-tablestyle="width:100%"border><el-table-columntype="index"label="序号"width="80px"align="center">......
  • vue项目在360浏览器兼容模式下SCRIPT1002: 语法错误以及“fetch”未定义问题解决
    使用360浏览器的兼容模式,vue项目页面空白,打开控制台,发现如下报错:SCRIPT1002:语法错误 解决方法如下:1、安装依赖npminstall--savecore-jsregenerator-runtime2、在main.js引入import'core-js/stable';import'regenerator-runtime/runtime';3、在babel.confi......
  • 智能照明控制系统在体育馆乒乓球比赛场地中的设计与应用
    未晓妃安科瑞电气股份有限公司上海嘉定201801摘要:在早期的体育建设中,大多较为注重体育赛场的规糢形式,随着体育建筑的不断发展,人们对体育场地的功能性、设备情况、安全舒适程度和绿色环保情况越来越重视。智能系统开始在体育场馆建设中应用,而智能照明是智能系统的重要组成部分。在......
  • 模拟集成电路设计系列博客——1.1.4 Wilson电流镜
    1.1.4Wilson电流镜另一种高输出阻抗的电流镜是Wilson电流镜,如下图所示:这是一个使用串联-分流反馈来提升输出阻抗的例子,\(Q_2\)获得输出电流将其镜像给\(I_{D1}\),其反过头来与\(I_{in}\)相减。注意\(I_{D1}\)必须精确等于\(I_{in}\),否则\(Q_3\)和\(Q_4\)的栅压将会增加或减少,负......
  • Vuejs装饰器风格开发教程(计算属性、事件派发、侦听器)
    计算属性计算属性的设计背景:在Vuejs开发时我们可以在模板中通过编写表达式的方式做一系列的逻辑处理,但这就偏离的模板的概念,还会使得模板的内容变得臃肿且难以维护,所以引入了计算属性的来对不该出现在模板中的复杂逻辑处理进行重构,使用计算属性重构后的依然保持了状态的响应式......
  • 基于微信小程序的网上交易平台的设计与实现-计算机毕业设计源码+LW文档
    摘 要随着互联网技术的发展,传统的商品销售迎来了机遇,我国是个人口大国,商品的需求量大,如何推广商品的销售是企业非常关注的事情。随着电子商务多元化的发展,各种类型的商品逐渐转移到线上销售。在互联网的帮助下,带动企业打开销路,促进商品销售的可持续发展。同时,通过基于微信小程......
  • 会议记录管理系统-计算机毕业设计源码+LW文档
    摘 要随着信息技术的发展,管理系统越来越成熟,各种企事业单位使用各种类型的管理系统来提高工作效率,从而降低手工劳动的弊端。公司一直以来都非常重视公司信息化的发展,近几年来随着公司规模扩大,业务逐渐增加,公司对会员的管理也愈发的困难。因此,公司提出通过开发会议记录管理系统......
  • 基于PHP的花茶交流平台的设计与实现-计算机毕业设计源码+LW文档
    摘  要现在这种紧张压抑的生活状态,人们已经渐渐忘记了原本的样子,我们有时会想着去放下手中的工作,学会享受生活,品鉴人间趣味。在我国近五千年的历史长河中,茶文化对人们来说有着深厚含义。对于有着丰富生活阅历的人来说,品茶聊天就是最佳休闲方式。借此我产生了灵感设计了茶交流......
  • RTSP/Onvif视频服务器EasyNVR安防视频平台关于行业一体化监控平台的设计方案
    随着数字经济时代的到来,实体经济与数字技术的深度融合已经成为经济发展的主流思路。在这一背景下,传统能源行业的运营管理也面临着新的考验和机遇。很多大型能源企业开始积极应对这一趋势,逐步将视频监控、云计算、大数据和人工智能技术广泛应用于生产、维护、运输和配送等环节,以实......