commit
fc9b237dcf
@ -7,7 +7,8 @@ var mainWindow = {
|
|||||||
'selectDepartment': '',
|
'selectDepartment': '',
|
||||||
'foundName': "",
|
'foundName': "",
|
||||||
"user": "",
|
"user": "",
|
||||||
'token': ""
|
'token': "",
|
||||||
|
'is_print': false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -194,19 +195,30 @@ var mainWindow = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'generatePic': function () {
|
'generatePic': function () {
|
||||||
|
var main = this
|
||||||
|
const doPrint = new Promise((resolve, reject) => {
|
||||||
|
main.is_print = true;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
doPrint
|
||||||
|
.then(() =>{
|
||||||
html2canvas(document.getElementById('course-table-div')).then(function (canvas) {
|
html2canvas(document.getElementById('course-table-div')).then(function (canvas) {
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.href = canvas.toDataURL("image/jpeg").replace("image/jpeg", "image/octet-stream");
|
a.href = canvas.toDataURL("image/jpeg").replace("image/jpeg", "image/octet-stream");
|
||||||
a.download = '課表.jpg';
|
a.download = '課表.jpg';
|
||||||
a.click();
|
a.click();
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
main.is_print = false;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
'share': function () {
|
'share': function () {
|
||||||
if (this.user != "")
|
if (this.user != "")
|
||||||
$('#share').modal('show');
|
$('#share').modal('show');
|
||||||
else
|
else
|
||||||
this.login()
|
this.login()
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'course-table': courseTable,
|
'course-table': courseTable,
|
||||||
@ -292,6 +304,7 @@ var mainWindow = {
|
|||||||
id="course-table-div"
|
id="course-table-div"
|
||||||
v-bind:selectCourses="selectCourses"
|
v-bind:selectCourses="selectCourses"
|
||||||
v-bind:select_c="selectCourses"
|
v-bind:select_c="selectCourses"
|
||||||
|
v-bind:is_print="is_print"
|
||||||
v-bind:is_shared="false"
|
v-bind:is_shared="false"
|
||||||
v-on:remove-course="removeCourse"
|
v-on:remove-course="removeCourse"
|
||||||
></course-table>
|
></course-table>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
var courseDiv = {
|
var courseDiv = {
|
||||||
props: ['course', 'is_shared'],
|
props: ['course', 'is_shared', 'is_print'],
|
||||||
template: `
|
template: `
|
||||||
<div style='border: 5px #1abc9c solid; text-align: center;'>
|
<div style='border: 5px #1abc9c solid; text-align: center;'>
|
||||||
{{ course.name }}
|
{{ course.name }}
|
||||||
@ -7,6 +7,7 @@ var courseDiv = {
|
|||||||
v-if="!is_shared"
|
v-if="!is_shared"
|
||||||
v-on:click="$emit('remove-course', course.name)"
|
v-on:click="$emit('remove-course', course.name)"
|
||||||
class="btn btn-danger btn-sm"
|
class="btn btn-danger btn-sm"
|
||||||
|
:style="{'display': is_print ? 'none' : 'inline-block'}"
|
||||||
>
|
>
|
||||||
刪
|
刪
|
||||||
</button>
|
</button>
|
||||||
@ -22,7 +23,7 @@ var tempDiv = {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
var courseTable = {
|
var courseTable = {
|
||||||
props: ['select_c', 'is_shared'],
|
props: ['select_c', 'is_shared', 'is_print'],
|
||||||
data: function(){
|
data: function(){
|
||||||
return {
|
return {
|
||||||
'courses': {},
|
'courses': {},
|
||||||
@ -112,6 +113,7 @@ var courseTable = {
|
|||||||
v-if="exist(week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))) && !courses[week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))].temp"
|
v-if="exist(week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))) && !courses[week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))].temp"
|
||||||
v-bind:course="courses[week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))]"
|
v-bind:course="courses[week+String.fromCharCode(97+((hour<5)?(hour-1):(hour-2)))]"
|
||||||
v-bind:is_shared="is_shared"
|
v-bind:is_shared="is_shared"
|
||||||
|
v-bind:is_print="is_print"
|
||||||
v-on:remove-course="removeCourseHandler"
|
v-on:remove-course="removeCourseHandler"
|
||||||
></course-div>
|
></course-div>
|
||||||
<temp-div
|
<temp-div
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user