杂项-TMod:常见错误
ylbtech-杂项-TMod:常见错误 |
1.返回顶部 |
{Template Error} TypeError: dateDiff is not a function
at Array.<anonymous> (http://localhost:8023/y/js/template.js:1616:15)
2.返回顶部 |
3.返回顶部 |
4.返回顶部 |
5.返回顶部 |
6.返回顶部 |
7.返回顶部 |
8.返回顶部 |
9.返回顶部 |
10.返回顶部 |
11.返回顶部 |
var formatDate = function (date, fmt) {
if (!date) return "";
if (!(date instanceof Date)) {
try {
date = new Date(date);
} catch (ex) {
return date;
} finally { }
}
var o = {
"M+": date.getMonth() + 1, //月份
"d+": date.getDate(), //日
"h+": date.getHours() % 12 === 0 ? 12 : date.getHours() % 12, //小时
"H+": date.getHours(), //小时
"m+": date.getMinutes(), //分
"s+": date.getSeconds(), //秒
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
var week = {
"0": "/u65e5",
"1": "/u4e00",
"2": "/u4e8c",
"3": "/u4e09",
"4": "/u56db",
"5": "/u4e94",
"6": "/u516d"
};
if (!fmt) {
fmt = "yyyy-MM-dd HH:mm:ss";
} if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
}
if (/(E+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468") : "") + week[date.getDay() + ""]);
}
for (var k in o) {
if (o.hasOwnProperty(k)) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
}
}
return fmt;
}; var utcToLocal = function (ticks, format) { if (!ticks) {
return "";
}
var t = new Date(ticks);
var utc = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds()); if (!format) {
format = "yyyy-MM-dd HH:mm:ss";
}
try {
return formatDate(utc, format);
} catch (e) {
return "Invalid Date";
}
}; template.helper("dateFormat", utcToLocal); var dateDiff = function (timestamp) {
var minute = 1000 * 60;
var hour = minute * 60;
var day = hour * 24;
var now = new Date().getTime();
var diffValue = now - timestamp;
// 如果本地时间反而小于变量时间
if (diffValue < 0) {
//return '不久前';
return '刚刚';
}
// 计算差异时间的量级
var dayC = diffValue / day;
var hourC = diffValue / hour;
var minC = diffValue / minute;
//一分钟之内显示为刚刚,例如:刚刚,1分钟前、2分钟前...... 、一小时前、两小时前、一天前等;超过3天以上的显示为发布日期,如11月19日、11月18日;
// 使用
if (dayC >= 1 && dayC <= 3) {
return parseInt(dayC) + "天前";
} else if (hourC >= 1 && hourC < 24) {
return parseInt(hourC) + "小时前";
} else if (minC >= 1 && minC < 60) {
return parseInt(minC) + "分钟前";
} else if (minC < 1) {
return '刚刚';
} else {
return utcToLocal(timestamp, "MM-dd");
}
}; template.helper("dateDiff", dateDiff); template.helper("getAllMoney", function (money) {
return (money + money * 0.002).toFixed(2);
}); template.helper("getChangeMoney", function (money) {
return (money * 0.002).toFixed(2);
}); template.helper("fmtImgPath", function (faceUrl) {
if (!faceUrl)
return "/img/none.gif";
return faceUrl;//.replace("/bgimg/", "/x_bgimg/");
}); template.helper("fmtCustomerIdentity", function (Identity) {
switch (Identity) {
default:
case 0: {
return "先生";
}
case 1: {
return "太太";
}
case 2: {
return "爷爷";
}
case 3: {
return "奶奶";
}
case 4: {
return "给父母请(不同住)";
}
case 5: {
return "帮朋友请";
}
}
}); template.helper("fmtMarriage", function (Marriage) {
switch (Marriage) {
default:
case 1: {
return "已婚";
}
case 2: {
return "未婚";
}
case 3: {
return "离异";
}
}
}); template.helper("fmtEducation", function (Education) {
switch (Education) {
default:
case 1: {
return "小学";
}
case 2: {
return "初中";
}
case 3: {
return "高中";
}
case 4: {
return "高中以上";
}
}
}); template.helper("fmtPolitical", function (Political) {
switch (Political) {
default: return "群众";
case 1: {
return "团员";
}
case 2: {
return "党员";
}
case 3: {
return "入党积极分子";
}
}
}); template.helper('getSkill', function (num) {
switch (num) {
case 1:
return '一般';
case 2:
return '精细';
case 3:
return '完美';
} }); template.helper('getSFH', function (num) {
if (!num) return ""; var result = [];
if (num.CleanRoom) result.push('打扫房间');
if (num.Cook) result.push('餐食制作');
if (num.Laundry) result.push('洗涤熨烫');
if (num.Plant) result.push('植卉养护');
if (num.OldPeople) result.push('照护老人');
if (num.Child) result.push('照护小孩');
if (num.Patient) result.push('照护病人');
if (num.Pet) result.push('照顾宠物');
return result.join('、');
});
template.helper('getJYW', function (num) {
if (!num) return ""; if (num.Experience == 0) {
return "新手";
} else if (num.Experience == 1) {
return "熟练(2年- 5年)";
} else if (num.Experience == 2) {
return "资深(5年以上)";
}
}); template.helper('getJGS', function (num) {
if (!num) return ""; if (num.NativePlace == 0) {
return "周边人";
} else if (num.NativePlace == 1) {
return "南方人";
} else if (num.NativePlace == 2) {
return "北方人";
}
else if (num.NativePlace == 3) {
return "东北人";
} else if (num.NativePlace == 4) {
return "西北人";
} else if (num.NativePlace == 5) {
return "西南人";
} else if (num.NativePlace == 6) {
return "沿海人";
}
}); template.helper('getSFP', function (num) {
if (!num) return "";
var result = [];
if (num.Cat) result.push('猫');
if (num.Puppy) result.push('小狗');
if (num.SmallDogs) result.push('小型犬');
if (num.GoldFish) result.push('金鱼');
if (num.Bird) result.push('鸟');
return result.join('、');
}); template.helper('getJYF', function (num) {
if (!num) return "";
var result = [];
if (num.Oversee) result.push('监控');
if (num.InFected) result.push('传染病人');
if (num.Basement) result.push('住地下室');
return result.join('、');
}); template.helper('getYYH', function (num) {
if (!num) return "";
var result = [];
if (num.English) result.push('简单英语口语');
return result.join('、');
}); template.helper('getTCY', function (num) {
if (!num) return "";
var result = [];
if (num.Delicious) result.push('做饭好吃');
if (num.Pasta) result.push('擅长面食');
if (num.WesternFood) result.push('西餐制作');
if (num.GoodLaundry) result.push('洗涤熨烫');
if (num.Neat) result.push('干净利落');
if (num.Positive) result.push('阳光心态'); if (num.LikeChild) result.push('喜欢小孩');
if (num.Filial) result.push('恭顺老人');
if (num.Temper) result.push('好脾气');
if (num.LikeAnimal) result.push('喜欢小动物'); return result.join('、');
}); template.helper('getXYW', function (num) {
if (!num) return "";
var result = [];
if (num.Buddhism) result.push('信仰佛');
if (num.Catholicism) result.push('信仰天主');
if (num.Christianity) result.push('信仰基督');
if (num.Ala) result.push('信仰阿拉');
if (num.GoodRepay) result.push('信仰好人好报');
return result.join('、');
}); template.helper('getCYBZ', function (num) {
if (!num) return "";
var result = [];
if (num.Chinese) result.push('普通话标准');
if (num.Face) result.push('五官端正无残疾');
if (num.Smell) result.push('无狐臭口臭');
if (num.Mental) result.push('无精神病倾向');
return result.join('、');
}); template.helper('getSFBZ', function (num) {
if (!num) return "";
var result = [];
if (num.IDCard) result.push('身份证(包括:姓名、年龄、籍贯、身份证号码)');
if (num.Communicate) result.push('沟通(包括:文化程度、婚姻状况、政治面貌)');
return result.join('、');
}); template.helper('getJKBZ', function (num) {
if (!num) return "";
var result = [];
if (num.PhysicalExam) result.push('体检证明(包括:无传染性疾病、体检日期、体检项目)');
return result.join('、');
}); template.helper('getPXBZ', function (num) {
if (!num) return "";
var result = [];
if (num.Certificate) result.push('荣誉与证书(包括:获得时间、鉴定单位、有无钢印)');
return result.join('、');
}); template.helper('getFKBZ', function (num) {
if (!num) return "";
var result = [];
if (num.Insurance) result.push('职业责任险(包括:有效日期)');
return result.join('、');
}); template.helper('getClean', function (num) {
var result = [];
if (num.Clean) result.push('打扫房间');
if (num.Mark) result.push('餐食制作');
if (num.Wash) result.push('洗涤熨烫');
if (num.CuringPlant) result.push('植卉养护');
if (num.CaringOld) result.push('照护老人');
if (num.CaringSmall) result.push('照护小孩');
if (num.CaringDisease) result.push('照护病人');
if (num.CaringPet) result.push('恭顺老人');
if (num.LikePet) result.push('照护宠物');
if (num.ServicesOther) result.push(num.ServicesOther);
if (num.ServicesOthers) result.push(num.ServicesOthers);
return result.join('、');
}); template.helper('getCat', function (num) {
var result = [];
if (num.Cat) result.push('猫');
if (num.Pup) result.push('小狗');
if (num.LargeDog) result.push('大型犬');
if (num.GoldFish) result.push('金鱼');
if (num.Bird) result.push('鸟');
if (num.OtherPet) result.push(num.OtherPet);
if (num.OtherPets) result.push(num.OtherPets);
return result.join('、');
}); template.helper('getCookingGood', function (num) {
var result = [];
if (num.CookingGood) result.push('做饭好吃');
if (num.GoodPasta) result.push('擅长面食');
if (num.WesternFoodMark) result.push('西餐制作');
if (num.Ironing) result.push('洗涤熨烫');
if (num.Smooth) result.push('干净利落');
if (num.SunshineMentality) result.push('阳光心态');
if (num.Likekid) result.push('喜欢小孩');
if (num.PoorOld) result.push('恭顺老人');
if (num.LikePet) result.push('喜欢小动物');
return result.join('、'); }); template.helper('getSimpleEnglish', function (num) {
var result = [];
if (num.SimpleEnglish) result.push('会简单英语口语');
if (num.HandWash) result.push('手洗特殊内衣');
if (num.Wipe) result.push('手持抹布擦地');
if (num.OtherSpecial) result.push(num.OtherSpecial);
return result.join('、');
}); template.helper('getMonitor', function (num) {
var result = [];
if (num.Monitor) result.push('监控');
if (num.InfectiousPatients) result.push('传染病人');
if (num.MentalDisease) result.push('精神不太正常家属');
if (num.Basement) result.push('住地下室');
if (num.Roommate) result.push('陪同性雇主同室住');
if (num.WithSleep) result.push('幼儿带睡');
return result.join('、');
}); template.helper('getHealthConditioning', function (num) {
var result = [];
if (num.HealthConditioning) result.push('健康调理');
if (num.TeaCeremony) result.push('茶艺');
if (num.Flowering) result.push('插花');
if (num.PanHead) result.push('盘头');
if (num.Cosmetology) result.push('美容');
if (num.OtherNeed) result.push(num.OtherNeed);
if (num.OtherNeeds) result.push(num.OtherNeeds);
return result.join('、');
}); template.helper('getWorkHours', function (num) {
switch (num) {
case 0:
return '';
case 1:
return '平均每天有效工作';
} });
template.helper('getDifferentPlaces', function (num) {
switch (num) {
case 0:
return '';
case 1:
return '工作地点在两个不同的地方';
} }); template.helper('getMembers', function (num) {
switch (num) {
case 1:
return '三口之家';
case 2:
return '婆媳同住';
case 3:
return '三代同堂';
case 4:
return '单身';
case 5:
return '丁克家族';
} }); template.helper('getFooding', function (num) {
switch (num) {
case 1:
return '普通';
case 2:
return '偏肉';
case 3:
return '偏素';
case 4:
return '全素';
} }); template.helper('getFlavor', function (num) {
switch (num) {
case 1:
return '偏重';
case 2:
return '偏甜';
case 3:
return '清淡';
case 4:
return '喜辣';
case 5:
return '不吃辣椒';
} }); template.helper('getHabit', function (num) {
switch (num) {
case 1:
return '早睡早起';
case 2:
return '夜猫子';
case 3:
return '不坐班';
} }); template.helper('getEducation', function (s) {
switch (s) {
case 0:
return '专科';
case 1:
return '本科';
case 2:
return '硕士';
case 3:
return '博士';
} }); template.helper('getExperience', function (num) {
switch (num) {
case 0:
return '一年以下';
case 1:
return '一年到三年';
case 2:
return '三年到五年';
case 3:
return '五年以上';
} }); template.helper("parseimg", function (s) {
if (!s) return "";
return s.replace(/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/ig, function (cap1, cap2) {
var tag1 = cap1.replace(/\/bgimg\//ig, '/x_bgimg/').replace(/src=/ig, 'src=');
var tag2 = cap2.replace(/\/bgimg\//ig, '/bgimg/');
return '' + tag1 + '" data-preview-src="' + tag2
});
});
12.返回顶部 |
13.返回顶部 |
module.exports = function (grunt) {
grunt.initConfig({ useminPrepare: {
html: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!m/js/tmp/**/*.html', '!s/tmp/**/*.html', '!y/js/tpl/**/*.html'],
options: {
dest: 'dist'
}
},
usemin: {
html: ['dist/**/*.html'],
options: {
assetsDirs: ['dist'],
blockReplacements: {
MaxPrestaJSBuild: function (block) {
return '<script src="/js/vendor.min.js"></script>';
}
}
}
},
copy: {
dist: {
files: [
{ expand: true, cwd: 'fonts', src: '**', dest: 'dist/fonts/' },
{ expand: true, cwd: 'bin', src: '*.dll', dest: 'dist/bin/' },
{ expand: true, cwd: 'img', src: '**', dest: 'dist/img/' },
{ expand: true, cwd: 'js/ueditor', src: '**', dest: 'dist/js/ueditor/' },
{ expand: true, src: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!m/js/tmp/**/*.html', '!s/tmp/**/*.html', '!y/js/tpl/**/*.html'], dest: 'dist/' },
{ src: 'Global.asax', dest: 'dist/Global.asax' },
{ src: 'NLog.config', dest: 'dist/NLog.config' },
{ src: 'css/mlibs.appvendor.min.css', dest: 'dist/css/mlibs.appvendor.min.css' },
{ src: 'js/mlibs.appvendor.min.js', dest: 'dist/js/mlibs.appvendor.min.js' },
{ src: 'js/video/video-js.css', dest: 'dist/js/video/video-js.css' },
{ src: 'js/video/video.6.0.js', dest: 'dist/js/video/video.6.0.js' },
{ src: 'js/jquery.cxselect.min.js', dest: 'dist/js/jquery.cxselect.min.js' },
{ src: 'js/cityData.min.json', dest: 'dist/js/cityData.min.json' },
{ expand: true, cwd: 'js/my97datepicker', src: '**', dest: 'dist/g' },
{ src:['*.aspx','*.aspx.cs','*.ashx'],dest:'dist/'}
]
},
js: {
files: []
}
},
htmlmin: {
dist: {
options: { removeComments: true, collapseWhitespace: true },
files: [
{
expand: true,
cwd: 'dist/',
src: ['**/*.html', '!g/tmp/**/*.html', '!m/js/tmp/**/*.html', '!s/tmp/**/*.html', '!y/js/tpl/**/*.html'],
dest: 'dist/'
}
]
}
},
filerev: {
options: {
encoding: 'utf8',
algorithm: 'md5',
length: 8
},
js: {
src: ['dist/js/**/m.*.min.js'],
dest: 'dist/js'
},
css: {
src: ['dist/css/**/m.*.min.css'],
dest: 'dist/css'
}
},
compress: {
main: {
options: {
archive: function () {
return 'dist/jfb-' + (new Date()).getTime() + '.tgz'
},
pretty: true,
mode: 'tgz'
},
expand: true,
cwd: 'dist/',
src: ['**/*'],
dest: '/'
}
},
exec: {
genGTmpl: {
cmd: 'tmod g/tmp --no-watch'
},
genMTmpl: {
cmd: 'tmod m/js/tmp --no-watch'
},
genSTmpl: {
cmd: 'tmod s/tmp --no-watch'
},
genYTmpl: {
cmd: 'tmod y/js/tpl --no-watch'
}
},
clean: {
dist: {
src: ['dist/']
},
tmp: {
src: ['.tmp/']
},
build: {
src: [
'dist/m/js/**/m.*.min.js',
'dist/m/css/**/m.*.min.css',
]
}
}
}); grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-filerev');
grunt.loadNpmTasks('grunt-exec'); grunt.registerTask('build', [
'clean:dist',
'exec:genGTmpl',
'exec:genMTmpl',
'exec:genSTmpl',
'exec:genYTmpl',
'copy',
'useminPrepare',
'concat:generated',
'cssmin:generated',
'uglify:generated',
'filerev',
'usemin',
'htmlmin',
'clean:tmp',
'copy:js',
'clean:build',
'compress:main'
]);
};
14.返回顶部 |
15.返回顶部 |
16.返回顶部 |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
杂项-TMod:常见错误的更多相关文章
- 杂项-Tmod:常见错误提示
ylbtech-杂项-Tmod:常见错误提示 1.返回顶部 1. The column 'Content' was specified multiple times for 'T'.select a. ...
- 杂项-Grunt:grunt build 打包和常见错误
ylbtech-杂项-Grunt:grunt build 打包和常见错误 1. 安装.打包返回顶部 1. npm WARN deprecated coffee-script@: CoffeeScrip ...
- 初识JAVA(二)(送给Java和安卓初学者)----常见错误
博主接着上篇的来讲哦,以后的更新中,博主会出一些练习题,有兴趣的可以做做然后吧代码粘贴到下面,大家可以一起研究学习,一起进步,本篇文章主要讲的是: 一.常见错误 二.连接上篇一起的训练 无论是什么方向 ...
- ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock
ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock 通过终端安装程序sudo apt-get install xxx时出错:E: Could not ...
- coreseek常见错误原因及解决方法
coreseek常见错误原因及解决方法 Coreseek 中文全文检索引擎 Coreseek 是一款中文全文检索/搜索软件,以GPLv2许可协议开源发布,基于Sphinx研发并独立发布,专攻中文搜索和 ...
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
嵌套Fragment的使用及常见错误 嵌套Fragments (Nested Fragments), 是在Fragment内部又添加Fragment. 使用时, 主要要依靠宿主Fragment的 ge ...
- C语言初学者代码中的常见错误与瑕疵(23)
见:C语言初学者代码中的常见错误与瑕疵(23)
- struts2.5框架使用通配符指定方法常见错误
struts2.5框架使用通配符指定方法(常见错误) 在学习struts框架时经常会使用到通配符调用方法,如下: <package name="shop" namespace ...
- .Net常见错误
常见错误 #1: 把引用当做值来用,或者反过来 C++ 和其他很多语言的程序员,习惯了给变量赋值的时候,要么赋单纯的值,要么是现有对象的引用.然而,在C# 中,是值还是引用,是由写这个对象的程序员决定 ...
随机推荐
- Linux 配置JDK + MyEclipse
版本:Ubuntu16.04: jdK: Java SE Development Kit 8u102; My Eclipse: 10.6; JDK配置的细致步骤参见此处. 就一点要注意: 请使用代码进 ...
- mongodb分片集群安装教程
mongodb 集群包含副本集群,主从集群以及分片集群,分片集群比较复杂,这里测试我采用了三台机器,交差部署 blog地址:http://www.cnblogs.com/caoguo 一 .环境:#m ...
- haproxy故障处理
1. haproxy 在配置健康检查的时候,默认没有配置页面检查 ,通过端口状态来检测.后端IIS web服务开始可能 是一个站点,或者采用了基于域名的配置方式,导致目前站点停了,后端主机不能被hap ...
- Android List,Set,Map集合安全 集合区别 并发集合类性能分析
对于Android开发者来说深入了解Java的集合类很有必要主要是从Collection和Map接口衍生出来的,目前主要提供了List.Set和 Map这三大类的集合 Collection接口主要有两 ...
- jquery制作动态添加表单行与删除表单行
<script type="text/javascript" src="js/jquery1.7.js"></script> <s ...
- js用正则表达式将英文引号字符替换为中文引号字符
<script> $(function(){ var str='"我是英文版的引号",我要变成"中文版的引号"'; alert(replaceDqm ...
- Python - 三大器 迭代器,生层器,装饰器
目录 Python - 三大器 迭代器,生层器,装饰器 一. 容器 二. 可迭代对象(iterable) 三. 迭代器 四. 生成器 五. 装饰器 1. 定义 六. 闭包 Python - 三大器 迭 ...
- 【hiho一下 第146周】子矩阵求和
[题目链接]:http://hihocoder.com/contest/hiho146/problem/1 [题意] [题解] 设s[i][j]表示左上角的坐标为(i,j)的n*m的矩阵的和; 有s[ ...
- 【郑轻邀请赛 C】DOBRI
[题目链接]:https://acm.zzuli.edu.cn/zzuliacm/problem.php?id=2129 [题意] [题解] NMB 直接说i-1,i-2,i-3不就好了- [Numb ...
- HDU 5446 Unknown Treasure
Unknown Treasure Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Other ...