FUYU
2023-05-19 559771a80cf779dc13a84ecd2f178e6ca5a8353a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!-- 该页面实现token上传预览 -->
<apex:page standardController="FileAddress__c" extensions="FilePreviewDownVFController" showHeader="false">
    <head>
        <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
        <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
 
        <script>
            var staticResources = JSON.parse('{!staticResource}');
            var fileKey = '{!fileKey}';
            var fileName = '{!fileName}';
            var type = '{!type}';
 
            var PARAMS = {};
            PARAMS.fileKey = fileKey;
            PARAMS.fileName = fileName;
            PARAMS.token = staticResources.token;
            console.log('PARAMS = ' + JSON.stringify(PARAMS));
 
            if(type == 'preview'){
                postAWS(staticResources.queryUrl.split('?')[0]+'V2',PARAMS);
            }else if(type == 'download'){
                postAWS(staticResources.undeleteUrl.split('?')[0]+'V2',PARAMS);
            }
            //调用AWS进行预览或下载
            debugger
            function postAWS(url,PARAMS){
                //组装表单发送
                console.log('1');
                jQuery("body").append("<form></form>");
                jQuery("body").find("form").attr("action",url);
                jQuery("body").find("form").attr("method","post");
                jQuery("body").find("form").attr("display","none");
                for (var x in PARAMS) { 
                    jQuery("body").find("form").append("<input type='text' name='"+x+"' value = '"+PARAMS[x]+"' style='display:none'></input>");
                }
                jQuery("body").find("form").submit();
            }
            
        </script>
    </head>
 
    <body style="display : none;">
        <span id="loading" style="display : none;">正在生成,请稍候...</span>
    </body>
</apex:page>