Commit bf5c95540fc730c579f6e8456c6c221c11d04572

Authored by 后端研发-倪永富
1 parent 36262af8

日期的显示格式

Showing 1 changed file with 16 additions and 14 deletions
utils/util.js
@@ -236,13 +236,13 @@ function check_mobile(phoneMobile){ @@ -236,13 +236,13 @@ function check_mobile(phoneMobile){
236 var ob={code:1}; 236 var ob={code:1};
237 if (phoneMobile.length === 0) { 237 if (phoneMobile.length === 0) {
238 ob.title='输入的手机号为空'; 238 ob.title='输入的手机号为空';
239 - ob.code=-1; 239 + ob.code=-1;
240 } else if (phoneMobile.length < 11) { 240 } else if (phoneMobile.length < 11) {
241 ob.title ='手机号长度有误!'; 241 ob.title ='手机号长度有误!';
242 - ob.code = -1; 242 + ob.code = -1;
243 } else if (!myreg.test(phoneMobile)) { 243 } else if (!myreg.test(phoneMobile)) {
244 ob.title = '手机号格式有误!'; 244 ob.title = '手机号格式有误!';
245 - ob.code = -1; 245 + ob.code = -1;
246 } 246 }
247 return ob; 247 return ob;
248 } 248 }
@@ -280,31 +280,31 @@ function draw_randon_rect(ctx,x,y,r,w,h){ @@ -280,31 +280,31 @@ function draw_randon_rect(ctx,x,y,r,w,h){
280 // ctx.setStrokeStyle('transparent') 280 // ctx.setStrokeStyle('transparent')
281 // 左上角 281 // 左上角
282 ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) 282 ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
283 - 283 +
284 // border-top 284 // border-top
285 ctx.moveTo(x + r, y) 285 ctx.moveTo(x + r, y)
286 ctx.lineTo(x + w - r, y) 286 ctx.lineTo(x + w - r, y)
287 ctx.lineTo(x + w, y + r) 287 ctx.lineTo(x + w, y + r)
288 // 右上角 288 // 右上角
289 ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) 289 ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2)
290 - 290 +
291 // border-right 291 // border-right
292 ctx.lineTo(x + w, y + h - r) 292 ctx.lineTo(x + w, y + h - r)
293 ctx.lineTo(x + w - r, y + h) 293 ctx.lineTo(x + w - r, y + h)
294 // 右下角 294 // 右下角
295 ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) 295 ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5)
296 - 296 +
297 // border-bottom 297 // border-bottom
298 ctx.lineTo(x + r, y + h) 298 ctx.lineTo(x + r, y + h)
299 ctx.lineTo(x, y + h - r) 299 ctx.lineTo(x, y + h - r)
300 // 左下角 300 // 左下角
301 ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) 301 ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI)
302 - 302 +
303 // border-left 303 // border-left
304 ctx.lineTo(x, y + r) 304 ctx.lineTo(x, y + r)
305 - ctx.lineTo(x + r, y) 305 + ctx.lineTo(x + r, y)
306 // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 306 // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应
307 - ctx.fill(); 307 + ctx.fill();
308 } 308 }
309 309
310 /** 310 /**
@@ -324,7 +324,7 @@ function get_box_arr(num,x,y,sp,r){ @@ -324,7 +324,7 @@ function get_box_arr(num,x,y,sp,r){
324 324
325 /** 325 /**
326 * @param {Object} ctx 画图句柄 326 * @param {Object} ctx 画图句柄
327 - * @param {Object} x x坐标 327 + * @param {Object} x x坐标
328 * @param {Object} y y坐标 328 * @param {Object} y y坐标
329 * @param {Object} img 画的图片 329 * @param {Object} img 画的图片
330 * @param {Object} color 边框的颜色 330 * @param {Object} color 边框的颜色
@@ -345,7 +345,7 @@ function draw_circle(ctx,x,y,r,img,color,unit){ @@ -345,7 +345,7 @@ function draw_circle(ctx,x,y,r,img,color,unit){
345 345
346 346
347 function null_promise(){ 347 function null_promise(){
348 - var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; 348 + var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise;
349 } 349 }
350 350
351 module.exports = { 351 module.exports = {
@@ -371,9 +371,11 @@ module.exports = { @@ -371,9 +371,11 @@ module.exports = {
371 for (var o in n) new RegExp("(" + o + ")").test(r) && (r = r.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length))); 371 for (var o in n) new RegExp("(" + o + ")").test(r) && (r = r.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length)));
372 return r; 372 return r;
373 }, 373 },
374 - formar_no_full(e){ 374 + formar_no_full(e,char){
375 var t= new Date(1e3 * e); 375 var t= new Date(1e3 * e);
376 - return t.getFullYear() +"-"+(t.getMonth() + 1)+"-"+t.getDate(); 376 + var c="-";
  377 + if(char) c=char;
  378 + return t.getFullYear() +c+(t.getMonth() + 1)+c+t.getDate();
377 }, 379 },
378 380
379 json2Form: function(e) { 381 json2Form: function(e) {
@@ -442,7 +444,7 @@ module.exports = { @@ -442,7 +444,7 @@ module.exports = {
442 sub_last: sub_last,//去掉末尾一个字符 444 sub_last: sub_last,//去掉末尾一个字符
443 measureText: measureText,//画布需要的函数 445 measureText: measureText,//画布需要的函数
444 check_mobile: check_mobile,//验证手机 446 check_mobile: check_mobile,//验证手机
445 - get_rand_item:get_rand_item, //随机获取元素 447 + get_rand_item:get_rand_item, //随机获取元素
446 getDistance:getDistance, //获取俩个经纬网度之间的距离 448 getDistance:getDistance, //获取俩个经纬网度之间的距离
447 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形 449 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形
448 null_promise:null_promise,//返回空的promise 450 null_promise:null_promise,//返回空的promise