Skip to content

Commit a9b91e7

Browse files
committed
优化:社交登录、用户的管理
1 parent ac7f1e2 commit a9b91e7

File tree

8 files changed

+98
-226
lines changed

8 files changed

+98
-226
lines changed

src/api/system/social/user/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,3 @@ export const getSocialUserPage = async (params) => {
2222
export const getSocialUser = async (id: number) => {
2323
return await request.get({ url: `/system/social-user/get?id=` + id })
2424
}
25-
26-
// 修改社交用户
27-
export const updateSocialUser = async (data: SocialUserVO) => {
28-
return await request.put({ url: `/system/social-user/update`, data })
29-
}
30-
31-
// 删除社交用户
32-
export const deleteSocialUser = async (id: number) => {
33-
return await request.delete({ url: `/system/social-user/delete?id=` + id })
34-
}

src/utils/dict.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export enum DICT_TYPE {
116116
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
117117
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
118118
SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
119-
SYSTEM_SOCIAL_CLIENT_TYPE = 'system_social_client_type',
119+
SYSTEM_SOCIAL_TYPE = 'system_social_type',
120120

121121
// ========== INFRA 模块 ==========
122122
INFRA_BOOLEAN_STRING = 'infra_boolean_string',

src/views/system/loginlog/LoginLogDetail.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ defineOptions({ name: 'SystemLoginLogDetail' })
3434
3535
const dialogVisible = ref(false) // 弹窗的是否展示
3636
const detailLoading = ref(false) // 表单的加载中
37-
const detailData = ref() // 详情数据
37+
const detailData = ref({}) // 详情数据
3838
3939
/** 打开弹窗 */
4040
const open = async (data: LoginLogApi.LoginLogVO) => {

src/views/system/social/client/SocialClientForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<el-form-item label="社交平台" prop="socialType">
1414
<el-radio-group v-model="formData.socialType">
1515
<el-radio
16-
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_SOCIAL_CLIENT_TYPE)"
16+
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_SOCIAL_TYPE)"
1717
:key="dict.value"
1818
:label="dict.value"
1919
>
@@ -41,8 +41,8 @@
4141
placeholder="请输入客户端密钥,对应各平台的appSecret"
4242
/>
4343
</el-form-item>
44-
<el-form-item label="agentId" prop="agentId">
45-
<el-input v-model="formData.agentId" placeholder="授权方的网页应用ID,有则填" />
44+
<el-form-item label="agentId" prop="agentId" v-if="formData!.socialType === 30">
45+
<el-input v-model="formData.agentId" placeholder="授权方的网页应用 ID,有则填" />
4646
</el-form-item>
4747
<el-form-item label="状态" prop="status">
4848
<el-radio-group v-model="formData.status">

src/views/system/social/client/index.vue

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
placeholder="请选择社交平台"
2626
>
2727
<el-option
28-
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_SOCIAL_CLIENT_TYPE)"
28+
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_SOCIAL_TYPE)"
2929
:key="dict.value"
3030
:label="dict.label"
3131
:value="dict.value"
@@ -56,15 +56,6 @@
5656
@keyup.enter="handleQuery"
5757
/>
5858
</el-form-item>
59-
<el-form-item label="客户端密钥" prop="clientSecret">
60-
<el-input
61-
v-model="queryParams.clientSecret"
62-
class="!w-240px"
63-
clearable
64-
placeholder="请输入客户端密钥"
65-
@keyup.enter="handleQuery"
66-
/>
67-
</el-form-item>
6859
<el-form-item label="状态" prop="status">
6960
<el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="请选择状态">
7061
<el-option
@@ -75,17 +66,6 @@
7566
/>
7667
</el-select>
7768
</el-form-item>
78-
<el-form-item label="创建时间" prop="createTime">
79-
<el-date-picker
80-
v-model="queryParams.createTime"
81-
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
82-
class="!w-240px"
83-
end-placeholder="结束日期"
84-
start-placeholder="开始日期"
85-
type="daterange"
86-
value-format="YYYY-MM-DD HH:mm:ss"
87-
/>
88-
</el-form-item>
8969
<el-form-item>
9070
<el-button @click="handleQuery">
9171
<Icon class="mr-5px" icon="ep:search" />
@@ -115,16 +95,15 @@
11595
<el-table-column align="center" label="应用名" prop="name" />
11696
<el-table-column align="center" label="社交平台" prop="socialType">
11797
<template #default="scope">
118-
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_CLIENT_TYPE" :value="scope.row.socialType" />
98+
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="scope.row.socialType" />
11999
</template>
120100
</el-table-column>
121101
<el-table-column align="center" label="用户类型" prop="userType">
122102
<template #default="scope">
123103
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
124104
</template>
125105
</el-table-column>
126-
<el-table-column align="center" label="客户端编号" prop="clientId" />
127-
<el-table-column align="center" label="客户端密钥" prop="clientSecret" />
106+
<el-table-column align="center" label="客户端编号" prop="clientId" width="180px" />
128107
<el-table-column align="center" label="状态" prop="status">
129108
<template #default="scope">
130109
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
@@ -192,9 +171,7 @@ const queryParams = reactive({
192171
socialType: null,
193172
userType: null,
194173
clientId: null,
195-
clientSecret: null,
196-
status: null,
197-
createTime: []
174+
status: null
198175
})
199176
const queryFormRef = ref() // 搜索的表单
200177
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<template>
2+
<Dialog v-model="dialogVisible" title="详情" width="800">
3+
<el-descriptions :column="1" border>
4+
<el-descriptions-item label="社交平台" min-width="160">
5+
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="detailData.type" />
6+
</el-descriptions-item>
7+
<el-descriptions-item label="用户昵称" min-width="120">
8+
{{ detailData.nickname }}
9+
</el-descriptions-item>
10+
<el-descriptions label="用户头像" min-width="120">
11+
<el-image :src="detailData.avatar" class="h-30px w-30px" />
12+
</el-descriptions>
13+
<el-descriptions-item label="社交 token" min-width="120">
14+
{{ detailData.token }}
15+
</el-descriptions-item>
16+
<el-descriptions-item label="原始 Token 数据" min-width="120">
17+
<el-input
18+
v-model="detailData.rawTokenInfo"
19+
:autosize="{ maxRows: 20 }"
20+
:readonly="true"
21+
type="textarea"
22+
/>
23+
</el-descriptions-item>
24+
<el-descriptions-item label="原始 User 数据" min-width="120">
25+
<el-input
26+
v-model="detailData.rawUserInfo"
27+
:autosize="{ maxRows: 20 }"
28+
:readonly="true"
29+
type="textarea"
30+
/>
31+
</el-descriptions-item>
32+
<el-descriptions-item label="最后一次的认证 code" min-width="120">
33+
{{ detailData.code }}
34+
</el-descriptions-item>
35+
<el-descriptions-item label="最后一次的认证 state" min-width="120">
36+
{{ detailData.state }}
37+
</el-descriptions-item>
38+
</el-descriptions>
39+
</Dialog>
40+
</template>
41+
<script lang="ts" setup>
42+
import { DICT_TYPE } from '@/utils/dict'
43+
import * as SocialUserApi from '@/api/system/social/user'
44+
45+
const dialogVisible = ref(false) // 弹窗的是否展示
46+
const detailLoading = ref(false) // 表单的加载中
47+
const detailData = ref({}) // 详情数据
48+
49+
/** 打开弹窗 */
50+
const open = async (id: number) => {
51+
dialogVisible.value = true
52+
// 设置数据
53+
try {
54+
detailData.value = await SocialUserApi.getSocialUser(id)
55+
} finally {
56+
detailLoading.value = false
57+
}
58+
}
59+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
60+
</script>

src/views/system/social/user/SocialUserForm.vue

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)