feat: 新增创建接口,修改i8n部分内容

This commit is contained in:
奔跑的面条
2022-05-21 18:03:15 +08:00
parent b6143bc75e
commit 46cb8e7d0b
9 changed files with 55 additions and 16 deletions
@@ -38,7 +38,9 @@
import { watch } from 'vue'
import { icon } from '@/plugins'
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
import { ResultEnum } from '@/enums/httpEnum'
import { fetchPathByName, routerTurnByPath, renderLang, getUUID } from '@/utils'
import { createProjectApi } from '@/api/path/project'
const { FishIcon, CloseIcon } = icon.ionicons5
const { StoreIcon, ObjectStorageIcon } = icon.carbon
@@ -82,13 +84,30 @@ const closeHandle = () => {
}
// 处理按钮点击
const btnHandle = (key: string) => {
const btnHandle = async (key: string) => {
switch (key) {
case ChartEnum.CHART_HOME_NAME:
const id = getUUID()
const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href')
routerTurnByPath(path, [id], undefined, true)
closeHandle()
try {
// 新增项目
const res:any = await createProjectApi({
// 项目名称
projectName: getUUID(),
// remarks
remarks: null,
// 图片地址
indexImage: null,
})
if(res.code === ResultEnum.SUCCESS) {
window['$message'].success(window['$t']('project.create_success'))
const { id } = res
const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href')
routerTurnByPath(path, [id], undefined, true)
closeHandle()
}
} catch (error) {
window['$message'].error(window['$t']('project.create_failure'))
}
break;
}
}