feat:前端判断是否开启游客上传
This commit is contained in:
@@ -41,6 +41,17 @@ const handleOnChangeFileList = (file: any) => {
|
||||
const handleHttpRequest = (options: any) => {
|
||||
fileBoxStore.showFileBox = true;
|
||||
const formData = new FormData();
|
||||
if (config.openUpload === 0 || localStorage.getItem('adminPassword') === null) {
|
||||
fileStore.shareData.forEach((file: any) => {
|
||||
if (file.uid === options.file.uid) {
|
||||
ElMessage.error(t('msg.uploadClose'));
|
||||
file.status = 'fail';
|
||||
file.code = t('msg.fileUploadFail');
|
||||
fileStore.save();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (options.file.size > config.uploadSize) {
|
||||
fileStore.shareData.forEach((file: any) => {
|
||||
if (file.uid === options.file.uid) {
|
||||
|
||||
@@ -7,8 +7,10 @@ import { useFileBoxStore } from "@/stores/fileBox";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useConfigStore } from "@/stores/config";
|
||||
|
||||
const { t } = useI18n()
|
||||
const {config} = useConfigStore();
|
||||
const fileBoxStore = useFileBoxStore();
|
||||
const fileStore = useFileDataStore();
|
||||
const props = defineProps({
|
||||
@@ -25,6 +27,8 @@ const props = defineProps({
|
||||
const handleSubmitShareText = ()=>{
|
||||
if (shareText.value === '') {
|
||||
ElMessage.warning(t('send.prompt3'));
|
||||
} else if(config.openUpload === 0 && localStorage.getItem('adminPassword') === null){
|
||||
ElMessage.error(t('msg.uploadClose'));
|
||||
} else {
|
||||
const formData = new FormData();
|
||||
formData.append('text', shareText.value);
|
||||
|
||||
@@ -118,5 +118,6 @@ export default {
|
||||
fileOverSize: '文件过大',
|
||||
fileUploadFail: '上传失败',
|
||||
fileUploadSuccess: '上传成功',
|
||||
uploadClose: '本站已关闭游客上传',
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user