feat(custom): i

This commit is contained in:
2023-09-06 03:48:46 +08:00
parent 3b3cb7ba34
commit a9707c6d94
51 changed files with 2273 additions and 87 deletions

View File

@@ -0,0 +1,5 @@
import { request } from '@/utils'
export default {
getUser: (data) => request.post('/user', data),
}

View File

@@ -0,0 +1,101 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
/>
</CommonPage>
</template>
<script setup>
import api from './api'
const loading = ref(false)
const columns = ref([
{
title: 'ID',
align: 'center',
key: 'ID',
},
{
title: '头像',
align: 'center',
slot: 'avatar',
render(row) {
return h('img', {
src: row.avatar,
style: {
width: '30px',
height: '30px',
borderRadius: '50%',
},
})
},
},
{
title: '电话',
align: 'center',
key: 'phone',
},
{
title: '用户积分',
align: 'center',
key: 'integral',
},
{
title: '用户豆子',
align: 'center',
key: 'pulse',
},
{
title: '操作',
align: 'center',
slot: 'action',
render(row) {
console.log(row)
},
},
])
const data = ref([])
const pagination = ref({
current: 1,
pageSize: 10,
total: 0,
onChange: (page) => {
pagination.value.page = page
getList()
},
onUpdatePageSize: (pageSize) => {
pagination.value.pageSize = pageSize
pagination.value.page = 1
getList()
},
})
onMounted(() => {
getList()
})
const getList = async () => {
loading.value = true
try {
const res = await api.getUser({
pageNum: pagination.value.current,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
</script>
<style lang="scss" scoped></style>

19
src/views/user/route.js Normal file
View File

@@ -0,0 +1,19 @@
const Layout = () => import('@/layout/index.vue')
export default {
name: '用户管理',
path: '/user',
component: Layout,
redirect: '/user_list',
children: [
{
name: 'Userlist',
path: 'user_list',
component: () => import('./index/index.vue'),
meta: {
title: '用户列表',
order: 10,
},
},
],
}