123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- var dataList=[]
- var content=''
- var index=0
- $().ready(function () {
- count_down('2019-1-1 00:00:00')
- getList()
- everyOneMoney();
- })
- function getList() {
- $.ajax({
- type: 'post',
- url: '/api/v2/pullTheNewUser/topList',
- success: function (res) {
- if (res && res.errno == 0) {
- content=""
- dataList=res.rst
- for(var i in dataList){
- if(dataList[i].nickname.length>5){
- dataList[i].nickname=dataList[i].nickname.substring(0, 4)+"..."
- }
- index++;
- if(index<=3){
- content+=`
- <tr>
- <td>
- <span class="num">
- <img class="medal" src="./img/gold.png" style="display:`+(index==1?'block':'none')+`">
- <img class="medal" src="./img/sliver.png" style="display:`+(index==2?'block':'none')+`">
- <img class="medal" src="./img/bronze.png" style="display:`+(index==3?'block':'none')+`">
- </span>
- </td>
- <td>
- <img class="head" src="`+dataList[i].headimgurl+`">
- </td>
- <td>`+dataList[i].nickname+`</td>
- <td>`+dataList[i].newUserNum+`</td>
- <td>`+dataList[i].money+`元</td>
- </tr>
- `
- }else {
- content+=`
- <tr>
- <td>
- <span class="num">
- `+index+`
- </span>
- </td>
- <td>
- <img class="head" src="`+dataList[i].headimgurl+`">
- </td>
- <td>`+dataList[i].nickname+`</td>
- <td>`+dataList[i].newUserNum+`</td>
- <td>`+dataList[i].money+`元</td>
- </tr>
- `
- }
- }
- $("#table").append(content)
- }
- },
- fail: function () {
- console.log("fail")
- }
- })
- }
- // 倒计时
- function count_down(o) {
- // $("#test").html(o);
- time = setTimeout(function () { count_down(o) }, 1000);
- var datatime = /^[\d]{4}-[\d]{1,2}-[\d]{1,2}( [\d]{1,2}:[\d]{1,2}(:[\d]{1,2})?)?$/ig, str = '', conn, s;
- if (!o.match(datatime)) {
- // alert('参数格式为2020-01-01[ 01:01[:01]].\r其中[]内的内容可省略');
- return false;
- }
- var sec = (new Date(o.replace(/-/ig, '/')).getTime() - new Date().getTime()) / 1000;
- // $("#test1").text(sec)
- if (sec == 0 || sec < 0) {
- html = `<img class="img" src="https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/shuangshiyi/chaojihongbao/yure_hongbao.png" />`
- $('.daojishi').html(html);
- $(".button").addClass('buttonActive');
- $(".button").click(function () {
- copyPassword();
- })
- clearTimeout(time);
- } else {
- s = { '天': sec / 24 / 3600, '时': Math.floor(sec / 3600 % 24), '分': Math.floor(sec / 60 % 60),'秒':Math.floor(sec%60) };
- for (i in s) {
- if (s[i] < 10) { s[i] = '0' + s[i] };
- if (i != '天') {
- str += '<span>' + s[i] + '</span>' + i;
- } else {
- str += '<span>' + parseInt(s[i]) + '</span>' + i;
- }
- }
- $("#count").html(str)
- }
- }
- function count_down(o) {
- // $("#test").html(o);
- time = setTimeout(function () { count_down(o) }, 1000);
- var datatime = /^[\d]{4}-[\d]{1,2}-[\d]{1,2}( [\d]{1,2}:[\d]{1,2}(:[\d]{1,2})?)?$/ig, str = '', conn, s;
- if (!o.match(datatime)) {
- // alert('参数格式为2020-01-01[ 01:01[:01]].\r其中[]内的内容可省略');
- return false;
- }
- var sec = (new Date(o.replace(/-/ig, '/')).getTime() - new Date().getTime()) / 1000;
- // $("#test1").text(sec)
- if (sec == 0 || sec < 0) {
- html = `<img class="img" src="https://kx-youhuiquan.oss-cn-beijing.aliyuncs.com/shuangshiyi/chaojihongbao/yure_hongbao.png" />`
- $('.daojishi').html(html);
- $(".button").addClass('buttonActive');
- $(".button").click(function () {
- copyPassword();
- })
- clearTimeout(time);
- } else {
- s = { '天': sec / 24 / 3600, '时': Math.floor(sec / 3600 % 24), '分': Math.floor(sec / 60 % 60),'秒':Math.floor(sec%60) };
- for (i in s) {
- if (s[i] < 10) { s[i] = '0' + s[i] };
- if (i != '天') {
- str += '<span>' + s[i] + '</span>' + i;
- } else {
- str += '<span>' + parseInt(s[i]) + '</span>' + i;
- }
- }
- $("#count").html(str)
- }
- }
- function everyOneMoney() {
- $.ajax({
- type: 'post',
- url: '/api/v2/pullTheNewUser/everyOneMoney',
- dataType: 'json',
- success: function (res) {
- if (res && res.errno == 0) {
- odometer.innerHTML = Number(res.rst.every_money);
- }else{
- $(".bottomPrice").html('')
- }
- },
- fail: function () {
- }
- })
- }
|