Commit f1ff7acf authored by 高飞's avatar 高飞

修改网页打开电脑软件

parent 97ae2be7
...@@ -21,5 +21,6 @@ ...@@ -21,5 +21,6 @@
alert("当前浏览器版本过低,请升级!!!"); alert("当前浏览器版本过低,请升级!!!");
} }
</script> </script>
<script src="static/js/protocolcheck.js"></script>
<script src="http://192.168.168.213:9000/web-apps/apps/api/documents/api.js"></script> <script src="http://192.168.168.213:9000/web-apps/apps/api/documents/api.js"></script>
</html> </html>
\ No newline at end of file
...@@ -567,7 +567,7 @@ export default { ...@@ -567,7 +567,7 @@ export default {
data.list.forEach((item, index) => { data.list.forEach((item, index) => {
data.list[index].create_time = new Date( data.list[index].create_time = new Date(
data.list[index].create_time data.list[index].create_time
).Format("yyyy-MM-dd HH:mm:ss"); ).Format("yyyy-MM-dd hh:mm:ss");
}); });
_this.get_files = data.list; _this.get_files = data.list;
_this.totals_qw = data.totals; _this.totals_qw = data.totals;
...@@ -621,10 +621,6 @@ export default { ...@@ -621,10 +621,6 @@ export default {
document.getElementById("sound_id").currentTime = 0; document.getElementById("sound_id").currentTime = 0;
}, 500); }, 500);
} else { } else {
// let path_srt =
// "api/rest/document/pdf/" + _this.type_folder + "/" + row.file.uuid;
// window.open(path_srt);
// window.open(`api/rest/file/pdf/DocumentPDF?objectName=${row.file.uuid}`);
get(`api/rest/file/exists?bucket=DocumentPDF&filename=${row.file.uuid}`).then(res => { get(`api/rest/file/exists?bucket=DocumentPDF&filename=${row.file.uuid}`).then(res => {
if (res) { if (res) {
...@@ -643,13 +639,19 @@ export default { ...@@ -643,13 +639,19 @@ export default {
}, },
//table_全文搜索预览 //table_全文搜索预览
handleView_qwss(item) { handleView_qwss(item) {
// let path_srt = get(`api/rest/file/exists?bucket=DocumentPDF&filename=${item.fileInfo.file.uuid}`).then(res => {
// "api/rest/document/pdf/" + if (res) {
// this.type_folder +
// "/" +
// item.fileInfo.file.uuid;
// window.open(path_srt);
window.open(`api/rest/file/pdf/DocumentPDF?objectName=${item.fileInfo.file.uuid}`); window.open(`api/rest/file/pdf/DocumentPDF?objectName=${item.fileInfo.file.uuid}`);
} else {
return post("api/rest/file/path?bucket=Document&filename=" + item.fileInfo.file.uuid);
}
}).then(res => {
if (res) {
window.open(`./onlyoffice.html?url=${encodeURIComponent(res)}&fileType=${item.fileInfo.file.type}&filename=${item.fileInfo.name}`);
}
}).catch(err => {
this.$message("预览失败");
});
}, },
//table数据下载 //table数据下载
handleDownload(index, row) { handleDownload(index, row) {
......
...@@ -561,7 +561,7 @@ export default { ...@@ -561,7 +561,7 @@ export default {
data.list.forEach((item, index) => { data.list.forEach((item, index) => {
data.list[index].create_time = new Date( data.list[index].create_time = new Date(
data.list[index].create_time data.list[index].create_time
).Format("yyyy-MM-dd HH:mm:ss"); ).Format("yyyy-MM-dd hh:mm:ss");
}); });
_this.get_files = data.list; _this.get_files = data.list;
_this.totals_qw = data.totals; _this.totals_qw = data.totals;
...@@ -615,10 +615,6 @@ export default { ...@@ -615,10 +615,6 @@ export default {
document.getElementById("sound_id").currentTime = 0; document.getElementById("sound_id").currentTime = 0;
}, 500); }, 500);
} else { } else {
// let path_srt =
// "api/rest/document/pdf/" + _this.type_folder + "/" + row.file.uuid;
// window.open(path_srt);
// window.open(`api/rest/file/pdf/DocumentPDF?objectName=${row.file.uuid}`);
get(`api/rest/file/exists?bucket=DocumentPDF&filename=${row.file.uuid}`).then(res => { get(`api/rest/file/exists?bucket=DocumentPDF&filename=${row.file.uuid}`).then(res => {
if (res) { if (res) {
...@@ -637,13 +633,19 @@ export default { ...@@ -637,13 +633,19 @@ export default {
}, },
//table_全文搜索预览 //table_全文搜索预览
handleView_qwss(item) { handleView_qwss(item) {
// let path_srt = get(`api/rest/file/exists?bucket=DocumentPDF&filename=${item.fileInfo.file.uuid}`).then(res => {
// "api/rest/document/pdf/" + if (res) {
// this.type_folder +
// "/" +
// item.fileInfo.file.uuid;
// window.open(path_srt);
window.open(`api/rest/file/pdf/DocumentPDF?objectName=${item.fileInfo.file.uuid}`); window.open(`api/rest/file/pdf/DocumentPDF?objectName=${item.fileInfo.file.uuid}`);
} else {
return post("api/rest/file/path?bucket=Document&filename=" + item.fileInfo.file.uuid);
}
}).then(res => {
if (res) {
window.open(`./onlyoffice.html?url=${encodeURIComponent(res)}&fileType=${item.fileInfo.file.type}&filename=${item.fileInfo.name}`);
}
}).catch(err => {
this.$message("预览失败");
});
}, },
//table数据下载 //table数据下载
handleDownload(index, row) { handleDownload(index, row) {
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="file.type" label="文档类型" width="110"> <el-table-column prop="file.type" label="文档类型" width="110">
</el-table-column> </el-table-column>
<el-table-column prop="cz" label="操作" width="150" show-overflow-tooltip> <el-table-column prop="cz" label="操作" width="200" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-view" @click="handleView(scope.$index, scope.row)" <i class="el-icon-view" @click="handleView(scope.$index, scope.row)"
title="预览"></i>&nbsp; title="预览"></i>&nbsp;
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
>&nbsp; --> >&nbsp; -->
<i class="el-icon-edit" @click="handleEdit(scope.$index, scope.row)" <i class="el-icon-edit" @click="handleEdit(scope.$index, scope.row)"
title="编辑"></i>&nbsp; title="编辑"></i>&nbsp;
<!-- <i class="el-icon-delete-solid" @click="handleOpen(scope.$index, scope.row)"
title="打开软件" v-if="fl_type===2"></i>&nbsp; -->
<div class="ht-div" @click="handleOpen(scope.$index, scope.row)" v-if="fl_type===2" title="打开软件"></div>
<i class="el-icon-delete-solid" @click="handleDelete(scope.$index, scope.row)" <i class="el-icon-delete-solid" @click="handleDelete(scope.$index, scope.row)"
title="删除"></i> title="删除"></i>
</template> </template>
...@@ -166,7 +169,7 @@ ...@@ -166,7 +169,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="file.type" label="文档类型" width="110"> <el-table-column prop="file.type" label="文档类型" width="110">
</el-table-column> </el-table-column>
<el-table-column prop="cz" label="操作" width="150" show-overflow-tooltip> <el-table-column prop="cz" label="操作" width="200" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<i class="el-icon-view" @click="handleView(scope.$index, scope.row)" <i class="el-icon-view" @click="handleView(scope.$index, scope.row)"
title="预览"></i>&nbsp; title="预览"></i>&nbsp;
...@@ -178,6 +181,10 @@ ...@@ -178,6 +181,10 @@
>&nbsp; --> >&nbsp; -->
<i class="el-icon-edit" @click="handleEdit(scope.$index, scope.row)" <i class="el-icon-edit" @click="handleEdit(scope.$index, scope.row)"
title="编辑"></i>&nbsp; title="编辑"></i>&nbsp;
<!-- <i class="el-icon-delete-solid" @click="handleOpen(scope.$index, scope.row)"
title="打开软件" v-if="fl_type===2"></i>&nbsp; -->
<div class="ht-div" @click="handleOpen(scope.$index, scope.row)" v-if="fl_type===2" title="打开软件"></div>
<i class="el-icon-delete-solid" @click="handleDelete(scope.$index, scope.row)" <i class="el-icon-delete-solid" @click="handleDelete(scope.$index, scope.row)"
title="删除"></i> title="删除"></i>
</template> </template>
...@@ -488,7 +495,7 @@ export default { ...@@ -488,7 +495,7 @@ export default {
data.list.forEach((item, index) => { data.list.forEach((item, index) => {
data.list[index].create_time = new Date( data.list[index].create_time = new Date(
data.list[index].create_time data.list[index].create_time
).Format("yyyy-MM-dd HH:mm:ss"); ).Format("yyyy-MM-dd hh:mm:ss");
}); });
_this.get_files = data.list; _this.get_files = data.list;
_this.totals_qw = data.totals; _this.totals_qw = data.totals;
...@@ -589,6 +596,39 @@ export default { ...@@ -589,6 +596,39 @@ export default {
item.fileInfo.file.uuid; item.fileInfo.file.uuid;
download(path_srt, item.fileInfo.file.name); download(path_srt, item.fileInfo.file.name);
}, },
//打开软件
handleOpen(index,row){
let _this = this;
//用户判断此格式是否是视频格式
let video_type = false;
//用户判断此格式是否是音频格式
let sound_type = false;
arr_video_format().forEach((name) => {
if (name.toUpperCase() == row.file.type.toUpperCase()) {
video_type = true;
}
});
arr_sound_format().forEach((name) => {
if (name.toUpperCase() == row.file.type.toUpperCase()) {
sound_type = true;
}
});
if(video_type||sound_type){
window.protocolCheck('UHD://',(fail) =>{
// 安装则直接打开
console.log(1111);
},(succ) => {
// 安装则直接打开
console.log('succ', succ)
}
)
}else{
_this.$message({
type: "warning",
message: "当前文件格式不支持本地软件操作",
});
}
},
//table数据编辑弹出框展示 //table数据编辑弹出框展示
handleEdit(index, row) { handleEdit(index, row) {
let _this = this; let _this = this;
...@@ -1136,7 +1176,15 @@ export default { ...@@ -1136,7 +1176,15 @@ export default {
.table-div { .table-div {
width: 100%; width: 100%;
height: calc(100% - 50px); height: calc(100% - 50px);
.ht-div{
width: 26px;
height: 21px;
background-image: url(../../assets/img/setting/ht1.png);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-right: 9px;
float: left;
}
.el-table tr { .el-table tr {
background-color: transparent !important; background-color: transparent !important;
color: #ffffffc7; color: #ffffffc7;
......
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.protocolCheck = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function _registerEvent(target, eventType, cb) {
if (target.addEventListener) {
target.addEventListener(eventType, cb);
return {
remove: function () {
target.removeEventListener(eventType, cb);
}
};
} else {
target.attachEvent(eventType, cb);
return {
remove: function () {
target.detachEvent(eventType, cb);
}
};
}
}
function _createHiddenIframe(target, uri) {
var iframe = document.createElement("iframe");
iframe.src = uri;
iframe.id = "hiddenIframe";
iframe.style.display = "none";
target.appendChild(iframe);
return iframe;
}
function openUriWithHiddenFrame(uri, failCb, successCb) {
var timeout = setTimeout(function () {
failCb();
handler.remove();
}, 1000);
var iframe = document.querySelector("#hiddenIframe");
if (!iframe) {
iframe = _createHiddenIframe(document.body, "about:blank");
}
var handler = _registerEvent(window, "blur", onBlur);
function onBlur() {
clearTimeout(timeout);
handler.remove();
successCb();
}
iframe.contentWindow.location.href = uri;
}
function openUriWithTimeoutHack(uri, failCb, successCb) {
var timeout = setTimeout(function () {
failCb();
handler.remove();
}, 1000);
//handle page running in an iframe (blur must be registered with top level window)
var target = window;
while (target != target.parent) {
target = target.parent;
}
var handler = _registerEvent(target, "blur", onBlur);
function onBlur() {
clearTimeout(timeout);
handler.remove();
successCb();
}
window.location = uri;
}
function openUriUsingFirefox(uri, failCb, successCb) {
var iframe = document.querySelector("#hiddenIframe");
if (!iframe) {
iframe = _createHiddenIframe(document.body, "about:blank");
}
try {
iframe.contentWindow.location.href = uri;
successCb();
} catch (e) {
if (e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {
failCb();
}
}
}
function openUriUsingIEInOlderWindows(uri, failCb, successCb) {
if (getInternetExplorerVersion() === 10) {
openUriUsingIE10InWindows7(uri, failCb, successCb);
} else if (getInternetExplorerVersion() === 9 || getInternetExplorerVersion() === 11) {
openUriWithHiddenFrame(uri, failCb, successCb);
} else {
openUriInNewWindowHack(uri, failCb, successCb);
}
}
function openUriUsingIE10InWindows7(uri, failCb, successCb) {
var timeout = setTimeout(failCb, 1000);
window.addEventListener("blur", function () {
clearTimeout(timeout);
successCb();
});
var iframe = document.querySelector("#hiddenIframe");
if (!iframe) {
iframe = _createHiddenIframe(document.body, "about:blank");
}
try {
iframe.contentWindow.location.href = uri;
} catch (e) {
failCb();
clearTimeout(timeout);
}
}
function openUriInNewWindowHack(uri, failCb, successCb) {
var myWindow = window.open('', '', 'width=0,height=0');
myWindow.document.write("<iframe src='" + uri + "'></iframe>");
setTimeout(function () {
try {
myWindow.location.href;
myWindow.setTimeout("window.close()", 1000);
successCb();
} catch (e) {
myWindow.close();
failCb();
}
}, 1000);
}
function openUriWithMsLaunchUri(uri, failCb, successCb) {
navigator.msLaunchUri(uri,
successCb,
failCb
);
}
function checkBrowser() {
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var ua = navigator.userAgent.toLowerCase();
return {
isOpera : isOpera,
isFirefox : typeof InstallTrigger !== 'undefined',
isSafari : (~ua.indexOf('safari') && !~ua.indexOf('chrome')) || Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0,
isIOS : /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
isChrome : !!window.chrome && !isOpera,
isIE : /*@cc_on!@*/false || !!document.documentMode // At least IE6
}
}
function getInternetExplorerVersion() {
var rv = -1;
if (navigator.appName === "Microsoft Internet Explorer") {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat(RegExp.$1);
}
else if (navigator.appName === "Netscape") {
var ua = navigator.userAgent;
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
rv = parseFloat(RegExp.$1);
}
}
return rv;
}
module.exports = function(uri, failCb, successCb, unsupportedCb) {
function failCallback() {
failCb && failCb();
}
function successCallback() {
successCb && successCb();
}
if (navigator.msLaunchUri) { //for IE and Edge in Win 8 and Win 10
openUriWithMsLaunchUri(uri, failCb, successCb);
} else {
var browser = checkBrowser();
if (browser.isFirefox) {
openUriUsingFirefox(uri, failCallback, successCallback);
} else if (browser.isChrome || browser.isIOS) {
openUriWithTimeoutHack(uri, failCallback, successCallback);
} else if (browser.isIE) {
openUriUsingIEInOlderWindows(uri, failCallback, successCallback);
} else if (browser.isSafari) {
openUriWithHiddenFrame(uri, failCallback, successCallback);
} else {
unsupportedCb();
//not supported, implement please
}
}
}
},{}]},{},[1])(1)
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment