02 2014 档案
摘要:就是把现有文件转移到隔离空间即可代码如下private async void CopyDB() { StorageFile fage = await ApplicationData.Current.LocalFolder.GetFileAsync("Logos.png"); if (!File.Exists(fage.Path)) { StorageFile storageFile = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Logos.png"); var path =
阅读全文
摘要:下载nicEdit富文本编辑框,把nicEdit.js文件放到public/javascripts/下新建jade文件:代码如下doctype htmlhtml head title script(type="text/javascript", src="/javascripts/nicEdit.js") script(type="text/javascript"). var niceditor; bkLib.onDomLoaded(function() { niceditor = new nicEditor({fullPanel :
阅读全文
摘要:安装npm install formidable先把文件上传到临时文件夹,再通过fs重命名移动到指定的目录即可fs.rename即重命名,但是fs.rename不能夸磁盘移动文件,所以我们需要指定上传的临时目录要和最终目录在同一磁盘下前段请求方法1:使用form标签和submit提交 form(action='/uploadImg', method="post", enctype="multipart/form-data" ) input(type="file", id="file1", name=
阅读全文
摘要:安装ccap库 npm install ccapvar ccap = require();var captcha = ccap({ width:190, height:50, offset:30, quality:100, fontsize:40, generate:function(){ //自定义生成字符串 //此方法可不要 var str = "qQ"; return str; } });var ary = captcha.get();console.log(ary[0]);//字符串res.write(ary[1]); //res.end();
阅读全文
摘要:安装 npm install node-schedule使用方法1:确定时间 例如:2014年2月14日,15:40执行 var schedule = require("node-schedule"); var date = new Date(2014,2,14,15,40,0); var j = schedule.scheduleJob(date, function(){ console.log("执行任务"); }); 取消任务 j.cancel();2:每小时的固定时间 例如:每小时的40分钟执行 var rule = new schedule.R
阅读全文
摘要:本文通过jquery实现简单的无刷新登录1:首先要在router中配置登录请求,因为登录需要传user和pwd考虑到安全需用post请求 { path:'/', method :'post', handler:user.login }2:index.jade需要引用jquery-1.7.1.min文件 script(type="text/javascript", src="/javascripts/jquery-1.7.1.min.js") 上篇文章中已经写好登录见面,登录按钮方法为loginClick(),下面来写登录方
阅读全文
摘要:jade是express自带的模板引擎jade文件可以嵌套使用,include引用外部jade文件,extends引用jade模板例如有一个主jade文件layout.jade,引用top.jade和footer.jade这两个如下设计1:layout.jade的文件doctype htmlhtml...
阅读全文
摘要:1:新建一个404.jade2:在app.js后面配置如下代码 app.use(function(req, res){ res.render("404", {status:404, title:"404-未找到文件"}); }) 使用res.render跳转的404.jade页面 是不是挺简单的
阅读全文
摘要:页面的访问最常见的是get和post两种,无论是get请求还是post请求express自动判断执行app.get或app.post1:app.get(名称,路径)或app["get"](名称, 路径)2:app.post(名称, 路径)或app["post"](名称, 路径)每个请求我们都要注册这些东西,看着挺烦的,那router就出现了首先我们所有的请求放到一个router.js文件中,如下exports.router = [ { path:"/", method:"get", //可选的 handler:路径
阅读全文