diff --git a/build/constant.ts b/build/constant.ts index 9d6ca339..1d033f12 100644 --- a/build/constant.ts +++ b/build/constant.ts @@ -7,7 +7,7 @@ export const prefix = `monaco-editor/esm/vs` // chunk 警告大小 export const chunkSizeWarningLimit = 2000 -// 禁用 brotli 压缩大小报告A +// 禁用 brotliSize 压缩大小报告 export const brotliSize = false // 分包 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 682a81c7..9fa763c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3074,7 +3074,7 @@ packages: source-map: 0.6.1 wordwrap: 1.0.0 optionalDependencies: - uglify-js: 3.16.0 + uglify-js: 3.17.4 dev: true /hard-rejection/2.1.0: @@ -5014,8 +5014,8 @@ packages: hasBin: true dev: true - /uglify-js/3.16.0: - resolution: {integrity: sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw==} + /uglify-js/3.17.4: + resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} engines: {node: '>=0.8.0'} hasBin: true requiresBuild: true diff --git a/src/api/axios.ts b/src/api/axios.ts index 4c218427..55df7798 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -1,4 +1,4 @@ -import axios, { AxiosResponse, AxiosRequestConfig } from 'axios' +import axios, { AxiosResponse, AxiosRequestConfig, Axios } from 'axios' import { ResultEnum, ModuleTypeEnum } from "@/enums/httpEnum" import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum" import { StorageEnum } from '@/enums/storageEnum' @@ -8,10 +8,20 @@ import { redirectErrorPage, getLocalStorage, routerTurnByName, isPreview } from import { fetchAllowList } from './axios.config' import includes from 'lodash/includes' +export interface MyResponseType { + code: ResultEnum + data: T + message: string +} + +export interface MyRequestInstance extends Axios { + (config: AxiosRequestConfig): Promise> +} + const axiosInstance = axios.create({ baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`, timeout: ResultEnum.TIMEOUT, -}) +}) as unknown as MyRequestInstance axiosInstance.interceptors.request.use( (config: AxiosRequestConfig) => { diff --git a/src/api/http.ts b/src/api/http.ts index 534f0c0e..a122d603 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -9,16 +9,16 @@ import { } from '@/enums/httpEnum' import type { RequestGlobalConfigType, RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' -export const get = (url: string, params?: object) => { - return axiosInstance({ +export const get = (url: string, params?: object) => { + return axiosInstance({ url: url, method: RequestHttpEnum.GET, params: params, }) } -export const post = (url: string, data?: object, headersType?: string) => { - return axiosInstance({ +export const post = (url: string, data?: object, headersType?: string) => { + return axiosInstance({ url: url, method: RequestHttpEnum.POST, data: data, @@ -28,8 +28,8 @@ export const post = (url: string, data?: object, headersType?: string) => { }) } -export const patch = (url: string, data?: object, headersType?: string) => { - return axiosInstance({ +export const patch = (url: string, data?: object, headersType?: string) => { + return axiosInstance({ url: url, method: RequestHttpEnum.PATCH, data: data, @@ -39,8 +39,8 @@ export const patch = (url: string, data?: object, headersType?: string) => { }) } -export const put = (url: string, data?: object, headersType?: ContentTypeEnum) => { - return axiosInstance({ +export const put = (url: string, data?: object, headersType?: ContentTypeEnum) => { + return axiosInstance({ url: url, method: RequestHttpEnum.PUT, data: data, @@ -50,8 +50,8 @@ export const put = (url: string, data?: object, headersType?: ContentTypeEnum) = }) } -export const del = (url: string, params?: object) => { - return axiosInstance({ +export const del = (url: string, params?: object) => { + return axiosInstance({ url: url, method: RequestHttpEnum.DELETE, params @@ -82,11 +82,11 @@ export const http = (type?: RequestHttpEnum) => { } const prefix = 'javascript:' // 对输入字符进行转义处理 -export const translateStr = (target: string | object) => { +export const translateStr = (target: string | Record) => { if (typeof target === 'string') { if (target.startsWith(prefix)) { const funcStr = target.split(prefix)[1] - let result; + let result try { result = new Function(`${funcStr}`)() } catch (error) { @@ -100,8 +100,8 @@ export const translateStr = (target: string | object) => { } for (const key in target) { if (Object.prototype.hasOwnProperty.call(target, key)) { - const subTarget = (target as any)[key]; - (target as any)[key] = translateStr(subTarget) + const subTarget = target[key] + target[key] = translateStr(subTarget) } } return target @@ -116,7 +116,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req if (!targetParams || !globalParams) { return } - // 全局 const { // 全局请求源地址 diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts index 42aeaf22..164df1d3 100644 --- a/src/api/path/project.api.ts +++ b/src/api/path/project.api.ts @@ -1,84 +1,98 @@ import { http } from '@/api/http' import { httpErrorHandle } from '@/utils' import { ContentTypeEnum, RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum' +import { ProjectItem, ProjectDetail } from './project' // * 项目列表 export const projectListApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/list`, data); - return res; + try { + const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/list`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 新增项目 export const createProjectApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/create`, data); - return res; + try { + const res = await http(RequestHttpEnum.POST)<{ + /** + * 项目id + */ + id: number + }>(`${ModuleTypeEnum.PROJECT}/create`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 获取项目 export const fetchProjectApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/getData`, data); - return res; + try { + const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/getData`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 保存项目 export const saveProjectApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/save/data`, data, ContentTypeEnum.FORM_URLENCODED); - return res; + try { + const res = await http(RequestHttpEnum.POST)( + `${ModuleTypeEnum.PROJECT}/save/data`, + data, + ContentTypeEnum.FORM_URLENCODED + ) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 修改项目基础信息 export const updateProjectApi = async (data: object) => { try { - const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data); - return res; + const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } - // * 删除项目 export const deleteProjectApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data); - return res; + try { + const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 修改发布状态 [-1未发布,1发布] export const changeProjectReleaseApi = async (data: object) => { - try { - const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data); - return res; + try { + const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } } // * 上传文件 export const uploadFile = async (data: object) => { - try { - const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA); - return res; + try { + const res = await http(RequestHttpEnum.POST)<{ + /** + * 文件地址 + */ + fileName: string + }>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA) + return res } catch { - httpErrorHandle(); + httpErrorHandle() } -} \ No newline at end of file +} diff --git a/src/api/path/project.d.ts b/src/api/path/project.d.ts new file mode 100644 index 00000000..c9e20096 --- /dev/null +++ b/src/api/path/project.d.ts @@ -0,0 +1,39 @@ +export type ProjectItem = { + /** + * 项目 id + */ + id: string + /** + * 项目名称 + */ + projectName: string + /** + * 项目状态:\ + * -1: 未发布\ + * 1: 已发布 + */ + state: number + /** + * 创建时间 + */ + createTime: string + /** + * 预览图片url + */ + indexImage: string + /** + * 创建者 id + */ + createUserId: string + /** + * 项目备注 + */ + remarks: string +} + +export interface ProjectDetail extends ProjectItem { + /** + * 项目参数 + */ + content: string +} \ No newline at end of file diff --git a/src/api/path/system.api.ts b/src/api/path/system.api.ts index 499194c7..6c3412f1 100644 --- a/src/api/path/system.api.ts +++ b/src/api/path/system.api.ts @@ -1,33 +1,39 @@ import { http } from '@/api/http' import { httpErrorHandle } from '@/utils' import { RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum' +import { LoginResult } from './system' // * 登录 export const loginApi = async (data: object) => { try { - const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.SYSTEM}/login`, data); - return res; - } catch(err) { - httpErrorHandle(); + const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.SYSTEM}/login`, data) + return res + } catch (err) { + httpErrorHandle() } } // * 登出 export const logoutApi = async () => { try { - const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`); - return res; - } catch(err) { - httpErrorHandle(); + const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`) + return res + } catch (err) { + httpErrorHandle() } } // * 获取 oss 上传接口 export const ossUrlApi = async (data: object) => { try { - const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data); - return res; - } catch(err) { - httpErrorHandle(); + const res = await http(RequestHttpEnum.GET)<{ + /** + * bucket 地址 + */ + bucketURL?: string + }>(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data) + return res + } catch (err) { + httpErrorHandle() } -} \ No newline at end of file +} diff --git a/src/api/path/system.d.ts b/src/api/path/system.d.ts new file mode 100644 index 00000000..221e404d --- /dev/null +++ b/src/api/path/system.d.ts @@ -0,0 +1,26 @@ +export interface LoginResult { + token: { + /** + * token 值 + */ + tokenValue: string + /** + * token key + */ + tokenName: string + } + userinfo: { + /** + * 昵称 + */ + nickname: string + /** + * 用户名 + */ + username: string + /** + * 用户 id + */ + id: string + } +} diff --git a/src/assets/images/canvas/noData.png b/src/assets/images/canvas/noData.png new file mode 100644 index 00000000..d65bc8ed Binary files /dev/null and b/src/assets/images/canvas/noData.png differ diff --git a/src/components/GoSystemInfo/index.vue b/src/components/GoSystemInfo/index.vue index 5073c8b9..d38c1e03 100644 --- a/src/components/GoSystemInfo/index.vue +++ b/src/components/GoSystemInfo/index.vue @@ -42,15 +42,21 @@ diff --git a/src/packages/components/Decorates/Mores/FlipperNumber/index.ts b/src/packages/components/Decorates/Mores/FlipperNumber/index.ts index 16aa2137..b4fce9cd 100644 --- a/src/packages/components/Decorates/Mores/FlipperNumber/index.ts +++ b/src/packages/components/Decorates/Mores/FlipperNumber/index.ts @@ -6,7 +6,7 @@ export const FlipperNumberConfig: ConfigType = { key: 'FlipperNumber', chartKey: 'VFlipperNumber', conKey: 'VCFlipperNumber', - title: '数字翻牌', + title: '数字翻牌-需动态触发', category: ChatCategoryEnum.MORE, categoryName: ChatCategoryEnumName.MORE, package: PackagesCategoryEnum.DECORATES, diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index ab85be64..49dda2b0 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -20,7 +20,7 @@ import { chartInitConfig } from '@/settings/designSetting' import cloneDeep from 'lodash/cloneDeep' // 请求基础属性 -const requestConfig: RequestConfigType = { +export const requestConfig: RequestConfigType = { requestDataType: RequestDataTypeEnum.STATIC, requestHttpType: RequestHttpEnum.GET, requestUrl: '', diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts index 9354a285..ab4dbb1f 100644 --- a/src/plugins/naive.ts +++ b/src/plugins/naive.ts @@ -7,6 +7,7 @@ import { NH2, NH3, NH4, + NH5, NCode, NCountdown, NText, @@ -109,6 +110,7 @@ const naive = create({ NH2, NH3, NH4, + NH5, NCode, NCountdown, NText, diff --git a/src/utils/router.ts b/src/utils/router.ts index 5f104f56..7c04b96f 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -106,8 +106,8 @@ export const reloadRoutePage = () => { */ export const logout = async () => { try { - const res = await logoutApi() as unknown as MyResponseType - if(res.code === ResultEnum.SUCCESS) { + const res = await logoutApi() + if(res && res.code === ResultEnum.SUCCESS) { window['$message'].success(window['$t']('global.logout_success')) clearCookie(RequestHttpHeaderEnum.COOKIE) clearLocalStorage(StorageEnum.GO_SYSTEM_STORE) diff --git a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue index e87e0bf6..655fe824 100644 --- a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue +++ b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue @@ -1,35 +1,41 @@ diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index 908cc6b0..084b33ee 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -282,9 +282,9 @@ const customRequest = (options: UploadCustomRequestOptions) => { ) let uploadParams = new FormData() uploadParams.append('object', newNameFile) - const uploadRes = await uploadFile(uploadParams) as unknown as MyResponseType + const uploadRes = await uploadFile(uploadParams) - if(uploadRes.code === ResultEnum.SUCCESS) { + if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) { chartEditStore.setEditCanvasConfig( EditCanvasConfigEnum.BACKGROUND_IMAGE, `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}?time=${new Date().getTime()}` diff --git a/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue b/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue index b4b716fc..76143958 100644 --- a/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue @@ -1,7 +1,7 @@