portal html css js resource

upload.js 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. var typenum,authStatus;
  2. var userid = $.cookie("userid");
  3. var sett = GetQueryString("set");
  4. if(sett==3){
  5. $("#sfnav").addClass("bgcolor").siblings().removeClass("bgcolor");
  6. $("#sfbox").show().siblings().hide();
  7. }
  8. //角色切换
  9. $(".IdentityChoice").on("click",".boxnav li",function(){
  10. $(this).addClass("set").siblings().removeClass("set");
  11. })
  12. //初始化身份状态
  13. $.ajax("/ajax/professor/auth",{
  14. data:{"id":userid},
  15. type:"GET",
  16. dataType: 'json',
  17. async: false,
  18. success:function(data){
  19. var $info = data.data || {};
  20. if(data.success && data.data) {
  21. authStatus=$info.authStatus;
  22. //console.log(authStatus)
  23. if($info.authStatus==0){
  24. $(".identProcess").text("暂时还未进行身份认证");
  25. $(".identBtn").text("现在去认证");
  26. }else if($info.authStatus==1){
  27. $(".identProcess").text("已经通过身份认证");
  28. $(".identBtn").text("重新认证");
  29. }else if($info.authStatus==2){
  30. $(".identProcess").text("身份待审核 ");
  31. $(".identts").text("(认证审核期间不能重复认证操作) ");
  32. $(".identBtn").hide();
  33. }else if($info.authStatus==3){
  34. $(".identProcess").text("身份审核中");
  35. $(".identts").text("(认证审核期间不能重复认证操作) ");
  36. $(".identBtn").hide();
  37. }else if($info.authStatus==4){
  38. $(".identProcess").text("身份认证通过");
  39. $(".identBtn").text("重新认证");
  40. }else if($info.authStatus==5){
  41. $(".identProcess").text("身份认证失败,请重新认证");
  42. $(".identBtn").text("重新认证");
  43. }
  44. typenum = $info.authentication;
  45. authStatus=$info.authStatus;
  46. }else{
  47. $.MsgBox.Alert("消息提醒","系统异常!");
  48. }
  49. },
  50. error:function(){
  51. $.MsgBox.Alert("消息提醒","系统异常!");
  52. }
  53. });
  54. $(".boxnav span").each(function () {
  55. var datanum =$(this).attr("data-num");
  56. if(datanum==typenum){
  57. $(this).parent().addClass("set");
  58. }
  59. });
  60. $(".identBtn").on("click",function(){
  61. $(".IdentityUp").show();
  62. $('.IdentityState').hide();
  63. /*if(authStatus==0 && authStatus==4 && authStatus==5){
  64. $(".IdentityUp").show();
  65. $('.IdentityState').hide();
  66. }else if(authStatus==1){
  67. $(".IdentityUp").show();
  68. $('.IdentityState').hide();
  69. }*/
  70. })
  71. //提交上传
  72. $('.subUp').on("click", function() {
  73. var imglen = $(".uploader-list .thumbnail").length;
  74. if(imglen == 0) {
  75. $.MsgBox.Alert("消息提醒","请上传能够证明您身份的相关证件");
  76. } else {
  77. typename(userid, typenum);
  78. }
  79. })
  80. //添加认证申请信息
  81. function typename(userid, usertype) {
  82. $.ajax("/ajax/authApply",{
  83. data:{"professorId":userid,"applyType":usertype},
  84. type:"post",
  85. dataType: 'json',
  86. async: false,
  87. success:function(data){
  88. if(data.success) {
  89. var authapplyid = data.data;
  90. $(".uploader-list img").each(function() {
  91. var str = $(this).attr("src");
  92. var base64 = str.replace("data:image/jpeg;base64,", "");
  93. //console.log(base64);
  94. typeimg(authapplyid, base64);
  95. });
  96. }else{
  97. $.MsgBox.Alert("消息提醒","系统异常!");
  98. }
  99. },
  100. error:function(){
  101. $.MsgBox.Alert("消息提醒","系统异常!");
  102. }
  103. });
  104. }
  105. //添加申请认证图片
  106. function typeimg(authapplyid, base64) {
  107. $.ajax("/ajax/authImage",{
  108. data:{"authApplyId":authapplyid,"base64":base64},
  109. type:"post",
  110. dataType: 'json',
  111. async: false,
  112. success:function(data){
  113. if(data.success) {
  114. $.MsgBox.Alert("消息提醒","认证图片上传成功");
  115. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  116. window.location.href="account-set.html?set=3";
  117. }
  118. },
  119. error:function(){
  120. $.MsgBox.Alert("消息提醒","系统异常!");
  121. }
  122. });
  123. }
  124. /*图片上传*/
  125. var uploader = WebUploader.create({
  126. auto: true,// 选完文件后,是否自动上传。
  127. swf: 'webuploader/Uploader.swf',// swf文件路径
  128. pick: '#filePicker', // 选择文件的按钮。可选。
  129. duplicate :true ,//允许图片重复上传
  130. // 只允许选择图片文件。
  131. accept: {
  132. title: 'Images',
  133. extensions: 'gif,jpg,jpeg,bmp,png',
  134. mimeTypes: 'image/*'
  135. }
  136. });
  137. // 当有文件添加进来的时候
  138. uploader.on( 'fileQueued', function( file ) {
  139. var $li = $(
  140. '<div id="' + file.id + '" class="file-item thumbnail">' +
  141. '<img>' +
  142. //'<div class="info">' + file.name + '</div>' +
  143. '</div>'
  144. ),
  145. $btns = $('<div class="file-panel">' +
  146. '<span class="cancel">删除</span>' +
  147. '</div>').appendTo( $li ),
  148. $img = $li.find('img');
  149. var $list = $("#fileList");
  150. $list.prepend( $li );
  151. // 创建缩略图
  152. // 如果为非图片文件,可以不用调用此方法。
  153. // thumbnailWidth x thumbnailHeight 为 100 x 100
  154. uploader.makeThumb( file, function( error, src ) {
  155. if ( error ) {
  156. $img.replaceWith('<span>不能预览</span>');
  157. return;
  158. }
  159. $img.attr( 'src', src );
  160. }, 1000, 1000 );
  161. $li.on( 'mouseenter', function() {
  162. $btns.stop().animate({height: 30});
  163. });
  164. $li.on( 'mouseleave', function() {
  165. $btns.stop().animate({height: 0});
  166. });
  167. });
  168. /*
  169. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  170. uploader.on( 'uploadSuccess', function( file ) {
  171. });*/
  172. $("#fileList").on("click",".cancel",function(){
  173. $(this).parent().parent().remove();
  174. })
  175. $(".webuploader-pick").css({"width":"100px","height":"100px"});
  176. /*图片上传结束*/