function timeDifc(endtime) {

    var stime = Date.parse(new Date(new Date()));

    var etime = Date.parse(new Date(endtime));

    var usedTime = etime - stime;  //两个时间戳相差的毫秒数  

    var days = Math.floor(usedTime / (24 * 3600 * 1000));

    //计算出小时数  

    var leave1 = usedTime % (24 * 3600 * 1000);    //计算天数后剩余的毫秒数  

    var hours = Math.floor(leave1 / (3600 * 1000));

    //计算相差分钟数  

    var leave2 = leave1 % (3600 * 1000);        //计算小时数后剩余的毫秒数  

    var minutes = Math.floor(leave2 / (60 * 1000));

    //计算相差秒数  

    var leave3 = leave2 % (60 * 1000);        //计算分钟数后剩余的毫秒数  

    var seconds = Math.floor(leave3 / (1000));

    var time = days + "天" + hours + "时" + minutes + "分" + seconds + "秒";

    return time;

}

setInterval(function(){

    var data = timeDifc(1524585600000)

    that.setData({

        console.log(data)

    })

}, 1000)


效果如下:

    报名还剩:1天12时46分38秒