generated from Leo_Ding/web-template
Compare commits
No commits in common. "2d2d435b0689bc62331828908dfa5ea9906cc61b" and "4d5192786d6268c5b943c83dd6675e80d77cfed5" have entirely different histories.
2d2d435b06
...
4d5192786d
@ -1,9 +1,10 @@
|
|||||||
const modules = import.meta.glob('./modules/*.js', { eager: true })
|
const modules = import.meta.glob('./modules/*.js', { eager: true })
|
||||||
|
|
||||||
const api = {}
|
const api = {}
|
||||||
|
|
||||||
Object.keys(modules).forEach((key) => {
|
Object.keys(modules).forEach((key) => {
|
||||||
const name = key.slice(key.lastIndexOf('/') + 1, key.lastIndexOf('.'))
|
const name = key.slice(key.lastIndexOf('/') + 1, key.lastIndexOf('.'))
|
||||||
console.log(name)
|
|
||||||
api[name] = { ...modules[key] }
|
api[name] = { ...modules[key] }
|
||||||
})
|
})
|
||||||
|
|
||||||
export default api
|
export default api
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* 图片管理接口
|
|
||||||
*/
|
|
||||||
import request from '@/utils/request'
|
|
||||||
// 获取菜单列表
|
|
||||||
export const getDataList = (params) => request.basic.get('/api/v1/banners', params)
|
|
||||||
// 获取菜单条数据
|
|
||||||
export const getMenu = (id) => request.basic.get(`/api/v1/menus/${id}`)
|
|
||||||
// 添加菜单
|
|
||||||
export const createMenu = (params) => request.basic.post('/api/v1/menus', params)
|
|
||||||
// 更新菜单
|
|
||||||
export const updateMenu = (id, params) => request.basic.put(`/api/v1/menus/${id}`, params)
|
|
||||||
// 删除菜单
|
|
||||||
export const delMenu = (id) => request.basic.delete(`/api/v1/menus/${id}`)
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.9 KiB |
@ -1,9 +1,8 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import imgErr from '@/assets/imgerror.png'
|
|
||||||
import App from '@/App.vue'
|
import App from '@/App.vue'
|
||||||
import { useCore } from '@/core'
|
import { useCore } from '@/core'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
app.config.globalProperties.$imageErr={imgErr}
|
|
||||||
useCore(app)
|
useCore(app)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
@ -1,27 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<x-search-bar class="mb-8-2">
|
<x-search-bar class="mb-8-2">
|
||||||
<template #default="{ gutter, colSpan }">
|
<template #default="{ gutter, colSpan }">
|
||||||
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
<a-form :label-col="{ style: { width: '100px' } }" :model="searchFormData" layout="inline">
|
||||||
<a-row :gutter="gutter">
|
<a-row :gutter="gutter">
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="标题" name="name">
|
<a-form-item :label="$t('pages.system.user.form.username')" name="username">
|
||||||
<a-input placeholder="请输入图片标题" v-model:value="searchFormData.name"></a-input>
|
<a-input
|
||||||
|
:placeholder="$t('pages.system.user.form.username.placeholder')"
|
||||||
|
v-model:value="searchFormData.username"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="状态" name="status">
|
<a-form-item name="name">
|
||||||
<a-select v-model:value="searchFormData.status">
|
<template #label>
|
||||||
<a-select-option value="enabled">启用</a-select-option>
|
{{ $t('pages.system.user.form.name') }}
|
||||||
<a-select-option value="disabled">停用</a-select-option>
|
<a-tooltip :title="$t('pages.system.user.form.name')">
|
||||||
</a-select>
|
<question-circle-outlined class="ml-4-1 color-placeholder" />
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<a-input
|
||||||
|
:placeholder="$t('pages.system.user.form.name.placeholder')"
|
||||||
|
v-model:value="searchFormData.name"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col class="align-right" v-bind="colSpan">
|
<a-col
|
||||||
|
class="align-right"
|
||||||
|
v-bind="colSpan">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
<a-button ghost type="primary" @click="handleSearch">
|
<a-button
|
||||||
|
ghost
|
||||||
|
type="primary"
|
||||||
|
@click="handleSearch">
|
||||||
{{ $t('button.search') }}
|
{{ $t('button.search') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
@ -30,37 +42,58 @@
|
|||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
</x-search-bar>
|
</x-search-bar>
|
||||||
<a-row :gutter="8" :wrap="false">
|
<a-row
|
||||||
|
:gutter="8"
|
||||||
|
:wrap="false">
|
||||||
<a-col flex="auto">
|
<a-col flex="auto">
|
||||||
<a-card type="flex">
|
<a-card type="flex">
|
||||||
<x-action-bar class="mb-8-2">
|
<x-action-bar class="mb-8-2">
|
||||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
@click="$refs.editDialogRef.handleCreate()">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<plus-outlined></plus-outlined>
|
<plus-outlined></plus-outlined>
|
||||||
</template>
|
</template>
|
||||||
添加图片
|
{{ $t('pages.system.user.add') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</x-action-bar>
|
</x-action-bar>
|
||||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
<a-table
|
||||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
:columns="columns"
|
||||||
|
:data-source="listData"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="paginationState"
|
||||||
|
:scroll="{ x: 1000 }"
|
||||||
|
@change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'img' === column.dataIndex">
|
<template v-if="'statusType' === column.key">
|
||||||
<a-image :width="50" :src="record.img || $imageErr.imgErr" />
|
<!--状态-->
|
||||||
|
<a-tag
|
||||||
|
v-if="statusUserTypeEnum.is('activated', record.status)"
|
||||||
|
color="processing">
|
||||||
|
{{ statusUserTypeEnum.getDesc(record.status) }}
|
||||||
|
</a-tag>
|
||||||
|
<!--状态-->
|
||||||
|
<a-tag
|
||||||
|
v-if="statusUserTypeEnum.is('freezed', record.status)"
|
||||||
|
color="processing">
|
||||||
|
{{ statusUserTypeEnum.getDesc(record.status) }}
|
||||||
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'createAt' === column.key">
|
||||||
<a-tag :color="record.sequence === 'enabled' ? 'green' : 'red'">{{
|
{{ formatUtcDateTime(record.created_at) }}
|
||||||
record.sequence==='enabled'?'启用':'停用' }}</a-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||||
<edit-outlined /> </a-tooltip></x-action-button>
|
<edit-outlined /> </a-tooltip
|
||||||
|
></x-action-button>
|
||||||
<x-action-button @click="handleDelete(record)">
|
<x-action-button @click="handleDelete(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
<delete-outlined style="color: #ff4d4f" /> </a-tooltip
|
||||||
|
></x-action-button>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -68,7 +101,9 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
<edit-dialog
|
||||||
|
ref="editDialogRef"
|
||||||
|
@ok="onOk"></edit-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -88,11 +123,13 @@ defineOptions({
|
|||||||
})
|
})
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' },
|
{ title: t('pages.system.user.form.username'), dataIndex: 'username', width: 120 },
|
||||||
{ title: '标题', dataIndex: 'name', key: 'name' },
|
{ title: t('pages.system.user.form.name'), dataIndex: 'name', key: 'name', width: 100 },
|
||||||
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
{ title: t('pages.system.user.form.phone'), dataIndex: 'phone', width: 120 },
|
||||||
{ title: '顺序', dataIndex: 'sequence', width: 100, align: 'center' },
|
{ title: t('pages.system.user.form.email'), dataIndex: 'email', width: 100 },
|
||||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
{ title: t('pages.system.user.form.status'), dataIndex: 'status', key: 'statusType', width: 60 },
|
||||||
|
{ title: t('pages.system.user.form.created_at'), key: 'createAt', fixed: 'right', width: 120 },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100 },
|
||||||
]
|
]
|
||||||
|
|
||||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||||
@ -108,8 +145,8 @@ async function getPageList() {
|
|||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
const { pageSize, current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const { success, data, total } = await apis.imgmgt
|
const { success, data, total } = await apis.users
|
||||||
.getDataList({
|
.getUsersList({
|
||||||
pageSize,
|
pageSize,
|
||||||
page: current,
|
page: current,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user