Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于最后修改时间 #613

Open
ZhangXincun opened this issue Sep 4, 2023 · 2 comments
Open

关于最后修改时间 #613

ZhangXincun opened this issue Sep 4, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ZhangXincun
Copy link

您好,我使用的版本是5.2.2,目前遇到一个需求,就是有些部门上传文件后,希望下载以后仍然保留上传文件时,文件所在电脑的“最后修改时间”。能否给点意见,该如何实现,谢谢

@ZhangXincun ZhangXincun added the bug Something isn't working label Sep 4, 2023
@liuliang-wt
Copy link
Collaborator

这个应该是不好实现,前台写js倒是能获取文件的修改时间,但是不一定准确,即使准确,框架目前的上传并没有获取这个时间,除非你不用框架提供的上传控件,自己重新写上传的逻辑。

@ZhangXincun
Copy link
Author

ZhangXincun commented Sep 4, 2023

我用的是https://github.com/hql7/wl-explorer
分享一下实现:
前端获取编辑时间
let formData = new FormData() // 用FormData存放上传文件 this.fileList.forEach(file => { formData.append('file', file.raw); // 将最后编辑时间添加到FormData let dateTime = this.msToDate(file.raw.lastModifiedDate); formData.append('lastEditTime', dateTime.hasTime); })

后端通过读取lastEditTime获取文件列表的这个时间然后存储文件的时候把时间作为一个字段到数据库里面。下载的时候再去设置这个时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants