大家都自己計算造表格,不如寫一個小計算機讓大家可以在上面試算與分享?
就這樣,應該馬上就做好了!
先來看一下 勞基法 好了!
BTW, 這只是其中的一條
等等等等,先跳過太複雜的變形工時
我們還是從簡單的問題開始好了
每個月工作天約二十天,每天正常工作時數是八小時
最低加班費的算法是乘以 1 ⅓
36000 / 20 / 8 * (4 / 3) = 300
36000 / 30 / 8 * (4 / 3) = 200
週六加班第一小時的 最低法定薪資 應該是多少?
因為你假日有給薪喔~
所以週六來加班的話根據勞基法 24 條額外加給三分之一以上
所以我有打電話去台北市勞動局確認過
目前勞動檢查確實是這樣認定
好吧雖然很扯,但搞清楚規則之後
還是可以照計畫作出來
不管用框架或是純寫 JavaScript 都可以完成,我自己使用框架主要是要讓開發速度加快。熟悉了開發工具不論用哪套其實都可以達到目的
這是現代版本的 Angular.js 吧?
$ npm install vue-cli
$ vue init webpack PROJECT_NAME
import Vue from 'vue'; import App from './App'; new Vue({ el: 'body', components: { App }, });
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>workweek</title> </head> <body> <app></app> <!-- built files will be auto injected --> </body> </html>
import Vue from 'vue'; import App from './App'; new Vue({ el: 'body', components: { App }, });
// ES5 new Vue({ el: 'body', components: { App: App }, });
ES6
items.filter(item => item.is(Text));
var [a, b] = [1, 2];
身為一個新手而這又是個小週末專案
就把所有東西都到一個叫做 Workweek 的 vue component 吧 :D
export default { components: { Component1, Component2 }, props: ['prop1', 'prop2'], methods: { method1 (reason) { // ... }, method2 () { // ... } }, data () { // {{data1}} return { data1: 'DATA1', data2: 'DATA2', data3: 'DATA3', }; }, computed: { // {{computed1}} computed1() { // ... }, computed2() { // ... } } };
data () { // ... return { reason: reason, daynames: solutions.DAY_NAMES, workhours: workhours, assumingWorkHours: 240, monthlyPay: monthlyPay, expandDetail: false, regularHoursPerDay: solutions.REGULAR_HOURS_PER_DAY }; },
export default { data() { /* ... */ }, computed: { hourlyPay: function () { return parseFloat(this.monthlyPay / this.assumingWorkHours); }, regularPay: function () { return this.hourlyPay * 8 * 7; } } };
export default { methods: { toggleExpanding: function (evt) { this.expandDetail = !this.expandDetail; } } };
v-model
v-for
v-show / v-if
v-bind:model
(簡寫 :model)v-on:click
(簡寫 @click){{ variable }}
{{{ html }}}
<offday-condition v-bind:reason="reason" v-on:reason-changed="reasonChanged"> </offday-condition>
簡寫
<offday-condition :reason="reason" @reason-changed="reasonChanged"> </offday-condition>
OffdayCondition.vue script
export default { props: ['reason'], watch: { reason (val) { this.$dispatch('reason-changed', val); } } };
Workweek.vue script
reasonChanged (reason) { this.reason = reason; }
export default { computed: { currentSolution () { return solutions.current(this.workhours, this.hourlyPay, this.reason); }, oneRestOneOffSolution () { return solutions.oneRestOneOff(this.workhours, this.hourlyPay, this.reason); }, twoOffSolution () { return solutions.twoOff(this.workhours, this.hourlyPay, this.reason); } } }
<current-solution :solution="currentSolution" :regular-pay="regularPay" :overtime-pay-winner="mostOvertimePay.current" :expand="expandDetail"> </current-solution>
deploy 到 github pages 是個不錯的選擇
{ "name": "workweek", "scripts": { "dev": "node build/dev-server.js", "build": "node build/build.js", "test": "echo \"No tests\"", "lint": "eslint --ext .js,.vue src", "deploy": "node build/deploy.js" } }
language: node_js node_js: - '4' env: global: - GH_REF=github.com/g0v/workweek.git # GH_TOKEN - secure: "..." cache: node_modules script: - npm run build after_success: npm run deploy
require('shelljs/global'); rm('-rf', 'out'); exec('git clone "https://' + env.GH_TOKEN + '@' + env.GH_REF + '" --depth 1 -b gh-pages out'); pushd('out'); exec('git config user.name "Automatic Commit"'); exec('git config user.email "workweek@g0v.tw"'); exec('git rm -rf .'); cp('-r', '../dist/', '.'); exec('git add .'); exec('git commit -m "Automatic commit: ' + Date() + '"'); exec('git push "https://' + env.GH_TOKEN + '@' + env.GH_REF + '" gh-pages', {silent: true}); popd(); exit(0);