portal html css js resource

realname-authentication.js 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. //修改密码
  2. $(function(){
  3. loginStatus();//判断个人是否登录
  4. valUser();
  5. istyle();
  6. var temp=[];
  7. //提交上传
  8. $('.subUp').on("click", function() {
  9. var imglen = $(".uploader-list .thumbnail").length;
  10. if(imglen == 0) {
  11. $.MsgBox.Alert("消息提醒","请上传您身份证的正反面。");
  12. }else if(imglen > 3){
  13. $.MsgBox.Alert("消息提醒","最多上传3张照片。");
  14. }else{
  15. typeimg(temp);
  16. }
  17. })
  18. /*图片上传*/
  19. var uploader = WebUploader.create({
  20. auto: true,// 选完文件后,是否自动上传。
  21. swf: 'webuploader/Uploader.swf',// swf文件路径
  22. server: '../ajax/cachedFileUpload',
  23. // 添加的文件数量
  24. //fileNumLimit: 3,
  25. pick: '#filePicker', // 选择文件的按钮。可选。
  26. duplicate :true ,//允许图片重复上传
  27. // 只允许选择图片文件。
  28. accept: {
  29. title: 'Images',
  30. extensions: 'gif,jpg,jpeg,bmp,png',
  31. mimeTypes: 'image/*'
  32. }
  33. });
  34. // 当有文件添加进来的时候
  35. uploader.on( 'fileQueued', function( file ) {
  36. var $li = $(
  37. '<div id="' + file.id + '" class="file-item thumbnail">' +
  38. '<img>' +
  39. //'<div class="info">' + file.name + '</div>' +
  40. '</div>'
  41. ),
  42. $btns = $('<div class="file-panel">' +
  43. '<span class="cancel">删除</span>' +
  44. '</div>').appendTo( $li ),
  45. $img = $li.find('img');
  46. var $list = $("#fileList");
  47. $list.prepend( $li );
  48. // 创建缩略图
  49. // 如果为非图片文件,可以不用调用此方法。
  50. // thumbnailWidth x thumbnailHeight 为 100 x 100
  51. uploader.makeThumb( file, function( error, src ) {
  52. if ( error ) {
  53. $img.replaceWith('<span>不能预览</span>');
  54. return;
  55. }
  56. $img.attr( 'src', src );
  57. }, 1000, 1000 );
  58. $li.on( 'mouseenter', function() {
  59. $btns.stop().animate({height: 30});
  60. });
  61. $li.on( 'mouseleave', function() {
  62. $btns.stop().animate({height: 0});
  63. });
  64. });
  65. /*图片上传成功*/
  66. uploader.on( 'uploadSuccess', function(file,data) {
  67. var cacheImageKey =data.data[0].cacheKey;
  68. temp.push(cacheImageKey);
  69. })
  70. /*删除图片*/
  71. $("#fileList").on("click",".cancel",function(){
  72. $(this).parent().parent().remove();
  73. })
  74. })
  75. /*实名认证*/
  76. function istyle() {
  77. $.ajax("/ajax/professor/auth", {
  78. data: {
  79. "id": $.cookie("userid")
  80. },
  81. dataType: 'json', //数据格式类型
  82. type: 'GET', //http请求类型
  83. timeout: 10000, //超时设置
  84. async: false,
  85. success: function(data) {
  86. //console.log(JSON.stringify(data));
  87. var $info = data.data || {};
  88. if(data.success && data.data) {
  89. authStatus = $info.authStatus;
  90. //console.log(authStatus)
  91. if(authStatus == -1) {
  92. $("#identBtn").show();
  93. $("#identProcess").text("很遗憾,您提交的材料没有通过认证,请更换符合要求的认证材料再试试。");
  94. $("#identProcess").css({"width":"350px"});
  95. $("#identBtn").text("重新认证");
  96. } else if(authStatus == 0) {
  97. $("#identBtn").show();
  98. $("#identProcess").text("您还未进行实名认证");
  99. $("#identBtn").text("开始认证");
  100. } else if(authStatus == 1) {
  101. $("#identProcess").text("认证信息提交成功!");
  102. $("#identts").text("我们将尽快对您的信息进行认证。");
  103. } else if(authStatus == 2) {
  104. $("#identProcess").text("我们正在对您的材料进行认证,请稍等片刻。");
  105. $("#identProcess").css({"width":"280px"});
  106. } else if(authStatus == 3) {
  107. $("#identProcess").text("恭喜您实名认证成功!");
  108. }
  109. if(authStatus == -1 || authStatus == 0){
  110. $("#identBtn").on("click",function(){
  111. $(".IdentityUp").show();
  112. $(".IdentityState").hide();
  113. })
  114. }
  115. }
  116. },
  117. error: function() {
  118. $.MsgBox.Alert('消息','服务器链接超时');
  119. }
  120. });
  121. }
  122. //提交实名认证图片
  123. function typeimg(temp) {
  124. $.ajax("/ajax/authApply/realName", {
  125. data: {
  126. "professorId": $.cookie("userid"),
  127. "fns": temp
  128. },
  129. dataType: 'json', //数据格式类型
  130. type: 'post', //http请求类型
  131. //async: false,
  132. timeout: 10000, //超时设置
  133. traditional:true,//传数组必须加这个
  134. success: function(data) {
  135. //console.log(JSON.stringify(data));
  136. if(data.success) {
  137. $(".IdentityUp").hide();
  138. $(".IdentityState").show();
  139. location.reload(true);
  140. }
  141. },
  142. error: function() {
  143. $.MsgBox.Alert('消息','服务器链接超时');
  144. }
  145. });
  146. }