徐景良 2024-07-13 09:43:19 +08:00
commit 783f7c1123
7 changed files with 125 additions and 64 deletions

View File

@ -68,6 +68,7 @@ export function fun_Upload(
{
url: apiUrl + Api.Post_Upload,
onUploadProgress,
timeout: 300000,
},
params,
);

View File

@ -9,5 +9,7 @@ export enum PageEnum {
ERROR_LOG_PAGE = '/error-log/list',
// 专题
SUBJECT_HOME = '/subject',
// 欢迎登陆
WELCOME_HOME = '/welcome',
}
export const PageWrapperFixedHeightKey = 'PageWrapperFixedHeight';

View File

@ -28,12 +28,12 @@
<a-select-option :value="false">停用</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="是否开放" name="isDevelop">
<a-switch
v-model:checked="modalData.isDevelop"
checked-children="开放"
un-checked-children="不开放"
/>
<a-form-item label="是否开放" name="isDevelop">
<a-switch
v-model:checked="modalData.isDevelop"
checked-children="开放"
un-checked-children="不开放"
/>
</a-form-item>
<a-form-item label="流程分类" name="category">
<a-select
@ -49,10 +49,10 @@
un-checked-children="否"
/>
</a-form-item>
<a-form-item label="外部链接" name="linkOrApi" v-if="modalData.isExternal" :required="modalData.isDevelop">
<a-form-item label="外部链接" name="linkOrApi" v-if="modalData.isExternal">
<a-input v-model:value="modalData.linkOrApi" />
</a-form-item>
<a-form-item label="跳转首页" name="linkOrApi" v-if="!modalData.isExternal" :required="modalData.isDevelop">
<a-form-item label="跳转首页" name="linkOrApi" v-if="!modalData.isExternal">
<a-input v-model:value="modalData.linkOrApi" />
</a-form-item>
<a-form-item label="排序号" name="sort">

View File

