commit
516620e29b
@ -14,7 +14,7 @@ logger = logging.getLogger(__name__)
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", summary="查看用户列表", dependencies=[DependPermisson])
|
@router.get("/list", summary="查看用户列表")
|
||||||
async def list_user(
|
async def list_user(
|
||||||
page: int = Query(1, description="页码"),
|
page: int = Query(1, description="页码"),
|
||||||
page_size: int = Query(10, description="每页数量"),
|
page_size: int = Query(10, description="每页数量"),
|
||||||
@ -32,7 +32,7 @@ async def list_user(
|
|||||||
return SuccessExtra(data=data, total=total, page=page, page_size=page_size)
|
return SuccessExtra(data=data, total=total, page=page, page_size=page_size)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/get", summary="查看用户", dependencies=[DependPermisson])
|
@router.get("/get", summary="查看用户")
|
||||||
async def get_user(
|
async def get_user(
|
||||||
user_id: int = Query(..., description="用户ID"),
|
user_id: int = Query(..., description="用户ID"),
|
||||||
):
|
):
|
||||||
@ -42,7 +42,7 @@ async def get_user(
|
|||||||
return Success(data=user_dict)
|
return Success(data=user_dict)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/create", summary="创建用户", dependencies=[DependPermisson])
|
@router.post("/create", summary="创建用户")
|
||||||
async def create_user(
|
async def create_user(
|
||||||
user_in: UserCreate,
|
user_in: UserCreate,
|
||||||
):
|
):
|
||||||
@ -58,7 +58,7 @@ async def create_user(
|
|||||||
return Success(msg="Created Successfully")
|
return Success(msg="Created Successfully")
|
||||||
|
|
||||||
|
|
||||||
@router.post("/update", summary="更新用户", dependencies=[DependPermisson])
|
@router.post("/update", summary="更新用户")
|
||||||
async def update_user(
|
async def update_user(
|
||||||
user_in: UserUpdate,
|
user_in: UserUpdate,
|
||||||
):
|
):
|
||||||
@ -68,7 +68,7 @@ async def update_user(
|
|||||||
return Success(msg="Updated Successfully")
|
return Success(msg="Updated Successfully")
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/delete", summary="删除用户", dependencies=[DependPermisson])
|
@router.delete("/delete", summary="删除用户")
|
||||||
async def delete_user(
|
async def delete_user(
|
||||||
user_id: int = Query(..., description="用户ID"),
|
user_id: int = Query(..., description="用户ID"),
|
||||||
):
|
):
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import { createI18n } from 'vue-i18n'
|
import { createI18n } from 'vue-i18n'
|
||||||
import { sStorage } from '@/utils'
|
import { lStorage } from '@/utils'
|
||||||
|
|
||||||
import messages from './messages'
|
import messages from './messages'
|
||||||
|
|
||||||
const currentLocale = sStorage.get('locale')
|
const currentLocale = lStorage.get('locale')
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
legacy: false,
|
legacy: false,
|
||||||
globalInjection: true,
|
globalInjection: true,
|
||||||
locale: currentLocale || 'en',
|
locale: currentLocale || 'cn',
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'cn',
|
||||||
messages: messages,
|
messages: messages,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useAppStore } from '@/store'
|
import { useAppStore } from '@/store'
|
||||||
|
import { router } from '~/src/router'
|
||||||
|
|
||||||
const store = useAppStore()
|
const store = useAppStore()
|
||||||
const { availableLocales, t } = useI18n()
|
const { availableLocales, t } = useI18n()
|
||||||
@ -26,5 +27,7 @@ const options = computed(() => {
|
|||||||
|
|
||||||
const handleChangeLocale = (value) => {
|
const handleChangeLocale = (value) => {
|
||||||
store.setLocale(value)
|
store.setLocale(value)
|
||||||
|
// reload page
|
||||||
|
router.go()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { useDark } from '@vueuse/core'
|
import { useDark } from '@vueuse/core'
|
||||||
import { sStorage } from '@/utils'
|
import { lStorage } from '@/utils'
|
||||||
import i18n from '~/i18n'
|
import i18n from '~/i18n'
|
||||||
|
|
||||||
const currentLocale = sStorage.get('locale')
|
const currentLocale = lStorage.get('locale')
|
||||||
const { locale } = i18n.global
|
const { locale } = i18n.global
|
||||||
|
|
||||||
const isDark = useDark()
|
const isDark = useDark()
|
||||||
@ -54,7 +54,7 @@ export const useAppStore = defineStore('app', {
|
|||||||
setLocale(newLocale) {
|
setLocale(newLocale) {
|
||||||
this.locale = newLocale
|
this.locale = newLocale
|
||||||
locale.value = newLocale
|
locale.value = newLocale
|
||||||
sStorage.set('locale', newLocale)
|
lStorage.set('locale', newLocale)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { sStorage } from '@/utils'
|
import { lStorage } from '@/utils'
|
||||||
|
|
||||||
export const activeTag = sStorage.get('activeTag')
|
export const activeTag = lStorage.get('activeTag')
|
||||||
export const tags = sStorage.get('tags')
|
export const tags = lStorage.get('tags')
|
||||||
|
|
||||||
export const WITHOUT_TAG_PATHS = ['/404', '/login']
|
export const WITHOUT_TAG_PATHS = ['/404', '/login']
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { activeTag, tags, WITHOUT_TAG_PATHS } from './helpers'
|
import { activeTag, tags, WITHOUT_TAG_PATHS } from './helpers'
|
||||||
import { router } from '@/router'
|
import { router } from '@/router'
|
||||||
import { sStorage } from '@/utils'
|
import { lStorage } from '@/utils'
|
||||||
|
|
||||||
export const useTagsStore = defineStore('tag', {
|
export const useTagsStore = defineStore('tag', {
|
||||||
state() {
|
state() {
|
||||||
@ -18,11 +18,11 @@ export const useTagsStore = defineStore('tag', {
|
|||||||
actions: {
|
actions: {
|
||||||
setActiveTag(path) {
|
setActiveTag(path) {
|
||||||
this.activeTag = path
|
this.activeTag = path
|
||||||
sStorage.set('activeTag', path)
|
lStorage.set('activeTag', path)
|
||||||
},
|
},
|
||||||
setTags(tags) {
|
setTags(tags) {
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
sStorage.set('tags', tags)
|
lStorage.set('tags', tags)
|
||||||
},
|
},
|
||||||
addTag(tag = {}) {
|
addTag(tag = {}) {
|
||||||
this.setActiveTag(tag.path)
|
this.setActiveTag(tag.path)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { useCRUD } from '@/composables'
|
|||||||
// import { loginTypeMap, loginTypeOptions } from '@/constant/data'
|
// import { loginTypeMap, loginTypeOptions } from '@/constant/data'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
|
|
||||||
defineOptions({ name: 'Api列表' })
|
defineOptions({ name: 'API管理' })
|
||||||
|
|
||||||
const $table = ref(null)
|
const $table = ref(null)
|
||||||
const queryItems = ref({})
|
const queryItems = ref({})
|
||||||
@ -141,9 +141,9 @@ const columns = [
|
|||||||
{
|
{
|
||||||
default: () => '编辑',
|
default: () => '编辑',
|
||||||
icon: renderIcon('material-symbols:edit', { size: 16 }),
|
icon: renderIcon('material-symbols:edit', { size: 16 }),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
[[vPermission, 'post/api/v1/api/update']],
|
[[vPermission, 'post/api/v1/api/update']]
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
NPopconfirm,
|
NPopconfirm,
|
||||||
@ -163,12 +163,12 @@ const columns = [
|
|||||||
{
|
{
|
||||||
default: () => '删除',
|
default: () => '删除',
|
||||||
icon: renderIcon('material-symbols:delete-outline', { size: 16 }),
|
icon: renderIcon('material-symbols:delete-outline', { size: 16 }),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
[[vPermission, 'delete/api/v1/api/delete']],
|
[[vPermission, 'delete/api/v1/api/delete']]
|
||||||
),
|
),
|
||||||
default: () => h('div', {}, '确定删除该API吗?'),
|
default: () => h('div', {}, '确定删除该API吗?'),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import api from '@/api'
|
|||||||
import TheIcon from '@/components/icon/TheIcon.vue'
|
import TheIcon from '@/components/icon/TheIcon.vue'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
defineOptions({ name: '用户列表' })
|
defineOptions({ name: '用户管理' })
|
||||||
|
|
||||||
const $table = ref(null)
|
const $table = ref(null)
|
||||||
const queryItems = ref({})
|
const queryItems = ref({})
|
||||||
@ -99,7 +99,7 @@ const columns = [
|
|||||||
const group = []
|
const group = []
|
||||||
for (let i = 0; i < roles.length; i++)
|
for (let i = 0; i < roles.length; i++)
|
||||||
group.push(
|
group.push(
|
||||||
h(NTag, { type: 'info', style: { margin: '2px 3px' } }, { default: () => roles[i].name }),
|
h(NTag, { type: 'info', style: { margin: '2px 3px' } }, { default: () => roles[i].name })
|
||||||
)
|
)
|
||||||
return h('span', group)
|
return h('span', group)
|
||||||
},
|
},
|
||||||
@ -113,7 +113,7 @@ const columns = [
|
|||||||
return h(
|
return h(
|
||||||
NTag,
|
NTag,
|
||||||
{ type: 'info', style: { margin: '2px 3px' } },
|
{ type: 'info', style: { margin: '2px 3px' } },
|
||||||
{ default: () => (row.is_superuser ? '是' : '否') },
|
{ default: () => (row.is_superuser ? '是' : '否') }
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -130,7 +130,7 @@ const columns = [
|
|||||||
{
|
{
|
||||||
default: () => (row.last_login !== null ? formatDate(row.last_login) : null),
|
default: () => (row.last_login !== null ? formatDate(row.last_login) : null),
|
||||||
icon: renderIcon('mdi:update', { size: 16 }),
|
icon: renderIcon('mdi:update', { size: 16 }),
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -175,9 +175,9 @@ const columns = [
|
|||||||
{
|
{
|
||||||
default: () => '编辑',
|
default: () => '编辑',
|
||||||
icon: renderIcon('material-symbols:edit', { size: 16 }),
|
icon: renderIcon('material-symbols:edit', { size: 16 }),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
[[vPermission, 'post/api/v1/user/update']],
|
[[vPermission, 'post/api/v1/user/update']]
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
NPopconfirm,
|
NPopconfirm,
|
||||||
@ -197,12 +197,12 @@ const columns = [
|
|||||||
{
|
{
|
||||||
default: () => '删除',
|
default: () => '删除',
|
||||||
icon: renderIcon('material-symbols:delete-outline', { size: 16 }),
|
icon: renderIcon('material-symbols:delete-outline', { size: 16 }),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
[[vPermission, 'delete/api/v1/user/delete']],
|
[[vPermission, 'delete/api/v1/user/delete']]
|
||||||
),
|
),
|
||||||
default: () => h('div', {}, '确定删除该用户吗?'),
|
default: () => h('div', {}, '确定删除该用户吗?'),
|
||||||
},
|
}
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user