提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<ContentWrap> |
|
3 |
<!-- 搜索工作栏 --> |
|
4 |
<el-form |
|
5 |
ref="queryFormRef" |
|
6 |
:inline="true" |
|
7 |
:model="queryParams" |
|
8 |
class="-mb-15px" |
|
9 |
label-width="120px" |
|
10 |
> |
|
11 |
<el-form-item label="社交平台" prop="type"> |
|
12 |
<el-select |
|
13 |
v-model="queryParams.type" |
|
14 |
class="!w-240px" |
|
15 |
clearable |
|
16 |
placeholder="请选择社交平台" |
|
17 |
> |
|
18 |
<el-option |
|
19 |
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_SOCIAL_TYPE)" |
|
20 |
:key="dict.value" |
|
21 |
:label="dict.label" |
|
22 |
:value="dict.value" |
|
23 |
/> |
|
24 |
</el-select> |
|
25 |
</el-form-item> |
|
26 |
<el-form-item label="用户昵称" prop="nickname"> |
|
27 |
<el-input |
|
28 |
v-model="queryParams.nickname" |
|
29 |
class="!w-240px" |
|
30 |
clearable |
|
31 |
placeholder="请输入用户昵称" |
|
32 |
@keyup.enter="handleQuery" |
|
33 |
/> |
|
34 |
</el-form-item> |
|
35 |
<el-form-item label="社交 openid" prop="openid"> |
|
36 |
<el-input |
|
37 |
v-model="queryParams.openid" |
|
38 |
class="!w-240px" |
|
39 |
clearable |
|
40 |
placeholder="请输入社交 openid" |
|
41 |
@keyup.enter="handleQuery" |
|
42 |
/> |
|
43 |
</el-form-item> |
|
44 |
<el-form-item label="创建时间" prop="createTime"> |
|
45 |
<el-date-picker |
|
46 |
v-model="queryParams.createTime" |
|
47 |
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
|
48 |
class="!w-240px" |
|
49 |
end-placeholder="结束日期" |
|
50 |
start-placeholder="开始日期" |
|
51 |
type="daterange" |
|
52 |
value-format="YYYY-MM-DD HH:mm:ss" |
|
53 |
/> |
|
54 |
</el-form-item> |
|
55 |
<el-form-item> |
|
56 |
<el-button @click="handleQuery"> |
|
57 |
<Icon class="mr-5px" icon="ep:search" /> |
|
58 |
搜索 |
|
59 |
</el-button> |
|
60 |
<el-button @click="resetQuery"> |
|
61 |
<Icon class="mr-5px" icon="ep:refresh" /> |
|
62 |
重置 |
|
63 |
</el-button> |
|
64 |
</el-form-item> |
|
65 |
</el-form> |
|
66 |
</ContentWrap> |
|
67 |
|
|
68 |
<!-- 列表 --> |
|
69 |
<ContentWrap> |
|
70 |
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true"> |
|
71 |
<el-table-column align="center" label="社交平台" prop="type"> |
|
72 |
<template #default="scope"> |
|
73 |
<dict-tag :type="DICT_TYPE.SYSTEM_SOCIAL_TYPE" :value="scope.row.type" /> |
|
74 |
</template> |
|
75 |
</el-table-column> |
|
76 |
<el-table-column align="center" label="社交 openid" prop="openid" /> |
|
77 |
<el-table-column align="center" label="用户昵称" prop="nickname" /> |
|
78 |
<el-table-column align="center" label="用户头像" prop="avatar"> |
|
79 |
<template #default="{ row }"> |
|
80 |
<el-image :src="row.avatar" class="h-30px w-30px" @click="imagePreview(row.avatar)" /> |
|
81 |
</template> |
|
82 |
</el-table-column> |
|
83 |
<el-table-column |
|
84 |
:formatter="dateFormatter" |
|
85 |
align="center" |
|
86 |
label="创建时间" |
|
87 |
prop="createTime" |
|
88 |
width="180px" |
|
89 |
/> |
|
90 |
<el-table-column |
|
91 |
:formatter="dateFormatter" |
|
92 |
align="center" |
|
93 |
label="更新时间" |
|
94 |
prop="updateTime" |
|
95 |
width="180px" |
|
96 |
/> |
|
97 |
<el-table-column align="center" fixed="right" label="操作"> |
|
98 |
<template #default="scope"> |
|
99 |
<el-button |
|
100 |
v-hasPermi="['system:social-user:query']" |
|
101 |
link |
|
102 |
type="primary" |
|
103 |
@click="openDetail(scope.row.id)" |
|
104 |
> |
|
105 |
详情 |
|
106 |
</el-button> |
|
107 |
</template> |
|
108 |
</el-table-column> |
|
109 |
</el-table> |
|
110 |
<!-- 分页 --> |
|
111 |
<Pagination |
|
112 |
v-model:limit="queryParams.pageSize" |
|
113 |
v-model:page="queryParams.pageNo" |
|
114 |
:total="total" |
|
115 |
@pagination="getList" |
|
116 |
/> |
|
117 |
</ContentWrap> |
|
118 |
|
|
119 |
<!-- 表单弹窗:详情 --> |
|
120 |
<SocialUserDetail ref="detailRef" /> |
|
121 |
</template> |
|
122 |
|
|
123 |
<script lang="ts" setup> |
|
124 |
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
|
125 |
import { dateFormatter } from '@/utils/formatTime' |
|
126 |
import * as SocialUserApi from '@/api/system/social/user' |
|
127 |
import SocialUserDetail from './SocialUserDetail.vue' |
|
128 |
import { createImageViewer } from '@/components/ImageViewer' |
|
129 |
|
|
130 |
defineOptions({ name: 'SocialUser' }) |
|
131 |
|
|
132 |
const loading = ref(true) // 列表的加载中 |
|
133 |
const total = ref(0) // 列表的总页数 |
|
134 |
const list = ref([]) // 列表的数据 |
|
135 |
const queryParams = reactive({ |
|
136 |
pageNo: 1, |
|
137 |
pageSize: 10, |
|
138 |
type: undefined, |
|
139 |
openid: undefined, |
|
140 |
nickname: undefined, |
|
141 |
createTime: [] |
|
142 |
}) |
|
143 |
const queryFormRef = ref() // 搜索的表单 |
|
144 |
|
|
145 |
/** 查询列表 */ |
|
146 |
const getList = async () => { |
|
147 |
loading.value = true |
|
148 |
try { |
|
149 |
const data = await SocialUserApi.getSocialUserPage(queryParams) |
|
150 |
list.value = data.list |
|
151 |
total.value = data.total |
|
152 |
} finally { |
|
153 |
loading.value = false |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
/** 搜索按钮操作 */ |
|
158 |
const handleQuery = () => { |
|
159 |
queryParams.pageNo = 1 |
|
160 |
getList() |
|
161 |
} |
|
162 |
|
|
163 |
/** 重置按钮操作 */ |
|
164 |
const resetQuery = () => { |
|
165 |
queryFormRef.value.resetFields() |
|
166 |
handleQuery() |
|
167 |
} |
|
168 |
|
|
169 |
const imagePreview = (imgUrl: string) => { |
|
170 |
createImageViewer({ |
|
171 |
urlList: [imgUrl] |
|
172 |
}) |
|
173 |
} |
|
174 |
|
|
175 |
/** 详情操作 */ |
|
176 |
const detailRef = ref() |
|
177 |
const openDetail = (id: number) => { |
|
178 |
detailRef.value.open(id) |
|
179 |
} |
|
180 |
|
|
181 |
/** 初始化 **/ |
|
182 |
onMounted(() => { |
|
183 |
getList() |
|
184 |
}) |
|
185 |
</script> |