portal html css js resource

expert-authentication.js 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. //专家和实名认证
  2. $(function() {
  3. valUser();
  4. isexpert();
  5. var temp = [];
  6. var temp2 = [];
  7. /*专家认证提交上传*/
  8. $('.webupArea').on("click", ".expertSubmit", function() {
  9. var imglen = $("#fileList2 .thumbnail").length;
  10. if(imglen == 0) {
  11. $.MsgBox.Alert("消息提醒", "请上传能够证明您身份的相关证件,如工作证、在职证明、学生证、在读证明等");
  12. } else if(imglen > 5) {
  13. $.MsgBox.Alert("消息提醒", "最多上传5张照片。");
  14. } else {
  15. $.MsgBox.Confirm("消息提醒", "确认提交实名信息?一旦审核通过后,将不可更改。", function() {
  16. expertimg(temp2);
  17. });
  18. }
  19. })
  20. /*专家和实名认证提交上传*/
  21. $('.webupArea').on("click", ".realnameSubmit", function() {
  22. var imglen = $("#fileList2 .thumbnail").length;
  23. var imglen2 = $("#fileList .thumbnail").length;
  24. if(imglen2 == 0) {
  25. $.MsgBox.Alert("消息提醒", "请上传您身份证的正反面。");
  26. } else if(imglen2 > 3) {
  27. $.MsgBox.Alert("消息提醒", "最多上传3张照片。");
  28. } else if(imglen == 0) {
  29. $.MsgBox.Alert("消息提醒", "请上传能够证明您身份的相关证件,如工作证、在职证明、学生证、在读证明等");
  30. } else if(imglen > 5) {
  31. $.MsgBox.Alert("消息提醒", "最多上传5张照片。");
  32. } else {
  33. $.MsgBox.Confirm("消息提醒", "确认提交实名信息?一旦审核通过后,将不可更改。", function() {
  34. realnameimg(temp)
  35. expertimg(temp2);
  36. });
  37. }
  38. })
  39. expertuploader();
  40. realnameuploader();
  41. /*实名认证图片上传*/
  42. function realnameuploader() {
  43. /*图片上传*/
  44. var uploader = WebUploader.create({
  45. auto: true, // 选完文件后,是否自动上传。
  46. swf: 'webuploader/Uploader.swf', // swf文件路径
  47. server: '../ajax/cachedFileUpload',
  48. // 添加的文件数量
  49. //fileNumLimit: 3,
  50. pick: '#filePicker', // 选择文件的按钮。可选。
  51. duplicate: true, //允许图片重复上传
  52. // 只允许选择图片文件。
  53. accept: {
  54. title: 'Images',
  55. extensions: 'gif,jpg,jpeg,bmp,png',
  56. mimeTypes: 'image/*'
  57. }
  58. });
  59. // 当有文件添加进来的时候
  60. uploader.on('fileQueued', function(file) {
  61. var $li = $(
  62. '<div id="' + file.id + '" class="file-item thumbnail">' +
  63. '<img>' +
  64. //'<div class="info">' + file.name + '</div>' +
  65. '</div>'
  66. ),
  67. $btns = $('<div class="file-panel">' +
  68. '<span class="cancel">删除</span>' +
  69. '</div>').appendTo($li),
  70. $img = $li.find('img');
  71. var $list = $("#fileList");
  72. $list.prepend($li);
  73. // 创建缩略图
  74. // 如果为非图片文件,可以不用调用此方法。
  75. // thumbnailWidth x thumbnailHeight 为 100 x 100
  76. uploader.makeThumb(file, function(error, src) {
  77. $img.attr('src', src);
  78. }, 1000, 1000);
  79. $li.on('mouseenter', function() {
  80. $btns.stop().animate({
  81. height: 30
  82. });
  83. });
  84. $li.on('mouseleave', function() {
  85. $btns.stop().animate({
  86. height: 0
  87. });
  88. });
  89. });
  90. /*图片上传成功*/
  91. uploader.on('uploadSuccess', function(file, data) {
  92. var cacheImageKey = data.data[0].cacheKey;
  93. temp.push(cacheImageKey);
  94. })
  95. /*删除图片*/
  96. $("#fileList").on("click", ".cancel", function() {
  97. $(this).parent().parent().remove();
  98. })
  99. }
  100. /*专家认证图片上传*/
  101. function expertuploader() {
  102. var uploader2 = WebUploader.create({
  103. auto: true, // 选完文件后,是否自动上传。
  104. swf: 'webuploader/Uploader.swf', // swf文件路径
  105. server: '../ajax/cachedFileUpload',
  106. // 添加的文件数量
  107. //fileNumLimit: 3,
  108. pick: '#filePicker2', // 选择文件的按钮。可选。
  109. duplicate: true, //允许图片重复上传
  110. // 只允许选择图片文件。
  111. accept: {
  112. title: 'Images',
  113. extensions: 'gif,jpg,jpeg,bmp,png',
  114. mimeTypes: 'image/*'
  115. }
  116. });
  117. // 当有文件添加进来的时候
  118. uploader2.on('fileQueued', function(file) {
  119. var $li = $(
  120. '<div id="' + file.id + '" class="file-item thumbnail">' +
  121. '<img>' +
  122. //'<div class="info">' + file.name + '</div>' +
  123. '</div>'
  124. ),
  125. $btns = $('<div class="file-panel">' +
  126. '<span class="cancel">删除</span>' +
  127. '</div>').appendTo($li),
  128. $img = $li.find('img');
  129. var $list2 = $("#fileList2");
  130. $list2.prepend($li);
  131. // 创建缩略图
  132. // 如果为非图片文件,可以不用调用此方法。
  133. // thumbnailWidth x thumbnailHeight 为 100 x 100
  134. uploader2.makeThumb(file, function(error, src) {
  135. $img.attr('src', src);
  136. }, 1000, 1000);
  137. $li.on('mouseenter', function() {
  138. $btns.stop().animate({
  139. height: 30
  140. });
  141. });
  142. $li.on('mouseleave', function() {
  143. $btns.stop().animate({
  144. height: 0
  145. });
  146. });
  147. });
  148. /*图片上传成功*/
  149. uploader2.on('uploadSuccess', function(file, data) {
  150. var cacheImageKey = data.data[0].cacheKey;
  151. temp2.push(cacheImageKey);
  152. })
  153. /*删除图片*/
  154. $("#fileList2").on("click", ".cancel", function() {
  155. $(this).parent().parent().remove();
  156. })
  157. }
  158. })
  159. /*专家认证*/
  160. function isexpert() {
  161. $.ajax("/ajax/professor/auth", {
  162. data: {
  163. "id": $.cookie("userid")
  164. },
  165. dataType: 'json', //数据格式类型
  166. type: 'GET', //http请求类型
  167. timeout: 10000, //超时设置
  168. async: false,
  169. success: function(data) {
  170. console.log(JSON.stringify(data));
  171. var $info = data.data || {};
  172. if(data.success && data.data) {
  173. authStatusExpert = $info.authStatusExpert;
  174. authStatus = $info.authStatus;
  175. console.log(authStatusExpert)
  176. if(authStatusExpert == -1) {
  177. $("#identProcess").text("很遗憾,您没有通过认证。");
  178. $("#identts").text("请更换符合要求的认证材料再试试。");
  179. $("#identBtn").show().text("重新认证");
  180. } else if(authStatusExpert == 0) {
  181. $("#identProcess").text("成为科袖认证专家用户,与企业开展合作,将您的科研价值变现!");
  182. $("#identProcess").css({
  183. "width": "300px"
  184. });
  185. $("#identBtn").show().text("开始认证");
  186. } else if(authStatusExpert == 1) {
  187. $("#identProcess").text("认证信息提交成功!");
  188. $("#identts").text("我们将尽快对您的信息进行认证,通过后您将成为科袖认证专家,获得特殊功能权限!");
  189. } else if(authStatusExpert == 2) {
  190. $("#identProcess").text("我们正在对您的材料进行认证,请稍等片刻。");
  191. $("#identProcess").css({
  192. "width": "280px"
  193. });
  194. } else if(authStatusExpert == 3) {
  195. $("#identProcess").text("恭喜您已成为科袖认证专家!");
  196. $("#identts").text("在【我的工作台】可以查看发布中的需求,与企业展开合作,将科研价值变现。");
  197. $("#identBtn").show().text("进入[我的工作台]");
  198. $("#identBtn").on("click", function() {
  199. window.location.href = "workspaces.html";
  200. })
  201. }
  202. if(authStatus == 3) {
  203. if(authStatusExpert == -1 || authStatusExpert == 0) {
  204. $("#identBtn").on("click", function() {
  205. $(".IdentityState,.realname").hide();
  206. $(".IdentityUp").show();
  207. $(".subUp").addClass("expertSubmit");
  208. })
  209. }
  210. } else if(authStatus == -1 || authStatus == 0) {
  211. if(authStatusExpert == -1 || authStatusExpert == 0) {
  212. $("#identBtn").on("click", function() {
  213. $(".IdentityState").hide();
  214. $(".IdentityUp").show();
  215. $(".subUp").addClass("realnameSubmit");
  216. })
  217. }
  218. } else if(authStatus == 1 || authStatus == 2) {
  219. $("#identBtn").hide();
  220. $("#identProcess").text("我们正在对您的材料进行认证,请稍等片刻。");
  221. $("#identProcess").css({
  222. "width": "280px"
  223. });
  224. }
  225. }
  226. },
  227. error: function() {
  228. $.MsgBox.Alert('消息', '服务器链接超时');
  229. return;
  230. }
  231. });
  232. }
  233. /*提交专家认证图片*/
  234. function expertimg(temp) {
  235. $.ajax("/ajax/authApply/expert", {
  236. data: {
  237. "professorId": $.cookie("userid"),
  238. "fns": temp
  239. },
  240. dataType: 'json', //数据格式类型
  241. type: 'post', //http请求类型
  242. async: false,
  243. timeout: 10000, //超时设置
  244. traditional: true, //传数组必须加这个
  245. success: function(data) {
  246. console.log(JSON.stringify(data));
  247. if(data.success) {
  248. $(".IdentityUp").hide();
  249. $(".IdentityState").show();
  250. location.reload(true);
  251. }
  252. },
  253. error: function() {
  254. $.MsgBox.Alert('消息', '服务器链接超时');
  255. }
  256. });
  257. }
  258. /*提交实名认证图片*/
  259. function realnameimg(temp2) {
  260. $.ajax("/ajax/authApply/realName", {
  261. data: {
  262. "professorId": $.cookie("userid"),
  263. "fns": temp2
  264. },
  265. dataType: 'json', //数据格式类型
  266. type: 'post', //http请求类型
  267. async: false,
  268. timeout: 10000, //超时设置
  269. traditional: true, //传数组必须加这个
  270. success: function(data) {
  271. console.log(JSON.stringify(data));
  272. if(data.success) {
  273. $(".IdentityUp").hide();
  274. $(".IdentityState").show();
  275. location.reload(true);
  276. }
  277. },
  278. error: function() {
  279. $.MsgBox.Alert('消息', '服务器链接超时');
  280. }
  281. });
  282. }