reactor:【system 系统管理】notifymessage、operatelog、socialuser
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemSocialUserApi } from '#/api/system/social/user';
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
@@ -99,3 +105,61 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'type',
|
||||
label: '社交平台',
|
||||
content: (data: SystemSocialUserApi.SocialUser) => {
|
||||
return h(DictTag, {
|
||||
type: DICT_TYPE.SYSTEM_SOCIAL_TYPE,
|
||||
value: data?.type,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'nickname',
|
||||
label: '用户昵称',
|
||||
},
|
||||
{
|
||||
field: 'avatar',
|
||||
label: '用户头像',
|
||||
content: (data: SystemSocialUserApi.SocialUser) => {
|
||||
if (data?.avatar) {
|
||||
// TODO @芋艿:使用 antd 的 Image 组件
|
||||
return h('img', {
|
||||
src: data.avatar,
|
||||
style: 'width: 30px; height: 30px; cursor: pointer;',
|
||||
onClick: () => {
|
||||
// 可以添加图片预览功能
|
||||
window.open(data.avatar, '_blank');
|
||||
},
|
||||
});
|
||||
}
|
||||
return '无';
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'token',
|
||||
label: '社交 token',
|
||||
},
|
||||
{
|
||||
field: 'rawTokenInfo',
|
||||
label: '原始 Token 数据',
|
||||
},
|
||||
{
|
||||
field: 'rawUserInfo',
|
||||
label: '原始 User 数据',
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
label: '最后一次的认证 code',
|
||||
},
|
||||
{
|
||||
field: 'state',
|
||||
label: '最后一次的认证 state',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
<script lang="ts" setup>
|
||||
<script setup lang="ts">
|
||||
import type { SystemSocialUserApi } from '#/api/system/social/user';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
|
||||
import { Descriptions, DescriptionsItem, Image } from 'ant-design-vue';
|
||||
|
||||
import { getSocialUser } from '#/api/system/social/user';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { useDescription } from '#/components/description';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useDetailSchema } from '../data';
|
||||
|
||||
const formData = ref<SystemSocialUserApi.SocialUser>();
|
||||
|
||||
const [Descriptions] = useDescription({
|
||||
componentProps: {
|
||||
bordered: true,
|
||||
column: 1,
|
||||
size: 'middle',
|
||||
class: 'mx-4',
|
||||
labelStyle: { width: '185px' },
|
||||
},
|
||||
schema: useDetailSchema(),
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
title: $t('ui.actionTitle.detail'),
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
@@ -43,37 +53,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
>
|
||||
<Descriptions
|
||||
bordered
|
||||
:column="1"
|
||||
size="middle"
|
||||
class="mx-4"
|
||||
:label-style="{ width: '185px' }"
|
||||
>
|
||||
<DescriptionsItem label="社交平台">
|
||||
<DictTag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="formData?.type" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="用户昵称">
|
||||
{{ formData?.nickname }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="用户头像">
|
||||
<Image :src="formData?.avatar" :width="30" :height="30" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="社交 token">
|
||||
{{ formData?.token }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="原始 Token 数据">
|
||||
{{ formData?.rawTokenInfo }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="原始 User 数据">
|
||||
{{ formData?.rawUserInfo }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="最后一次的认证 code">
|
||||
{{ formData?.code }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="最后一次的认证 state">
|
||||
{{ formData?.state }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
<Descriptions :data="formData" />
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user