删除 cookie 需要这么
res.cookie('admin_uid',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
res.cookie('admin_name',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
res.cookie('admin_cname',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
res.cookie('admin_key',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
要当场指定域
Handlebars 模板引擎 加 全局 helper 需要这么
var Handlebars = require('handlebars');
var request = require('request');
Handlebars.registerHelper('eq',function(num1,num2,options){
if(num1==num2){
return options.fn(this);
}
});
先把 Handlebars 引进来
循环体内取外部 模板变量需要加 ../
如
{{#each lists}}
<tr >
<td><label
class="check"><input type="checkbox" name="checkid[]"
value="{{this._id}}" {{#eq this.mid ../user.mid}} cancheck='1'
{{/eq}}></label></td>
<td><a href="/content/{{this._id}}">{{this.title}}</a></td>
<td>{{this.autor}}</td>
<td id="isdel"><font color="blue">{{this.cname}}</font></td>
<td>{{{this.statustxt}}}</td>
<td>{{this.bollowcount}}</td>
<td>{{this.createTime.minute}} {{cando}}</td>
{{#if ../cando}}
<td>
{{#if canborrow}}
<a href="javascript:;" class="btnn gray h24 lDisabled" data-id='{{this._id}}'>借书</a>
{{/if}}
{{#if canreback}}
<a href="javascript:;" class="btnn gray h24 lEnable" data-id='{{this._id}}'>对方归还</a>
{{/if}}
{{#if canedit}}
<a href="/newbook?id={{this._id}}" class="btnn gray h24 lEdit" data-id='{{this._id}}'>编辑</a>
<a href="javascript:;" class="btnn gray h24 ldelete" data-id='{{this._id}}'>删除</a>
{{/if}}
</td>
{{/if}}
</tr>
{{/each}}