Explorar el Código

添加首页mini课表

liqk hace 4 años
padre
commit
673eaaa912

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/system.js

@@ -1,4 +1,5 @@
 export default {
+    preview:'P',
     title:'TEAM Model Cloud',
     loading:'加载中',
     menu:{

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/system.js

@@ -1,4 +1,5 @@
 export default {
+    preview:'预览',
     title:'醍摩豆云平台',
     loading:'加载中',
     menu:{

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/system.js

@@ -1,4 +1,5 @@
 export default {
+    preview:'預覽',
     title:'醍摩豆雲平台',
     loading: '加載中',
     menu: {

+ 0 - 182
TEAMModelOS/ClientApp/src/view/homepage/CoursePlan.vue

@@ -1,182 +0,0 @@
-<template>
-    <!-- 首页mini课表,暂时不用 -->
-    <div class="home-cus-plan dark-iview-table">
-        <Table :columns="columns1" :data="data1" border>
-            <!--星期一-->
-            <template slot-scope="{ row, index }" slot="MON">
-                <div v-if="row.MON == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期二-->
-            <template slot-scope="{ row, index }" slot="TUE">
-                <div v-if="row.TUE == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期三-->
-            <template slot-scope="{ row, index }" slot="WED">
-                <div v-if="row.WED == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期四-->
-            <template slot-scope="{ row, index }" slot="THU">
-                <div v-if="row.THU == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期五-->
-            <template slot-scope="{ row, index }" slot="FRI">
-                <div v-if="row.FRI == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期六-->
-            <template slot-scope="{ row, index }" slot="SAT">
-                <div v-if="row.SAT == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-            <!--星期日-->
-            <template slot-scope="{ row, index }" slot="SUN">
-                <div v-if="row.SUN == 1" class="active-cell">
-                    <span class="course-dot"></span>
-                </div>
-            </template>
-        </Table>
-    </div>
-</template>
-<script>
-    export default {
-        data() {
-            return {
-                columns1: [
-                    {
-                        title: ' ',
-                        type: 'index',
-                        align: 'center'
-                    },
-                    {
-                        title: '一',
-                        slot: 'MON',
-                        align: 'center'
-                    },
-                    {
-                        title: '二',
-                        slot: 'TUE',
-                        align: 'center'
-                    },
-                    {
-                        title: '三',
-                        slot: 'WED',
-                        align: 'center'
-                    },
-                    {
-                        title: '四',
-                        slot: 'THU',
-                        align: 'center'
-                    },
-                    {
-                        title: '五',
-                        slot: 'FRI',
-                        align: 'center'
-                    },
-                    {
-                        title: '六',
-                        slot: 'SAT',
-                        align: 'center'
-                    },
-                    {
-                        title: '日',
-                        slot: 'SUN',
-                        align: 'center'
-                    }
-                ],
-                data1: [
-                    {
-                        MON: '',
-                        THU: '',
-                        WED: '',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '1',
-                        SUN:''
-                    },
-                    {
-                        MON: '',
-                        THU: '',
-                        WED: '',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '',
-                        SUN:''
-                    },
-                    {
-                        MON: '',
-                        THU: '1',
-                        WED: '',
-                        THU: '',
-                        FRI: '1',
-                        SAT: '1',
-                        SUN:''
-                    },
-                    {
-                        MON: '1',
-                        THU: '',
-                        WED: '',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '',
-                        SUN:''
-                    },
-                    {
-                        MON: '',
-                        THU: '',
-                        WED: '',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '',
-                        SUN:''
-                    },
-                    {
-                        MON: '1',
-                        THU: '',
-                        WED: '',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '',
-                        SUN:''
-                    },
-                    {
-                        MON: '',
-                        THU: '',
-                        WED: '1',
-                        THU: '1',
-                        FRI: '',
-                        SAT: '',
-                        SUN:''
-                    }
-                ]
-            }
-        }
-    }
-</script>
-<style scoped lang="less">
-    .course-dot {
-        display:inline-block;
-        width:8px;
-        height:8px;
-        background:aqua;
-        border-radius:4px;
-    }
-    .active-cell {
-        width:100%;
-        height:48px;
-        line-height:48px;
-        background:#505050;
-    }
-</style>
-<style>
-
-</style>

+ 65 - 8
TEAMModelOS/ClientApp/src/view/homepage/HomePage.less

@@ -43,16 +43,19 @@
     margin-top: 15px;
     height: ~"calc(100% - 40px)";
 }
+.cus-table-area{
+    width: ~"calc(25% - 30px)";
+    margin-right: 30px;
+    margin-left: 20px;
+    margin-top: 15px;
+    height: ~"calc(100% - 40px)";
+}
 .class-data-area {
     width: ~"calc(22% - 20px)";
-    margin-right: 20px;
+    margin-right: 30px;
     height: ~"calc(100% - 40px)";
     margin-top: 15px;
 
-    .calss-chart-box {
-        /*padding-bottom: 20px;*/
-    }
-
     .upload-record-box {
         margin-top: 15px;
         height:~"calc(100% - 587px)";
@@ -60,7 +63,7 @@
 }
 .activity-area {
     width: ~"calc(27% - 20px)";
-    margin-right: 20px;
+    margin-right: 30px;
     height: ~"calc(100% - 40px)";
     margin-top: 15px;
     .ac-count-box {
@@ -79,7 +82,8 @@
     margin-top: 15px;
 
     .school-notice-box {
-        height: 33%;
+        // height: 33%;
+        height: 395px;
     }
 
     .common-notice-box {
@@ -89,7 +93,8 @@
 
     .system-notice-box {
         margin-top: 15px;
-        height: ~"calc(33% - 15px)";
+        // height: ~"calc(33% - 15px)";
+        height: ~"calc(100% - 410px)";
     }
 }
 
@@ -360,4 +365,56 @@
     color: white;
     text-align: center;
     font-size: 16px;
+}
+.today-text-label{
+    color: #FFFFFF;
+    margin-top: 30px;
+    border-bottom: 1px solid #606060;
+    padding-bottom: 8px;
+}
+.today-cus-item{
+    padding: 10px 10px;
+    border-bottom: 1px solid #505050;
+    display: flex;
+    align-items: center;
+    &:hover{
+        background: #404040;
+    }
+    
+    .label-icon{
+        color:#1cc0f3;
+        margin-right: 5px;
+        font-size: 22px;
+        display: block;
+        width: 40px;
+        margin-right: 10px;
+        text-align: center;
+    }
+    .cus-time{
+        font-size: 22px;
+        font-weight: 400;
+        color: white;
+        display: inline-block;
+    }
+    .cus-time-label{
+        font-size: 18px;
+        font-weight: 400;
+        margin-left: 5px;
+        // color: #1cc0f3;
+    }
+    .cus-name{
+        color: #a5a5a5;
+        font-size: 14px;
+        text-overflow:ellipsis; 
+        overflow:hidden; 
+        white-space:nowrap; 
+        margin-right: 20px;
+    }
+    .cus-class{
+        color: #a5a5a5;
+        font-size: 14px;
+        text-overflow:ellipsis; 
+        overflow:hidden; 
+        white-space:nowrap; 
+    }
 }

+ 64 - 37
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

@@ -38,9 +38,9 @@
         </div>
 
     </div>
-
     <div v-else class="home-page-container dark-iview-split dark-iview-card">
-        <div class="prepare-area box-item">
+        <!-- 课前预习 对应模块暂未排上里程 暂时隐藏 -->
+        <!-- <div class="prepare-area box-item">
             <p class="list-title">
                 {{$t('home.previewStudy')}}
             </p>
@@ -66,11 +66,54 @@
                     </div>
                 </vuescroll>
             </div>
+        </div> -->
+        <div class="cus-table-area box-item">
+            <p class="list-title">
+                <!-- {{$t('home.previewStudy')}} -->
+                我的课表
+            </p>
+            <div class="card-content-box" style="padding:10px">
+                <vuescroll>
+                    <MinTable @tmwCus="getTmwCus"></MinTable>
+                    <p class="today-text-label">
+                        明日课程
+                    </p>
+                    <div class="today-cus-item" v-for="(item,index) in tmwCus" :key="index">
+                        <Icon type="md-time" class="label-icon" />
+                        <div>
+                            <p class="cus-time">
+                                <span>{{item.time}}</span>
+                                <span class="cus-time-label">
+                                    {{item.timeLabel}}
+                                </span>
+                            </p>
+                            <p>
+                                <span class="cus-name">
+                                    课程:
+                                    <span style="color:white">
+                                        {{item.course}}
+                                    </span>
+                                </span>
+                                <span class="cus-class">
+                                    班级:
+                                    <span style="color:white">
+                                        {{item.class}}
+                                    </span>
+                                </span>
+                            </p>
+                        </div>
+                    </div>
+                    <EmptyData textContent="明日暂无课程"></EmptyData>
+                </vuescroll>
+            </div>
         </div>
         <div class="class-data-area" style="display:flex;flex-direction:column;">
             <div class="calss-chart-box box-item">
                 <p class="chart-title">
                     {{$t('home.classData')}}
+                    <span style="color: aqua;margin-left: 6px;font-size: 12px;">
+                        ({{$t('system.preview')}})
+                    </span>
                 </p>
                 <TechScore></TechScore>
                 <TeachScore></TeachScore>
@@ -78,6 +121,9 @@
             <div class="upload-record-box box-item" style="flex:1;">
                 <p class="list-title">
                     {{$t('home.recentRecord')}}
+                    <span style="color: aqua;margin-left: 6px;font-size: 12px;">
+                        ({{$t('system.preview')}})
+                    </span>
                 </p>
                 <div class="card-content-box">
                     <vuescroll>
@@ -197,6 +243,9 @@
             <div class="school-notice-box box-item">
                 <p class="list-title">
                     <span>{{$t('home.scNotice')}}</span>
+                    <span style="color: aqua;margin-left: 6px;font-size: 12px;">
+                        ({{$t('system.preview')}})
+                    </span>
                     <span class="notice-count-tag">2</span>
                 </p>
                 <div class="card-content-box">
@@ -216,7 +265,8 @@
                     </vuescroll>
                 </div>
             </div>
-            <div class="common-notice-box box-item">
+            <!-- 消息通知 暂时去掉移到头部, -->
+            <!-- <div class="common-notice-box box-item">
                 <p class="list-title">
                     <span>{{$t('home.msg')}}</span>
                     <span class="notice-count-tag">1</span>
@@ -234,40 +284,16 @@
                                 </div>
                                 <p class="notice-text">上课的时候有个问题没听懂,想和老师做进一步讨论。</p>
                             </li>
-                            <li>
-                                <div style="display:flex;justify-content:space-between;">
-                                    <p>
-                                        <span class="notice-title">李志轩</span>
-                                    </p>
-                                    <span class="notice-time">2020-09-09 18:02</span>
-                                </div>
-                                <p class="notice-text">上课的时候有个问题没听懂,想和老师做进一步讨论。</p>
-                            </li>
-                            <li>
-                                <div style="display:flex;justify-content:space-between;">
-                                    <p>
-                                        <span class="notice-title">叶曜灵</span>
-                                    </p>
-                                    <span class="notice-time">2020-09-09 18:02</span>
-                                </div>
-                                <p class="notice-text">上课的时候有个问题没听懂,想和老师做进一步讨论。</p>
-                            </li>
-                            <li>
-                                <div style="display:flex;justify-content:space-between;">
-                                    <p>
-                                        <span class="notice-title">王子睿</span>
-                                    </p>
-                                    <span class="notice-time">2020-09-09 18:02</span>
-                                </div>
-                                <p class="notice-text">上课的时候有个问题没听懂,想和老师做进一步讨论。</p>
-                            </li>
                         </ul>
                     </vuescroll>
                 </div>
-            </div>
+            </div> -->
             <div class="system-notice-box box-item">
                 <p class="list-title">
                     <span>{{$t('home.sysMsg')}}</span>
+                    <span style="color: aqua;margin-left: 6px;font-size: 12px;">
+                        ({{$t('system.preview')}})
+                    </span>
                     <span class="notice-count-tag">{{$store.state.userInfo.hasSchool ? 1 : 2}}</span>
                 </p>
                 <div class="card-content-box">
@@ -297,19 +323,24 @@
 import AcCountPie from "./AcCountPie.vue"
 import TechScore from "./TechScore.vue"
 import TeachScore from "./TeachScore.vue"
+import MinTable from "./MinTable.vue"
 export default {
     components: {
-        AcCountPie, TechScore, TeachScore
+        AcCountPie, TechScore, TeachScore, MinTable
     },
     data() {
         return {
             split1: 0.5,
             split2: 0.5,
             split3: 0.5,
-            itemCount: 10
+            itemCount: 10,
+            tmwCus: []
         }
     },
     methods: {
+        getTmwCus(data) {
+            this.tmwCus = data
+        },
         toAc(type) {
             switch (type) {
                 case 'vote':
@@ -366,8 +397,4 @@ export default {
     height: calc(100% - 52px);
     padding: 0px;
 }
-
-.home-page-container .__panel {
-    /* padding-right: 17px; */
-}
 </style>

+ 358 - 0
TEAMModelOS/ClientApp/src/view/homepage/MinTable.vue

@@ -0,0 +1,358 @@
+<template>
+    <!-- 首页mini课表,暂时不用 -->
+    <div class="home-cus-plan dark-iview-table">
+        <Table :columns="columns" :data="cusData" border>
+            <!--星期一-->
+            <template slot-scope="{ row, index }" slot="MON">
+                <div v-if="row.MON == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期二-->
+            <template slot-scope="{ row, index }" slot="TUE">
+                <div v-if="row.TUE == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期三-->
+            <template slot-scope="{ row, index }" slot="WED">
+                <div v-if="row.WED == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期四-->
+            <template slot-scope="{ row, index }" slot="THU">
+                <div v-if="row.THU == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期五-->
+            <template slot-scope="{ row, index }" slot="FRI">
+                <div v-if="row.FRI == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期六-->
+            <template slot-scope="{ row, index }" slot="SAT">
+                <div v-if="row.SAT == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+            <!--星期日-->
+            <template slot-scope="{ row, index }" slot="SUN">
+                <div v-if="row.SUN == 1" class="active-cell" @click="toDetail">
+                    <span class="course-dot"></span>
+                </div>
+            </template>
+        </Table>
+    </div>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            classList: [],
+            schoolBase: {
+                period: []
+            },
+            courseList: [],
+            courseListShow: [],
+            fullCus: [],
+            columns: [
+                {
+                    title: ' ',
+                    type: 'index',
+                    align: 'center'
+                },
+                {
+                    title: '一',
+                    slot: 'MON',
+                    align: 'center'
+                },
+                {
+                    title: '二',
+                    slot: 'TUE',
+                    align: 'center'
+                },
+                {
+                    title: '三',
+                    slot: 'WED',
+                    align: 'center'
+                },
+                {
+                    title: '四',
+                    slot: 'THU',
+                    align: 'center'
+                },
+                {
+                    title: '五',
+                    slot: 'FRI',
+                    align: 'center'
+                },
+                {
+                    title: '六',
+                    slot: 'SAT',
+                    align: 'center'
+                },
+                {
+                    title: '日',
+                    slot: 'SUN',
+                    align: 'center'
+                }
+            ],
+            cusData: [],
+            tmwCus:[]
+        }
+    },
+    methods: {
+        toDetail(){
+            this.$router.push({
+                name:'myCourse'
+            })
+        },
+        //获取个人和校本课程列表,API调整后没有进行分开处理
+        getCourseList() {
+            this.listLoading = true
+            let requestData = {
+                'code': this.$store.state.userInfo.TEAMModelId,
+                'schoolId': this.$store.state.userInfo.schoolCode,
+                'scope': 'private'
+            }
+            this.$api.courseMgmt.findCourse(requestData).then(
+                (res) => {
+                    if (!res.error) {
+                        this.courseList = res.courses
+                        //过滤校本课程 
+                        this.courseListShow = this.courseList.filter(item => {
+                            return item.scope == 'school'
+                        })
+                        let promises = []
+                        this.courseListShow.forEach(item => {
+                            let requestData = {
+                                'code': this.$store.state.userInfo.schoolCode,
+                                'scope': 'school',
+                                'id': item.id
+                            }
+                            promises.push(this.$api.courseMgmt.findCusInfo(requestData))
+                        })
+                        Promise.all(promises).then(
+                            async resAll => {
+                                for (const res of resAll) {
+                                    if (res.courses && res.courses.length > 0) {
+                                        res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
+                                        //过滤当前教师的schedule
+                                        res.courses[0].schedule = res.courses[0].schedule.filter(item => {
+                                            return item.teacherId == this.$store.state.userInfo.TEAMModelId
+                                        })
+                                        // 获取自定义名单信息
+                                        let ids = res.courses[0].schedule.map(item => {
+                                            return item.stulist
+                                        })
+                                        for (let i = 0; i < ids.length; i++) {
+                                            if (!ids[i]) {
+                                                ids.splice(i, 1)
+                                                i--
+                                            }
+                                        }
+                                        let stuList = []
+                                        if (ids.length) {
+                                            try {
+                                                let listRes = await this.getListInfo([...ids])
+                                                if (listRes) stuList.push(...listRes.stuList)
+                                            } catch (e) {
+                                                this.$Message.error('API ERROR!')
+                                            }
+                                        }
+
+                                        res.courses[0].schedule.forEach(item => {
+                                            //补充教室信息
+                                            if (item.classId) {
+                                                let classInfo = this.classList.find(classItem => {
+                                                    return classItem.id == item.classId
+                                                })
+                                                item.classInfo = {
+                                                    id: item.classId,
+                                                    name: classInfo ? classInfo.name : '--'
+                                                }
+                                            }
+                                            //补充名单信息
+                                            if (ids.length && item.stulist) {
+                                                let listInfo = stuList.find(listItem => {
+                                                    return listItem.id == item.stulist
+                                                })
+                                                item.listName = listInfo ? listInfo.name : '--'
+                                                item.students = listInfo ? listInfo.students : []
+                                                item.fullStu = false
+                                            }
+                                        })
+                                    }
+                                    this.fullCus.push(res.courses[0])
+                                }
+                                this.dataToTable()
+                            },
+                            err => {
+                                this.$Message.error('API ERROR')
+                            }
+                        ).finally(() => {
+                            this.listLoading = false
+                        })
+
+                    } else {
+                        this.$Message.error('API ERROR!')
+                    }
+                },
+                (err) => {
+                    this.$Message.error('API ERROR!')
+                }
+            ).finally(() => {
+                this.listLoading = false
+            })
+        },
+        //根据id获取stulist信息
+        getListInfo(ids) {
+            let requestData = {
+                'code': this.$store.state.userInfo.schoolCode,
+                'scope': 'school',
+                'ids': ids
+            }
+            return this.$api.courseMgmt.findListSummary(requestData)
+        },
+        //根据schedule处理数据进行渲染
+        dataToTable() {
+            //目前默认显示第一个学段的课程
+            let period = ''
+            if (this.schoolBase.period && this.schoolBase.period.length) {
+                period = this.schoolBase.period[0].id
+            }
+            let pdData = this.schoolBase.period.find(item => {
+                return item.id == period
+            })
+            if (pdData) {
+                let times = pdData.timetable
+                if (times && times.length) {
+                    this.cusData = Array.apply(null, { length: times.length }).map(() => ({
+                        MON: '',
+                        TUE: '',
+                        WED: '',
+                        THU: '',
+                        FRI: '',
+                        SAT: '',
+                        SUN: ''
+                    }))
+                    let tmw = this.getNextDay()
+                    // let tmw = 'WED'
+                    this.fullCus.forEach((cusItem) => {
+                        cusItem.schedule.forEach(schedItem => {
+                            schedItem.time.forEach(timeItem => {
+                                //处理mini课表数据
+                                let index = times.findIndex(i => {
+                                    return i.id == timeItem.id
+                                })
+                                if (index > -1) {
+                                    this.cusData[index][timeItem.week] = '1'
+                                }
+
+                                // 获取明日课程
+                                if(timeItem.week == tmw){
+                                    let t = times.find(i=>{
+                                        return i.id == timeItem.id
+                                    })
+                                    if(t){
+                                        this.tmwCus.push(
+                                            {
+                                                time: t.time,
+                                                timeLabel: t.label,
+                                                course: cusItem.name,
+                                                class: schedItem.classId ? schedItem.classInfo.name : schedItem.listName
+                                            }
+                                        )
+                                    }
+                                }
+                            })
+                        })
+                    })
+                    this.$emit('tmwCus',this.tmwCus)
+                }
+            }
+        },
+        getNextDay() {
+            let today = new Date().getDay()
+            let tomorrow
+            if (today < 7) {
+                tomorrow = today++
+            } else {
+                tomorrow = 1
+            }
+            let name
+            switch (tomorrow) {
+                case 1:
+                    name = 'MON'
+                    break
+                case 2:
+                    name = 'TUE'
+                    break
+                case 3:
+                    name = 'WED'
+                    break
+                case 4:
+                    name = 'THU'
+                    break
+                case 5:
+                    name = 'FRI'
+                    break
+                case 6:
+                    name = 'SAT'
+                    break
+                case 7:
+                    name = 'SUN'
+                    break
+                default:
+                    break
+            }
+            return name
+        }
+    },
+    created() {
+        //直接读取登录成功拿到得学校基础信息
+        this.$store.dispatch('user/getSchoolProfile').then(res => {
+            this.classList = res.school_classes
+            this.schoolBase = res.school_base
+            this.getCourseList()
+        })
+    }
+}
+</script>
+<style scoped lang="less">
+.course-dot {
+    display: inline-block;
+    width: 8px;
+    height: 8px;
+    background: #1cc0f3;
+    border-radius: 4px;
+}
+.active-cell {
+    width: 100%;
+    height: 30px;
+    line-height: 30px;
+    background: #383838;
+    cursor: pointer;
+}
+</style>
+<style>
+.home-cus-plan .ivu-table-cell {
+    padding: 0px;
+}
+.home-cus-plan .ivu-table-row-hover {
+    background: none;
+}
+.home-cus-plan .ivu-table td,
+.ivu-table th {
+    height: 30px;
+}
+.home-cus-plan .ivu-table td, .home-cus-plan .ivu-table-header thead tr th, .home-cus-plan .ivu-table-wrapper{
+    border-color: #383838;
+}
+.home-cus-plan .ivu-table::after{
+    background-color: #383838;
+}
+</style>

+ 1 - 1
TEAMModelOS/ClientApp/src/view/task/index.vue

@@ -369,7 +369,7 @@ export default {
     },
     created() {
         this.findTask()
-        this.curBarIndex = sessionStorage.getItem('markMode') || 0
+        this.curBarIndex = sessionStorage.getItem('markMode') || 1
 
     },
     computed: {