feat:【system】social 三方登录:100%

This commit is contained in:
YunaiV
2025-12-21 10:47:37 +08:00
parent d2bd4d8738
commit a1d1a1309d
8 changed files with 83 additions and 41 deletions

View File

@@ -2,7 +2,7 @@
<view class="yd-page-container">
<!-- 顶部导航栏 -->
<wd-navbar
title="社交客户端详情"
title="三方应用详情"
left-arrow placeholder safe-area-inset-top fixed
@click-left="handleBack"
/>
@@ -18,9 +18,10 @@
<wd-cell title="用户类型">
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="formData?.userType" />
</wd-cell>
<wd-cell title="客户端编号" :value="String(formData?.clientId ?? '-')" />
<wd-cell title="客户端密钥" :value="String(formData?.clientSecret ?? '-')" />
<wd-cell title="应用编号" :value="String(formData?.clientId ?? '-')" />
<wd-cell title="应用密钥" :value="String(formData?.clientSecret ?? '-')" />
<wd-cell title="agentId" :value="String(formData?.agentId ?? '-')" />
<wd-cell title="publicKey" :value="String(formData?.publicKey ?? '-')" />
<wd-cell title="状态">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="formData?.status" />
</wd-cell>
@@ -79,7 +80,7 @@ function handleBack() {
navigateBackPlus('/pages-system/social/index')
}
/** 加载社交客户端详情 */
/** 加载三方应用详情 */
async function getDetail() {
if (!props.id) {
return
@@ -92,21 +93,21 @@ async function getDetail() {
}
}
/** 编辑社交客户端 */
/** 编辑三方应用 */
function handleEdit() {
uni.navigateTo({
url: `/pages-system/social/client/form/index?id=${props.id}`,
})
}
/** 删除社交客户端 */
/** 删除三方应用 */
function handleDelete() {
if (!props.id) {
return
}
uni.showModal({
title: '提示',
content: '确定要删除该社交客户端吗?',
content: '确定要删除该三方应用吗?',
success: async (res) => {
if (!res.confirm) {
return

View File

@@ -41,21 +41,22 @@
</wd-cell>
<wd-input
v-model="formData.clientId"
label="客户端编号"
label="应用编号"
label-width="200rpx"
prop="clientId"
clearable
placeholder="请输入客户端编号,对应各平台的 appKey"
placeholder="请输入应用编号,对应各平台的 appKey"
/>
<wd-input
v-model="formData.clientSecret"
label="客户端密钥"
label="应用密钥"
label-width="200rpx"
prop="clientSecret"
clearable
placeholder="请输入客户端密钥,对应各平台的 appSecret"
placeholder="请输入应用密钥,对应各平台的 appSecret"
/>
<wd-input
v-show="formData.socialType === 30"
v-model="formData.agentId"
label="agentId"
label-width="200rpx"
@@ -63,6 +64,15 @@
clearable
placeholder="授权方的网页应用 ID有则填"
/>
<wd-input
v-show="formData.socialType === 40"
v-model="formData.publicKey"
label="publicKey"
label-width="200rpx"
prop="publicKey"
clearable
placeholder="请输入 publicKey 公钥"
/>
<wd-cell title="状态" title-width="200rpx" prop="status" center>
<wd-radio-group v-model="formData.status" shape="button">
<wd-radio
@@ -113,24 +123,25 @@ definePage({
})
const toast = useToast()
const getTitle = computed(() => props.id ? '编辑社交客户端' : '新增社交客户端')
const getTitle = computed(() => props.id ? '编辑三方应用' : '新增三方应用')
const formLoading = ref(false)
const formData = ref<SocialClient>({
id: undefined,
name: '',
socialType: 0,
socialType: undefined,
userType: 1,
clientId: '',
clientSecret: '',
agentId: '',
publicKey: '',
status: 0,
})
const formRules = {
name: [{ required: true, message: '应用名不能为空' }],
socialType: [{ required: true, message: '社交平台不能为空' }],
userType: [{ required: true, message: '用户类型不能为空' }],
clientId: [{ required: true, message: '客户端编号不能为空' }],
clientSecret: [{ required: true, message: '客户端密钥不能为空' }],
clientId: [{ required: true, message: '应用编号不能为空' }],
clientSecret: [{ required: true, message: '应用密钥不能为空' }],
}
const formRef = ref()
@@ -139,7 +150,7 @@ function handleBack() {
navigateBackPlus('/pages-system/social/index')
}
/** 加载社交客户端详情 */
/** 加载三方应用详情 */
async function getDetail() {
if (!props.id) {
return

View File

@@ -3,7 +3,7 @@
<!-- 搜索组件 -->
<ClientSearchForm @search="handleQuery" @reset="handleReset" />
<!-- 社交客户端列表 -->
<!-- 三方应用列表 -->
<view class="p-24rpx">
<view
v-for="item in list"
@@ -19,7 +19,7 @@
<dict-tag :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="mr-8rpx shrink-0 text-[#999]">三方平台</text>
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="item.socialType" />
</view>
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
@@ -27,7 +27,7 @@
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="item.userType" />
</view>
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
<text class="mr-8rpx text-[#999]">客户端编号</text>
<text class="mr-8rpx 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]">
@@ -39,7 +39,7 @@
<!-- 加载更多 -->
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="py-100rpx text-center">
<wd-status-tip image="content" tip="暂无社交客户端数据" />
<wd-status-tip image="content" tip="暂无三方应用数据" />
</view>
<wd-loadmore
v-if="list.length > 0"
@@ -78,7 +78,7 @@ const queryParams = ref({
pageSize: 10,
})
/** 查询社交客户端列表 */
/** 查询三方应用列表 */
async function getList() {
loadMoreState.value = 'loading'
try {
@@ -117,7 +117,7 @@ function loadMore() {
getList()
}
/** 新增社交客户端 */
/** 新增三方应用 */
function handleAdd() {
uni.navigateTo({
url: '/pages-system/social/client/form/index',

View File

@@ -19,7 +19,7 @@
</view>
<view class="yd-search-form-item">
<view class="yd-search-form-label">
社交平台
三方平台
</view>
<wd-radio-group v-model="formData.socialType" shape="button">
<wd-radio :value="-1">
@@ -114,7 +114,7 @@ const placeholder = computed(() => {
if (formData.status !== -1) {
conditions.push(`状态:${getDictLabel(DICT_TYPE.COMMON_STATUS, formData.status)}`)
}
return conditions.length > 0 ? conditions.join(' | ') : '搜索社交客户端'
return conditions.length > 0 ? conditions.join(' | ') : '搜索三方应用'
})
/** 搜索 */

View File

@@ -3,7 +3,7 @@
<!-- 搜索组件 -->
<UserSearchForm @search="handleQuery" @reset="handleReset" />
<!-- 社交用户列表 -->
<!-- 三方用户列表 -->
<view class="p-24rpx">
<view
v-for="item in list"
@@ -24,7 +24,7 @@
</view>
<view v-if="item.avatar" class="mb-12rpx flex items-center text-28rpx text-[#666]">
<text class="mr-8rpx text-[#999]">头像</text>
<image :src="item.avatar" class="h-80rpx w-80rpx rounded-8rpx" mode="aspectFill" />
<wd-img :src="item.avatar" width="60rpx" height="60rpx" />
</view>
<view class="mb-12rpx flex items-center text-28rpx text-[#666]">
<text class="mr-8rpx text-[#999]">创建时间</text>
@@ -35,7 +35,7 @@
<!-- 加载更多 -->
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="py-100rpx text-center">
<wd-status-tip image="content" tip="暂无社交用户数据" />
<wd-status-tip image="content" tip="暂无三方用户数据" />
</view>
<wd-loadmore
v-if="list.length > 0"
@@ -63,7 +63,7 @@ const queryParams = ref({
pageSize: 10,
})
/** 查询社交用户列表 */
/** 查询三方用户列表 */
async function getList() {
loadMoreState.value = 'loading'
try {

View File

@@ -9,7 +9,7 @@
<view class="yd-search-form-container" :style="{ paddingTop: `${getNavbarHeight()}px` }">
<view class="yd-search-form-item">
<view class="yd-search-form-label">
社交平台
三方平台
</view>
<wd-radio-group v-model="formData.type" shape="button">
<wd-radio :value="-1">
@@ -86,7 +86,7 @@ const placeholder = computed(() => {
if (formData.openid) {
conditions.push(`openid:${formData.openid}`)
}
return conditions.length > 0 ? conditions.join(' | ') : '搜索社交用户'
return conditions.length > 0 ? conditions.join(' | ') : '搜索三方用户'
})
/** 搜索 */

View File

@@ -2,7 +2,7 @@
<view class="yd-page-container">
<!-- 顶部导航栏 -->
<wd-navbar
title="社交用户管理"
title="三方用户管理"
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="社交客户端" />
<wd-tab title="社交用户" />
<wd-tab title="三方应用" />
<wd-tab title="三方用户" />
</wd-tabs>
</view>

View File

@@ -2,7 +2,7 @@
<view class="yd-page-container">
<!-- 顶部导航栏 -->
<wd-navbar
title="社交用户详情"
title="三方用户详情"
left-arrow placeholder safe-area-inset-top fixed
@click-left="handleBack"
/>
@@ -10,17 +10,33 @@
<!-- 详情内容 -->
<view>
<wd-cell-group border>
<wd-cell title="社交平台">
<wd-cell title="三方平台">
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="formData?.type" />
</wd-cell>
<wd-cell title="用户昵称" :value="String(formData?.nickname ?? '-')" />
<wd-cell v-if="formData?.avatar" title="用户头像">
<image :src="formData.avatar" class="h-120rpx w-120rpx rounded-8rpx" mode="aspectFill" />
<wd-img :src="formData.avatar" width="120rpx" height="120rpx" />
</wd-cell>
<wd-cell title="社交 openid" is-link @click="handleCopyText(formData?.openid, '社交 openid')">
<view class="max-w-400rpx truncate text-right">
{{ formData?.openid || '-' }}
</view>
</wd-cell>
<wd-cell title="社交 token" is-link @click="handleCopyText(formData?.token, '社交 token')">
<view class="max-w-400rpx truncate text-right">
{{ formData?.token || '-' }}
</view>
</wd-cell>
<wd-cell title="原始 Token 数据" is-link @click="handleCopyText(formData?.rawTokenInfo, '原始 Token 数据')">
<view class="max-w-400rpx truncate text-right">
{{ formData?.rawTokenInfo || '-' }}
</view>
</wd-cell>
<wd-cell title="原始 User 数据" is-link @click="handleCopyText(formData?.rawUserInfo, '原始 User 数据')">
<view class="max-w-400rpx truncate text-right">
{{ formData?.rawUserInfo || '-' }}
</view>
</wd-cell>
<wd-cell title="社交 openid" :value="String(formData?.openid ?? '-')" />
<wd-cell title="社交 token" :value="String(formData?.token ?? '-')" />
<wd-cell title="原始 Token 数据" :value="String(formData?.rawTokenInfo ?? '-')" />
<wd-cell title="原始 User 数据" :value="String(formData?.rawUserInfo ?? '-')" />
<wd-cell title="最后一次的认证 code" :value="String(formData?.code ?? '-')" />
<wd-cell title="最后一次的认证 state" :value="String(formData?.state ?? '-')" />
<wd-cell title="创建时间" :value="formatDateTime(formData?.createTime) || '-'" />
@@ -58,7 +74,21 @@ function handleBack() {
navigateBackPlus('/pages-system/social/index')
}
/** 加载社交用户详情 */
/** 复制文本并提示 */
function handleCopyText(text?: string, title?: string) {
if (!text || text === '-') {
return
}
uni.setClipboardData({
data: text,
success: () => {
uni.hideToast()
toast.success(`${title || '内容'}已复制`)
},
})
}
/** 加载三方用户详情 */
async function getDetail() {
if (!props.id) {
return