This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.post('/1', function (req, res, callback) { | |
| var check = new Check(req.body.foodName, req.body.bigMoney, req.body.samllMoney, req.body.numBig, req.body.numSamll, req.body.sNum, req.body.sPhone); | |
| var ssNum = check.sNum; | |
| var foodName = check.foodName; | |
| var bigMoney = check.bigMoney; | |
| var samllMoney = check.samllMoney; | |
| var numBig = check.numBig; | |
| var numSamll = check.numSamll; | |
| console.log(check); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style type="text/css"> | |
| img { | |
| display:block; | |
| margin: auto; | |
| /* max-width: 500px; 建議可加上「最大寬度」讓圖片不會過大。500px只是一個例子*/ | |
| } | |
| </style> | |
| <img src="/images/avatar.png" style="display:block; margin:auto;"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| var today = new Date().getDate(); | |
| var tomoro = new Date().getDate()+1; | |
| $( "#departure" ).dateDropper({ | |
| format: "Y/m/d", | |
| minYear:"2016", | |
| maxYear:"2016", | |
| lock:{form:today,to:tomoro}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.get('/2', function (req, res) { | |
| res.render('indexTest', { | |
| title: '首頁', | |
| user: req.session.user, | |
| block:Block, | |
| success: req.flash('success').toString(), | |
| error: req.flash('error').toString() | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var updatePostTask = function(i) { | |
| return new Promise(function(resolve, reject) { | |
| console.log('before', numBig[i], numSamll[i]); | |
| numSamll[i] = numSamll[i]?parseInt(numSamll[i]):0;//把空的[i]轉成0,否則會錯誤 | |
| numBig[i] = numBig[i]?parseInt(numBig[i]):0; | |
| console.log('after', numBig[i], numSamll[i]); | |
| var partly = numBig[i] + numSamll[i]; //後來發現這樣比較快 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GGGGGGGGGGGGGGGGGGGGGGGGGGG | |
| GGGGGGGGGG////////GGGGGGGGG | |
| GGGGGGGG//GGGGGGGGGGGGGGGGG | |
| GGGGGGG///GGGGGGGGGGGGGGGGG | |
| GGGGGG////GGGGG///////GGGGG | |
| GGGGGG////GGGGGGGGGG///GGGG | |
| GGGGGGG///GGGGGGGGGG//GGGGG | |
| GGGGGGGGGGG/////////GGGGGGG | |
| GGGGGGGGGGGGGGGGGGGGGGGGGGG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form name="check_get" id="check_get" method="get"> | |
| <input type="hidden" name="num" value="<%- check.num%>"> | |
| <button type="button" id="btnback" class="btn btn-success">取消</button> | |
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Check.remove = function(num, callback){ | |
| mongodb.open(function(err,db){ | |
| if (err) { | |
| return callback(err); | |
| } | |
| db.collection('checks',function(err,collection){ | |
| if (err) { | |
| mongodb.close(); | |
| return callback(err); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.get('/check/del/:num',function(req, res){ | |
| var num = req.params.num; | |
| Check.remove(num, function(err){ | |
| if (err){ | |
| req.flash('error', err); | |
| return res.req.redirect('/check'); | |
| } | |
| req.flash('success', '刪除成功!'); | |
| res.redirect('/check') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*這是用Google開發者工具看的*/ | |
| <p>韓泡菜炒飯 - 大份:140</p> | |
| <input type="hidden" name="foodName" value="韓泡菜炒飯"/> | |
| <input type="hidden" name="numBig" value="2"/> | |
| <input type="hidden" name="numSamll" value="0"/> | |
| <!--3.小份大份都>0 印小份大份--> | |