feat:【system】oauth2.0:100%
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view class="yd-page-container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<wd-navbar
|
||||
title="OAuth2 客户端详情"
|
||||
title="应用详情"
|
||||
left-arrow placeholder safe-area-inset-top fixed
|
||||
@click-left="handleBack"
|
||||
/>
|
||||
@@ -77,7 +77,7 @@ function handleBack() {
|
||||
navigateBackPlus('/pages-system/oauth2/index')
|
||||
}
|
||||
|
||||
/** 加载 OAuth2 客户端详情 */
|
||||
/** 加载应用详情 */
|
||||
async function getDetail() {
|
||||
if (!props.id) {
|
||||
return
|
||||
@@ -90,21 +90,21 @@ async function getDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 编辑 OAuth2 客户端 */
|
||||
/** 编辑应用 */
|
||||
function handleEdit() {
|
||||
uni.navigateTo({
|
||||
url: `/pages-system/oauth2/client/form/index?id=${props.id}`,
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除 OAuth2 客户端 */
|
||||
/** 删除应用 */
|
||||
function handleDelete() {
|
||||
if (!props.id) {
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该 OAuth2 客户端吗?',
|
||||
content: '确定要删除该应用吗?',
|
||||
success: async (res) => {
|
||||
if (!res.confirm) {
|
||||
return
|
||||
|
||||
@@ -111,7 +111,7 @@ definePage({
|
||||
})
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑 OAuth2 客户端' : '新增 OAuth2 客户端')
|
||||
const getTitle = computed(() => props.id ? '编辑应用' : '新增应用')
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<OAuth2Client>({
|
||||
id: undefined,
|
||||
@@ -145,7 +145,7 @@ function handleBack() {
|
||||
navigateBackPlus('/pages-system/oauth2/index')
|
||||
}
|
||||
|
||||
/** 加载 OAuth2 客户端详情 */
|
||||
/** 加载应用详情 */
|
||||
async function getDetail() {
|
||||
if (!props.id) {
|
||||
return
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- 搜索组件 -->
|
||||
<ClientSearchForm @search="handleQuery" @reset="handleReset" />
|
||||
|
||||
<!-- OAuth2 客户端列表 -->
|
||||
<!-- 应用列表 -->
|
||||
<view class="p-24rpx">
|
||||
<view
|
||||
v-for="item in list"
|
||||
@@ -13,19 +13,15 @@
|
||||
>
|
||||
<view class="p-24rpx">
|
||||
<view class="mb-16rpx flex items-center justify-between">
|
||||
<view class="text-32rpx text-[#333] font-semibold">
|
||||
<view class="min-w-0 flex-1 truncate text-32rpx text-[#333] font-semibold">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="item.status" />
|
||||
<dict-tag class="ml-16rpx shrink-0" :type="DICT_TYPE.COMMON_STATUS" :value="item.status" />
|
||||
</view>
|
||||
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
|
||||
<text class="mr-8rpx shrink-0 text-[#999]">客户端编号:</text>
|
||||
<text class="min-w-0 flex-1 truncate">{{ item.clientId || '-' }}</text>
|
||||
</view>
|
||||
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
|
||||
<text class="mr-8rpx text-[#999]">客户端密钥:</text>
|
||||
<text class="min-w-0 flex-1 truncate">{{ item.secret || '-' }}</text>
|
||||
</view>
|
||||
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
|
||||
<text class="mr-8rpx text-[#999]">访问令牌有效期:</text>
|
||||
<text>{{ item.accessTokenValiditySeconds }} 秒</text>
|
||||
@@ -43,7 +39,7 @@
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="py-100rpx text-center">
|
||||
<wd-status-tip image="content" tip="暂无 OAuth2 客户端数据" />
|
||||
<wd-status-tip image="content" tip="暂无应用数据" />
|
||||
</view>
|
||||
<wd-loadmore
|
||||
v-if="list.length > 0"
|
||||
@@ -82,7 +78,7 @@ const queryParams = ref({
|
||||
pageSize: 10,
|
||||
})
|
||||
|
||||
/** 查询 OAuth2 客户端列表 */
|
||||
/** 查询应用列表 */
|
||||
async function getList() {
|
||||
loadMoreState.value = 'loading'
|
||||
try {
|
||||
@@ -121,7 +117,7 @@ function loadMore() {
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 新增 OAuth2 客户端 */
|
||||
/** 新增应用 */
|
||||
function handleAdd() {
|
||||
uni.navigateTo({
|
||||
url: '/pages-system/oauth2/client/form/index',
|
||||
|
||||
@@ -72,7 +72,7 @@ const placeholder = computed(() => {
|
||||
if (formData.status !== -1) {
|
||||
conditions.push(`状态:${getDictLabel(DICT_TYPE.COMMON_STATUS, formData.status)}`)
|
||||
}
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索 OAuth2 客户端'
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索应用'
|
||||
})
|
||||
|
||||
/** 搜索 */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- 搜索组件 -->
|
||||
<TokenSearchForm @search="handleQuery" @reset="handleReset" />
|
||||
|
||||
<!-- OAuth2 令牌列表 -->
|
||||
<!-- 令牌列表 -->
|
||||
<view class="p-24rpx">
|
||||
<view
|
||||
v-for="item in list"
|
||||
@@ -40,10 +40,10 @@
|
||||
<!-- 删除按钮 -->
|
||||
<view
|
||||
v-if="hasAccessByCodes(['system:oauth2-token:delete'])"
|
||||
class="mt-16rpx flex justify-end"
|
||||
class="-mt-8 flex justify-end"
|
||||
>
|
||||
<wd-button size="small" type="error" @click="handleDelete(item)">
|
||||
删除
|
||||
强退
|
||||
</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="py-100rpx text-center">
|
||||
<wd-status-tip image="content" tip="暂无 OAuth2 令牌数据" />
|
||||
<wd-status-tip image="content" tip="暂无令牌数据" />
|
||||
</view>
|
||||
<wd-loadmore
|
||||
v-if="list.length > 0"
|
||||
@@ -83,7 +83,7 @@ const queryParams = ref({
|
||||
pageSize: 10,
|
||||
})
|
||||
|
||||
/** 查询 OAuth2 令牌列表 */
|
||||
/** 查询令牌列表 */
|
||||
async function getList() {
|
||||
loadMoreState.value = 'loading'
|
||||
try {
|
||||
@@ -122,7 +122,7 @@ function loadMore() {
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 删除 OAuth2 令牌 */
|
||||
/** 删除令牌 */
|
||||
function handleDelete(item: OAuth2Token) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -131,14 +131,10 @@ function handleDelete(item: OAuth2Token) {
|
||||
if (!res.confirm) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await deleteOAuth2Token(item.accessToken)
|
||||
toast.success('删除成功')
|
||||
// 刷新列表
|
||||
handleQuery()
|
||||
} catch {
|
||||
// 错误处理
|
||||
}
|
||||
await deleteOAuth2Token(item.accessToken)
|
||||
toast.success('删除成功')
|
||||
// 刷新列表
|
||||
handleQuery()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ const placeholder = computed(() => {
|
||||
conditions.push(`类型:${getDictLabel(DICT_TYPE.USER_TYPE, formData.userType)}`)
|
||||
}
|
||||
if (formData.clientId) {
|
||||
conditions.push(`客户端:${formData.clientId}`)
|
||||
conditions.push(`应用:${formData.clientId}`)
|
||||
}
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索 OAuth2 令牌'
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索令牌'
|
||||
})
|
||||
|
||||
/** 搜索 */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="yd-page-container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<wd-navbar
|
||||
title="OAuth2 管理"
|
||||
title="OAuth2.0 管理"
|
||||
left-arrow placeholder safe-area-inset-top fixed
|
||||
@click-left="handleBack"
|
||||
/>
|
||||
@@ -10,8 +10,8 @@
|
||||
<!-- Tab 切换 -->
|
||||
<view class="bg-white">
|
||||
<wd-tabs v-model="tabIndex" shrink @change="handleTabChange">
|
||||
<wd-tab title="OAuth2 客户端" />
|
||||
<wd-tab title="OAuth2 令牌" />
|
||||
<wd-tab title="应用管理" />
|
||||
<wd-tab title="令牌管理" />
|
||||
</wd-tabs>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user