<!-- 该页面实现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>
|