Merge pull request #2 from snsd0805/dev

修正issue #1
This commit is contained in:
snsd0805 2020-09-17 15:54:38 +08:00 committed by GitHub
commit 4032c04629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,8 +17,8 @@ var courseTable = {
props: ['select_c'],
data: function(){
return {
'tableBody': "<tbody>",
'courses': {},
'existWeekend': false
}
},
methods: {
@ -38,8 +38,17 @@ var courseTable = {
watch: {
'select_c': function(){
this.courses = {}
var weekendLock = false
for(var c of this.select_c){
this.courses[c.time] = c.name
if(c.time[0]==6 || c.time[0]==7){
weekendLock = true
}
}
if(weekendLock){
this.existWeekend = true
}
}
},
@ -55,6 +64,10 @@ var courseTable = {
<th scope="col" class="col-md-2"></th>
<th scope="col" class="col-md-2"></th>
<th scope="col" class="col-md-2"></th>
<template v-if='existWeekend'>
<th scope="col" class="col-md-1"></th>
<th scope="col" class="col-md-1"></th>
</template>
</tr>
</thead>
<tbody>
@ -63,8 +76,14 @@ var courseTable = {
<th style='text-align: center;' scope='row'>
{{ hour+7 }}~{{ hour+8 }} <br> z
</th>
<td style='text-align: center; background-color: #1abc9c;' colspan='5'>
中午休息時間
<td style='text-align: center; background-color: #1abc9c;'
v-for="week in (existWeekend)?7:5">
<course-div
v-if="exist(week+'z')"
v-bind:course="courses[week+'z']"
v-on:remove-course="removeCourseHandler"
></course-div>
</td>
</template>
<template v-else>
@ -72,7 +91,7 @@ var courseTable = {
{{ hour+7 }} ~ {{ hour+8 }} <br>
{{ String.fromCharCode(97+((hour<5)?(hour-1):(hour-2))) }}
</th>
<td v-for='week in 5'>
<td v-for='week in (existWeekend)?7:5'>
<course-div
v-if="exist(week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2))))"
v-bind:course="courses[week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))]"