From 63536e0dfc14c3c08ce23d4c19b7bde959e055ca Mon Sep 17 00:00:00 2001 From: FunnyTedZhao <15201321241@163.com> Date: Sat, 22 Jun 2019 11:46:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E8=AE=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diary.html | 20 ++++++++++++++++++++ diary.js | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 diary.html create mode 100644 diary.js diff --git a/diary.html b/diary.html new file mode 100644 index 0000000..110326e --- /dev/null +++ b/diary.html @@ -0,0 +1,20 @@ + + + + + + + 日记 + + + + + + \ No newline at end of file diff --git a/diary.js b/diary.js new file mode 100644 index 0000000..d9a6029 --- /dev/null +++ b/diary.js @@ -0,0 +1,38 @@ +/** + * @Author: FunnyTedZhao + * @Date: 2019-06-22 10:04:43 + * @Last Modified by: FunnyTedZhao + * @Last Modified time: 2019-06-22 11:45:55 + */ + +/** + * 日记类 + * @class Diary + */ +class Diary { + constructor (day, isOvertime = false) { + this.day = day + this.isWork = (this.day > 0 && this.day < 6) ? true : (isOvertime ? true : false) + } + + /** + * 起床函数 + * @function getUP + * @param {Boolean} isOvertime + */ + getUP () { + const _wakeUpTime = this.isWork ? '闹钟响了' : '自然醒了' + document.write(`${_wakeUpTime},我该起床了!
`) + } + + /** + * 上班函数 + * @function goToWork + */ + goToWork (askForLeave = null) { + const _reasons = ['病假', '事假', '年假', '调休'] + this.isWork = _reasons.includes(askForLeave) ? false : true + const _doSomething = this.isWork ? '身体健康,吃嘛嘛香!好好上班,努力挣钱!' : '有些事情,请假一天。好好休息,调整身心!' + document.write(`${_doSomething}
`) + } +}