This commit is contained in:
gyj
2024-05-16 16:11:03 +08:00
7 changed files with 155 additions and 14 deletions
+1
View File
@@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<script src="http://121.40.189.20:8899/web-apps/apps/api/documents/api.js"></script>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style> <style>
html, html,
+20
View File
@@ -0,0 +1,20 @@
import request from '@/utils/request'
// 获取onlyoffice配置文件
export function getOnlyoffice(params) {
return request({
url: '/onlyOffice',
// headers: {
// isToken: false
// },
method: 'get',
params: params
})
}
// 保存onlyoffice文档
export function saveOnlyOfficeFile(data) {
return request({
url: '/caseApplication/saveOnlyOfficeFile',
method: 'post',
data: data
})
}
+5
View File
@@ -61,6 +61,11 @@ export const constantRoutes = [
component: () => import('@/views/error/401'), component: () => import('@/views/error/401'),
hidden: true hidden: true
}, },
{
path: '/onlyoffice',
component: () => import('@/views/onlyoffice/onlyoffice'),
hidden: true
},
{ {
path: '', path: '',
component: Layout, component: Layout,
+1
View File
@@ -15,5 +15,6 @@ const getters = {
topbarRouters:state => state.permission.topbarRouters, topbarRouters:state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes, defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters, sidebarRouters:state => state.permission.sidebarRouters,
userId:state => state.user.userId,
} }
export default getters export default getters
+4
View File
@@ -11,6 +11,9 @@ const user = {
}, },
mutations: { mutations: {
SET_USERID:(state,userId) => {
state.userId = userId
},
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
state.token = token state.token = token
}, },
@@ -60,6 +63,7 @@ const user = {
} }
commit('SET_NAME', user.userName) commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_USERID',user.userId)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
@@ -157,7 +157,7 @@
<el-form-item label="裁决书:"> <el-form-item label="裁决书:">
<div v-if="awardArr.length == 0">裁决书暂未提供!</div> <div v-if="awardArr.length == 0">裁决书暂未提供!</div>
<div v-for="(item, index) in awardArr" :key="index"> <div v-for="(item, index) in awardArr" :key="index">
<a href="#" @click="awardToFile(item, index)" style="color: blue"> <a href="#" @click="awardToFile(item.onlyOfficeFileId)" style="color: blue">
{{ item.annexName }} {{ item.annexName }}
</a> </a>
</div> </div>
@@ -549,10 +549,7 @@ export default {
} }
//裁决书附件 //裁决书附件
if (item.annexType == 3) { if (item.annexType == 3) {
this.awardArr.push({ this.awardArr.push(item);
annexName: item.annexName,
annexPath: item.annexPath,
});
} }
}); });
} }
@@ -585,11 +582,17 @@ export default {
); );
}, },
//裁决书文件 //裁决书文件
awardToFile(item, index) { awardToFile(item) {
window.open( console.log(item,"LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
window.location.origin + "/API" + this.awardArr[index].annexPath, // window.open(
"_black" // window.location.origin + "/API" + this.awardArr[index].annexPath,
); // "_black"
// );
if (this.checkPermi(['caseManagement:list:editOffice'])) {
this.$router.push({ path: '/onlyoffice', query: { id: item, flag: 1 } })
} else {
this.$router.push({ path: '/onlyoffice', query: { id: item, flag: 0 } })
}
}, },
// 庭审笔录附件 // 庭审笔录附件
toFile2(item, index) { toFile2(item, index) {
@@ -670,10 +673,7 @@ export default {
this.adjudicatename.caseAttachList = res.data.caseAttachList; this.adjudicatename.caseAttachList = res.data.caseAttachList;
this.adjudicatename.caseAttachList.forEach(item=>{ this.adjudicatename.caseAttachList.forEach(item=>{
if(item.annexType==3){ if(item.annexType==3){
this.awardArr.push({ this.awardArr.push(item);
annexName: item.annexName,
annexPath: item.annexPath,
});
} }
}) })
+110
View File
@@ -0,0 +1,110 @@
<template>
<div style="width: 100%; height: 100%">
<div id="placeholder"></div>
</div>
</template>
<script>
import { getOnlyoffice, saveOnlyOfficeFile } from "@/api/onlyoffice/onlyoffice";
import { setToken } from "@/utils/auth";
import store from "@/store";
import axios from "axios";
export default {
props: [],
data() {
return {
config: {},
flag: 0,
userId: store.getters.userId,
websock: null,
};
},
destroyed() {
//页面销毁时关闭ws连接
if (this.websock) {
this.websock.close(); // 关闭websocket
}
},
methods: {
getConfig(id) {
let edit = "edit";
if (this.flag == 0) {
edit = "view";
} else {
edit = "edit";
}
axios
.get(
`http://121.40.189.20:9090/onlyOfficeConfig/${edit}/${id}/${this.userId}/desktop/true/zhongcai`
)
.then((res) => {
this.config = res.data;
this.config.editorConfig.callbackUrl = this.config.editorConfig.callbackUrl + "/" + id;
console.log(this.config,"OOOOOOOOOOOOOOOOOOOOOOOOOOO");
// this.config.callbackUrl = this.config.callbackUrl + `/${this.userId}`;
var docEditor = new DocsAPI.DocEditor("placeholder", this.config);
});
},
//初始化weosocket
initWebSocket() {
if (typeof WebSocket === "undefined") {
alert("您的浏览器不支持WebSocket");
return false;
}
const wsuri = `ws://121.40.189.20:9090/api/websocket/${this.userId}`; // websocket地址
this.websock = new WebSocket(wsuri);
this.websock.onopen = this.websocketonopen;
this.websock.onmessage = this.websocketonmessage;
this.websock.onerror = this.websocketonerror;
this.websock.onclose = this.websocketclose;
},
//连接成功
websocketonopen() {
console.log("WebSocket连接成功");
},
//接收后端返回的数据
websocketonmessage(e) {
let dataJson = e.data;
if (dataJson != "conn_success") {
dataJson = JSON.parse(dataJson);
}
if (dataJson.caseId) {
saveOnlyOfficeFile({
caseAppliId: Number(dataJson.caseId),
annexName: dataJson.fileName,
annexPath: dataJson.filePath,
onlyOfficeFileId: dataJson.fileId,
}).then((res) => {
this.websock.send();
});
}
// 在这里使用后端返回的数据,对数据进行处理渲染
},
//连接建立失败重连
websocketonerror(e) {
console.log(`连接失败的信息:`, e);
this.initWebSocket(); // 连接失败后尝试重新连接
},
//关闭连接
websocketclose(e) {
console.log("断开连接", e);
},
/**是否从视频会议跳转,是处理token */
async getToken() {
setToken(this.$route.query.token);
},
},
async mounted() {
if (this.$route.query.token) {
await this.getToken();
}
let id = this.$route.query.id;
this.flag = this.$route.query.flag;
this.getConfig(id);
this.initWebSocket();
},
watch: {},
};
</script>
<style lang="scss" scoped></style>