{"id":151771,"student_id":3311,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n \u003ctitle\u003eDocument\u003c/title\u003e\\n \u003cscript src=\\\"https://code.jquery.com/jquery-3.4.1.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003cdiv\u003e\\n \u003cselect id=\\\"type\\\"\u003e\\n \u003coption value=\\\"食物\\\"\u003e 🍖 食物 \u003c/option\u003e\\n \u003coption value=\\\"衣服\\\"\u003e 👕 衣服 \u003c/option\u003e\\n \u003coption value=\\\"生活\\\"\u003e 🏠 生活 \u003c/option\u003e\\n \u003coption value=\\\"交通\\\"\u003e 🚌 交通 \u003c/option\u003e\\n \u003coption value=\\\"學習\\\"\u003e 📖 學習 \u003c/option\u003e\\n \u003coption value=\\\"娛樂\\\"\u003e 🎮 娛樂 \u003c/option\u003e\\n \u003c/select\u003e\\n \u003cinput type=\\\"date\\\" id=\\\"date\\\"\u003e\\n \u003cinput type=\\\"number\\\" id=\\\"cost\\\" placeholder=\\\"價格\\\"\u003e\\n \u003cinput type=\\\"text\\\" id=\\\"note\\\" placeholder=\\\"註記\\\"\u003e\\n \u003cbutton id=\\\"create\\\"\u003e新增\u003c/button\u003e\\n \u003c/div\u003e\\n\\n \u003c!-- 總和 --\u003e\\n \u003ch1\u003e\\n 總和 \u003cspan id=\\\"sum\\\"\u003e\u003c/span\u003e 元\\n \u003c/h1\u003e\\n\\n \u003c!-- 分類 --\u003e\\n \u003cdiv\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"食物\\\"\u003e 🍖 \u003c/span\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"衣服\\\"\u003e 👕 \u003c/span\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"生活\\\"\u003e 🏠 \u003c/span\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"交通\\\"\u003e 🚌 \u003c/span\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"學習\\\"\u003e 📖 \u003c/span\u003e\\n \u003cspan class=\\\"icon filter\\\" data-type=\\\"娛樂\\\"\u003e 🎮 \u003c/span\u003e\\n \u003c/div\u003e\\n\\n \u003c!-- 表格 --\u003e\\n \u003ctable\u003e\\n \u003cthead\u003e\\n \u003ctr\u003e\\n \u003cth\u003e圖示\u003c/th\u003e\\n \u003cth\u003e種類\u003c/th\u003e\\n \u003cth\u003e日期\u003c/th\u003e\\n \u003cth\u003e花費\u003c/th\u003e\\n \u003cth\u003e註記\u003c/th\u003e\\n \u003c/tr\u003e\\n \u003c/thead\u003e\\n \u003ctbody\u003e\\n \u003c/tbody\u003e\\n \u003c/table\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"body {\\n padding: 30px;\\n color: #ddd;\\n background-color: rgb(22, 28, 37);\\n text-align: center;\\n}\\n\\nbutton, select, input {\\n display: block;\\n outline: none;\\n width: 100%;\\n height: 40px;\\n padding: 5px 10px;\\n margin-top: 10px;\\n border-radius: 5px;\\n border: 1px solid #555;\\n color: #ddd;\\n background-color: rgba(0, 0, 0, 0);\\n font-size: 1rem;\\n box-sizing: border-box;\\n}\\n\\n.icon {\\n display: inline-block;\\n width: 45px;\\n height: 45px;\\n line-height: 45px;\\n font-size: 1.5rem;\\n border-radius: 50%;\\n border: 1px solid #555;\\n margin: 0px 5px;\\n cursor: pointer;\\n}\\n\\ntable {\\n font-size: 0.9rem;\\n border-collapse: collapse;\\n width: 100%;\\n margin-top: 15px;\\n background-color: rgb(22, 28, 37);\\n}\\nth, tr {\\n padding: 15px;\\n border-bottom: 1px solid #3555;\\n}\\ntr td:nth-child(1) {\\n font-size: 1.8rem;\\n}\\n\\n#sum {\\n color: rgb(52, 235, 161);\\n}\\nbutton:active, select:focus, input:focus, .icon:hover {\\n color: rgb(52, 235, 161);\\n border-color: rgb(52, 235, 161);\\n}\\n\",\"js\":\"var account = DB.table('account');\\n\\n$('#create').click(create);\\n\\n$('.filter').click(filter);\\n\\n\\n\\naccount.read({}, updateTable);\\n\\nfunction create () {\\n var type = $(\\\"#type\\\").val();\\n\\n var date = $(\\\"#date\\\").val();\\n\\n var cost = $(\\\"#cost\\\").val();\\n\\n var note = $(\\\"#note\\\").val();\\n\\n if (type === \\\"\\\" || date === \\\"\\\" || cost === \\\"\\\") {\\n\\n alert('有欄位忘記填了喔!');\\n\\n } else {\\n\\n account.create({\\n\\n type: type,\\n\\n date: date,\\n\\n cost: cost,\\n\\n note: note\\n\\n });\\n\\n account.read({}, console.log);\\n\\n }\\n}\\n\\nfunction updateTable (data) {\\n\\n $('tbody').empty();\\n\\n var total = 0;\\n\\n data.forEach(function(item) {\\n\\n total += Number(item.cost);\\n\\n var row = `\\n\\n \u003ctr\u003e\\n\\n \u003ctd\u003e${typeToEmoji(item.type)}\u003c/td\u003e\\n\\n \u003ctd\u003e${item.type}\u003c/td\u003e\\n\\n \u003ctd\u003e${item.date}\u003c/td\u003e\\n\\n \u003ctd\u003e${item.cost}元\u003c/td\u003e\\n\\n \u003ctd\u003e${item.note}\u003c/td\u003e\\n\\n \u003c/tr\u003e\\n\\n `;\\n\\n $('tbody').append(row);\\n\\n });\\n\\n $(\\\"#sum\\\").text(total);\\n\\n account.read({}, updateTable);\\n\\n}\\n\\nfunction typeToEmoji (type) {\\n\\n if (type == '食物') {\\n\\n return '🍖';\\n\\n } else if (type == '衣服') {\\n\\n return '👕';\\n\\n } else if (type == '生活') {\\n\\n return '🏠';\\n\\n } else if (type == '交通') {\\n\\n return '🚌';\\n\\n } else if (type == '學習') {\\n\\n return '📖';\\n\\n } else if (type == '娛樂') {\\n\\n return '🎮';\\n\\n }\\n\\n}\\n\\nfunction filter () {\\n var type = $(this).data('type');\\n account.read({type: type}, updateTable);\\n}\"}","created_at":"2020-05-24T12:30:14.388+08:00","updated_at":"2020-05-24T12:32:46.116+08:00","name":"複製","language":"web","screenshot":{"url":null},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":171,"hashid":"p93s2wr3","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