|
- (function() {
- var page = {
- isScroll: false,
- init: function($page) {
- $(document).ready(function() {
- learun.layer.loading(true);
- //判断当前时间是否可以打卡
- learun.httpget(config.webapi + 'learun/adms/attendance/IsAttendance', {}, (
- data) => {
- learun.layer.loading(false);
- //console.log(data.data);
- if (data.data == "red") {
- $('#attimg').attr('src', 'images/dkred.png');
- } else if (data.data == "yellow") {
- $('#attimg').attr('src', 'images/dkyellow.png');
- }else {
- $('#attimg').attr('src', 'images/dk.png');
- }
-
- });
-
- $('#attendContent').on('tap', function(ev) {
- if((($('#attimg')[0].src).indexOf('dk.png')>0)||(($('#attimg')[0].src).indexOf('dkyellow.png')>0)){
- var account = learun.storage.get('logininfo').account;
- learun.layer.loading(true);
- learun.httppost(config.webapi + 'learun/adms/attendance/clockin', {}, (
- data) => {
- learun.layer.loading(false);
- if (data) {
- learun.layer.toast("打卡成功");
- learun.nav.closeCurrent();
- } else {
- learun.layer.toast("打卡失败!");
- }
- });
- }
-
- });
-
- function setTime() {
- var date = new Date();
- var HH = date.getHours(),
- MM = date.getMinutes(),
- SS = date.getSeconds(),
- date = date.getDate();
- if (SS < 10) {
- SS = "0" + SS
- }
- $("#show").text(HH + ":" + MM + ":" + SS);
- }
- setInterval(setTime, 1000);
-
- })
- },
-
- };
-
- return page;
- })();
|