test_httpfile.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. </head>
  8. <body>
  9. <button id="btn">转换</button>
  10. <script src="../../js/jquery.min.js"></script>
  11. <script type="text/javascript">
  12. $("#btn").click(function () {
  13. let postData = {
  14. convertType: 0,
  15. fileUrl: "http://10.233.22.204:8088/glwork/g2work/files2/inline/865e508cb0c706bd2e09e73f2168cb8a/431d39d5e28fec47bc346a3b8e2f35f7/e887aae5ae9ae8a1a8e58d95e5b7a5e4bd9ce9878fe9878de696b0e6a2b3e79086.doc"
  16. };
  17. $.ajax({
  18. url: "http://10.233.22.204:8088/fcscloud/composite/httpfile",
  19. //url: "http://10.4.23.31/api.do",
  20. data: postData,
  21. type: "POST",
  22. dataType: "json",
  23. contentType: "application/x-www-form-urlencoded",
  24. general: false,
  25. async: false,
  26. success: function (res) {
  27. console.log(res);
  28. if (res.errorcode === 0) {
  29. let rst = res.data;
  30. console.log(rst.viewUrl);
  31. window.open(rst.viewUrl, "_blank");
  32. } else {
  33. alert(res.message);
  34. }
  35. },
  36. });
  37. });
  38. </script>
  39. </body>
  40. </html>