Commit fa5b4a85 authored by 华国豪's avatar 华国豪 🙄

优化收藏, 收藏下载

parent 9d0c39a9
...@@ -43,6 +43,7 @@ export default { ...@@ -43,6 +43,7 @@ export default {
.CollectionContentList p{ .CollectionContentList p{
margin: 0; margin: 0;
padding: 0; padding: 0;
outline: none;
} }
.CollectionContentList ul li{ .CollectionContentList ul li{
...@@ -65,7 +66,6 @@ export default { ...@@ -65,7 +66,6 @@ export default {
} }
.CollectionContentList .item .images img{ .CollectionContentList .item .images img{
width: 120px; width: 120px;
height: 60px;
} }
.CollectionContentList .from-date p{ .CollectionContentList .from-date p{
text-align: right; text-align: right;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<li v-contextmenu:msg-contextmenu @click="preview"> <li v-contextmenu:msg-contextmenu @click="preview">
<v-contextmenu ref="msg-contextmenu"> <v-contextmenu ref="msg-contextmenu">
<v-contextmenu-item @click="forwardMsg">转发</v-contextmenu-item> <v-contextmenu-item @click="forwardMsg">转发</v-contextmenu-item>
<v-contextmenu-item v-if="item.CollectionType !== 3 && item.CollectionType !== 1" @click="downloadFile">另存为</v-contextmenu-item>
<v-contextmenu-item @click="deleteCollection(item.ID)">删除</v-contextmenu-item> <v-contextmenu-item @click="deleteCollection(item.ID)">删除</v-contextmenu-item>
</v-contextmenu> </v-contextmenu>
<el-row class="item" :gutter="30"> <el-row class="item" :gutter="30">
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="8" class="from-date"> <el-col :span="8" class="from-date">
<!-- <p>今天</p> --> <p>{{item.CreateTime}}</p>
<p class="text-row1">来自:{{item.FromUser}}</p> <p class="text-row1">来自:{{item.FromUser}}</p>
</el-col> </el-col>
<video v-if="url!==''" id="video" :src="url" controls="controls" ></video> <video v-if="url!==''" id="video" :src="url" controls="controls" ></video>
...@@ -68,6 +69,7 @@ export default { ...@@ -68,6 +69,7 @@ export default {
this.setData() this.setData()
}, },
methods: { methods: {
// 渲染
setData: function (){ setData: function (){
if (this.item.CollectionType === 2) { if (this.item.CollectionType === 2) {
let url = this.item.PicURL let url = this.item.PicURL
...@@ -97,6 +99,82 @@ export default { ...@@ -97,6 +99,82 @@ export default {
}) })
} }
}, },
// 下载文件
downloadFile: function (){
event.preventDefault();
let data = this.item
let file = JSON.parse(this.item.FromContent)
console.log("file", file, data.PicURL, data.Content)
let crt = this;
this.$electron.remote.dialog.showSaveDialog(
{
title: "麦子助手另存文件",
defaultPath:
this.$electron.remote.getGlobal("defaultdownloaddir") +
file.file.name,
filters: [{ name: "麦子助手文件", extensions: [file.file.ext] }]
},
function(res) {
console.log(res)
if (res) {
crt.beginDownload(res);
}
}
);
},
beginDownload(res) {
this.isDownloading = true;
let file = JSON.parse(this.item.FromContent)
let key = file.file.md5
let name = res.substring(res.lastIndexOf("\\") + 1, res.length);
this.$electron.ipcRenderer.send(
"download",
file.file.url,
res.substring(0, res.lastIndexOf("\\")),
name,
key
);
let that = this;
this.$electron.ipcRenderer.on("downloading", (event, progess) => {
that.progess = progess;
});
this.$electron.ipcRenderer.once("downloadOver", (event, msgId, lpath) => {
//that.progess=-1
setTimeout(() => {
that.progess = -1;
}, 1000);
this.$electron.ipcRenderer.removeListener(
"downloading",
(event, progess) => {
that.progess = progess;
}
);
let downloadFileList = [];
that.isDownloading = false;
let newDownLoad = { msgID: msgId, locationPath: lpath };
if (window.localStorage.downloadFileList) {
downloadFileList = JSON.parse(window.localStorage.downloadFileList);
let isUpdate = false;
downloadFileList.forEach((item, index) => {
if (item.msgID === msgId) {
item.locationPath = lpath;
isUpdate = true;
}
});
if (!isUpdate) {
downloadFileList.push(newDownLoad);
}
} else {
downloadFileList.push(newDownLoad);
}
window.localStorage.downloadFileList = JSON.stringify(downloadFileList);
that.msg.locationPath = lpath;
that.msg.locationFolder = lpath.substring(
0,
lpath.lastIndexOf("\\") + 1
);
});
},
// 转发 // 转发
forwardMsg: function(){ forwardMsg: function(){
let msg = JSON.parse(this.item.FromContent) let msg = JSON.parse(this.item.FromContent)
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
} }
.CollectionSearchBox .type-box li div i.iconfont{ .CollectionSearchBox .type-box li div i.iconfont{
color: #555; color: #555;
font-size: 20px; font-size: 24px;
padding-right: 15px; padding-right: 15px;
} }
.CollectionSearchBox .type-box li div span{ .CollectionSearchBox .type-box li div span{
......
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