123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <title></title>
- </head>
- <body>
- <button id="btn">打开编辑</button>
- <button onclick="btnPreview()">在线预览</button>
- <script src="../../js/jquery.min.js"></script>
- <script type="text/javascript">
- function btnPreview() {
- var set_convertType = 0;
- //if (obj.FILEEXT == "doc") {
- // set_convertType = 0;
- //} else if (obj.FILEEXT == "pdf") {
- // set_convertType = 20;
- //} else if (obj.FILEEXT == "ofd") {
- // set_convertType = 570;
- //} else {
- // set_convertType = 0;
- //}
- ////http://10.233.22.204:8088/glwork/g2work/files/4d8c3459225b48c6cafbb566136cac7f/166b0abc34fa497c43d27018acef4884/e8b7afe5be84.xls
- let postData = {
- convertType: 0,
- fileUrl:"http://10.233.22.204:8088/glwork/g2work/files2/inline/6dcdadb1f70f8eff8360d97566957c62/2ab09aea96928e078003283d1fdb3591/e696b0e5bbba204d6963726f736f667420576f726420e69687e6a1a3.doc"
- };
-
- $.ajax({
- url: "http://10.233.22.204:8088/fcscloud/composite/httpfile",
- data: {
- jsonParams: encodeURIComponent(JSON.stringify(postData))
- },
- type: "POST",
- dataType: "json",
- general: false,
- async: false,
- success: function (data) {
- console.log(data);
- if (data) {
- if (data.errorCode === "0") {
- let rst = data.result;
- console.log(rst.urls);
- if (rst && rst.urls) {
- window.open(get_urls, "_blank");
- } else {
- console.warn("ajax响应内容data.result有问题:" + rst);
- }
- } else {
- alert(data.errorMessage);
- }
- } else {
- console.warn("ajax响应内容为空!");
- }
- },
- });
- ///20230324---zyg ---永中转换-----end
- }
- var setstr="%7B%22method%22%3A1%2C%22params%22%3A%7B%22userId%22%3A%2210.222.33.204%22%2C%22fileId%22%3A%22bcc3655a692547259a2f2335f78cd52f_1262116709%22%2C%22filePath%22%3A%22%2F5G%E7%BB%BD%E6%94%BE%E6%9D%AF%EF%BC%88%E7%AC%AC%E5%9B%9B%E5%B1%8A%EF%BC%89.docx%22%2C%22userRight%22%3A0%2C%22mobileFlag%22%3Afalse%2C%22saveFlag%22%3Atrue%7D%2C%22indexFlag%22%3Atrue%7D";
- //console.log(decodeURIComponent(setstr));
- //{"method":1,"params":{"userId":"10.222.33.204","fileId":"bcc3655a692547259a2f2335f78cd52f_1262116709","filePath":"/5G绽放杯(第四届).docx","userRight":0,"mobileFlag":false,"saveFlag":true},"indexFlag":true}
- //let data = {
- // method: 1,
- // params: {
- // userId: "10.222.33.204",
- // fileId: "bcc3655a692547259a2f2335f78cd52f_1262116709",
- // filePath: "/5G绽放杯(第四届).docx"
- // }
- //};
- //let data = {
- // method: 1,
- // params: {
- // userId: "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf",
- // fileId: "111121",
- // fileName:"路径.xls",
- // filePath: "http://10.233.22.204:8088/glwork/g2work/files/4d8c3459225b48c6cafbb566136cac7f/166b0abc34fa497c43d27018acef4884/e8b7afe5be84.xls"
- // //文件的绝对路径,如果配置文件webOffice.properties里面的filePath值有效,则此处参数为相对路径
- // }
- //};
- ///自定义表单工作梳理.doc
- ///http://10.233.22.204:8088/glwork/g2work/files2/inline/865e508cb0c706bd2e09e73f2168cb8a/431d39d5e28fec47bc346a3b8e2f35f7/e887aae5ae9ae8a1a8e58d95e5b7a5e4bd9ce9878fe9878de696b0e6a2b3e79086.doc
- let data = {
- method: 1,
- params: {
- userId: "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf",
- fileId: "111121",
- fileName: "测试永中转换.pdf",
- filePath: "http://10.233.22.204:8088/glwork/g2work/files2/inline/701eb9dd32a111e5b0a3d0eeb25920c7/00907aaf12fb2b4a846358e6d5b7f2fe/e6b58be8af95e6b0b8e4b8ade8bdace68da2.pdf"
- //文件的绝对路径,如果配置文件webOffice.properties里面的filePath值有效,则此处参数为相对路径
- }
- };
- $("#btn").click(function(){
- $.ajax({
- url: apiurljs.yzFileWo + "api.do",
- //url: "http://10.4.23.31/api.do",
- data: {
- jsonParams: encodeURIComponent(JSON.stringify(data))
- },
- type: "POST",
- dataType: "json",
- general: false,
- async: false,
- success: function (data) {
- console.log(data);
- if (data) {
- if (data.errorCode === "0") {
- let rst = data.result;
- console.log(rst.urls);
- if (rst && rst.urls) {
-
- var get_urls = rst.urls;
- if (typeof (get_urls) === "string") {
- window.open(get_urls, "_blank");
- } else if ($.isArray(get_urls) && get_urls.length) {
- get_urls.forEach(url, function () {
- if (url) {
- window.open(url, "_blank");
- }
- });
- } else {
- console.warn("无效的urls:" + get_urls);
- }
- } else {
- console.warn("ajax响应内容data.result有问题:" + rst);
- }
- } else {
- alert(data.errorMessage);
- }
- } else {
- console.warn("ajax响应内容为空!");
- }
- },
- });
- });
-
- </script>
- </body>
- </html>
|