mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
feat: 修改接口
This commit is contained in:
parent
8e38d1c84d
commit
d2c8ed1c20
5
.env
5
.env
@ -3,8 +3,9 @@ VITE_DEV_PORT = '8080'
|
|||||||
|
|
||||||
# development path
|
# development path
|
||||||
# VITE_DEV_PATH = 'https://demo.mtruning.club'
|
# VITE_DEV_PATH = 'https://demo.mtruning.club'
|
||||||
VITE_DEV_PATH = 'http://192.168.0.120:3001'
|
VITE_DEV_PATH = 'http://192.168.0.34:8024'
|
||||||
|
# VITE_DEV_PATH = 'http://192.168.0.120:3001'
|
||||||
|
|
||||||
# production path
|
# production path
|
||||||
# VITE_PRO_PATH = 'https://demo.mtruning.club'
|
# VITE_PRO_PATH = 'https://demo.mtruning.club'
|
||||||
VITE_PRO_PATH = 'http://192.168.0.120:3001'
|
VITE_PRO_PATH = 'http://192.168.0.34:8024'
|
||||||
|
@ -4,15 +4,10 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<meta name="renderer" content="webkit" />
|
<meta name="renderer" content="webkit" />
|
||||||
<meta name="description" content="GoView 是高效、高性能的拖拽式低代码数据可视化开发平台,将页面元素封装为基础组件,无需编写代码即可完成业务需求。">
|
|
||||||
<meta name="keywords" content="GoView,goview,低代码,可视化">
|
|
||||||
<meta name="author" content="奔跑的面条,面条">
|
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
||||||
/>
|
/>
|
||||||
<link rel="icon" href="./favicon.ico" />
|
|
||||||
<title>GoView</title>
|
|
||||||
<link rel="stylesheet" href="./index.css" />
|
<link rel="stylesheet" href="./index.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -18,6 +18,9 @@ import { NConfigProvider } from 'naive-ui'
|
|||||||
import { GoAppProvider } from '@/components/GoAppProvider'
|
import { GoAppProvider } from '@/components/GoAppProvider'
|
||||||
import { I18n } from '@/components/I18n'
|
import { I18n } from '@/components/I18n'
|
||||||
import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks'
|
import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks'
|
||||||
|
import { getToken } from '@/api/path'
|
||||||
|
|
||||||
|
getToken()
|
||||||
|
|
||||||
// 暗黑主题
|
// 暗黑主题
|
||||||
const darkTheme = useDarkThemeHook()
|
const darkTheme = useDarkThemeHook()
|
||||||
|
@ -13,7 +13,7 @@ export interface MyResponseType<T> {
|
|||||||
data: T
|
data: T
|
||||||
message: string
|
message: string
|
||||||
// 兼顾主系统
|
// 兼顾主系统
|
||||||
errcode: any
|
errcode: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MyRequestInstance extends Axios {
|
export interface MyRequestInstance extends Axios {
|
||||||
|
@ -3,32 +3,23 @@ import { http } from "@/api/http";
|
|||||||
import { RequestHttpEnum } from "@/enums/httpEnum";
|
import { RequestHttpEnum } from "@/enums/httpEnum";
|
||||||
import { httpErrorHandle } from '@/utils'
|
import { httpErrorHandle } from '@/utils'
|
||||||
|
|
||||||
const allCookies = document.cookie;
|
|
||||||
function getCookie(name: string) {
|
|
||||||
const cookies = document.cookie.split(';');
|
|
||||||
for (const cookie of cookies) {
|
|
||||||
const [cookieName, cookieValue] = cookie.trim().split('=');
|
|
||||||
if (cookieName === name) {
|
|
||||||
return decodeURIComponent(cookieValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
console.log(allCookies, getCookie('access_token'));
|
|
||||||
|
|
||||||
export function getToken() {
|
export function getToken() {
|
||||||
const TokenKey = 'access_token'
|
let queryStr = window.location.href
|
||||||
if (getCookie(TokenKey)) {
|
queryStr = queryStr.split('?')[1]
|
||||||
return getCookie(TokenKey)
|
if(queryStr.indexOf('#') > -1) queryStr = queryStr.split('#')[0]
|
||||||
} else {
|
console.log(queryStr)
|
||||||
return sessionStorage.getItem(TokenKey)
|
let query:{[key:string]: string} = {}
|
||||||
}
|
queryStr.split('&').forEach((item:string) => {
|
||||||
|
query[item.split('=')[0]] = item.split('=')[1]
|
||||||
|
})
|
||||||
|
return query.access_token
|
||||||
}
|
}
|
||||||
|
|
||||||
export const publicInterface = async (paramType:string, interfaceType:string, paramData:unknown) =>{
|
export const publicInterface = async (paramType:string, interfaceType:string, paramData?:unknown) =>{
|
||||||
try {
|
try {
|
||||||
const access_token = getToken()
|
const access_token = getToken()
|
||||||
const res = await http(RequestHttpEnum.POST)<unknown>(paramType, {
|
console.log(access_token, window)
|
||||||
|
const res = await http(RequestHttpEnum.POST)<any>(paramType, {
|
||||||
access_token,
|
access_token,
|
||||||
type: interfaceType,
|
type: interfaceType,
|
||||||
data: paramData
|
data: paramData
|
||||||
|
@ -1,99 +1,50 @@
|
|||||||
import { http } from '@/api/http'
|
import {publicInterface} from './business.api'
|
||||||
import { httpErrorHandle } from '@/utils'
|
import {http} from "@/api/http";
|
||||||
import { ContentTypeEnum, RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
import {ContentTypeEnum, RequestHttpEnum} from "@/enums/httpEnum";
|
||||||
import { ProjectItem, ProjectDetail } from './project'
|
import {httpErrorHandle} from "@/utils";
|
||||||
|
|
||||||
// * 项目列表
|
// * 项目列表
|
||||||
export const projectListApi = async (data: object) => {
|
export const projectListApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'get', data)
|
||||||
const res = await http(RequestHttpEnum.GET)<ProjectItem[]>(`${ModuleTypeEnum.PROJECT}/list`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 新增项目
|
// * 新增项目
|
||||||
export const createProjectApi = async (data: object) => {
|
export const createProjectApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'add', data)
|
||||||
const res = await http(RequestHttpEnum.POST)<{
|
|
||||||
/**
|
|
||||||
* 项目id
|
|
||||||
*/
|
|
||||||
id: number
|
|
||||||
}>(`${ModuleTypeEnum.PROJECT}/create`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 获取项目
|
// * 获取项目
|
||||||
export const fetchProjectApi = async (data: object) => {
|
export const fetchProjectApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'get_one', data)
|
||||||
const res = await http(RequestHttpEnum.GET)<ProjectDetail>(`${ModuleTypeEnum.PROJECT}/getData`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 保存项目
|
// * 保存项目
|
||||||
export const saveProjectApi = async (data: object) => {
|
export const saveProjectApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'mod', data)
|
||||||
const res = await http(RequestHttpEnum.POST)(
|
|
||||||
`${ModuleTypeEnum.PROJECT}/save/data`,
|
|
||||||
data,
|
|
||||||
ContentTypeEnum.FORM_URLENCODED
|
|
||||||
)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 修改项目基础信息
|
// * 修改项目基础信息
|
||||||
export const updateProjectApi = async (data: object) => {
|
export const updateProjectApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'mod', data)
|
||||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 删除项目
|
// * 删除项目
|
||||||
export const deleteProjectApi = async (data: object) => {
|
export const deleteProjectApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'del', data)
|
||||||
const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 修改发布状态 [-1未发布,1发布]
|
// * 修改发布状态 [-1未发布,1发布]
|
||||||
export const changeProjectReleaseApi = async (data: object) => {
|
export const changeProjectReleaseApi = async (data: object) => {
|
||||||
try {
|
return publicInterface('/dcim/system/custom_large_screen', 'mod', data)
|
||||||
const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 上传文件
|
// * 上传文件
|
||||||
export const uploadFile = async (data: object) => {
|
export const uploadFile = async (data: object) => {
|
||||||
try {
|
try {
|
||||||
const res = await http(RequestHttpEnum.POST)<{
|
const res = await http(RequestHttpEnum.POST)<any>('/dcim/system/custom_large_screen/upload_file', data, ContentTypeEnum.FORM_DATA)
|
||||||
/**
|
return res
|
||||||
* 文件地址
|
} catch {
|
||||||
*/
|
httpErrorHandle()
|
||||||
fileName: string,
|
}
|
||||||
fileurl: string,
|
// return publicInterface('/dcim/system/custom_large_screen/upload_file', 'get', data)
|
||||||
}>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA)
|
|
||||||
return res
|
|
||||||
} catch {
|
|
||||||
httpErrorHandle()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
99
src/api/path/projectV3.api.ts
Normal file
99
src/api/path/projectV3.api.ts
Normal file
@ -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)<ProjectItem[]>(`${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)<ProjectDetail>(`${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()
|
||||||
|
}
|
||||||
|
}
|
@ -10,14 +10,18 @@ export const useSystemInit = async () => {
|
|||||||
|
|
||||||
// 获取 OSS 信息的 url 地址,用来拼接展示图片的地址
|
// 获取 OSS 信息的 url 地址,用来拼接展示图片的地址
|
||||||
const getOssUrl = async () => {
|
const getOssUrl = async () => {
|
||||||
const res = await ossUrlApi({})
|
// const res = await ossUrlApi({})
|
||||||
if (res && res.code === ResultEnum.SUCCESS) {
|
// if (res && res.code === ResultEnum.SUCCESS) {
|
||||||
systemStore.setItem(SystemStoreEnum.FETCH_INFO, {
|
// systemStore.setItem(SystemStoreEnum.FETCH_INFO, {
|
||||||
OSSUrl: res.data?.bucketURL
|
// OSSUrl: res.data?.bucketURL
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
const url = window.location.origin
|
||||||
|
systemStore.setItem(SystemStoreEnum.FETCH_INFO, {
|
||||||
|
OSSUrl: url
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行
|
// 执行
|
||||||
getOssUrl()
|
getOssUrl()
|
||||||
}
|
}
|
||||||
|
@ -267,9 +267,9 @@ type ValueType = ItemType[]
|
|||||||
const { value } = defineProps(['value']) as { value: ValueType }
|
const { value } = defineProps(['value']) as { value: ValueType }
|
||||||
|
|
||||||
const color = ref('#4dca59')
|
const color = ref('#4dca59')
|
||||||
const getRotate = (horizontal, data) => {
|
const getRotate = (horizontal:string, data:number) => {
|
||||||
// 传入指针水平位置,计算指针角度,水平位置即为指针角度为0时,两端点的纵坐标
|
// 传入指针水平位置,计算指针角度,水平位置即为指针角度为0时,两端点的纵坐标
|
||||||
const pue = parseFloat(data) // 当前指针值
|
const pue = parseFloat(data.toString()) // 当前指针值
|
||||||
if (pue >= 0 && pue < 1.7) {
|
if (pue >= 0 && pue < 1.7) {
|
||||||
color.value = '#4dca59'
|
color.value = '#4dca59'
|
||||||
} else if (pue >= 1.7 && pue < 2.2) {
|
} else if (pue >= 1.7 && pue < 2.2) {
|
||||||
|
@ -277,10 +277,10 @@ const customRequest = (options: UploadCustomRequestOptions) => {
|
|||||||
type: file.file.type
|
type: file.file.type
|
||||||
})
|
})
|
||||||
let uploadParams = new FormData()
|
let uploadParams = new FormData()
|
||||||
uploadParams.append('object', newNameFile)
|
uploadParams.append('files', newNameFile)
|
||||||
const uploadRes = await uploadFile(uploadParams)
|
const uploadRes = await uploadFile(uploadParams)
|
||||||
|
|
||||||
if (uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
|
if (uploadRes && uploadRes.errcode === '00000') {
|
||||||
if (uploadRes.data.fileurl) {
|
if (uploadRes.data.fileurl) {
|
||||||
chartEditStore.setEditCanvasConfig(
|
chartEditStore.setEditCanvasConfig(
|
||||||
EditCanvasConfigEnum.BACKGROUND_IMAGE,
|
EditCanvasConfigEnum.BACKGROUND_IMAGE,
|
||||||
|
@ -251,11 +251,20 @@ export const useSync = () => {
|
|||||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.START)
|
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.START)
|
||||||
try {
|
try {
|
||||||
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() })
|
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() })
|
||||||
if (res && res.code === ResultEnum.SUCCESS) {
|
console.log(res)
|
||||||
|
if (res) {
|
||||||
|
// type dataType = {
|
||||||
|
// id: string
|
||||||
|
// projectName: string,
|
||||||
|
// indexImage: string,
|
||||||
|
// remarks: string,
|
||||||
|
// state: number,
|
||||||
|
// content: string,
|
||||||
|
// }
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
updateStoreInfo(res.data)
|
updateStoreInfo(res.data as any)
|
||||||
// 更新全局数据
|
// 更新全局数据
|
||||||
await updateComponent(JSONParse(res.data.content))
|
await updateComponent(JSONParse((res.data as any).content))
|
||||||
return
|
return
|
||||||
}else {
|
}else {
|
||||||
chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation())
|
chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation())
|
||||||
@ -267,6 +276,7 @@ export const useSync = () => {
|
|||||||
}
|
}
|
||||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.FAILURE)
|
||||||
httpErrorHandle()
|
httpErrorHandle()
|
||||||
}
|
}
|
||||||
@ -298,19 +308,19 @@ export const useSync = () => {
|
|||||||
|
|
||||||
// 上传预览图
|
// 上传预览图
|
||||||
let uploadParams = new FormData()
|
let uploadParams = new FormData()
|
||||||
uploadParams.append('object', base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`))
|
uploadParams.append('files', base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`))
|
||||||
const uploadRes = await uploadFile(uploadParams)
|
const uploadRes = await uploadFile(uploadParams)
|
||||||
// 保存预览图
|
// 保存预览图
|
||||||
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
|
if(uploadRes && uploadRes.data) {
|
||||||
if (uploadRes.data.fileurl) {
|
if (uploadRes.data.length) {
|
||||||
await updateProjectApi({
|
await updateProjectApi({
|
||||||
id: fetchRouteParamsLocation(),
|
id: Number(fetchRouteParamsLocation()),
|
||||||
indexImage: `${uploadRes.data.fileurl}`
|
indexImage: `${uploadRes.data[0]}`
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await updateProjectApi({
|
await updateProjectApi({
|
||||||
id: fetchRouteParamsLocation(),
|
id: Number(fetchRouteParamsLocation()),
|
||||||
indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}`
|
indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data[0]}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,12 +330,16 @@ export const useSync = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
let params = new FormData()
|
// let params = new FormData()
|
||||||
params.append('projectId', projectId)
|
// params.append('projectId', projectId)
|
||||||
params.append('content', JSONStringify(chartEditStore.getStorageInfo() || {}))
|
// params.append('content', JSONStringify(chartEditStore.getStorageInfo() || {}))
|
||||||
|
const params = {
|
||||||
|
id: projectId,
|
||||||
|
content: JSONStringify(chartEditStore.getStorageInfo() || {})
|
||||||
|
}
|
||||||
const res= await saveProjectApi(params)
|
const res= await saveProjectApi(params)
|
||||||
|
|
||||||
if (res && res.code === ResultEnum.SUCCESS) {
|
if (res && res.data) {
|
||||||
// 成功状态
|
// 成功状态
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.SUCCESS)
|
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.SUCCESS)
|
||||||
|
@ -20,14 +20,14 @@ export const getSessionStorageInfo = async () => {
|
|||||||
if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
|
if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
|
||||||
// 接口调用
|
// 接口调用
|
||||||
const res = await fetchProjectApi({ projectId: id })
|
const res = await fetchProjectApi({ projectId: id })
|
||||||
if (res && res.code === ResultEnum.SUCCESS) {
|
if (res) {
|
||||||
const { content, state } = res.data
|
const { content, state } = res.data
|
||||||
if (state === -1) {
|
// if (state === -1) {
|
||||||
// 跳转未发布页
|
// // 跳转未发布页
|
||||||
return { isRelease: false }
|
// return { isRelease: false }
|
||||||
}
|
// }
|
||||||
console.log(content)
|
console.log(content)
|
||||||
const parseData = { ...JSONParse(content), id }
|
const parseData = { ...JSONParse(content ? content : '{}'), id }
|
||||||
const { editCanvasConfig, requestGlobalConfig, componentList } = parseData
|
const { editCanvasConfig, requestGlobalConfig, componentList } = parseData
|
||||||
chartEditStore.editCanvasConfig = editCanvasConfig
|
chartEditStore.editCanvasConfig = editCanvasConfig
|
||||||
chartEditStore.requestGlobalConfig = requestGlobalConfig
|
chartEditStore.requestGlobalConfig = requestGlobalConfig
|
||||||
|
@ -30,7 +30,7 @@ export const useDataListInit = () => {
|
|||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
const { count } = res as any // 这里的count与data平级,不在Response结构中
|
const { count } = res as any // 这里的count与data平级,不在Response结构中
|
||||||
paginat.count = count
|
paginat.count = count
|
||||||
list.value = res.data.map(e => {
|
list.value = res.data.map((e:any) => {
|
||||||
const { id, projectName, state, createTime, indexImage, createUserId } = e
|
const { id, projectName, state, createTime, indexImage, createUserId } = e
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
@ -69,13 +69,11 @@ export const useDataListInit = () => {
|
|||||||
onPositiveCallback: () =>
|
onPositiveCallback: () =>
|
||||||
new Promise(res => {
|
new Promise(res => {
|
||||||
res(
|
res(
|
||||||
deleteProjectApi({
|
deleteProjectApi([cardData.id])
|
||||||
ids: cardData.id
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
promiseResCallback: (res: any) => {
|
promiseResCallback: (res: any) => {
|
||||||
if (res.code === ResultEnum.SUCCESS) {
|
if (res.errcode === '00000') {
|
||||||
window['$message'].success(window['$t']('global.r_delete_success'))
|
window['$message'].success(window['$t']('global.r_delete_success'))
|
||||||
fetchList()
|
fetchList()
|
||||||
return
|
return
|
||||||
|
@ -95,7 +95,7 @@ const btnHandle = async (key: string) => {
|
|||||||
// 图片地址
|
// 图片地址
|
||||||
indexImage: null,
|
indexImage: null,
|
||||||
})
|
})
|
||||||
if(res && res.code === ResultEnum.SUCCESS) {
|
if(res && res.data) {
|
||||||
window['$message'].success(window['$t']('project.create_success'))
|
window['$message'].success(window['$t']('project.create_success'))
|
||||||
|
|
||||||
const { id } = res.data
|
const { id } = res.data
|
||||||
|
@ -47,6 +47,14 @@ export default ({ mode }) => defineConfig({
|
|||||||
port: 3000,
|
port: 3000,
|
||||||
proxy: {
|
proxy: {
|
||||||
[axiosPre]: {
|
[axiosPre]: {
|
||||||
|
// @ts-ignore
|
||||||
|
target: loadEnv(mode, process.cwd()).VITE_DEV_PATH,
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(new RegExp(`^${axiosPre}`), ''),
|
||||||
|
ws: true,
|
||||||
|
secure: true,
|
||||||
|
},
|
||||||
|
'/data/file': {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
target: loadEnv(mode, process.cwd()).VITE_DEV_PATH,
|
target: loadEnv(mode, process.cwd()).VITE_DEV_PATH,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user