mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
type: 定义全局返回值类型
This commit is contained in:
@@ -288,7 +288,7 @@ const customRequest = (options: UploadCustomRequestOptions) => {
|
||||
)
|
||||
let uploadParams = new FormData()
|
||||
uploadParams.append('object', newNameFile)
|
||||
const uploadRes:any = await uploadFile(systemStore.getFetchInfo.OSSUrl ,uploadParams)
|
||||
const uploadRes = await uploadFile(systemStore.getFetchInfo.OSSUrl ,uploadParams) as unknown as MyResponseType
|
||||
|
||||
if(uploadRes.code === ResultEnum.SUCCESS) {
|
||||
chartEditStore.setEditCanvasConfig(
|
||||
|
||||
@@ -61,10 +61,10 @@ const handleFocus = () => {
|
||||
const handleBlur = async () => {
|
||||
focus.value = false
|
||||
chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_NAME, title.value || '')
|
||||
const res:any = await updateProjectApi({
|
||||
const res = await updateProjectApi({
|
||||
id: fetchRouteParamsLocation(),
|
||||
projectName: title.value,
|
||||
})
|
||||
}) as unknown as MyResponseType
|
||||
if(res.code === ResultEnum.SUCCESS) {
|
||||
dataSyncUpdate()
|
||||
} else {
|
||||
|
||||
@@ -95,7 +95,7 @@ export const useSync = () => {
|
||||
const dataSyncFetch = async () => {
|
||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.START)
|
||||
try {
|
||||
const res: any = await fetchProjectApi({ projectId: fetchRouteParamsLocation() })
|
||||
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() }) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
if (res.data) {
|
||||
updateStoreInfo(res.data)
|
||||
@@ -135,7 +135,7 @@ export const useSync = () => {
|
||||
// 上传预览图
|
||||
let uploadParams = new FormData()
|
||||
uploadParams.append('object', base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`))
|
||||
const uploadRes:any = await uploadFile(systemStore.getFetchInfo.OSSUrl, uploadParams)
|
||||
const uploadRes = await uploadFile(systemStore.getFetchInfo.OSSUrl, uploadParams) as unknown as MyResponseType
|
||||
// 保存预览图
|
||||
if(uploadRes.code === ResultEnum.SUCCESS) {
|
||||
await updateProjectApi({
|
||||
@@ -148,7 +148,7 @@ export const useSync = () => {
|
||||
let params = new FormData()
|
||||
params.append('projectId', fetchRouteParamsLocation())
|
||||
params.append('content', JSON.stringify(chartEditStore.getStorageInfo || {}))
|
||||
const res: any = await saveProjectApi(params)
|
||||
const res= await saveProjectApi(params) as unknown as MyResponseType
|
||||
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
// 成功状态
|
||||
|
||||
@@ -204,10 +204,10 @@ const handleSubmit = async (e: Event) => {
|
||||
const { username, password } = formInline
|
||||
loading.value = true
|
||||
// 提交请求
|
||||
const res:any = await loginApi({
|
||||
const res = await loginApi({
|
||||
username,
|
||||
password
|
||||
})
|
||||
}) as unknown as MyResponseType
|
||||
if(res.data) {
|
||||
const { tokenValue } = res.data.token
|
||||
const { nickname, username, id } = res.data.userinfo
|
||||
|
||||
@@ -18,7 +18,7 @@ export const getSessionStorageInfo = async () => {
|
||||
// 是否本地预览
|
||||
if (!storageList) {
|
||||
// 接口调用
|
||||
const res: any = await fetchProjectApi({ projectId: id })
|
||||
const res = await fetchProjectApi({ projectId: id }) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
const { content, state } = res.data
|
||||
if (state === -1) {
|
||||
|
||||
@@ -24,10 +24,10 @@ export const useDataListInit = () => {
|
||||
// 数据请求
|
||||
const fetchList = async () => {
|
||||
loading.value = true
|
||||
const res: any = await projectListApi({
|
||||
const res = await projectListApi({
|
||||
page: paginat.page,
|
||||
limit: paginat.limit
|
||||
})
|
||||
}) as unknown as MyResponseType
|
||||
if (res.data) {
|
||||
const { count } = res
|
||||
paginat.count = count
|
||||
@@ -86,11 +86,11 @@ export const useDataListInit = () => {
|
||||
// 发布处理
|
||||
const releaseHandle = async (cardData: Chartype, index: number) => {
|
||||
const { id, release } = cardData
|
||||
const res: any = await changeProjectReleaseApi({
|
||||
const res = await changeProjectReleaseApi({
|
||||
id: id,
|
||||
// [-1未发布, 1发布]
|
||||
state: !release ? 1 : -1
|
||||
})
|
||||
}) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
list.value = []
|
||||
fetchList()
|
||||
|
||||
+2
-2
@@ -89,14 +89,14 @@ const btnHandle = async (key: string) => {
|
||||
case ChartEnum.CHART_HOME_NAME:
|
||||
try {
|
||||
// 新增项目
|
||||
const res:any = await createProjectApi({
|
||||
const res = await createProjectApi({
|
||||
// 项目名称
|
||||
projectName: getUUID(),
|
||||
// remarks
|
||||
remarks: null,
|
||||
// 图片地址
|
||||
indexImage: null,
|
||||
})
|
||||
}) as unknown as MyResponseType
|
||||
if(res.code === ResultEnum.SUCCESS) {
|
||||
window['$message'].success(window['$t']('project.create_success'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user