first version

This commit is contained in:
t510599
2018-10-12 23:51:55 +08:00
parent a1d3bb2ea6
commit 59b03a78c1
17 changed files with 1478 additions and 0 deletions

3
web/views/error.ejs Normal file
View File

@@ -0,0 +1,3 @@
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>

92
web/views/index.ejs Normal file
View File

@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><%= title %></title>
<meta charset="UTF-8">
<!-- Tocas UICSS 與元件 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.css">
<!-- Tocas JS模塊與 JavaScript 函式 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.js"></script>
<style>
.main {
padding: 4em 0;
}
</style>
</head>
<body>
<div class="ts main container">
<% if(typeof msg != "undefined"){ %>
<div class="ts inverted positive message">
<div class="header"><%= msg %></div>
</div>
<% } %>
<% if(typeof errMsg != "undefined"){ %>
<div class="ts inverted negative message">
<div class="header"><%= errMsg %></div>
</div>
<% } %>
<div class="ts grid">
<div class="stretched column">
<div class="ts header">
210 選(?)座位系統
<div class="sub header">登入者:<%= user.username %></div>
</div>
</div>
<div class="column">
<a class="ts button" href="./logout">登出</a>
</div>
</div>
<div class="ts container" style="overflow-x: auto">
<table class="ts center aligned basic celled table">
<thead>
<tr>
<th colspan="<%= seats[0].length %>">講台</th>
</tr>
</thead>
<tbody>
<% seats.forEach(function (row){ %>
<tr>
<% row.forEach(function (no){
if (no == user.no) { %>
<td style="background-color: yellow"><%= no %></td>
<% } else { %>
<td><%= (no != 0) ? no : "X" %></td>
<% }
}); %>
</tr>
<% }); %>
</tbody>
</table>
</div>
<div class="ts horizontal section divider">
<span class="text">我是分隔線</span>
</div>
<form class="ts form" method="POST" name="seat" action="./">
<div class="field">
<div class="three fields">
<div class="disabled field">
<input type="text" placeholder="座號" name="no" id="no" value="<%= user.no %>">
</div>
<div class="field">
<select name="direction" id="direction">
<option value="">Choose here</option>
<% for (key in directions) { %>
<% var selected = ( key == user.direction ) ? " selected" : ""; %>
<option value="<%= key %>"<%= selected %>><%= directions[key] %></option>
<% } %>
</select>
</div>
<div class="field">
<input type="text" placeholder="格數" name="steps" id="steps" value="<%= user.steps %>">
</div>
</div>
</div>
<div class="field">
<button class="ts right floated inverted primary button">送出</button>
</div>
</form>
</div>
</body>
</html>

54
web/views/login.ejs Normal file
View File

@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<!-- Tocas UICSS 與元件 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.css">
<!-- Tocas JS模塊與 JavaScript 函式 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.js"></script>
<title><%= title %></title>
<style type="text/css">
body {
background: whitesmoke;
}
.segment {
max-width: 300px;
}
.message {
max-width: 350px;
margin: auto !important;
}
</style>
</head>
<body>
<div class="ts center aligned narrow container">
<br>
<br>
<% if(typeof errMsg != "undefined"){ %>
<div class="ts inverted negative message">
<div class="header"><%= errMsg %></div>
</div>
<% } %>
<h1 class="ts center aligned header">
登入
</h1>
<div class="ts centered secondary segment">
<form class="ts form" method="POST" action="./login" name="login">
<div class="field">
<label for="username">帳號</label>
<input placeholder="" type="text" name="username" id="username">
</div>
<div class="field">
<label for="password">密碼</label>
<input placeholder="" type="password" name="password" id="password">
</div>
<button type="button" class="ts positive fluid button" onclick="document.login.submit()">登入</button>
</form>
</div>
</div>
</body>
</html>