Skip to content

Commit d82f3ec

Browse files
committed
feat: 由 Apifox 提供在线 Mock
1 parent c84b7bc commit d82f3ec

File tree

6 files changed

+32
-9
lines changed

6 files changed

+32
-9
lines changed

src/common/apis/table/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function createTableDataApi(data: Table.CreateOrUpdateTableRequestData) {
1111
}
1212

1313
/** 删 */
14-
export function deleteTableDataApi(id: string) {
14+
export function deleteTableDataApi(id: number) {
1515
return request({
1616
url: `table/${id}`,
1717
method: "delete"

src/common/apis/table/type.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface CreateOrUpdateTableRequestData {
2-
id?: string
2+
id?: number
33
username: string
44
password?: string
55
}
@@ -18,7 +18,7 @@ export interface TableRequestData {
1818
export interface TableData {
1919
createTime: string
2020
email: string
21-
id: string
21+
id: number
2222
phone: string
2323
roles: string
2424
status: boolean

src/pages/demo/element-plus/index.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ function getTableData() {
8484
getTableDataApi({
8585
currentPage: paginationData.currentPage,
8686
size: paginationData.pageSize,
87-
username: searchData.username || undefined,
88-
phone: searchData.phone || undefined
87+
username: searchData.username,
88+
phone: searchData.phone
8989
}).then(({ data }) => {
9090
paginationData.total = data.total
9191
tableData.value = data.list
@@ -110,6 +110,12 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl
110110

111111
<template>
112112
<div class="app-container">
113+
<el-alert
114+
title="数据来源"
115+
type="success"
116+
description="由 Apifox 提供在线 Mock,数据不具备真实性,仅供简单的 CRUD 操作演示。"
117+
show-icon
118+
/>
113119
<el-card v-loading="loading" shadow="never" class="search-wrapper">
114120
<el-form ref="searchFormRef" :inline="true" :model="searchData">
115121
<el-form-item prop="username" label="用户名">
@@ -227,6 +233,10 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl
227233
</template>
228234

229235
<style lang="scss" scoped>
236+
.el-alert {
237+
margin-bottom: 20px;
238+
}
239+
230240
.search-wrapper {
231241
margin-bottom: 20px;
232242
:deep(.el-card__body) {

src/pages/demo/vxe-table/index.vue

+15-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defineOptions({
1313
1414
// #region vxe-grid
1515
interface RowMeta {
16-
id: string
16+
id: number
1717
username: string
1818
roles: string
1919
phone: string
@@ -164,8 +164,8 @@ const xGridOpt: VxeGridProps = reactive({
164164
}
165165
// 接口需要的参数
166166
const params = {
167-
username: form.username || undefined,
168-
phone: form.phone || undefined,
167+
username: form.username || "",
168+
phone: form.phone || "",
169169
size: page.pageSize,
170170
currentPage: page.currentPage
171171
}
@@ -382,6 +382,12 @@ const crudStore = reactive({
382382

383383
<template>
384384
<div class="app-container">
385+
<el-alert
386+
title="数据来源"
387+
type="success"
388+
description="由 Apifox 提供在线 Mock,数据不具备真实性,仅供简单的 CRUD 操作演示。"
389+
show-icon
390+
/>
385391
<!-- 表格 -->
386392
<vxe-grid ref="xGridDom" v-bind="xGridOpt">
387393
<!-- 左侧按钮列表 -->
@@ -410,3 +416,9 @@ const crudStore = reactive({
410416
</vxe-modal>
411417
</div>
412418
</template>
419+
420+
<style lang="scss" scoped>
421+
.el-alert {
422+
margin-bottom: 20px;
423+
}
424+
</style>

types/auto/components.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {}
77
/* prettier-ignore */
88
declare module 'vue' {
99
export interface GlobalComponents {
10+
ElAlert: typeof import('element-plus/es')['ElAlert']
1011
ElAside: typeof import('element-plus/es')['ElAside']
1112
ElAvatar: typeof import('element-plus/es')['ElAvatar']
1213
ElBacktop: typeof import('element-plus/es')['ElBacktop']

vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default defineConfig(({ mode }) => {
3838
// 反向代理
3939
proxy: {
4040
"/api/v1": {
41-
target: "https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212",
41+
target: "https://apifoxmock.com/m1/2930465-2145633-default",
4242
// 是否为 WebSocket
4343
ws: false,
4444
// 是否允许跨域

0 commit comments

Comments
 (0)