完善提示

dev
truthhun 1 year ago
parent 8801a048e9
commit e127617b16

@ -648,7 +648,7 @@ func (m *DBModel) initConfig() (err error) {
{Category: ConfigCategoryCaptcha, Name: ConfigCaptchaType, Label: "验证码类型", Value: "digit", Placeholder: "请选择验证码类型,默认为数字", InputType: "select", Sort: 16, Options: captcha.CaptchaTypeOptions},
// 安全配置项
{Category: ConfigCategorySecurity, Name: ConfigSecurityMaxDocumentSize, Label: "最大文档大小(MB)", Value: "50", Placeholder: "允许用户上传的最大文档大小默认为50即50MB", InputType: "number", Sort: 1, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityMaxDocumentSize, Label: "最大文档大小(MB)", Value: "50", Placeholder: "允许用户上传的最大文档大小默认为50即50MB。配置时仍需注意NGINX等反向代理服务所允许传输的最大大小", InputType: "number", Sort: 1, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityCommentInterval, Label: "评论时间间隔", Value: "10", Placeholder: "用户评论时间间隔单位为秒。0表示不限制。", InputType: "number", Sort: 2, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityDocumentRelatedDuration, Label: "文档的【相关文档】有效期", Value: "7", Placeholder: "文档的相关联文档的有效期默认为7即7天0或小于0表示不开启相关文档功能", InputType: "number", Sort: 15, Options: ""},
{Category: ConfigCategorySecurity, Name: ConfigSecurityDocumentAllowedExt, Label: "允许上传的文档类型", Value: "", Placeholder: "留空表示允许程序所支持的全部文档类型", InputType: "select-multi", Sort: 3, Options: strings.Join(filetil.GetDocumentExts(), "\n")},

@ -356,6 +356,20 @@ export default {
handleChange(file) {
const name = file.name.toLowerCase()
const ext = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (!this.allowExt.includes(ext)) {
this.$message.warning(`${file.name} 不支持的文件格式,忽略该文件`)
return
}
if (file.size > this.maxDocumentSize) {
this.$message.warning(
`${file.name} 文件大小${formatBytes(
file.size
)} 超过限制最大${formatBytes(this.maxDocumentSize)}忽略该文件`
)
return
}
//
if (
!this.filesMap[name] &&

Loading…
Cancel
Save