@ -20,7 +20,7 @@
</span>
</a-form-item>
<a-form-item label="版本号">
<a-input v-model:value="currentAppForm.edition" />
<a-input-number v-model:value="currentAppForm.edition" />
</a-form-item>
<a-form-item label="项目名称">
<a-input
@ -29,18 +29,21 @@
/>
</a-form-item>
<a-form-item label="上传">
<span style="display: flex">
<BasicUpload
v-model:file-list="fileList"
:maxSize="100"
:maxNumber="10"
:showUploadList="false"
:beforeUpload="beforeUpload"
:api="uploadApi"
/>
{{ fileName }}
<DeleteOutlined v-if="fileName != ''" @click="deleteFileName" />
</span>
<a-upload
v-model:file-list="fileList"
:name="name"
:multiple="true"
:customRequest="handleCustomRequest"
:headers="headers"
:progress="progress"
:beforeUpload="beforeUpload"
@change="handleChange"
@drop="handleDrop"
>
<a-button :loading="loading"> 点击上传 </a-button>
</a-upload>
{{ fileName }}
<DeleteOutlined v-if="fileName != ''" @click="deleteFileName" />
</a-form-item>
<a-form-item label="描述信息">
<a-textarea
@ -82,24 +85,27 @@
</span>
</a-form-item>
<a-form-item label="版本号">
<a-input v-model:value="fly_currentAppForm.edition" />
<a-input-number v-model:value="fly_currentAppForm.edition" />
</a-form-item>
<a-form-item label="项目名称">
<a-input v-model:value="fly_currentAppForm.project_name" />
</a-form-item>
<a-form-item label="上传">
<span style="display: flex">
<BasicUpload
v-model:file-list="fly_fileList"
:maxSize="100"
:maxNumber="10"
:showUploadList="false"
:beforeUpload="beforeUpload"
:api="uploadApi"
/>
{{ fly_fileName }}
<DeleteOutlined v-if="fly_fileName != ''" @click="deleteFileName" />
</span>
<a-upload
v-model:file-list="fly_fileList"
:name="fly_name"
:multiple="true"
:customRequest="handleCustomRequest"
:headers="headers"
:progress="progress"
:beforeUpload="beforeUpload"
@change="handleChange"
@drop="handleDrop"
>
<a-button :loading="fly_loading"> 点击上传 </a-button>
</a-upload>
{{ fly_fileName }}
<DeleteOutlined v-if="fileName != ''" @click="deleteFileName" />
</a-form-item>
<a-form-item label="描述信息">
<a-textarea
@ -132,16 +138,20 @@
// vben
import BasicUpload from './src/BasicUpload.vue';
import { useMessage } from '@/hooks/web/useMessage';
import { DeleteOutlined } from '@ant-design/icons-vue';
import { DeleteOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { message, Upload } from 'ant-design-vue';
import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
import { useGlobSetting } from '@/hooks/setting';
// api
import { fun_GetUpdateFiles, fun_AddAppFiles } from '@/api/demo/version';
import { fun_Load, fun_Upload } from '@/api/demo/files';
const { createMessage } = useMessage();
const { apiUrl } = useGlobSetting();
//
const labelCol = { span: 4 };
const wrapperCol = { span: 20 };
const labelCol = { span: 6 };
const wrapperCol = { span: 18 };
// APP-
let currentAppInfo = ref({});
//
@ -149,6 +159,10 @@
//
let fileList: any = ref([]);
let fly_fileList: any = ref([]);
const loading = ref<boolean>(false);
const fly_loading = ref<boolean>(false);
const name = ref<string>('');
const fly_name = ref<string>('');
//
const fileName = ref('');
const fly_fileName = ref('');
@ -190,36 +204,65 @@
getAppInfo();
//
async function uploadApi(file, progress) {
const handleCustomRequest = (file, progress) => {
if (activeKey.value === 'zhifa') {
const obj: any = await fun_Upload(file, progress);
if (obj.data.result.length > 0) {
fileName.value = obj.data.result[0].fileName;
filePath = obj.data.result[0].filePath;
}
} else {
const obj: any = await fun_Upload(file, progress);
if (obj.data.result.length > 0) {
fly_fileName.value = obj.data.result[0].fileName;
fly_filePath = obj.data.result[0].filePath;
}
fileList.value = [];
fun_Upload(file, progress)
.then((res: any) => {
if (res.data.result.length > 0) {
fileName.value = res.data.result[0].fileName;
filePath = res.data.result[0].filePath;
loading.value = false;
}
})
.catch((err) => {
file.onError(err);
createMessage.error(err.message);
});
} else if (activeKey.value === 'feikong') {
fly_fileList.value = [];
fun_Upload(file, progress)
.then((res: any) => {
if (res.data.result.length > 0) {
fly_fileName.value = res.data.result[0].fileName;
fly_filePath = res.data.result[0].filePath;
fly_loading.value = false;
}
})
.catch((err) => {
file.onError(err);
createMessage.error(err.message);
});
}
}
};
//
function beforeUpload(file) {
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
let extension = file.name.substring(file.name.lastIndexOf('.') + 1);
let size = file.size / 1024 / 1024;
if (extension != 'apk') {
createMessage.warn('只能上传后缀是.apk的文件');
return false;
} else if (size > 100) {
createMessage.warn('文件大小不得超过100M');
return false;
const isApk = extension === 'apk';
const suitableSize = size < 100;
if (activeKey.value === 'zhifa') {
name.value = file.name;
} else {
return true;
fly_name.value = file.name;
}
}
if (!isApk) {
createMessage.error('只能上传后缀是.apk的文件');
}
if (!suitableSize) {
createMessage.error('文件大小不得超过100M');
}
if (isApk && suitableSize) {
if (activeKey.value === 'zhifa') {
loading.value = true;
} else {
fly_loading.value = true;
}
}
return (isApk && suitableSize) || Upload.LIST_IGNORE;
};
//
function deleteFileName() {

View File

@ -249,11 +249,11 @@
order: null,
});
const markTypeOptions = ref([
{ label: '合法', value: 0 },
{ label: '其他', value: 1 },
{ label: '非粮化', value: 2 },
{ label: '拆除复耕', value:3 },
{ label: '补办手续', value: 4 },
{ label: '合法', value: '合法' },
{ label: '其他', value: '其他' },
{ label: '非粮化', value: '非粮化' },
{ label: '拆除复耕', value: '拆除复耕' },
{ label: '补办手续', value: '补办手续' },
]);
const dataList = ref([]);

View File

@ -82,6 +82,7 @@
import Icon from '@/components/Icon/Icon.vue';
import { getAppEnvConfig } from '@/utils/env';
import { useI18n } from '@/hooks/web/useI18n';
import { PageEnum } from '@/enums/pageEnum';
const { VITE_GLOB_API_URL } = getAppEnvConfig();
const VITE_GLOB_API_URL_VAR = ref<String>(VITE_GLOB_API_URL + '/');
@ -146,6 +147,9 @@
if (item.isExternal) {
window.location.href = item.linkOrApi;
} else {
if (!item.linkOrApi) {
item.linkOrApi = PageEnum.WELCOME_HOME;
}
userStore.setSubject(item.id, item.logoTitle, item.linkOrApi);
}
}

View File

@ -106,6 +106,17 @@
icon: netWorkSvg,
});
if (
window.location.pathname == PageEnum.WELCOME_HOME ||
window.location.href.slice(window.location.href.indexOf('#') + 1) == PageEnum.WELCOME_HOME
) {
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, {
title: '欢迎登陆',
subTitle: '欢迎登陆',
icon: netWorkSvg,
});
}
return () => {
const { title, subTitle, btnText, icon, handler, status } = unref(getMapValue) || {};
return (