Commit 4abf166f by liyuhang19990520

聊天记录导出

parent d325d5f4
...@@ -13001,9 +13001,9 @@ ...@@ -13001,9 +13001,9 @@
"dev": true "dev": true
}, },
"tar": { "tar": {
"version": "6.1.10", "version": "6.1.11",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.10.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
"integrity": "sha512-kvvfiVvjGMxeUNB6MyYv5z7vhfFRwbwCXJAeL0/lnbrttBVqcMOnpHUf0X42LrPMR8mMpgapkJMchFH4FSHzNA==", "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
"dev": true, "dev": true,
"requires": { "requires": {
"chownr": "^2.0.0", "chownr": "^2.0.0",
......
...@@ -206,6 +206,9 @@ ...@@ -206,6 +206,9 @@
class="history-message" class="history-message"
width="60%" width="60%"
> >
<Button type="warning" class="export" @click="exportEvent"
>导出聊天记录</Button
>
<history-message <history-message
:showHistory="showHistory" :showHistory="showHistory"
:chat="chat" :chat="chat"
...@@ -368,7 +371,35 @@ export default { ...@@ -368,7 +371,35 @@ export default {
}); });
console.log(user); console.log(user);
}, },
exportEvent() {
RequestUtils.request(conf.getExportUrl())
.then((json) => {
if (json.code == 200) {
let str = "D:/temp";
let fileUrl = json.data.fileUrl.replace(/\\/g, "/");
let url =
"https://" +
localStorage.getItem("host") +
":" +
conf.http_port +
fileUrl.slice(str.length);
// 组装a标签
let elink = document.createElement("a");
// 设置下载文件名
elink.download = '聊天记录.xls';
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
} else if (json.code == 201) {
this.$Message.error("操作失败");
}
})
.catch((err) => {
console.error(err);
});
},
approver() { approver() {
this.groupPersonBoo = true; this.groupPersonBoo = true;
this.getApplyList(); this.getApplyList();
...@@ -907,7 +938,10 @@ export default { ...@@ -907,7 +938,10 @@ export default {
width: 100%; width: 100%;
margin: 0.5rem; margin: 0.5rem;
} }
.export {
margin-left: 10px;
margin-top: 10px;
}
.ivu-drawer-body { .ivu-drawer-body {
padding: 0 !important; padding: 0 !important;
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-08-20 16:31:17 * @Date: 2021-08-20 16:31:17
* @LastEditTime: 2021-08-25 14:42:06 * @LastEditTime: 2021-08-27 15:34:23
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \V-IM-PC\src\views\im\conf\index.js * @FilePath: \V-IM-PC\src\views\im\conf\index.js
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
export default { export default {
app_name: "V-IM", app_name: "V-IM",
http_protocol: "http", http_protocol: "http",
http_port: 8084, http_port: 8082,
ws_port: 9326, ws_port: 9326,
init: "/api/user/init", init: "/api/user/init",
his_url: "/api/message/list", his_url: "/api/message/list",
...@@ -25,6 +25,7 @@ export default { ...@@ -25,6 +25,7 @@ export default {
chatGroupUserDsh_url: '/api/chatGroupUser/dsh', chatGroupUserDsh_url: '/api/chatGroupUser/dsh',
chatGroupUserAgree_url: '/api/chatGroupUser/agree', chatGroupUserAgree_url: '/api/chatGroupUser/agree',
chatGroupDelUser_url: '/api/chatGroupUser/delete', chatGroupDelUser_url: '/api/chatGroupUser/delete',
export_url: '/api/message/export',
ws_protocol: "ws", ws_protocol: "ws",
getHostUrl: function() { getHostUrl: function() {
return ( return (
...@@ -80,6 +81,9 @@ export default { ...@@ -80,6 +81,9 @@ export default {
getChatGroupUserAgreeUrl: function() { getChatGroupUserAgreeUrl: function() {
return this.getHostUrl() + this.chatGroupUserAgree_url; return this.getHostUrl() + this.chatGroupUserAgree_url;
}, },
getExportUrl: function() {
return this.getHostUrl() + this.export_url;
},
getWsUrl: function() { getWsUrl: function() {
return ( return (
this.ws_protocol + this.ws_protocol +
......
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