feat: 由 Apifox 提供在线 Mock
This commit is contained in:
parent
c84b7bcca1
commit
d82f3ec874
@ -11,7 +11,7 @@ export function createTableDataApi(data: Table.CreateOrUpdateTableRequestData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 删 */
|
/** 删 */
|
||||||
export function deleteTableDataApi(id: string) {
|
export function deleteTableDataApi(id: number) {
|
||||||
return request({
|
return request({
|
||||||
url: `table/${id}`,
|
url: `table/${id}`,
|
||||||
method: "delete"
|
method: "delete"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface CreateOrUpdateTableRequestData {
|
export interface CreateOrUpdateTableRequestData {
|
||||||
id?: string
|
id?: number
|
||||||
username: string
|
username: string
|
||||||
password?: string
|
password?: string
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ export interface TableRequestData {
|
|||||||
export interface TableData {
|
export interface TableData {
|
||||||
createTime: string
|
createTime: string
|
||||||
email: string
|
email: string
|
||||||
id: string
|
id: number
|
||||||
phone: string
|
phone: string
|
||||||
roles: string
|
roles: string
|
||||||
status: boolean
|
status: boolean
|
||||||
|
@ -84,8 +84,8 @@ function getTableData() {
|
|||||||
getTableDataApi({
|
getTableDataApi({
|
||||||
currentPage: paginationData.currentPage,
|
currentPage: paginationData.currentPage,
|
||||||
size: paginationData.pageSize,
|
size: paginationData.pageSize,
|
||||||
username: searchData.username || undefined,
|
username: searchData.username,
|
||||||
phone: searchData.phone || undefined
|
phone: searchData.phone
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
paginationData.total = data.total
|
paginationData.total = data.total
|
||||||
tableData.value = data.list
|
tableData.value = data.list
|
||||||
@ -110,6 +110,12 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<el-alert
|
||||||
|
title="数据来源"
|
||||||
|
type="success"
|
||||||
|
description="由 Apifox 提供在线 Mock,数据不具备真实性,仅供简单的 CRUD 操作演示。"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
<el-card v-loading="loading" shadow="never" class="search-wrapper">
|
<el-card v-loading="loading" shadow="never" class="search-wrapper">
|
||||||
<el-form ref="searchFormRef" :inline="true" :model="searchData">
|
<el-form ref="searchFormRef" :inline="true" :model="searchData">
|
||||||
<el-form-item prop="username" label="用户名">
|
<el-form-item prop="username" label="用户名">
|
||||||
@ -227,6 +233,10 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.el-alert {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.search-wrapper {
|
.search-wrapper {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
:deep(.el-card__body) {
|
:deep(.el-card__body) {
|
||||||
|
@ -13,7 +13,7 @@ defineOptions({
|
|||||||
|
|
||||||
// #region vxe-grid
|
// #region vxe-grid
|
||||||
interface RowMeta {
|
interface RowMeta {
|
||||||
id: string
|
id: number
|
||||||
username: string
|
username: string
|
||||||
roles: string
|
roles: string
|
||||||
phone: string
|
phone: string
|
||||||
@ -164,8 +164,8 @@ const xGridOpt: VxeGridProps = reactive({
|
|||||||
}
|
}
|
||||||
// 接口需要的参数
|
// 接口需要的参数
|
||||||
const params = {
|
const params = {
|
||||||
username: form.username || undefined,
|
username: form.username || "",
|
||||||
phone: form.phone || undefined,
|
phone: form.phone || "",
|
||||||
size: page.pageSize,
|
size: page.pageSize,
|
||||||
currentPage: page.currentPage
|
currentPage: page.currentPage
|
||||||
}
|
}
|
||||||
@ -382,6 +382,12 @@ const crudStore = reactive({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<el-alert
|
||||||
|
title="数据来源"
|
||||||
|
type="success"
|
||||||
|
description="由 Apifox 提供在线 Mock,数据不具备真实性,仅供简单的 CRUD 操作演示。"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<vxe-grid ref="xGridDom" v-bind="xGridOpt">
|
<vxe-grid ref="xGridDom" v-bind="xGridOpt">
|
||||||
<!-- 左侧按钮列表 -->
|
<!-- 左侧按钮列表 -->
|
||||||
@ -410,3 +416,9 @@ const crudStore = reactive({
|
|||||||
</vxe-modal>
|
</vxe-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.el-alert {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
1
types/auto/components.d.ts
vendored
1
types/auto/components.d.ts
vendored
@ -7,6 +7,7 @@ export {}
|
|||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
|
ElAlert: typeof import('element-plus/es')['ElAlert']
|
||||||
ElAside: typeof import('element-plus/es')['ElAside']
|
ElAside: typeof import('element-plus/es')['ElAside']
|
||||||
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||||
ElBacktop: typeof import('element-plus/es')['ElBacktop']
|
ElBacktop: typeof import('element-plus/es')['ElBacktop']
|
||||||
|
@ -38,7 +38,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
// 反向代理
|
// 反向代理
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api/v1": {
|
"/api/v1": {
|
||||||
target: "https://mock.mengxuegu.com/mock/63218b5fb4c53348ed2bc212",
|
target: "https://apifoxmock.com/m1/2930465-2145633-default",
|
||||||
// 是否为 WebSocket
|
// 是否为 WebSocket
|
||||||
ws: false,
|
ws: false,
|
||||||
// 是否允许跨域
|
// 是否允许跨域
|
||||||
|
Loading…
x
Reference in New Issue
Block a user