portal html css js resource

realname-authentication.js 4.6KB

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