Skip to content

Commit

Permalink
feat: some crud
Browse files Browse the repository at this point in the history
  • Loading branch information
MarchRory committed Nov 19, 2023
1 parent bc77f0e commit 02427b7
Show file tree
Hide file tree
Showing 562 changed files with 75,111 additions and 1,794 deletions.
103 changes: 103 additions & 0 deletions .history/src/api/sys/article_20230922165058.ts
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,
},
)
}
104 changes: 104 additions & 0 deletions .history/src/api/sys/article_20230922172620.ts
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,
},
)
}
104 changes: 104 additions & 0 deletions .history/src/api/sys/article_20230922173319.ts
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,
},
)
}
Loading

0 comments on commit 02427b7

Please sign in to comment.