|
@@ -679,20 +679,32 @@
|
|
|
}
|
|
|
const time = 2 * 1000;
|
|
|
let that = this;
|
|
|
- $.ajax({
|
|
|
- url: conpath + "/qjt/",
|
|
|
- type: "get",
|
|
|
- dataType: "json",
|
|
|
- async: false,
|
|
|
- success: function (data) {
|
|
|
- const waitTime2 = document.getElementById('waitTime2');
|
|
|
- animateValue(waitTime2, 0, data.data[0], time);
|
|
|
- const currWaitPeople2 = document.getElementById('currWaitPeople2');
|
|
|
- animateValue(currWaitPeople2, 0, data.data[1], time);
|
|
|
- console.log(data.data[1]);
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
+ //获取当前排队人数和分钟数
|
|
|
+ function getCurrentPerson() {
|
|
|
+ $.ajax({
|
|
|
+ url: conpath + "/qjt/",
|
|
|
+ type: "get",
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ success: function (data) {
|
|
|
+ const waitTime2 = document.getElementById('waitTime2');
|
|
|
+ animateValue(waitTime2, 0, data.data[0], time);
|
|
|
+ const currWaitPeople2 = document.getElementById('currWaitPeople2');
|
|
|
+ animateValue(currWaitPeople2, 0, data.data[1], time);
|
|
|
+ console.log(data.data[1]);
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getCurrentPerson();
|
|
|
+ // 获取定时器的ID,以便之后可以清除它
|
|
|
+ var intervalId = setInterval(getCurrentPerson, 1800000);
|
|
|
+
|
|
|
+ // 当用户离开页面时清除定时器
|
|
|
+ window.addEventListener('beforeunload', function () {
|
|
|
+ clearInterval(intervalId);
|
|
|
+ });
|
|
|
// // 1号楼当前排队人数
|
|
|
// const currWaitPeopleElement = document.getElementById('currWaitPeople');
|
|
|
// animateValue(currWaitPeopleElement, 0, 12, time);
|