feat:初始化工程
This commit is contained in:
36
src/apis/anniversary.ts
Normal file
36
src/apis/anniversary.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IAnniversary } from '@/types/anniversary'
|
||||
import type { IStatsChart } from '@/types'
|
||||
|
||||
export const addAnniversaryApi = (anniversary: IAnniversary): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/anniversary',
|
||||
method: 'post',
|
||||
data: anniversary
|
||||
})
|
||||
|
||||
export const updateAnniversaryApi = (id: number, anniversary: IAnniversary): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/anniversary/${id}`,
|
||||
method: 'put',
|
||||
data: anniversary
|
||||
})
|
||||
|
||||
export const deleteAnniversaryApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/anniversary/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryAnniversaryApi = (category: string): Promise<IAnniversary[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/anniversary',
|
||||
method: 'get',
|
||||
params: { category }
|
||||
})
|
||||
|
||||
export const queryAnniversaryCategoryApi = (): Promise<IStatsChart[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/anniversary/category',
|
||||
method: 'get'
|
||||
})
|
||||
35
src/apis/asset.ts
Normal file
35
src/apis/asset.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IAssetRecord } from '@/types/asset'
|
||||
|
||||
export const addAssetApi = (asset: IAssetRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/asset',
|
||||
method: 'post',
|
||||
data: asset
|
||||
})
|
||||
|
||||
export const updateAssetApi = (id: number, asset: IAssetRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/asset/${id}`,
|
||||
method: 'put',
|
||||
data: asset
|
||||
})
|
||||
|
||||
export const deleteAssetApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/asset/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryAssetApi = (category: string): Promise<IAssetRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/asset',
|
||||
method: 'get',
|
||||
params: { category }
|
||||
})
|
||||
|
||||
export const queryAssetCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/asset/category',
|
||||
method: 'get'
|
||||
})
|
||||
35
src/apis/award.ts
Normal file
35
src/apis/award.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IAward, IAwardQuery } from '@/types/award.ts'
|
||||
|
||||
export const addAwardApi = (award: IAward): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/award',
|
||||
method: 'post',
|
||||
data: award
|
||||
})
|
||||
|
||||
export const updateAwardApi = (id: number, award: IAward): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/award/${id}`,
|
||||
method: 'put',
|
||||
data: award
|
||||
})
|
||||
|
||||
export const deleteAwardApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/award/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryAwardApi = (id: number): Promise<IAward> =>
|
||||
cloudService({
|
||||
url: `/home-api/award/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryAwardListApi = (query: IAwardQuery): Promise<IAward[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/award',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
110
src/apis/bill.ts
Normal file
110
src/apis/bill.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IBillBook, IBillCategory, IBillPay, IBillQuery, IBillRecord, IBillSearch } from '@/types/bill'
|
||||
import type { IStatsChart } from '@/types'
|
||||
|
||||
export const addBillRecordApi = (billRecord: IBillRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill',
|
||||
method: 'post',
|
||||
data: billRecord
|
||||
})
|
||||
|
||||
export const updateBillRecordApi = (id: number, billRecord: IBillRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill/${id}`,
|
||||
method: 'put',
|
||||
data: billRecord
|
||||
})
|
||||
|
||||
export const deleteBillRecordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryBillRecordApi = (id: number): Promise<IBillRecord> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBillSummaryApi = (query: IBillQuery): Promise<IBillRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill/summary',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
export const searchBillSummaryApi = (search: IBillSearch): Promise<IBillRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill/search',
|
||||
method: 'get',
|
||||
params: search
|
||||
})
|
||||
|
||||
export const queryBillStatsApi = (type: string, query: IBillQuery): Promise<IStatsChart[]> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill/stats/${type}`,
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
export const queryBillPayApi = (): Promise<IBillPay[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill/pay',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBillBookApi = (): Promise<IBillBook[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill/book',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBillCategoryApi = (): Promise<IBillCategory[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const addBillPayApi = (billPay: IBillPay): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill-manage/pay',
|
||||
method: 'post',
|
||||
data: billPay
|
||||
})
|
||||
|
||||
export const updateBillPayApi = (id: number, billPay: IBillPay): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill-manage/pay/${id}`,
|
||||
method: 'put',
|
||||
data: billPay
|
||||
})
|
||||
|
||||
export const addBillBookApi = (billBook: IBillBook): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill-manage/book',
|
||||
method: 'post',
|
||||
data: billBook
|
||||
})
|
||||
|
||||
export const updateBillBookApi = (id: number, billBook: IBillBook): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill-manage/book/${id}`,
|
||||
method: 'put',
|
||||
data: billBook
|
||||
})
|
||||
|
||||
export const addBillCategoryApi = (billCategory: IBillCategory): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/bill-manage/category',
|
||||
method: 'post',
|
||||
data: billCategory
|
||||
})
|
||||
|
||||
export const updateBillCategoryApi = (id: number, billCategory: IBillCategory): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/bill-manage/category/${id}`,
|
||||
method: 'put',
|
||||
data: billCategory
|
||||
})
|
||||
52
src/apis/blog.ts
Normal file
52
src/apis/blog.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IBlog, IBlogCategory, IBlogComment, IBlogStats, IQueryBlog } from '@/types/blog'
|
||||
|
||||
import qs from 'qs'
|
||||
import type { IPageRecord } from '@/types'
|
||||
|
||||
export const queryBlogApi = (currentPage: number, pageSize: number): Promise<IPageRecord<IBlog>> =>
|
||||
cloudService({
|
||||
url: '/blog-api/blog/page',
|
||||
method: 'get',
|
||||
params: { currentPage, pageSize }
|
||||
})
|
||||
|
||||
export const queryBlogByConditionApi = (query: IQueryBlog): Promise<IBlog[]> =>
|
||||
cloudService({
|
||||
url: '/blog-api/blog/condition',
|
||||
method: 'get',
|
||||
params: query,
|
||||
paramsSerializer: (params) => {
|
||||
return qs.stringify(params, { arrayFormat: 'indices' })
|
||||
}
|
||||
})
|
||||
|
||||
export const queryBlogByIdApi = (id: number): Promise<IBlog> =>
|
||||
cloudService({
|
||||
url: `/blog-api/blog/${id}/content`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBlogCategoryApi = (): Promise<IBlogCategory[]> =>
|
||||
cloudService({
|
||||
url: '/blog-api/blog/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBlogStatsApi = (): Promise<IBlogStats> =>
|
||||
cloudService({
|
||||
url: '/blog-api/blog/stats',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryLatestBlogApi = (): Promise<IBlog[]> =>
|
||||
cloudService({
|
||||
url: '/blog-api/blog/latest',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryBlogCommentApi = (blogId: number): Promise<IBlogComment[]> =>
|
||||
cloudService({
|
||||
url: `/blog-api/blog/${blogId}/comment`,
|
||||
method: 'get'
|
||||
})
|
||||
34
src/apis/file.ts
Normal file
34
src/apis/file.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IFileInfo } from '@/types/file'
|
||||
import type { AxiosProgressEvent } from 'axios'
|
||||
|
||||
export const uploadFileApi = (form: FormData, path: string, md5: string): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-api/file',
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
method: 'post',
|
||||
params: { path, md5 },
|
||||
data: form
|
||||
})
|
||||
|
||||
export const uploadAListFileApi = (form: FormData,
|
||||
progress: (event: AxiosProgressEvent) => void): Promise<string> =>
|
||||
cloudService({
|
||||
url: '/home-api/file/alist',
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
onUploadProgress: progress,
|
||||
timeout: 0,
|
||||
method: 'post',
|
||||
data: form
|
||||
})
|
||||
|
||||
export const getFolderInfoApi = (folderName: string): Promise<IFileInfo[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/file/catalog',
|
||||
method: 'get',
|
||||
params: { folderName }
|
||||
})
|
||||
89
src/apis/food.ts
Normal file
89
src/apis/food.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IFoodQuery, IFoodRecipe, IFoodRecord, IFoodStats } from '@/types/food'
|
||||
import type { IPageRecord } from '@/types'
|
||||
|
||||
export const addFoodRecipeApi = (foodRecipe: IFoodRecipe): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/recipe',
|
||||
method: 'post',
|
||||
data: foodRecipe
|
||||
})
|
||||
|
||||
export const updateFoodRecipeApi = (id: number, foodRecipe: IFoodRecipe): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/food/recipe/${id}`,
|
||||
method: 'put',
|
||||
data: foodRecipe
|
||||
})
|
||||
|
||||
export const deleteFoodRecipeApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/food/recipe/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryFoodRecipeByIdApi = (id: number): Promise<IFoodRecipe> =>
|
||||
cloudService({
|
||||
url: `/home-api/food/recipe/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryFoodRecipeApi = (currentPage: number, pageSize: number,
|
||||
query: IFoodQuery): Promise<IPageRecord<IFoodRecipe>> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/recipe/page',
|
||||
method: 'get',
|
||||
params: { currentPage, pageSize, ...query }
|
||||
})
|
||||
|
||||
export const searchFoodRecipeApi = (name: string): Promise<IFoodRecipe> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/recipe/search',
|
||||
method: 'get',
|
||||
params: { name }
|
||||
})
|
||||
|
||||
export const queryFoodNameListApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/recipe/name',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const addFoodRecordApi = (foodRecord: IFoodRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/record',
|
||||
method: 'post',
|
||||
data: foodRecord
|
||||
})
|
||||
|
||||
export const updateFoodRecordApi = (id: number, foodRecord: IFoodRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/food/record/${id}`,
|
||||
method: 'put',
|
||||
data: foodRecord
|
||||
})
|
||||
|
||||
export const deleteFoodRecordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/food/record/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryFoodRecordApi = (startDate: string, endDate: string): Promise<IFoodRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/record',
|
||||
method: 'get',
|
||||
params: { startDate, endDate }
|
||||
})
|
||||
|
||||
export const queryFoodCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryFoodStatsApi = (): Promise<IFoodStats> =>
|
||||
cloudService({
|
||||
url: '/home-api/food/stats',
|
||||
method: 'get'
|
||||
})
|
||||
16
src/apis/health.ts
Normal file
16
src/apis/health.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IHealth, IHealthQuery } from '@/types/health'
|
||||
|
||||
export const updateHealthApi = (id: number, health: IHealth): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/health/${id}`,
|
||||
method: 'put',
|
||||
data: health
|
||||
})
|
||||
|
||||
export const queryHealthApi = (query: IHealthQuery): Promise<IHealth[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/health',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
3
src/apis/index.ts
Normal file
3
src/apis/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import createService from '@/utils/axiosUtil'
|
||||
|
||||
export const cloudService = createService()
|
||||
36
src/apis/journal.ts
Normal file
36
src/apis/journal.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IStatsChart } from '@/types'
|
||||
import type { IJournal, IJournalQuery } from '@/types/journal.ts'
|
||||
|
||||
export const addJournalApi = (journal: IJournal): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/journal',
|
||||
method: 'post',
|
||||
data: journal
|
||||
})
|
||||
|
||||
export const updateJournalApi = (id: number, journal: IJournal): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/journal/${id}`,
|
||||
method: 'put',
|
||||
data: journal
|
||||
})
|
||||
|
||||
export const deleteJournalApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/journal/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryJournalApi = (query: IJournalQuery): Promise<IJournal[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/journal',
|
||||
method: 'get',
|
||||
params: { ...query }
|
||||
})
|
||||
|
||||
export const queryJournalCategoryApi = (): Promise<IStatsChart[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/journal/category',
|
||||
method: 'get'
|
||||
})
|
||||
29
src/apis/kpi.ts
Normal file
29
src/apis/kpi.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IKpi, IKpiQuery } from '@/types/kpi'
|
||||
|
||||
export const addKpiApi = (kpi: IKpi): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/kpi',
|
||||
method: 'post',
|
||||
data: kpi
|
||||
})
|
||||
|
||||
export const updateKpiApi = (id: number, kpi: IKpi): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/kpi/${id}`,
|
||||
method: 'put',
|
||||
data: kpi
|
||||
})
|
||||
|
||||
export const deleteKpiApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/kpi/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryKpiApi = (query: IKpiQuery): Promise<IKpi[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/kpi',
|
||||
method: 'get',
|
||||
params: { ...query }
|
||||
})
|
||||
35
src/apis/ledger.ts
Normal file
35
src/apis/ledger.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { cloudService } from './index'
|
||||
import type { ILedgerRecord } from '@/types/ledger'
|
||||
|
||||
export const addLedgerApi = (ledger: ILedgerRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/ledger',
|
||||
method: 'post',
|
||||
data: ledger
|
||||
})
|
||||
|
||||
export const updateLedgerApi = (id: number, ledger: ILedgerRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/ledger/${id}`,
|
||||
method: 'put',
|
||||
data: ledger
|
||||
})
|
||||
|
||||
export const deleteLedgerApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/ledger/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryLedgerApi = (book: string): Promise<ILedgerRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/ledger',
|
||||
method: 'get',
|
||||
params: { book }
|
||||
})
|
||||
|
||||
export const queryLedgerBookApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/ledger/book',
|
||||
method: 'get'
|
||||
})
|
||||
35
src/apis/password.ts
Normal file
35
src/apis/password.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IPassword, IPasswordQuery } from '@/types/password'
|
||||
|
||||
export const addPasswordApi = (password: IPassword): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/password',
|
||||
method: 'post',
|
||||
data: password
|
||||
})
|
||||
|
||||
export const updatePasswordApi = (id: number, password: IPassword): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/password/${id}`,
|
||||
method: 'put',
|
||||
data: password
|
||||
})
|
||||
|
||||
export const deletePasswordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/password/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryPasswordApi = (query: IPasswordQuery): Promise<IPassword[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/password',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
export const queryPasswordCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/password/category',
|
||||
method: 'get'
|
||||
})
|
||||
42
src/apis/period.ts
Normal file
42
src/apis/period.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IMenstrualPeriod, IPeriodDay, IPeriodSetting } from '@/types/period.ts'
|
||||
|
||||
export const updatePeriodDayApi = (id: number, periodDay: IPeriodDay): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/period/day/${id}`,
|
||||
method: 'put',
|
||||
data: periodDay
|
||||
})
|
||||
|
||||
export const queryPeriodDayApi = (month: string): Promise<IPeriodDay[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/period/day',
|
||||
method: 'get',
|
||||
params: { month }
|
||||
})
|
||||
|
||||
export const getMenstrualDaysApi = (): Promise<IMenstrualPeriod[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/period//menstruate/days',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const getMenstruateFirstDateApi = (month: string): Promise<string> =>
|
||||
cloudService({
|
||||
url: '/home-api/period/menstruate',
|
||||
method: 'get',
|
||||
params: { month }
|
||||
})
|
||||
|
||||
export const updatePeriodSettingApi = (id: number, setting: IPeriodSetting): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/period/setting/${id}`,
|
||||
method: 'put',
|
||||
data: setting
|
||||
})
|
||||
|
||||
export const queryPeriodSettingApi = (): Promise<IPeriodSetting> =>
|
||||
cloudService({
|
||||
url: '/home-api/period/setting',
|
||||
method: 'get'
|
||||
})
|
||||
42
src/apis/plan.ts
Normal file
42
src/apis/plan.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IPlanInfo, IPlanQuery } from '@/types/plan.ts'
|
||||
|
||||
export const addPlanApi = (plan: IPlanInfo): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-api/plan',
|
||||
method: 'post',
|
||||
data: plan
|
||||
})
|
||||
|
||||
export const updatePlanApi = (id: number, plan: IPlanInfo): Promise<any> =>
|
||||
cloudService({
|
||||
url: `/home-api/plan/${id}`,
|
||||
method: 'put',
|
||||
data: plan
|
||||
})
|
||||
|
||||
export const setPlanStatusApi = (id: number, status: boolean): Promise<any> =>
|
||||
cloudService({
|
||||
url: `/home-api/plan/${id}/status`,
|
||||
method: 'put',
|
||||
params: { status }
|
||||
})
|
||||
|
||||
export const deletePlanApi = (id: number): Promise<any> =>
|
||||
cloudService({
|
||||
url: `/home-api/plan/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryPlanApi = (query: IPlanQuery): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-api/plan',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
export const queryPlanStatsApi = (): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-api/plan/stats',
|
||||
method: 'get'
|
||||
})
|
||||
41
src/apis/product.ts
Normal file
41
src/apis/product.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IProduct, IProductQuery } from '@/types/product.ts'
|
||||
|
||||
export const addProductApi = (product: IProduct): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/product',
|
||||
method: 'post',
|
||||
data: product
|
||||
})
|
||||
|
||||
export const updateProductApi = (id: number, product: IProduct): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/product/${id}`,
|
||||
method: 'put',
|
||||
data: product
|
||||
})
|
||||
|
||||
export const deleteProductApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/product/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
export const queryProductApi = (id: number): Promise<IProduct> =>
|
||||
cloudService({
|
||||
url: `/home-api/product/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryProductListApi = (query: IProductQuery): Promise<IProduct[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/product',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
export const queryProductCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/product/category',
|
||||
method: 'get'
|
||||
})
|
||||
8
src/apis/quartz.ts
Normal file
8
src/apis/quartz.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IQuartzInfo } from '@/types/quartz'
|
||||
|
||||
export const queryQuartzApi = (): Promise<IQuartzInfo[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/quartz',
|
||||
method: 'get'
|
||||
})
|
||||
16
src/apis/session.ts
Normal file
16
src/apis/session.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cloudService } from './index'
|
||||
import type { ISession } from '@/types/auth'
|
||||
|
||||
export const loginHomeApi = (name: string, password: string): Promise<ISession> =>
|
||||
cloudService({
|
||||
url: '/home-api/session',
|
||||
method: 'post',
|
||||
params: { name, password }
|
||||
})
|
||||
|
||||
export const loginAdminApi = (name: string, password: string): Promise<ISession> =>
|
||||
cloudService({
|
||||
url: '/admin-api/session',
|
||||
method: 'post',
|
||||
params: { name, password }
|
||||
})
|
||||
82
src/apis/travel.ts
Normal file
82
src/apis/travel.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { cloudService } from './index'
|
||||
import type { ITravelQuery, ITravelRecord, ITravelSpot, ITravelStats } from '@/types/travel'
|
||||
|
||||
export const addTravelSpotApi = (travelSpot: ITravelSpot): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/spot',
|
||||
method: 'post',
|
||||
data: travelSpot
|
||||
})
|
||||
|
||||
export const updateTravelSpotApi = (id: number, travelSpot: ITravelSpot): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/travel/spot/${id}`,
|
||||
method: 'put',
|
||||
data: travelSpot
|
||||
})
|
||||
|
||||
export const deleteTravelSpotApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/travel/spot/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryTravelSpotApi = (id: number): Promise<ITravelSpot> =>
|
||||
cloudService({
|
||||
url: `/home-api/travel/spot/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryTravelSpotListApi = (currentPage: number, pageSize: number,
|
||||
query: ITravelQuery): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/spot/page',
|
||||
method: 'get',
|
||||
params: { currentPage, pageSize, ...query }
|
||||
})
|
||||
|
||||
export const queryTravelSpotNameListApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/spot/name',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const addTravelRecordApi = (travelRecord: ITravelRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/record',
|
||||
method: 'post',
|
||||
data: travelRecord
|
||||
})
|
||||
|
||||
export const updateTravelRecordApi = (id: number, travelRecord: ITravelRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/travel/record/${id}`,
|
||||
method: 'put',
|
||||
data: travelRecord
|
||||
})
|
||||
|
||||
export const deleteTravelRecordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/travel/record/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryTravelRecordApi = (startDate: string, endDate: string):
|
||||
Promise<ITravelRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/record',
|
||||
method: 'get',
|
||||
params: { startDate, endDate }
|
||||
})
|
||||
|
||||
export const queryTravelCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryTravelStatsApi = (): Promise<ITravelStats> =>
|
||||
cloudService({
|
||||
url: '/home-api/travel/stats',
|
||||
method: 'get'
|
||||
})
|
||||
15
src/apis/user.ts
Normal file
15
src/apis/user.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { cloudService } from './index'
|
||||
import type { IUser } from '@/types/auth.ts'
|
||||
|
||||
export const queryUserApi = (id: number): Promise<IUser> =>
|
||||
cloudService({
|
||||
url: `/home-api/user/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const updateUserApi = (id: number, user: IUser): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-api/user/${id}`,
|
||||
method: 'put',
|
||||
data: user
|
||||
})
|
||||
Reference in New Issue
Block a user