Skip to content

Commit

Permalink
feat: 新增後續給分離的前端用的登入api
Browse files Browse the repository at this point in the history
feat(courseSearch): 新增等待載入頁面

feat(courseSearch): 手機版預排課表新增紅色xx刪除課程

refactor: 更改名稱myBg-dark>labelBg-dark

只用在個人課表的class,更改名稱為label

docs: readme新增啟動

build: 新增給pm2用的設定檔

feat: 新增改angular前端用的cors
  • Loading branch information
Chinlinlee committed Jun 24, 2021
1 parent 1591dc2 commit 65ca1bc
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 193 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports =
{
"viewsRoot": "./views",
"httpPort": 30087,
"httpsPort": 7878, //這個應該沒用
"host" : "127.0.0.1" ,
"timeout": 30000
},
Expand All @@ -44,3 +43,8 @@ module.exports =
}
};
```

## 啟動
```bash=
node server.js
```
22 changes: 22 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
apps: [{
name: 'mycosim',
script: 'server.js',
watch: false,
ignore_watch: ["node_modules", "pm2log", "docx", "pdf", "picture", "xlsx", "*.log"],
exec_mode: 'cluster',
instances: 5,
max_memory_restart: '1000M',
time: true,
log_date_format: 'YYYY-MM-DD HH:mm Z',
force: true,
wait_ready: false,
max_restarts: 10,
// 單位為 ms, 預設為 0, 若有指定時間,則 app 會等待指定時間過後重啟
autorestart: true,
error_file: './pm2log/err.log',
// 正常輸出 log 的指定位置
out_file: './pm2log/out.log',
log_file: './pm2log/log.log'
}]
};
3 changes: 0 additions & 3 deletions routes/api/Course/controller/get_Course.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ module.exports = async function (req, res) {
return res.send(result);
}
async function getCourse(req) {
/*if (req.session.Course.length > 0) {
return Promise.resolve(req.session.Course);
}*/
let semno = req.query.semno;
let courseJson = await getCourseJson(req , semno);
if (!courseJson) {
Expand Down
366 changes: 182 additions & 184 deletions routes/routes.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ app.use(compression());
//app.set('views', config.HTTPServer.viewsRoot);
app.use(express.static(config.HTTPServer.viewsRoot));
app.use(flash());
app.use(cors());
app.use(cors({
origin : [
"http://localhost:4200"
] ,
credentials : true
}));
app.use(bodyPareser.urlencoded({extended: true , limit : '50mb'}));
app.use(bodyPareser.json({limit: '50mb'}));
app.use(cookieParser( "myNtunhsCookieSecret"));
Expand Down
17 changes: 17 additions & 0 deletions views/atm/Course_Search.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<link rel="stylesheet" href="../externals/Bootstrap/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css"
rel="stylesheet">
<link rel="stylesheet" href="/atm/css/loading.css">
<style>
fieldset {
border-radius: 8px;
Expand Down Expand Up @@ -46,6 +47,13 @@
</head>

<body ng-controller="CSCtrl" ng-init="init();">

<div class="wrap loading-div">
<div class="loading">
<div class="bounceball"></div>
<div class="text">NOW LOADING</div>
</div>
</div>

<a class="condition-button show" data-toggle="modal" data-target="#ModalCenter_Condition"
ng-click="testInclude=true;"></a>
Expand Down Expand Up @@ -279,6 +287,8 @@
<div class="card mb-3 mx-auto" style="max-width: 18rem;cursor: pointer;">
<div class="card-body text-center" data-toggle="modal"
data-target="#modal{{preScheduleItem.Course_Id}}">
<span class="text-danger pointer"
ng-click="PreSchedule_Remove(preScheduleItem);">×</span>
<p class="card-title">{{preScheduleItem.Time}}</p>
<p class="card-title">{{preScheduleItem.Period}}節</p>
<p class="card-title">{{preScheduleItem.Course_Place}}</p>
Expand Down Expand Up @@ -473,6 +483,13 @@ <h5 class="w-100 text-center modal-title" id="ModalLongTitle">課程</h5>

<script>
$(document).ready(() => {
$('body').css("overflow" , "hidden");
setTimeout(function () {
$(".loading-div").hide();
$('body').css("overflow" , "auto");
} , 2000);


///commonFunc.darkModeInit();

let darkMode = localStorage.getItem("darkMode");
Expand Down
2 changes: 1 addition & 1 deletion views/atm/Schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ <h5 class="modal-title" id="modalScheduleDetailCenterTitle">Other</h5>
if ($('[id*="Schedule_content"]').length) {
$('[id*="Schedule_content"]').each(function () {
if ($(this).children().text().trim() !== "") {
$(this).children().addClass("label border myBg-dark text-center my-0");
$(this).children().addClass("label border labelBg-dark text-center my-0");
} else {
$(this).children().remove();
}
Expand Down
7 changes: 7 additions & 0 deletions views/atm/css/Course_Search.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ table {
cursor: pointer;
}

.card-body > .text-danger{
position: absolute;
top:0;
right: .05rem;
font-size: 2.5rem;
}

#new_PreSchedule_Added {
height: 200px;
}
Expand Down
5 changes: 3 additions & 2 deletions views/atm/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
color: #fff;
}

.darkmode--activated .myBg-dark {
.darkmode--activated .labelBg-dark {
background-color: #4f5656;
color: whitesmoke;
border-radius: 10px;
Expand Down Expand Up @@ -132,7 +132,7 @@
}


/** 公告*/
/* #region 公告*/
.darkmode--activated .myAnnouncement {
background-color: #2f2f2f;
}
Expand All @@ -149,3 +149,4 @@
.darkmode--activated .myAnnouncement a:active {
color : #27af27;
}
/* #endregion 公告*/
59 changes: 59 additions & 0 deletions views/atm/css/loading.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@import url(https://fonts.googleapis.com/css?family=Montserrat);
body {
width: 100%;
height: 100%;
overflow: hidden;
}
.wrap {
width: 100vw;
height: 100vh;
background-image: linear-gradient(rgba(255, 255, 255, 0.9), #fff);
position: absolute;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 1050;
font-family: Montserrat;
}
.text {
color: #fbae17;
display: inline-block;
margin-left: 5px;
}
.bounceball {
position: relative;
display: inline-block;
height: 37px;
width: 15px;
}
.bounceball:before {
position: absolute;
content: '';
display: block;
top: 0;
width: 15px;
height: 15px;
border-radius: 50%;
background-color: #fbae17;
transform-origin: 50%;
animation: bounce 500ms alternate infinite ease;
}
@keyframes bounce {
0% {
top: 30px;
height: 5px;
border-radius: 60px 60px 20px 20px;
transform: scaleX(2);
}
35% {
height: 15px;
border-radius: 50%;
transform: scaleX(1);
}
100% {
top: 0;
}
}

2 changes: 1 addition & 1 deletion views/atm/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body
padding-bottom: 100px;
}

.myBg-dark {
.labelBg-dark {
background-color: #343a40;
color : #fff;
border-radius: 10px;
Expand Down

0 comments on commit 65ca1bc

Please sign in to comment.