portal html css js resource

expert-authentication.js 9.1KB

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