diff --git a/.env b/.env index 733a8577ef18675fe59c622f8b298908fe85bbb8..ada25fe744a28b460a5cb85c10ee8d252753d1bb 100644 --- a/.env +++ b/.env @@ -1,14 +1,8 @@ # port -VITE_DEV_PORT = '8001' +VITE_DEV_PORT = '8080' # development path -VITE_DEV_PATH = '/' +VITE_DEV_PATH = 'https://demo.mtruning.club' # production path -VITE_PRO_PATH = '/' - -# spa-title -VITE_GLOB_APP_TITLE = GoView - -# spa shortname -VITE_GLOB_APP_SHORT_NAME = GoView +VITE_PRO_PATH = 'https://demo.mtruning.club' \ No newline at end of file diff --git a/README.md b/README.md index dd2de17323fc6274eeac34ea4a7d8520d4a8e38c..c664b7c032e4f7a6cf41cd008c5cde7b2ca7f3b3 100644 --- a/README.md +++ b/README.md @@ -1,153 +1,114 @@ ## 总览 -![logo](readme/logo-t-y.png) +**`master-fetch` 分支是带有后端接口请求的分支** -GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图表或页面元素封装为基础组件,无需编写代码即可制作数据大屏,减少心智负担。 +**后端项目地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)** -### 😶 纯 **前端** 分支: **`master`** +**接口说明地址:[https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb)** -### 👻 携带 **后端** 请求分支: **`master-fetch`** +## 使用 -### 📚 GoView **文档** 地址:[http://www.mtruning.club:81/](http://www.mtruning.club:81/) +所有的接口地址位置:`src\api\path\*` -项目纯前端-Demo 地址:[https://www.mtruning.club](https://www.mtruning.club) - -项目带后端-Demo 地址:[后端 Demo 地址](http://1.117.240.165:8080/goview/#/login) - -文档-在线地址:[http://www.mtruning.club:81/](http://www.mtruning.club:81/) - -文档-源码地址:[https://gitee.com/MTrun/go-view-doc](https://gitee.com/MTrun/go-view-doc) - -### 🤯 后端项目 - -后端项目 gitee 地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve) - -接口说明地址:[https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb) - -技术点: - -- 框架:基于 `Vue3` 框架编写,使用 `hooks` 写法抽离部分逻辑,使代码结构更加清晰; - -- 类型:使用 `TypeScript` 进行类型约束,减少未知错误发生概率,可以大胆修改逻辑内容; - -- 性能:多处性能优化,使用页面懒加载、组件动态注册、数据滚动加载等方式,提升页面渲染速度; - -- 存储:拥有本地记忆,部分配置项采用 `storage` 存储本地,提升使用体验; - -- 封装:项目进行了详细的工具类封装如:路由、存储、加/解密、文件处理、主题、NaiveUI 全局方法、组件等 - -- 可视化:基于开源图表库[ECharts](https://echarts.apache.org/zh/index.html) 和 [VChart](https://www.visactor.io/vchart) 编写,具有丰富的图表类型和适配大屏的主题效果; - -- 入选 NaiveUI 社区精选资源推荐:[查看 NaiveUI 推荐列表](https://www.naiveui.com/zh-CN/light/docs/community) - -说明文档: -![说明文档](readme/go-view-doc.png) - -工作台: -![项目截图](readme/go-view-canvas.png) - -请求配置: -![项目截图](readme/go-view-fetch.png) - -数据过滤: -![项目截图](readme/go-view-filter.png) - -主题色: -![项目截图](readme/go-view-color.png) - -主要技术栈为: - -| 名称 | 版本 | 名称 | 版本 | -| ------------------- | ----- | ----------- | ------ | -| Vue | 3.2.x | TypeScript4 | 4.6.x | -| Vite | 4.2.x | NaiveUI | 2.34.x | -| ECharts | 5.3.x | Pinia | 2.0.x | -| 详见 `package.json` | 😁 | 🥰 | 🤗 | - -开发环境: - -| 名称 | 版本 | 名称 | 版本 | -| ---- | ------- | ------- | ----- | -| node | 16.16.x | npm | 8.5.x | -| pnpm | 7.1.x | windows | 11 | - -已完成图表: - -| 分类 | 名称 | 名称 | 名称 | -| ------ | ---------------- | ---------------- | -------- | -| 图表 | 柱状图 | 横向柱状图 | 折线图 | -| \* | 单/多 折线面积图 | 饼图 | 水球图 | -| \* | 环形图 | NaiveUI 多种进度 | 🤠 | -| 信息 | 文字 | 图片 | 😶 | -| 列表 | 滚动排名列表 | 滚动表格 | 🤓 | -| 小组件 | 边框-01~13 | 装饰-01~05 | 数字翻牌 | - -## 浏览器支持 - -开发和测试平台均在 `Google` 和最新版 `EDGE` 上完成,暂未测试 `IE11` 等其它浏览器,如有需求请自行测试与兼容。 - -## 安装 - -本项目采用` pnpm` 进行包管理 +接口地址修改:`.env` ```shell -#建议使用 nrm 切换到淘宝源 https://registry.npmmirror.com/ -#pnpm -pnpm install +# port +VITE_DEV_PORT = '8080' -#yarn -yarn install +# development path +VITE_DEV_PATH = 'http://127.0.0.1:8080' -#npm -npm install +# production path +VITE_PRO_PATH = 'http://127.0.0.1:8080' ``` -## 启动 +公共前缀修改:`src\settings\httpSetting.ts` ```shell -#pnpm -pnpm dev - -# npm -npm run dev - -#yarn -yarn dev - -#Makefile -make dev +// 请求前缀 +export const axiosPre = '/api/goview' ``` -## 编译 - -```shell -#pnpm -pnpm run build - -# npm -npm run build - -#yarn -yarn run build - -#Makefile -make dist +接口封装:`src\api\http.ts` + +```ts +import axiosInstance from './axios' +import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum' + +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({ + url: url, + method: RequestHttpEnum.POST, + data: data, + headers: { + 'Content-Type': headersType || ContentTypeEnum.JSON + } + }) +} + +export const put = (url: string, data?: object, headersType?: string) => { + return axiosInstance({ + url: url, + method: RequestHttpEnum.PUT, + data: data, + headers: { + 'Content-Type': headersType || ContentTypeEnum.JSON + } + }) +} + +export const del = (url: string, params?: object) => { + return axiosInstance({ + url: url, + method: RequestHttpEnum.DELETE, + params + }) +} + +// 获取请求函数,默认get +export const http = (type?: RequestHttpEnum) => { + switch (type) { + case RequestHttpEnum.GET: + return get + + case RequestHttpEnum.POST: + return post + + case RequestHttpEnum.PUT: + return put + + case RequestHttpEnum.DELETE: + return del + + default: + return get + } +} ``` ## 代码提交 -- feat: 新功能 -- fix: 修复 Bug -- docs: 文档修改 -- perf: 性能优化 -- revert: 版本回退 -- ci: CICD 集成相关 -- test: 添加测试代码 -- refactor: 代码重构 -- build: 影响项目构建或依赖修改 -- style: 不影响程序逻辑的代码修改 -- chore: 不属于以上类型的其他类型(日常事务) +* feat: 新功能 +* fix: 修复 Bug +* docs: 文档修改 +* perf: 性能优化 +* revert: 版本回退 +* ci: CICD集成相关 +* test: 添加测试代码 +* refactor: 代码重构 +* build: 影响项目构建或依赖修改 +* style: 不影响程序逻辑的代码修改 +* chore: 不属于以上类型的其他类型(日常事务) ## 交流 diff --git a/build/getConfigFileName.ts b/build/getConfigFileName.ts deleted file mode 100644 index d61cd4162a761bd2a342e1e7e07a98e5c6d1a956..0000000000000000000000000000000000000000 --- a/build/getConfigFileName.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Get the configuration file variable name - * @param env - */ -export const getConfigFileName = (env: Record) => { - return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__` - .toUpperCase() - .replace(/\s/g, ''); -}; diff --git a/package.json b/package.json index ffe4939e18800401f1e67269fdc8825d3880807e..a3c76ce99f970363d1effcfa984f546ddbe06fa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "go-view", - "version": "1.1.11", + "version": "2.2.9", "engines": { "node": ">=16.14" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a05db4fecd24adbac3f23a3911183a22848fa14..d47344c1cc3ea560ee1478cf6826773b20e82eb0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4331,7 +4331,7 @@ snapshots: '@types/node': 20.5.1 chalk: 4.1.2 cosmiconfig: 8.3.6(typescript@5.7.2) - cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@4.6.3))(ts-node@10.9.2(@types/node@16.18.122)(typescript@4.6.3))(typescript@5.7.2) + cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@4.6.3))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.2))(typescript@5.7.2) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -5623,7 +5623,7 @@ snapshots: core-util-is@1.0.3: {} - cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@4.6.3))(ts-node@10.9.2(@types/node@16.18.122)(typescript@4.6.3))(typescript@5.7.2): + cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@4.6.3))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.2))(typescript@5.7.2): dependencies: '@types/node': 20.5.1 cosmiconfig: 8.3.6(typescript@5.7.2) diff --git a/src/App.vue b/src/App.vue index 269905514ece1e432dc9239278778c0da6f77a51..7f6fedb9edcea715ac5eeb1f602ef2b36267506f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,7 +17,7 @@ import { NConfigProvider } from 'naive-ui' import { GoAppProvider } from '@/components/GoAppProvider' import { I18n } from '@/components/I18n' -import { useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks' +import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks' // 暗黑主题 const darkTheme = useDarkThemeHook() @@ -28,6 +28,9 @@ const overridesTheme = useThemeOverridesHook() // 代码主题 const hljsTheme = useCode() +// 系统全局数据初始化 +useSystemInit() + // 全局语言 const { locale, dateLocale } = useLang() //测试提交 diff --git a/src/api/axios.config.ts b/src/api/axios.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c976c7c8f066a1051b71ed6b0922d10f27cc745 --- /dev/null +++ b/src/api/axios.config.ts @@ -0,0 +1,14 @@ +import { ModuleTypeEnum } from '@/enums/httpEnum' + +// 接口白名单(免登录) +export const fetchAllowList = [ + // 登录 + `${ModuleTypeEnum.SYSTEM}/login`, + // 获取 OSS 接口 + `${ModuleTypeEnum.SYSTEM}/getOssInfo`, + // 预览获取数据 + `${ModuleTypeEnum.PROJECT}/getData`, +] + +// 接口黑名单 +export const fetchBlockList = [] \ No newline at end of file diff --git a/src/api/axios.ts b/src/api/axios.ts index 07860458597e95de0c6821dda57c919d2f08728c..f799f28c2e5a24eaee9fe4fad248855b1da60b25 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -1,34 +1,93 @@ -import axios, { AxiosResponse, InternalAxiosRequestConfig, AxiosError } from 'axios' -import { ResultEnum } from "@/enums/httpEnum" -import { ErrorPageNameMap } from "@/enums/pageEnum" -import { redirectErrorPage } from '@/utils' +import axios, { AxiosResponse, AxiosRequestConfig, Axios, AxiosError, InternalAxiosRequestConfig } from 'axios' +import { RequestHttpHeaderEnum, ResultEnum, ModuleTypeEnum } from '@/enums/httpEnum' +import { PageEnum, ErrorPageNameMap } from '@/enums/pageEnum' +import { StorageEnum } from '@/enums/storageEnum' +import { axiosPre } from '@/settings/httpSetting' +import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d' +import { redirectErrorPage, getLocalStorage, routerTurnByName, isPreview } from '@/utils' +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.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH, - timeout: ResultEnum.TIMEOUT, -}) + baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`, + timeout: ResultEnum.TIMEOUT +}) as unknown as MyRequestInstance axiosInstance.interceptors.request.use( (config: InternalAxiosRequestConfig) => { + // 白名单校验 + if (includes(fetchAllowList, config.url)) return config + // 获取 token + const info = getLocalStorage(StorageEnum.GO_SYSTEM_STORE) + // 重新登录 + if (!info) { + routerTurnByName(PageEnum.BASE_LOGIN_NAME) + return config + } + const userInfo = info[SystemStoreEnum.USER_INFO] + config.headers[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token'] = userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' return config }, - (error: AxiosError) => { - Promise.reject(error) + (err: AxiosError) => { + Promise.reject(err) } ) // 响应拦截器 axiosInstance.interceptors.response.use( (res: AxiosResponse) => { + // 预览页面错误不进行处理 + if (isPreview()) { + return Promise.resolve(res.data) + } const { code } = res.data as { code: number } + if (code === undefined || code === null) return Promise.resolve(res.data) - if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data) - // 重定向 - if (ErrorPageNameMap.get(code)) redirectErrorPage(code) + + // 成功 + if (code === ResultEnum.SUCCESS) { + return Promise.resolve(res.data) + } + + // 登录过期 + if (code === ResultEnum.TOKEN_OVERDUE) { + window['$message'].error(window['$t']('http.token_overdue_message')) + routerTurnByName(PageEnum.BASE_LOGIN_NAME) + return Promise.resolve(res.data) + } + + // 固定错误码重定向 + if (ErrorPageNameMap.get(code)) { + redirectErrorPage(code) + return Promise.resolve(res.data) + } + + // 提示错误 + window['$message'].error(window['$t']((res.data as any).msg)) return Promise.resolve(res.data) }, - (err: AxiosResponse) => { - Promise.reject(err) + (err: AxiosError) => { + const status = err.response?.status + switch (status) { + case 401: + routerTurnByName(PageEnum.BASE_LOGIN_NAME) + Promise.reject(err) + break + + default: + Promise.reject(err) + break + } } ) diff --git a/src/api/http.ts b/src/api/http.ts index 5da448569774655db6547428375c35f43d9e20b0..0d433a73d1cce174766673b8d9c068539e5e3bc5 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 + 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 diff --git a/src/api/path/index.ts b/src/api/path/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..66594d273075efb651eae3f14c4bdac52671e66c --- /dev/null +++ b/src/api/path/index.ts @@ -0,0 +1,2 @@ +export * from '@/api/path/project.api' +export * from '@/api/path/system.api' \ No newline at end of file diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee0001badecb9f9a3a8a4f2b249bab1afd109a4e --- /dev/null +++ b/src/api/path/project.api.ts @@ -0,0 +1,99 @@ +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 + } catch { + httpErrorHandle() + } +} + +// * 新增项目 +export const createProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.POST)<{ + /** + * 项目id + */ + id: number + }>(`${ModuleTypeEnum.PROJECT}/create`, data) + return res + } catch { + httpErrorHandle() + } +} + +// * 获取项目 +export const fetchProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/getData`, data) + return res + } catch { + httpErrorHandle() + } +} + +// * 保存项目 +export const saveProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.POST)( + `${ModuleTypeEnum.PROJECT}/save/data`, + data, + ContentTypeEnum.FORM_URLENCODED + ) + return res + } catch { + httpErrorHandle() + } +} + +// * 修改项目基础信息 +export const updateProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data) + return res + } catch { + httpErrorHandle() + } +} + +// * 删除项目 +export const deleteProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data) + return res + } catch { + httpErrorHandle() + } +} + +// * 修改发布状态 [-1未发布,1发布] +export const changeProjectReleaseApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data) + return res + } catch { + httpErrorHandle() + } +} + +// * 上传文件 +export const uploadFile = async (data: object) => { + try { + const res = await http(RequestHttpEnum.POST)<{ + /** + * 文件地址 + */ + fileName: string, + fileurl: string, + }>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA) + return res + } catch { + httpErrorHandle() + } +} diff --git a/src/api/path/project.d.ts b/src/api/path/project.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9e2009653d6dd03c69695dd7dfce4b127103a77 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..6c3412f124b40f0d71d3943306f181477708ee8e --- /dev/null +++ b/src/api/path/system.api.ts @@ -0,0 +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() + } +} + +// * 登出 +export const logoutApi = async () => { + try { + 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)<{ + /** + * bucket 地址 + */ + bucketURL?: string + }>(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data) + return res + } catch (err) { + httpErrorHandle() + } +} diff --git a/src/api/path/system.d.ts b/src/api/path/system.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..221e404d32bae7984408e84e46d052fea7046d2a --- /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/project/moke-20211219181327.png b/src/assets/images/project/moke-20211219181327.png deleted file mode 100644 index 7be19aa31540c4255c818bbcc62eaaca881b9c51..0000000000000000000000000000000000000000 Binary files a/src/assets/images/project/moke-20211219181327.png and /dev/null differ diff --git a/src/components/GoUserInfo/index.vue b/src/components/GoUserInfo/index.vue index aa01056fd781f898811616b76e0b64e457c5909c..c49d6bb13e5406a7b90911106a43ae4b749e12fc 100644 --- a/src/components/GoUserInfo/index.vue +++ b/src/components/GoUserInfo/index.vue @@ -27,7 +27,9 @@ diff --git a/src/views/chart/ContentEdit/components/EditHistory/index.vue b/src/views/chart/ContentEdit/components/EditHistory/index.vue index 4ad642bbaaaa1e2cec4e7478785727bb09479b50..a9c6c6a892186b2447df3246a26810cb5cb757de 100644 --- a/src/views/chart/ContentEdit/components/EditHistory/index.vue +++ b/src/views/chart/ContentEdit/components/EditHistory/index.vue @@ -133,9 +133,6 @@ const options = computed(() => { diff --git a/src/views/chart/ContentHeader/headerTitle/index.vue b/src/views/chart/ContentHeader/headerTitle/index.vue index d41541ce799ef6c07d67cbca760e6d0d6f401273..1ed56ebd5b457bdba6f90f411ff0f69dc440b1db 100644 --- a/src/views/chart/ContentHeader/headerTitle/index.vue +++ b/src/views/chart/ContentHeader/headerTitle/index.vue @@ -28,28 +28,27 @@ diff --git a/src/views/project/layout/components/ProjectLayoutCreate/components/CreateModal/index.vue b/src/views/project/layout/components/ProjectLayoutCreate/components/CreateModal/index.vue index fb629eb263626e06d532f8eecb994e55297e89bc..a87f451d8cd5f124154bde4b4d59a62b2f11d003 100644 --- a/src/views/project/layout/components/ProjectLayoutCreate/components/CreateModal/index.vue +++ b/src/views/project/layout/components/ProjectLayoutCreate/components/CreateModal/index.vue @@ -18,7 +18,7 @@ :disabled="item.disabled" v-for="item in typeList" :key="item.key" - @click="btnHandle" + @click="btnHandle(item.key)" >