mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2026-01-22 23:50:22 +08:00
style: lint
This commit is contained in:
@@ -12,12 +12,24 @@
|
||||
<n-card title="按钮 Button">
|
||||
<n-space>
|
||||
<n-button>Default</n-button>
|
||||
<n-button type="tertiary">Tertiary</n-button>
|
||||
<n-button type="primary">Primary</n-button>
|
||||
<n-button type="info">Info</n-button>
|
||||
<n-button type="success">Success</n-button>
|
||||
<n-button type="warning">Warning</n-button>
|
||||
<n-button type="error">Error</n-button>
|
||||
<n-button type="tertiary">
|
||||
Tertiary
|
||||
</n-button>
|
||||
<n-button type="primary">
|
||||
Primary
|
||||
</n-button>
|
||||
<n-button type="info">
|
||||
Info
|
||||
</n-button>
|
||||
<n-button type="success">
|
||||
Success
|
||||
</n-button>
|
||||
<n-button type="warning">
|
||||
Warning
|
||||
</n-button>
|
||||
<n-button type="error">
|
||||
Error
|
||||
</n-button>
|
||||
</n-space>
|
||||
</n-card>
|
||||
|
||||
@@ -46,10 +58,18 @@
|
||||
<n-space size="large" mt-30>
|
||||
<n-card min-w-340 title="通知 Notification">
|
||||
<n-space>
|
||||
<n-button @click="notify('info')">信息</n-button>
|
||||
<n-button @click="notify('success')">成功</n-button>
|
||||
<n-button @click="notify('warning')">警告</n-button>
|
||||
<n-button @click="notify('error')">错误</n-button>
|
||||
<n-button @click="notify('info')">
|
||||
信息
|
||||
</n-button>
|
||||
<n-button @click="notify('success')">
|
||||
成功
|
||||
</n-button>
|
||||
<n-button @click="notify('warning')">
|
||||
警告
|
||||
</n-button>
|
||||
<n-button @click="notify('error')">
|
||||
错误
|
||||
</n-button>
|
||||
</n-space>
|
||||
</n-card>
|
||||
|
||||
@@ -66,7 +86,9 @@
|
||||
<i v-show="!loading" class="i-mdi:login mr-4" />
|
||||
登录
|
||||
</n-button>
|
||||
<n-button type="error" @click="handleMultiMessage">多个错误提醒</n-button>
|
||||
<n-button type="error" @click="handleMultiMessage">
|
||||
多个错误提醒
|
||||
</n-button>
|
||||
</n-space>
|
||||
</n-card>
|
||||
</n-space>
|
||||
@@ -75,6 +97,7 @@
|
||||
|
||||
<script setup>
|
||||
import { sleep } from '@/utils'
|
||||
|
||||
const handleDelete = function () {
|
||||
$dialog.confirm({
|
||||
content: '确认删除?',
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
<div w-350>
|
||||
<n-input v-model:value="inputVal" />
|
||||
<n-input-number v-model:value="number" mt-30 />
|
||||
<p mt-20 text-center text-14 color-gray>注:右击标签重新加载可重置keep-alive</p>
|
||||
<p mt-20 text-center text-14 color-gray>
|
||||
注:右击标签重新加载可重置keep-alive
|
||||
</p>
|
||||
</div>
|
||||
</CommonPage>
|
||||
</template>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
<template>
|
||||
<CommonPage show-footer>
|
||||
<n-button type="primary" @click="openModal1">打开第一个弹个窗</n-button>
|
||||
<n-button type="primary" @click="openModal1">
|
||||
打开第一个弹个窗
|
||||
</n-button>
|
||||
<MeModal ref="$modal1">
|
||||
<n-input v-model:value="text" />
|
||||
</MeModal>
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
<template>
|
||||
<CommonPage show-footer>
|
||||
<template #title-suffix>
|
||||
<n-tag class="ml-12" type="primary">feather图标集 + isme自定义图标</n-tag>
|
||||
<n-tag class="ml-12" type="primary">
|
||||
feather图标集 + isme自定义图标
|
||||
</n-tag>
|
||||
</template>
|
||||
<ul class="flex flex-wrap justify-between">
|
||||
<li
|
||||
@@ -18,7 +20,7 @@
|
||||
class="m-16 w-160 f-c-c flex-col cursor-pointer rounded-12 px-12 py-24 card-border auto-bg"
|
||||
@click="copy(`<i class="${item}" />`)"
|
||||
>
|
||||
<i :class="item + '?mask'" class="text-28 text-gray-600 hover:bg-primary" />
|
||||
<i :class="`${item}?mask`" class="text-28 text-gray-600 hover:bg-primary" />
|
||||
<span
|
||||
class="mt-16 text-center text-14 text-gray-400 hover:color-primary"
|
||||
@click.stop="copy(item)"
|
||||
@@ -26,13 +28,13 @@
|
||||
{{ item }}
|
||||
</span>
|
||||
</li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160"></li>
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
<li class="mx-16 h-0 w-160" />
|
||||
</ul>
|
||||
</CommonPage>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
<n-upload-dragger>
|
||||
<div class="h-150 f-c-c flex-col">
|
||||
<i class="i-mdi:upload mb-12 text-68 color-primary" />
|
||||
<n-text class="text-14 color-gray">点击或者拖动文件到该区域来上传</n-text>
|
||||
<n-text class="text-14 color-gray">
|
||||
点击或者拖动文件到该区域来上传
|
||||
</n-text>
|
||||
</div>
|
||||
</n-upload-dragger>
|
||||
</n-upload>
|
||||
@@ -31,7 +33,9 @@
|
||||
<n-image width="200" :src="item.url" />
|
||||
</div>
|
||||
<n-space class="mt-16" justify="space-evenly">
|
||||
<n-button dashed type="primary" @click="copy(item.url)">url</n-button>
|
||||
<n-button dashed type="primary" @click="copy(item.url)">
|
||||
url
|
||||
</n-button>
|
||||
<n-button dashed type="primary" @click="copy(``)">
|
||||
MD
|
||||
</n-button>
|
||||
@@ -53,6 +57,7 @@
|
||||
|
||||
<script setup>
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
|
||||
defineOptions({ name: 'ImgUpload' })
|
||||
|
||||
const { copy, copied } = useClipboard()
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
<n-button v-if="back" type="primary" ghost @click="router.replace(back)">
|
||||
返回上一页
|
||||
</n-button>
|
||||
<n-button type="primary" class="ml-20" @click="router.replace('/')">返回首页</n-button>
|
||||
<n-button type="primary" class="ml-20" @click="router.replace('/')">
|
||||
返回首页
|
||||
</n-button>
|
||||
</template>
|
||||
</n-result>
|
||||
</div>
|
||||
@@ -35,7 +37,8 @@ const back = history.state.back
|
||||
|
||||
if (history.state.from === 'permission-guard') {
|
||||
delete history.state.from
|
||||
} else if (route.query.path) {
|
||||
}
|
||||
else if (route.query.path) {
|
||||
router.replace(route.query.path)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
size="large"
|
||||
>
|
||||
<template #footer>
|
||||
<n-button type="primary" ghost @click="replace('/')">返回首页</n-button>
|
||||
<n-button type="primary" ghost @click="replace('/')">
|
||||
返回首页
|
||||
</n-button>
|
||||
</template>
|
||||
</n-result>
|
||||
</div>
|
||||
|
||||
@@ -20,8 +20,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-28 text-14 opacity-60">一个人几乎可以在任何他怀有无限热忱的事情上成功。</p>
|
||||
<p class="mt-12 text-right text-12 opacity-40">—— 查尔斯·史考伯</p>
|
||||
<p class="mt-28 text-14 opacity-60">
|
||||
一个人几乎可以在任何他怀有无限热忱的事情上成功。
|
||||
</p>
|
||||
<p class="mt-12 text-right text-12 opacity-40">
|
||||
—— 查尔斯·史考伯
|
||||
</p>
|
||||
</n-card>
|
||||
<n-card class="ml-12 w-70%" title="✨ 欢迎使用 Vue Naive Admin 2.0">
|
||||
<template #header-extra>
|
||||
@@ -156,13 +160,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useUserStore } from '@/store'
|
||||
import * as echarts from 'echarts/core'
|
||||
import { TooltipComponent, GridComponent, LegendComponent } from 'echarts/components'
|
||||
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components'
|
||||
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
||||
import { UniversalTransition } from 'echarts/features'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<AppPage full>
|
||||
<iframe :src="route.meta.originPath" frameborder="0" class="wh-full"></iframe>
|
||||
<iframe :src="route.meta.originPath" frameborder="0" class="wh-full" />
|
||||
</AppPage>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { request } from '@/utils'
|
||||
|
||||
export default {
|
||||
toggleRole: (data) => request.post('/auth/role/toggle', data),
|
||||
login: (data) => request.post('/auth/login', data, { noNeedToken: true }),
|
||||
toggleRole: data => request.post('/auth/role/toggle', data),
|
||||
login: data => request.post('/auth/login', data, { noNeedToken: true }),
|
||||
getUser: () => request.get('/user/detail'),
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
class="m-auto max-w-700 min-w-345 f-c-c rounded-8 bg-opacity-20 bg-cover p-12 card-shadow auto-bg"
|
||||
>
|
||||
<div class="hidden w-380 px-20 py-35 md:block">
|
||||
<img src="@/assets/images/login_banner.webp" class="w-full" alt="login_banner" />
|
||||
<img src="@/assets/images/login_banner.webp" class="w-full" alt="login_banner">
|
||||
</div>
|
||||
|
||||
<div class="w-320 flex-col px-20 py-32">
|
||||
<h2 class="f-c-c text-24 text-#6a6a6a font-normal">
|
||||
<img src="@/assets/images/logo.png" class="mr-12 h-50" />
|
||||
<img src="@/assets/images/logo.png" class="mr-12 h-50">
|
||||
{{ title }}
|
||||
</h2>
|
||||
<n-input
|
||||
@@ -64,7 +64,7 @@
|
||||
height="40"
|
||||
class="ml-12 w-80 cursor-pointer"
|
||||
@click="initCaptcha"
|
||||
/>
|
||||
>
|
||||
</div>
|
||||
|
||||
<n-checkbox
|
||||
@@ -101,9 +101,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { throttle, lStorage } from '@/utils'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import api from './api'
|
||||
import { lStorage, throttle } from '@/utils'
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
@@ -118,7 +118,7 @@ const loginInfo = ref({
|
||||
|
||||
const captchaUrl = ref('')
|
||||
const initCaptcha = throttle(() => {
|
||||
captchaUrl.value = import.meta.env.VITE_AXIOS_BASE_URL + '/auth/captcha?' + Date.now()
|
||||
captchaUrl.value = `${import.meta.env.VITE_AXIOS_BASE_URL}/auth/captcha?${Date.now()}`
|
||||
}, 500)
|
||||
|
||||
const localLoginInfo = lStorage.get('loginInfo')
|
||||
@@ -138,19 +138,23 @@ const isRemember = useStorage('isRemember', true)
|
||||
const loading = ref(false)
|
||||
async function handleLogin(isQuick) {
|
||||
const { username, password, captcha } = loginInfo.value
|
||||
if (!username || !password) return $message.warning('请输入用户名和密码')
|
||||
if (!isQuick && !captcha) return $message.warning('请输入验证码')
|
||||
if (!username || !password)
|
||||
return $message.warning('请输入用户名和密码')
|
||||
if (!isQuick && !captcha)
|
||||
return $message.warning('请输入验证码')
|
||||
try {
|
||||
loading.value = true
|
||||
$message.loading('正在验证,请稍后...', { key: 'login' })
|
||||
const { data } = await api.login({ username, password: password.toString(), captcha, isQuick })
|
||||
if (isRemember.value) {
|
||||
lStorage.set('loginInfo', { username, password })
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lStorage.remove('loginInfo')
|
||||
}
|
||||
onLoginSuccess(data)
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
// 10003为验证码错误专属业务码
|
||||
if (error?.code === 10003) {
|
||||
// 为防止爆破,验证码错误则刷新验证码
|
||||
@@ -171,10 +175,12 @@ async function onLoginSuccess(data = {}) {
|
||||
const path = route.query.redirect
|
||||
delete route.query.redirect
|
||||
router.push({ path, query: route.query })
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
router.push('/')
|
||||
}
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error)
|
||||
$message.destroy('login')
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default {
|
||||
getMenuTree: () => request.get('/permission/menu/tree'),
|
||||
getButtons: ({ parentId }) => request.get(`/permission/button/${parentId}`),
|
||||
getComponents: () => axios.get(`${import.meta.env.VITE_PUBLIC_PATH}components.json`),
|
||||
addPermission: (data) => request.post('/permission', data),
|
||||
addPermission: data => request.post('/permission', data),
|
||||
savePermission: (id, data) => request.patch(`/permission/${id}`, data),
|
||||
deletePermission: (id) => request.delete(`permission/${id}`),
|
||||
deletePermission: id => request.delete(`permission/${id}`),
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
<h3>菜单</h3>
|
||||
<div class="flex">
|
||||
<n-input v-model:value="pattern" placeholder="搜索" clearable />
|
||||
<n-button class="ml-12" type="primary" @click="handleAdd()">
|
||||
<NButton class="ml-12" type="primary" @click="handleAdd()">
|
||||
<i class="i-material-symbols:add mr-4 text-14" />
|
||||
新增
|
||||
</n-button>
|
||||
</NButton>
|
||||
</div>
|
||||
|
||||
<n-tree
|
||||
@@ -28,8 +28,8 @@
|
||||
:on-update:selected-keys="onSelect"
|
||||
key-field="code"
|
||||
label-field="name"
|
||||
block-line
|
||||
default-expand-all
|
||||
|
||||
block-line default-expand-all
|
||||
/>
|
||||
</n-space>
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
<script setup>
|
||||
import { withModifiers } from 'vue'
|
||||
import ResAddOrEdit from './ResAddOrEdit.vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import api from '../api'
|
||||
import ResAddOrEdit from './ResAddOrEdit.vue'
|
||||
|
||||
defineProps({
|
||||
treeData: {
|
||||
@@ -86,7 +86,7 @@ function renderSuffix({ option }) {
|
||||
size: 'tiny',
|
||||
onClick: withModifiers(() => handleAdd({ parentId: option.id }), ['stop']),
|
||||
},
|
||||
{ default: () => '新增' }
|
||||
{ default: () => '新增' },
|
||||
),
|
||||
|
||||
h(
|
||||
@@ -98,7 +98,7 @@ function renderSuffix({ option }) {
|
||||
style: 'margin-left: 12px;',
|
||||
onClick: withModifiers(() => handleDelete(option), ['stop']),
|
||||
},
|
||||
{ default: () => '删除' }
|
||||
{ default: () => '删除' },
|
||||
),
|
||||
]
|
||||
}
|
||||
@@ -113,7 +113,8 @@ function handleDelete(item) {
|
||||
$message.success('删除成功', { key: 'deleteMenu' })
|
||||
emit('refresh')
|
||||
emit('update:currentMenu', null)
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
$message.destroy('deleteMenu')
|
||||
}
|
||||
},
|
||||
|
||||
@@ -99,8 +99,12 @@
|
||||
<QuestionLabel label="显示状态" content="控制是否在菜单栏显示,不影响路由注册" />
|
||||
</template>
|
||||
<n-switch v-model:value="modalForm.show">
|
||||
<template #checked>显示</template>
|
||||
<template #unchecked>隐藏</template>
|
||||
<template #checked>
|
||||
显示
|
||||
</template>
|
||||
<template #unchecked>
|
||||
隐藏
|
||||
</template>
|
||||
</n-switch>
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi :span="12" path="enable">
|
||||
@@ -111,8 +115,12 @@
|
||||
/>
|
||||
</template>
|
||||
<n-switch v-model:value="modalForm.enable">
|
||||
<template #checked>启用</template>
|
||||
<template #unchecked>禁用</template>
|
||||
<template #checked>
|
||||
启用
|
||||
</template>
|
||||
<template #unchecked>
|
||||
禁用
|
||||
</template>
|
||||
</n-switch>
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi v-if="modalForm.type === 'MENU'" :span="12" path="keepAlive">
|
||||
@@ -123,8 +131,12 @@
|
||||
/>
|
||||
</template>
|
||||
<n-switch v-model:value="modalForm.keepAlive">
|
||||
<template #checked>是</template>
|
||||
<template #unchecked>否</template>
|
||||
<template #checked>
|
||||
是
|
||||
</template>
|
||||
<template #unchecked>
|
||||
否
|
||||
</template>
|
||||
</n-switch>
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi
|
||||
@@ -147,12 +159,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { MeModal } from '@/components'
|
||||
import QuestionLabel from './QuestionLabel.vue'
|
||||
import { useForm, useModal } from '@/composables'
|
||||
import api from '../api'
|
||||
import pagePathes from 'isme:page-pathes'
|
||||
import icons from 'isme:icons'
|
||||
import api from '../api'
|
||||
import QuestionLabel from './QuestionLabel.vue'
|
||||
import { MeModal } from '@/components'
|
||||
import { useForm, useModal } from '@/composables'
|
||||
|
||||
const props = defineProps({
|
||||
menus: {
|
||||
@@ -165,10 +177,10 @@ const emit = defineEmits(['refresh'])
|
||||
const menuOptions = computed(() => {
|
||||
return [{ name: '根菜单', id: '', children: props.menus || [] }]
|
||||
})
|
||||
const componentOptions = pagePathes.map((path) => ({ label: path, value: path }))
|
||||
const iconOptions = icons.map((item) => ({
|
||||
const componentOptions = pagePathes.map(path => ({ label: path, value: path }))
|
||||
const iconOptions = icons.map(item => ({
|
||||
label: () =>
|
||||
h('span', { class: 'flex items-center' }, [h('i', { class: item + ' text-18 mr-8' }), item]),
|
||||
h('span', { class: 'flex items-center' }, [h('i', { class: `${item} text-18 mr-8` }), item]),
|
||||
value: item,
|
||||
}))
|
||||
const layoutOptions = [
|
||||
@@ -203,17 +215,20 @@ async function onSave() {
|
||||
okLoading.value = true
|
||||
try {
|
||||
let newFormData
|
||||
if (!modalForm.value.parentId) modalForm.value.parentId = null
|
||||
if (!modalForm.value.parentId)
|
||||
modalForm.value.parentId = null
|
||||
if (modalAction.value === 'add') {
|
||||
const res = await api.addPermission(modalForm.value)
|
||||
newFormData = res.data
|
||||
} else if (modalAction.value === 'edit') {
|
||||
}
|
||||
else if (modalAction.value === 'edit') {
|
||||
await api.savePermission(modalForm.value.id, modalForm.value)
|
||||
}
|
||||
okLoading.value = false
|
||||
$message.success('保存成功')
|
||||
emit('refresh', modalAction.value === 'add' ? newFormData : modalForm.value)
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error)
|
||||
okLoading.value = false
|
||||
return false
|
||||
|
||||
@@ -21,15 +21,21 @@
|
||||
<div class="ml-40 w-0 flex-1">
|
||||
<template v-if="currentMenu">
|
||||
<div class="flex justify-between">
|
||||
<h3 class="mb-12">{{ currentMenu.name }}</h3>
|
||||
<n-button size="small" type="primary" @click="handleEdit(currentMenu)">
|
||||
<h3 class="mb-12">
|
||||
{{ currentMenu.name }}
|
||||
</h3>
|
||||
<NButton size="small" type="primary" @click="handleEdit(currentMenu)">
|
||||
<i class="i-material-symbols:edit-outline mr-4 text-14" />
|
||||
编辑
|
||||
</n-button>
|
||||
</NButton>
|
||||
</div>
|
||||
<n-descriptions label-placement="left" bordered :column="2">
|
||||
<n-descriptions-item label="编码">{{ currentMenu.code }}</n-descriptions-item>
|
||||
<n-descriptions-item label="名称">{{ currentMenu.name }}</n-descriptions-item>
|
||||
<n-descriptions-item label="编码">
|
||||
{{ currentMenu.code }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="名称">
|
||||
{{ currentMenu.name }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="路由地址">
|
||||
{{ currentMenu.path ?? '--' }}
|
||||
</n-descriptions-item>
|
||||
@@ -61,11 +67,13 @@
|
||||
</n-descriptions>
|
||||
|
||||
<div class="mt-32 flex justify-between">
|
||||
<h3 class="mb-12">按钮</h3>
|
||||
<n-button size="small" type="primary" @click="handleAddBtn">
|
||||
<h3 class="mb-12">
|
||||
按钮
|
||||
</h3>
|
||||
<NButton size="small" type="primary" @click="handleAddBtn">
|
||||
<i class="i-fe:plus mr-4 text-14" />
|
||||
新增
|
||||
</n-button>
|
||||
</NButton>
|
||||
</div>
|
||||
|
||||
<MeCrud
|
||||
@@ -74,7 +82,7 @@
|
||||
:scroll-x="-1"
|
||||
:get-data="api.getButtons"
|
||||
:query-items="{ parentId: currentMenu.id }"
|
||||
></MeCrud>
|
||||
/>
|
||||
</template>
|
||||
<n-empty v-else class="h-450 f-c-c" size="large" description="请选择菜单查看详情" />
|
||||
</div>
|
||||
@@ -87,11 +95,13 @@
|
||||
import { NButton, NSwitch } from 'naive-ui'
|
||||
import MenuTree from './components/MenuTree.vue'
|
||||
import ResAddOrEdit from './components/ResAddOrEdit.vue'
|
||||
import { MeCrud } from '@/components'
|
||||
import api from './api'
|
||||
import { MeCrud } from '@/components'
|
||||
|
||||
const treeData = ref([])
|
||||
const treeLoading = ref(false)
|
||||
const $table = ref(null)
|
||||
const currentMenu = ref(null)
|
||||
async function initData(data) {
|
||||
if (data?.type === 'BUTTON') {
|
||||
$table.value.handleSearch()
|
||||
@@ -102,17 +112,16 @@ async function initData(data) {
|
||||
treeData.value = res?.data || []
|
||||
treeLoading.value = false
|
||||
|
||||
if (data) currentMenu.value = data
|
||||
if (data)
|
||||
currentMenu.value = data
|
||||
}
|
||||
initData()
|
||||
|
||||
const currentMenu = ref(null)
|
||||
|
||||
const modalRef = ref(null)
|
||||
function handleEdit(item = {}) {
|
||||
modalRef.value?.handleOpen({
|
||||
action: 'edit',
|
||||
title: '编辑菜单 - ' + item.name,
|
||||
title: `编辑菜单 - ${item.name}`,
|
||||
row: item,
|
||||
okText: '保存',
|
||||
})
|
||||
@@ -124,7 +133,7 @@ const btnsColumns = [
|
||||
{
|
||||
title: '状态',
|
||||
key: 'enable',
|
||||
render: (row) =>
|
||||
render: row =>
|
||||
h(
|
||||
NSwitch,
|
||||
{
|
||||
@@ -137,7 +146,7 @@ const btnsColumns = [
|
||||
{
|
||||
checked: () => '启用',
|
||||
unchecked: () => '停用',
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -159,7 +168,7 @@ const btnsColumns = [
|
||||
{
|
||||
default: () => '编辑',
|
||||
icon: () => h('i', { class: 'i-material-symbols:edit-outline text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
h(
|
||||
@@ -173,20 +182,20 @@ const btnsColumns = [
|
||||
{
|
||||
default: () => '删除',
|
||||
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
]
|
||||
},
|
||||
},
|
||||
]
|
||||
const $table = ref(null)
|
||||
|
||||
watch(
|
||||
() => currentMenu.value,
|
||||
async (v) => {
|
||||
await nextTick()
|
||||
if (v) $table.value.handleSearch()
|
||||
}
|
||||
if (v)
|
||||
$table.value.handleSearch()
|
||||
},
|
||||
)
|
||||
|
||||
function handleAddBtn() {
|
||||
@@ -201,7 +210,7 @@ function handleAddBtn() {
|
||||
function handleEditBtn(row) {
|
||||
modalRef.value?.handleOpen({
|
||||
action: 'edit',
|
||||
title: '编辑按钮 - ' + row.name,
|
||||
title: `编辑按钮 - ${row.name}`,
|
||||
row,
|
||||
okText: '保存',
|
||||
})
|
||||
@@ -220,7 +229,8 @@ function handleDeleteBtn(id) {
|
||||
$message.success('删除成功')
|
||||
$table.value.handleSearch()
|
||||
d.loading = false
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
d.loading = false
|
||||
}
|
||||
},
|
||||
@@ -236,7 +246,8 @@ async function handleEnable(item) {
|
||||
$message.success('操作成功')
|
||||
$table.value?.handleSearch()
|
||||
item.enableLoading = false
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
item.enableLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
import { request } from '@/utils'
|
||||
|
||||
export default {
|
||||
create: (data) => request.post('/role', data),
|
||||
create: data => request.post('/role', data),
|
||||
read: (params = {}) => request.get('/role/page', { params }),
|
||||
update: (data) => request.patch(`/role/${data.id}`, data),
|
||||
delete: (id) => request.delete(`/role/${id}`),
|
||||
update: data => request.patch(`/role/${data.id}`, data),
|
||||
delete: id => request.delete(`/role/${id}`),
|
||||
|
||||
getAllPermissionTree: () => request.get('/permission/tree'),
|
||||
getAllUsers: (params = {}) => request.get('/user', { params }),
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<template>
|
||||
<CommonPage>
|
||||
<template #action>
|
||||
<n-button type="primary" @click="handleAdd()">
|
||||
<NButton type="primary" @click="handleAdd()">
|
||||
<i class="i-material-symbols:add mr-4 text-18" />
|
||||
新增角色
|
||||
</n-button>
|
||||
</NButton>
|
||||
</template>
|
||||
|
||||
<MeCrud
|
||||
@@ -74,17 +74,20 @@
|
||||
:data="permissionTree"
|
||||
:checked-keys="modalForm.permissionIds"
|
||||
:on-update:checked-keys="(keys) => (modalForm.permissionIds = keys)"
|
||||
default-expand-all
|
||||
checkable
|
||||
check-on-click
|
||||
|
||||
default-expand-all checkable check-on-click
|
||||
class="cus-scroll max-h-200 w-full"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="状态" path="enable">
|
||||
<n-switch v-model:value="modalForm.enable">
|
||||
<template #checked>启用</template>
|
||||
<template #unchecked>停用</template>
|
||||
</n-switch>
|
||||
<NSwitch v-model:value="modalForm.enable">
|
||||
<template #checked>
|
||||
启用
|
||||
</template>
|
||||
<template #unchecked>
|
||||
停用
|
||||
</template>
|
||||
</NSwitch>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</MeModal>
|
||||
@@ -93,9 +96,9 @@
|
||||
|
||||
<script setup>
|
||||
import { NButton, NSwitch } from 'naive-ui'
|
||||
import { MeCrud, MeQueryItem, MeModal } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
import api from './api'
|
||||
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
|
||||
defineOptions({ name: 'RoleMgt' })
|
||||
|
||||
@@ -109,13 +112,23 @@ onMounted(() => {
|
||||
$table.value?.handleSearch()
|
||||
})
|
||||
|
||||
const { modalRef, modalFormRef, modalAction, modalForm, handleAdd, handleDelete, handleEdit }
|
||||
= useCrud({
|
||||
name: '角色',
|
||||
doCreate: api.create,
|
||||
doDelete: api.delete,
|
||||
doUpdate: api.update,
|
||||
initForm: { enable: true },
|
||||
refresh: () => $table.value?.handleSearch(),
|
||||
})
|
||||
|
||||
const columns = [
|
||||
{ title: '角色名', key: 'name' },
|
||||
{ title: '角色编码', key: 'code' },
|
||||
{
|
||||
title: '状态',
|
||||
key: 'enable',
|
||||
render: (row) =>
|
||||
render: row =>
|
||||
h(
|
||||
NSwitch,
|
||||
{
|
||||
@@ -129,7 +142,7 @@ const columns = [
|
||||
{
|
||||
checked: () => '启用',
|
||||
unchecked: () => '停用',
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -152,7 +165,7 @@ const columns = [
|
||||
{
|
||||
default: () => '分配用户',
|
||||
icon: () => h('i', { class: 'i-fe:user-plus text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
@@ -166,7 +179,7 @@ const columns = [
|
||||
{
|
||||
default: () => '编辑',
|
||||
icon: () => h('i', { class: 'i-material-symbols:edit-outline text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
h(
|
||||
@@ -181,7 +194,7 @@ const columns = [
|
||||
{
|
||||
default: () => '删除',
|
||||
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
]
|
||||
},
|
||||
@@ -195,21 +208,12 @@ async function handleEnable(row) {
|
||||
row.enableLoading = false
|
||||
$message.success('操作成功')
|
||||
$table.value?.handleSearch()
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
row.enableLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
const { modalRef, modalFormRef, modalAction, modalForm, handleAdd, handleDelete, handleEdit } =
|
||||
useCrud({
|
||||
name: '角色',
|
||||
doCreate: api.create,
|
||||
doDelete: api.delete,
|
||||
doUpdate: api.update,
|
||||
initForm: { enable: true },
|
||||
refresh: () => $table.value?.handleSearch(),
|
||||
})
|
||||
|
||||
const permissionTree = ref([])
|
||||
api.getAllPermissionTree().then(({ data = [] }) => (permissionTree.value = data))
|
||||
</script>
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
<template>
|
||||
<CommonPage back>
|
||||
<template #title-suffix>
|
||||
<n-tag class="ml-12" type="warning">{{ route.query.roleName }}</n-tag>
|
||||
<NTag class="ml-12" type="warning">
|
||||
{{ route.query.roleName }}
|
||||
</NTag>
|
||||
</template>
|
||||
<template #action>
|
||||
<div class="flex items-center">
|
||||
<n-button :disabled="!userIds.length" type="error" @click="handleBatchRemove()">
|
||||
<NButton :disabled="!userIds.length" type="error" @click="handleBatchRemove()">
|
||||
<i v-if="userIds.length" class="i-material-symbols:delete-outline mr-4 text-18" />
|
||||
批量取消授权
|
||||
</n-button>
|
||||
<n-button
|
||||
</NButton>
|
||||
<NButton
|
||||
class="ml-12"
|
||||
:disabled="!userIds.length"
|
||||
type="primary"
|
||||
@@ -25,7 +27,7 @@
|
||||
>
|
||||
<i v-if="userIds.length" class="i-line-md:confirm-circle mr-4 text-18" />
|
||||
批量授权
|
||||
</n-button>
|
||||
</NButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -66,10 +68,10 @@
|
||||
|
||||
<script setup>
|
||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||
import { h } from 'vue'
|
||||
import api from './api'
|
||||
import { MeCrud, MeQueryItem } from '@/components'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import api from './api'
|
||||
import { h } from 'vue'
|
||||
|
||||
defineOptions({ name: 'RoleUser' })
|
||||
const route = useRoute()
|
||||
@@ -111,8 +113,8 @@ const columns = [
|
||||
h(
|
||||
NTag,
|
||||
{ type: 'success', style: index > 0 ? 'margin-left: 8px;' : '' },
|
||||
{ default: () => item.name }
|
||||
)
|
||||
{ default: () => item.name },
|
||||
),
|
||||
)
|
||||
}
|
||||
return '暂无角色'
|
||||
@@ -122,14 +124,14 @@ const columns = [
|
||||
title: '性别',
|
||||
key: 'gender',
|
||||
width: 80,
|
||||
render: ({ gender }) => genders.find((item) => gender === item.value)?.label ?? '',
|
||||
render: ({ gender }) => genders.find(item => gender === item.value)?.label ?? '',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'createDate',
|
||||
width: 180,
|
||||
render(row) {
|
||||
return h('span', formatDateTime(row['createTime']))
|
||||
return h('span', formatDateTime(row.createTime))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -137,7 +139,7 @@ const columns = [
|
||||
key: 'enable',
|
||||
width: 100,
|
||||
|
||||
render: (row) =>
|
||||
render: row =>
|
||||
h(
|
||||
NSwitch,
|
||||
{
|
||||
@@ -148,7 +150,7 @@ const columns = [
|
||||
{
|
||||
checked: () => '启用',
|
||||
unchecked: () => '停用',
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -159,33 +161,33 @@ const columns = [
|
||||
fixed: 'right',
|
||||
hideInExcel: true,
|
||||
render(row) {
|
||||
return row.roles?.some((item) => item.id === +route.params.roleId)
|
||||
return row.roles?.some(item => item.id === +route.params.roleId)
|
||||
? h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'error',
|
||||
secondary: true,
|
||||
onClick: () => handleBatchRemove([row.id]),
|
||||
},
|
||||
{
|
||||
default: () => '取消授权',
|
||||
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
|
||||
}
|
||||
)
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'error',
|
||||
secondary: true,
|
||||
onClick: () => handleBatchRemove([row.id]),
|
||||
},
|
||||
{
|
||||
default: () => '取消授权',
|
||||
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
|
||||
},
|
||||
)
|
||||
: h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
secondary: true,
|
||||
onClick: () => handleBatchAdd([row.id]),
|
||||
},
|
||||
{
|
||||
default: () => '授权',
|
||||
icon: () => h('i', { class: 'i-line-md:confirm-circle text-14' }),
|
||||
}
|
||||
)
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
secondary: true,
|
||||
onClick: () => handleBatchAdd([row.id]),
|
||||
},
|
||||
{
|
||||
default: () => '授权',
|
||||
icon: () => h('i', { class: 'i-line-md:confirm-circle text-14' }),
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -197,8 +199,10 @@ function onChecked(rowKeys) {
|
||||
|
||||
function handleBatchAdd(ids = userIds.value) {
|
||||
const roleId = route.params.roleId
|
||||
if (!roleId) return $message.error('角色异常,请重新选择角色')
|
||||
if (!ids.length) return $message.error('请先选择用户')
|
||||
if (!roleId)
|
||||
return $message.error('角色异常,请重新选择角色')
|
||||
if (!ids.length)
|
||||
return $message.error('请先选择用户')
|
||||
$dialog.confirm({
|
||||
content: `确认分配【${route.query.roleName}】?`,
|
||||
async confirm() {
|
||||
@@ -209,8 +213,10 @@ function handleBatchAdd(ids = userIds.value) {
|
||||
}
|
||||
function handleBatchRemove(ids = userIds.value) {
|
||||
const roleId = route.params.roleId
|
||||
if (!roleId) return $message.error('角色异常,请重新选择角色')
|
||||
if (!ids.length) return $message.error('请先选择用户')
|
||||
if (!roleId)
|
||||
return $message.error('角色异常,请重新选择角色')
|
||||
if (!ids.length)
|
||||
return $message.error('请先选择用户')
|
||||
$dialog.confirm({
|
||||
content: `确认取消分配【${route.query.roleName}】?`,
|
||||
async confirm() {
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
import { request } from '@/utils'
|
||||
|
||||
export default {
|
||||
create: (data) => request.post('/user', data),
|
||||
create: data => request.post('/user', data),
|
||||
read: (params = {}) => request.get('/user', { params }),
|
||||
update: (data) => request.patch(`/user/${data.id}`, data),
|
||||
delete: (id) => request.delete(`/user/${id}`),
|
||||
update: data => request.patch(`/user/${data.id}`, data),
|
||||
delete: id => request.delete(`/user/${id}`),
|
||||
resetPwd: (id, data) => request.patch(`/user/password/reset/${id}`, data),
|
||||
|
||||
getAllRoles: () => request.get('/role?enable=1'),
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<template>
|
||||
<CommonPage>
|
||||
<template #action>
|
||||
<n-button v-permission="'AddUser'" type="primary" @click="handleAdd()">
|
||||
<NButton v-permission="'AddUser'" type="primary" @click="handleAdd()">
|
||||
<i class="i-material-symbols:add mr-4 text-18" />
|
||||
创建新用户
|
||||
</n-button>
|
||||
</NButton>
|
||||
</template>
|
||||
|
||||
<MeCrud
|
||||
@@ -92,10 +92,14 @@
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="modalAction === 'add'" label="状态" path="enable">
|
||||
<n-switch v-model:value="modalForm.enable">
|
||||
<template #checked>启用</template>
|
||||
<template #unchecked>停用</template>
|
||||
</n-switch>
|
||||
<NSwitch v-model:value="modalForm.enable">
|
||||
<template #checked>
|
||||
启用
|
||||
</template>
|
||||
<template #unchecked>
|
||||
停用
|
||||
</template>
|
||||
</NSwitch>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<n-alert v-if="modalAction === 'add'" type="warning" closable>
|
||||
@@ -107,10 +111,10 @@
|
||||
|
||||
<script setup>
|
||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import { MeCrud, MeQueryItem, MeModal } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
import api from './api'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
|
||||
defineOptions({ name: 'UserMgt' })
|
||||
|
||||
@@ -129,6 +133,24 @@ const genders = [
|
||||
const roles = ref([])
|
||||
api.getAllRoles().then(({ data = [] }) => (roles.value = data))
|
||||
|
||||
const {
|
||||
modalRef,
|
||||
modalFormRef,
|
||||
modalForm,
|
||||
modalAction,
|
||||
handleAdd,
|
||||
handleDelete,
|
||||
handleOpen,
|
||||
handleSave,
|
||||
} = useCrud({
|
||||
name: '用户',
|
||||
initForm: { enable: true },
|
||||
doCreate: api.create,
|
||||
doDelete: api.delete,
|
||||
doUpdate: api.update,
|
||||
refresh: () => $table.value?.handleSearch(),
|
||||
})
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '头像',
|
||||
@@ -152,8 +174,8 @@ const columns = [
|
||||
h(
|
||||
NTag,
|
||||
{ type: 'success', style: index > 0 ? 'margin-left: 8px;' : '' },
|
||||
{ default: () => item.name }
|
||||
)
|
||||
{ default: () => item.name },
|
||||
),
|
||||
)
|
||||
}
|
||||
return '暂无角色'
|
||||
@@ -163,7 +185,7 @@ const columns = [
|
||||
title: '性别',
|
||||
key: 'gender',
|
||||
width: 80,
|
||||
render: ({ gender }) => genders.find((item) => gender === item.value)?.label ?? '',
|
||||
render: ({ gender }) => genders.find(item => gender === item.value)?.label ?? '',
|
||||
},
|
||||
{ title: '邮箱', key: 'email', width: 150, ellipsis: { tooltip: true } },
|
||||
{
|
||||
@@ -171,14 +193,14 @@ const columns = [
|
||||
key: 'createDate',
|
||||
width: 180,
|
||||
render(row) {
|
||||
return h('span', formatDateTime(row['createTime']))
|
||||
return h('span', formatDateTime(row.createTime))
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'enable',
|
||||
width: 120,
|
||||
render: (row) =>
|
||||
render: row =>
|
||||
h(
|
||||
NSwitch,
|
||||
{
|
||||
@@ -191,7 +213,7 @@ const columns = [
|
||||
{
|
||||
checked: () => '启用',
|
||||
unchecked: () => '停用',
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -214,7 +236,7 @@ const columns = [
|
||||
{
|
||||
default: () => '分配角色',
|
||||
icon: () => h('i', { class: 'i-carbon:user-role text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
@@ -227,7 +249,7 @@ const columns = [
|
||||
{
|
||||
default: () => '重置密码',
|
||||
icon: () => h('i', { class: 'i-radix-icons:reset text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
h(
|
||||
@@ -241,7 +263,7 @@ const columns = [
|
||||
{
|
||||
default: () => '删除',
|
||||
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
|
||||
}
|
||||
},
|
||||
),
|
||||
]
|
||||
},
|
||||
@@ -255,13 +277,14 @@ async function handleEnable(row) {
|
||||
row.enableLoading = false
|
||||
$message.success('操作成功')
|
||||
$table.value?.handleSearch()
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
row.enableLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleOpenRolesSet(row) {
|
||||
const roleIds = row.roles.map((item) => item.id)
|
||||
const roleIds = row.roles.map(item => item.id)
|
||||
handleOpen({
|
||||
action: 'setRole',
|
||||
title: '分配角色',
|
||||
@@ -270,31 +293,14 @@ function handleOpenRolesSet(row) {
|
||||
})
|
||||
}
|
||||
|
||||
const {
|
||||
modalRef,
|
||||
modalFormRef,
|
||||
modalForm,
|
||||
modalAction,
|
||||
handleAdd,
|
||||
handleDelete,
|
||||
handleOpen,
|
||||
handleSave,
|
||||
} = useCrud({
|
||||
name: '用户',
|
||||
initForm: { enable: true },
|
||||
doCreate: api.create,
|
||||
doDelete: api.delete,
|
||||
doUpdate: api.update,
|
||||
refresh: () => $table.value?.handleSearch(),
|
||||
})
|
||||
|
||||
function onSave() {
|
||||
if (modalAction.value === 'setRole') {
|
||||
return handleSave({
|
||||
api: () => api.update(modalForm.value),
|
||||
cb: () => $message.success('分配成功'),
|
||||
})
|
||||
} else if (modalAction.value === 'reset') {
|
||||
}
|
||||
else if (modalAction.value === 'reset') {
|
||||
return handleSave({
|
||||
api: () => api.resetPwd(modalForm.value.id, modalForm.value),
|
||||
cb: () => $message.success('密码重置成功'),
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
import { request } from '@/utils'
|
||||
|
||||
export default {
|
||||
changePassword: (data) => request.post('/auth/password', data),
|
||||
updateProfile: (data) => request.patch(`/user/profile/${data.id}`, data),
|
||||
changePassword: data => request.post('/auth/password', data),
|
||||
updateProfile: data => request.patch(`/user/profile/${data.id}`, data),
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
</n-button>
|
||||
</div>
|
||||
<div class="mt-16 flex items-center">
|
||||
<n-button type="primary" ghost @click="avatarModalRef.open()">更改头像</n-button>
|
||||
<n-button type="primary" ghost @click="avatarModalRef.open()">
|
||||
更改头像
|
||||
</n-button>
|
||||
<span class="ml-12 opacity-60">
|
||||
修改头像只支持在线链接,不提供上传图片功能,如有需要可自行对接!
|
||||
</span>
|
||||
@@ -44,12 +46,18 @@
|
||||
:column="1"
|
||||
bordered
|
||||
>
|
||||
<n-descriptions-item label="昵称">{{ userStore.nickName }}</n-descriptions-item>
|
||||
<n-descriptions-item label="昵称">
|
||||
{{ userStore.nickName }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="性别">
|
||||
{{ genders.find((item) => item.value === userStore.userInfo?.gender)?.label ?? '未知' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="地址">{{ userStore.userInfo?.address }}</n-descriptions-item>
|
||||
<n-descriptions-item label="邮箱">{{ userStore.userInfo?.email }}</n-descriptions-item>
|
||||
<n-descriptions-item label="地址">
|
||||
{{ userStore.userInfo?.address }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="邮箱">
|
||||
{{ userStore.userInfo?.email }}
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</n-card>
|
||||
|
||||
@@ -97,11 +105,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import api from './api'
|
||||
import { MeModal } from '@/components'
|
||||
import { useForm, useModal } from '@/composables'
|
||||
import { useUserStore } from '@/store'
|
||||
import { getUserInfo } from '@/store/helper'
|
||||
import api from './api'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const required = {
|
||||
|
||||
Reference in New Issue
Block a user