-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
562 changed files
with
75,111 additions
and
1,794 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { defHttp } from '/@/utils/http/axios' | ||
import { ErrorMessageMode } from '/#/axios' | ||
import { | ||
articleItemModel, | ||
delOrDetailArtcileModel, | ||
articleContentResModel, | ||
articleSearchModel, | ||
articleSearchResModel, | ||
} from './model/articleModel' | ||
enum API { | ||
articleList = '/article/list', | ||
articleDetail = '/article', | ||
addArticle = '/article', | ||
updateArticle = '/article', | ||
delArticle = '/article', | ||
downloadFile = '/article/download', | ||
} | ||
|
||
export async function getArticleList(params: articleSearchModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.get<articleSearchResModel>( | ||
{ | ||
url: API.articleList, | ||
params, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function getArticleDetail( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get<articleContentResModel>( | ||
{ | ||
url: API.articleDetail, | ||
params, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function addArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.put( | ||
{ | ||
url: API.addArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function updateArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.patch( | ||
{ | ||
url: API.updateArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function delArticle( | ||
delParams: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.delete<delOrDetailArtcileModel>( | ||
{ | ||
url: `${API.delArticle}/${delParams.articleId}/${delParams.tagId}`, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
/** | ||
* 导出文章的md文件 | ||
* @param params articleId | ||
* @returns | ||
*/ | ||
export async function downLoadArticleMd( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get( | ||
{ | ||
url: API.downloadFile, | ||
params, | ||
responseType: 'blob', | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { defHttp } from '/@/utils/http/axios' | ||
import { ErrorMessageMode } from '/#/axios' | ||
import { | ||
articleItemModel, | ||
delOrDetailArtcileModel, | ||
articleContentResModel, | ||
articleSearchModel, | ||
articleSearchResModel, | ||
} from './model/articleModel' | ||
enum API { | ||
articleList = '/article/list', | ||
articleDetail = '/article', | ||
addArticle = '/article', | ||
updateArticle = '/article', | ||
delArticle = '/article', | ||
downloadFile = '/article/download', | ||
} | ||
|
||
export async function getArticleList(params: articleSearchModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.get<articleSearchResModel>( | ||
{ | ||
url: API.articleList, | ||
params, | ||
timeout: 10 * 1000, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function getArticleDetail( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get<articleContentResModel>( | ||
{ | ||
url: API.articleDetail, | ||
params, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function addArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.put( | ||
{ | ||
url: API.addArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function updateArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.patch( | ||
{ | ||
url: API.updateArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function delArticle( | ||
delParams: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.delete<delOrDetailArtcileModel>( | ||
{ | ||
url: `${API.delArticle}/${delParams.articleId}/${delParams.tagId}`, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
/** | ||
* 导出文章的md文件 | ||
* @param params articleId | ||
* @returns | ||
*/ | ||
export async function downLoadArticleMd( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get( | ||
{ | ||
url: API.downloadFile, | ||
params, | ||
responseType: 'blob', | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { defHttp } from '/@/utils/http/axios' | ||
import { ErrorMessageMode } from '/#/axios' | ||
import { | ||
articleItemModel, | ||
delOrDetailArtcileModel, | ||
articleContentResModel, | ||
articleSearchModel, | ||
articleSearchResModel, | ||
} from './model/articleModel' | ||
enum API { | ||
articleList = '/article/list', | ||
articleDetail = '/article', | ||
addArticle = '/article', | ||
updateArticle = '/article', | ||
delArticle = '/article', | ||
downloadFile = '/article/download', | ||
} | ||
|
||
export async function getArticleList(params: articleSearchModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.get<articleSearchResModel>( | ||
{ | ||
url: API.articleList, | ||
params, | ||
timeout: 10 * 1000, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function getArticleDetail( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get<articleContentResModel>( | ||
{ | ||
url: API.articleDetail, | ||
params, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function addArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.post( | ||
{ | ||
url: API.addArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function updateArticle(data: articleItemModel, mode: ErrorMessageMode = 'modal') { | ||
return await defHttp.patch( | ||
{ | ||
url: API.updateArticle, | ||
data, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
export async function delArticle( | ||
delParams: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.delete<delOrDetailArtcileModel>( | ||
{ | ||
url: `${API.delArticle}/${delParams.articleId}/${delParams.tagId}`, | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} | ||
|
||
/** | ||
* 导出文章的md文件 | ||
* @param params articleId | ||
* @returns | ||
*/ | ||
export async function downLoadArticleMd( | ||
params: delOrDetailArtcileModel, | ||
mode: ErrorMessageMode = 'modal', | ||
) { | ||
return await defHttp.get( | ||
{ | ||
url: API.downloadFile, | ||
params, | ||
responseType: 'blob', | ||
}, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
) | ||
} |
Oops, something went wrong.