format.wxs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. function substrDate(str){
  2. return str.substring(0,10)
  3. }
  4. function substrText(str,start,end){
  5. return str.substring(start,end)
  6. }
  7. function numRate(value){
  8. var result=(value==''?'0%':(value*100).toFixed(0)+"%");
  9. return result
  10. }
  11. function indexOf(arr, value) {
  12. if (arr.indexOf(value) < 0) {
  13. return false;
  14. } else {
  15. return true;
  16. }
  17. }
  18. function learnTime(value){
  19. if(value==''){
  20. return '';
  21. }else{
  22. var hour=Math.floor(value/3600);
  23. var minute=Math.floor((value-hour*3600)/60);
  24. var second=value%60;
  25. // return hour+'小时'+minute+'分钟'+second+'秒';
  26. return hour+'小时'+minute+'分钟';
  27. }
  28. }
  29. function learnTimeHour(value){
  30. var hour=Math.floor(value/3600);
  31. var minute=Math.floor((value-hour*3600)/60);
  32. var second=value%60;
  33. return hour;
  34. }
  35. function learnTimeMinute(value){
  36. var hour=Math.floor(value/3600);
  37. var minute=Math.floor((value-hour*3600)/60);
  38. var second=value%60;
  39. return minute;
  40. }
  41. module.exports = {
  42. substrDate: substrDate,
  43. indexOf:indexOf ,
  44. substrText:substrText,
  45. numRate:numRate,
  46. learnTime:learnTime,
  47. learnTimeHour:learnTimeHour,
  48. learnTimeMinute:learnTimeMinute
  49. }