You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AttendanceCard.js 1.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. (function() {
  2. var page = {
  3. isScroll: false,
  4. init: function($page) {
  5. $(document).ready(function() {
  6. learun.layer.loading(true);
  7. //判断当前时间是否可以打卡
  8. learun.httpget(config.webapi + 'learun/adms/attendance/IsAttendance', {}, (
  9. data) => {
  10. learun.layer.loading(false);
  11. //console.log(data.data);
  12. if (data.data == "red") {
  13. $('#attimg').attr('src', 'images/dkred.png');
  14. } else if (data.data == "yellow") {
  15. $('#attimg').attr('src', 'images/dkyellow.png');
  16. }else {
  17. $('#attimg').attr('src', 'images/dk.png');
  18. }
  19. });
  20. $('#attendContent').on('tap', function(ev) {
  21. if((($('#attimg')[0].src).indexOf('dk.png')>0)||(($('#attimg')[0].src).indexOf('dkyellow.png')>0)){
  22. var account = learun.storage.get('logininfo').account;
  23. learun.layer.loading(true);
  24. learun.httppost(config.webapi + 'learun/adms/attendance/clockin', {}, (
  25. data) => {
  26. learun.layer.loading(false);
  27. if (data) {
  28. learun.layer.toast("打卡成功");
  29. learun.nav.closeCurrent();
  30. } else {
  31. learun.layer.toast("打卡失败!");
  32. }
  33. });
  34. }
  35. });
  36. function setTime() {
  37. var date = new Date();
  38. var HH = date.getHours(),
  39. MM = date.getMinutes(),
  40. SS = date.getSeconds(),
  41. date = date.getDate();
  42. if (SS < 10) {
  43. SS = "0" + SS
  44. }
  45. $("#show").text(HH + ":" + MM + ":" + SS);
  46. }
  47. setInterval(setTime, 1000);
  48. })
  49. },
  50. };
  51. return page;
  52. })();