examine.js 4.35 KB
Newer Older
txy committed
1 2 3 4 5 6 7 8 9 10 11 12 13
$(document).ready(function(){
  setToken();
  // 获取个人信息
  userTabInfo();
  // 获取活动名称
  getActivityTitle();
});

function pass(){
  var activityCode = getQueryString('activityCode');
  var params = {
    activityCode: activityCode,
    reviewStatus: 1,
txy committed
14
    userId: getQueryString('userId')
txy committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  }

  $.ajax({
    type: 'PUT',
    url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode,
    headers: {
      'x-token': getToken()
    },
    data: params,
    success: function(data) {
        if(data.status == 200) {
            $.dialog({
              type: "alert",
              contentHtml: "<p style='text-align:center;'>操作成功</p>",
              onClosed: function(){
                window.location.reload()
              }
            });
        }
    },
    error: function() {
      $.dialog({
          type : 'tips',
          autoClose : 3000,
          infoText : '请求超时,请尝试刷新页面!'
      });
    }
  });
}

function refuse(){
  var activityCode = getQueryString('activityCode');
  var params = {
    activityCode: activityCode,
    reviewStatus: 0,
txy committed
50
    userId: getQueryString('userId')
txy committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
  }

  $.ajax({
    type: 'PUT',
    url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode,
    data: params,
    headers: {
      'x-token': getToken()
    },
    success: function(data) {
        if(data.status == 200) {
            $.dialog({
              type: "alert",
              contentHtml: "<p style='text-align:center;'>操作成功</p>",
              onClosed: function(){
                window.location.reload()
              }
            });
        }
    },
    error: function() {
      $.dialog({
          type : 'tips',
          autoClose : 3000,
          infoText : '请求超时,请尝试刷新页面!'
      });
    }
  });
}

// 个人信息展示
function userTabInfo() {
txy committed
83
    var id = getQueryString('userId');
txy committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
    var activityCode = getQueryString('activityCode');
    var params = {
        id: id
    }
    $.ajax({
        type: 'GET',
        url: baseUrl + '/ACTIVITY/sz/search/' + activityCode,
        data: params,
        headers: {
          'x-token': getToken()
        },
        success: function(data) {
            if(data.status == 200) {
              var userInfoObj = data.result && data.result.records && data.result.records[0];
              $("#userName").text(userInfoObj.name);
              $("#voteCount").text(userInfoObj.voteNum);
              $("#userPhone").text(userInfoObj.userPhone);
              $("#orgName").text(userInfoObj.orgName);
              $("#enounce").text(userInfoObj.declaration);

              $("#userImage img").attr("src", userInfoObj.imageUrl);
              $("#userImage").attr("href", userInfoObj.imageUrl).show();
              
              var reviewStatus = userInfoObj.reviewStatus;
              // reviewStatus 0-待审核 1-审核通过 2-审核未通过
              if(reviewStatus == 1||reviewStatus == 2){
                $(".edit-btn").addClass("hide");
                if(reviewStatus == 1){
                  $(".status-msg").addClass("text-success").html("已通过");  
                }else if(reviewStatus == 2){
                  $(".status-msg").addClass("text-danger").html("已驳回"); 
                }
              }else if(reviewStatus == 0){
                $(".status-msg").hide();  
                $(".edit-btn").removeClass("hide");  		
              }
            }
        },
        error: function() {
            $.dialog({
                type : 'tips',
                autoClose : 3000,
                infoText : '请求超时,请尝试刷新页面!'
            });
        }
    })
}

// 获取活动名称
function getActivityTitle() {
    var activityCode = getQueryString('activityCode');
    var params = {
      activityCode: activityCode
    }
    $.ajax({
        type: 'GET',
        url: baseUrl + '/ACTIVITY/'+ activityCode +'/settings',
        data: params,
        headers: {
          'x-token': getToken()
        },
        success: function(data) {
            if(data.status == 200) {
              var title = data.result.settings.szText.h5Title;
              $('#examineTitle').text(title);
            }
        },
        error: function() {
            $.dialog({
                type : 'tips',
                autoClose : 3000,
                infoText : '请求超时,请尝试刷新页面!'
            });
        }
    })
}