踩坑plus.io.resolveLocalFileSystemURL在其他andriod移动设备上可以直接点正文拟稿就可以编辑并保存,在小米手机上不可以(提示保存成功,但实际并未上传),是什么样的坑没有挖出来呢,求解
<%-- 移动端word在线编辑器转上传方式开始 ,修改字段名称--%>
<table width="100%" style="border: 0;" cellspacing="0" cellpadding="0">
<tr>
<td width="14%" style="border: 0;">公文编辑:</td>
<td class="label" style="border-top: 0;border-bottom: 0;border-right: 0;">
<%if (!StringUtil.webEncode(request.getParameter("printMode")).equals("1") && !policy.isItemHidden("SalaryWordFile")) {%>
<%if (policy.isItemEditable("SalaryWordFile")) {%>
<input type=button name="ContentWordFileBut" id="ContentWordFileBut"
style="border:0;background-color:transparent;color:blue;"
clicked=<%=(bizEntity.getDismissId()==0&&policy.isItemEditable("SalaryWordFile")&&!policy.isItemLocked("SalaryWordFile"))?"0 ":"1"%> value="<%=(policy.isItemEditable("SalaryWordFile")&&!policy.isItemLocked("SalaryWordFile"))?(bizEntity.getDismissId()==0?"【正文拟稿】":"【正文编辑】"):"【正文查看】"%>"
onclick="showWord(this);">
<%} else {%>
<%
int endIdx = StringUtil.nullTo(bizEntity.getSalaryWordFile()).lastIndexOf(".");
String end = StringUtil.nullTo(bizEntity.getSalaryWordFile()).substring(endIdx);
String s = "正文查看" + end + ":" + StringUtil.nullTo(bizEntity.getSalaryWordFile());
%>
<%=com.jacob.officeToHtml.FilePath.strPlit(s, ":", request)%>
<%}%>
<%}%>
<script>
<%
String name=StringUtil.nullTo(bizEntity.getSalaryWordFile()).replaceAll("\\\\","/");
String filePath=name;
int idx=name.lastIndexOf("/");
if(idx!=-1){
name=name.substring(idx+1);
}
String parentPath=filePath.replaceAll("/"+name,"");
%>
var folderPath = "_downloads";
var parentPath = "<%=parentPath%>";
var needUpload = false;
var bumfFileExist = false;
var name = "<%=name%>";
var file = "<%=filePath%>";
var editable = parseInt('<%=(policy.isItemEditable("ContentWordFile")&&!policy.isItemLocked("ContentWordFile")?1:0)%>') === 1;
var uploadUrl = "http://" + window.location.host + "/mobile/xwf/bumf/word_control_upload.jsp";
function wordEditClick() {
var flag = parseInt($("#ContentWordFileBut").attr("clicked")) === 1;
if (!flag) {
alert("您还没有进行公文编辑");
return flag;
}
if (needUpload && bumfFileExist) {
createUpload();
}
return true;
}
mui.plusReady(function () {
testFileExist();
document.addEventListener("resume", function () {
testFileExist();
})
});
function showWord(o) {
$(o).attr("clicked", 1);
if (!editable) {
needUpload = false;
return;
}
if (needUpload && bumfFileExist) {
plus.runtime.openFile("_downloads" + file);
return;
}
createDownloadTask(parentPath, name, name);
needUpload = true;
bumfFileExist = true;
}
var firstTest = true;
function testFileExist() {
plus.io.resolveLocalFileSystemURL((folderPath + file), function (entry) {
if (entry.isFile) {
console.log("已存在1,要删除。。。");
if (firstTest) {
entry.remove(function () {
console.log("删除----OK");
}, function () {
console.log("删除----ERROR");
})
} else {
bumfFileExist = true;
}
} else {
console.log("不存在2");
bumfFileExist = false;
}
firstTest = false;
}, function (e) {
console.log("不存在3");
bumfFileExist = false;
firstTest = false;
});
}
function createUpload() {
var taskUpload = plus.uploader.createUpload(uploadUrl, {
method: "POST", async: false
},
function (t, status) {
// 上传完成
if (parseInt(status) === 200 && $.trim(t.responseText) === "true") {
alert("正文保存成功");
} else {
alert("正文保存失败,请重试。。。");
}
}
);
taskUpload.addFile(folderPath + '<%=filePath%>', {
key: "<%=filePath%>",
name: "<%=filePath%>"
});
taskUpload.start();
}
</script>
<div style="display: none;">
<%if (bizEntity.getDismissId() != 0 && !StringUtil.webEncode(request.getParameter("printMode")).equals("1") && !policy.isItemHidden("ContentBumfFile")) {%>
<input type=button name="ContentBumfFileBut"
style="border:0;background-color:transparent;color:blue;"
clicked=<%=policy.isItemEditable("ContentBumfFile")?"0":"1"%> value="<%=policy.isItemEditable("ContentBumfFile")?"【生成公文】":"【公文阅读】"%>"
onclick="showBumf();">
<%if (policy.isItemEditable("ContentBumfFile")) {%>
<input type=button style="border:0;background-color:transparent;color:blue"
value="【公文查看】"
onclick="viewWord();">
<script>
function viewWord() {
officeEditWindow('/xwf/bumf/bumf_out_word.jsp?bumfOut=<%=bizEntity.getDismissId()%>&edit=0&url=<%=EncodeUtil.urlEncode("/xwf/bumf/word_control.jsp?isNew="+(bizEntity.getDismissId()==0)+"&templetURL=&canWhitePrint=1&readOnly=1&reviewMode="+(bizEntity.getDismissId()!=0?1:0)+"&showRevisions=0&canPrint=1&file="+(bizEntity.getSalaryWordFile())+"&printURL=&canSelectTemplet="+(bizEntity.getDismissId()==0?1:0)+"&templetListURL=&hideButtons=0")%>');
}
</script>
<%}%>
<script>
function showBumf() {
}
</script>
<%}%>
</div>
</td>
</tr>
</table>
<%-- 移动端word在线编辑器转上传方式结束--%>
0 个回复