feat: 账号管理页面
Browse files
sau_frontend/src/views/About.vue
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="about">
|
| 3 |
+
<h1>关于我们</h1>
|
| 4 |
+
<p>这是关于页面</p>
|
| 5 |
+
</div>
|
| 6 |
+
</template>
|
| 7 |
+
|
| 8 |
+
<script setup>
|
| 9 |
+
// 关于页面组件
|
| 10 |
+
</script>
|
| 11 |
+
|
| 12 |
+
<style lang="scss" scoped>
|
| 13 |
+
@use '@/styles/variables.scss' as *;
|
| 14 |
+
|
| 15 |
+
.about {
|
| 16 |
+
text-align: center;
|
| 17 |
+
padding: 2rem;
|
| 18 |
+
|
| 19 |
+
h1 {
|
| 20 |
+
color: #2c3e50;
|
| 21 |
+
margin-bottom: 1rem;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
p {
|
| 25 |
+
color: #7f8c8d;
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
</style>
|
sau_frontend/src/views/AccountManagement.vue
ADDED
|
@@ -0,0 +1,840 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="account-management">
|
| 3 |
+
<div class="page-header">
|
| 4 |
+
<h1>账号管理</h1>
|
| 5 |
+
</div>
|
| 6 |
+
|
| 7 |
+
<div class="account-tabs">
|
| 8 |
+
<el-tabs v-model="activeTab" class="account-tabs-nav">
|
| 9 |
+
<el-tab-pane label="全部" name="all">
|
| 10 |
+
<div class="account-list-container">
|
| 11 |
+
<div class="account-search">
|
| 12 |
+
<el-input
|
| 13 |
+
v-model="searchKeyword"
|
| 14 |
+
placeholder="输入名称或账号搜索"
|
| 15 |
+
prefix-icon="Search"
|
| 16 |
+
clearable
|
| 17 |
+
@clear="handleSearch"
|
| 18 |
+
@input="handleSearch"
|
| 19 |
+
/>
|
| 20 |
+
<div class="action-buttons">
|
| 21 |
+
<el-button type="primary" @click="handleAddAccount">添加账号</el-button>
|
| 22 |
+
<el-button type="info" @click="fetchAccounts" :loading="false">
|
| 23 |
+
<el-icon :class="{ 'is-loading': appStore.isAccountRefreshing }"><Refresh /></el-icon>
|
| 24 |
+
<span v-if="appStore.isAccountRefreshing">刷新中</span>
|
| 25 |
+
</el-button>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div v-if="filteredAccounts.length > 0" class="account-list">
|
| 30 |
+
<el-table :data="filteredAccounts" style="width: 100%">
|
| 31 |
+
<el-table-column label="头像" width="80">
|
| 32 |
+
<template #default="scope">
|
| 33 |
+
<el-avatar :src="scope.row.avatar" :size="40" />
|
| 34 |
+
</template>
|
| 35 |
+
</el-table-column>
|
| 36 |
+
<el-table-column prop="name" label="名称" width="180" />
|
| 37 |
+
<el-table-column prop="platform" label="平台">
|
| 38 |
+
<template #default="scope">
|
| 39 |
+
<el-tag
|
| 40 |
+
:type="getPlatformTagType(scope.row.platform)"
|
| 41 |
+
effect="plain"
|
| 42 |
+
>
|
| 43 |
+
{{ scope.row.platform }}
|
| 44 |
+
</el-tag>
|
| 45 |
+
</template>
|
| 46 |
+
</el-table-column>
|
| 47 |
+
<el-table-column prop="status" label="状态">
|
| 48 |
+
<template #default="scope">
|
| 49 |
+
<el-tag
|
| 50 |
+
:type="scope.row.status === '正常' ? 'success' : 'danger'"
|
| 51 |
+
effect="plain"
|
| 52 |
+
>
|
| 53 |
+
{{ scope.row.status }}
|
| 54 |
+
</el-tag>
|
| 55 |
+
</template>
|
| 56 |
+
</el-table-column>
|
| 57 |
+
<el-table-column label="操作">
|
| 58 |
+
<template #default="scope">
|
| 59 |
+
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
| 60 |
+
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
| 61 |
+
</template>
|
| 62 |
+
</el-table-column>
|
| 63 |
+
</el-table>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div v-else class="empty-data">
|
| 67 |
+
<el-empty description="暂无账号数据" />
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
</el-tab-pane>
|
| 71 |
+
|
| 72 |
+
<el-tab-pane label="快手" name="kuaishou">
|
| 73 |
+
<div class="account-list-container">
|
| 74 |
+
<div class="account-search">
|
| 75 |
+
<el-input
|
| 76 |
+
v-model="searchKeyword"
|
| 77 |
+
placeholder="输入名称或账号搜索"
|
| 78 |
+
prefix-icon="Search"
|
| 79 |
+
clearable
|
| 80 |
+
@clear="handleSearch"
|
| 81 |
+
@input="handleSearch"
|
| 82 |
+
/>
|
| 83 |
+
<div class="action-buttons">
|
| 84 |
+
<el-button type="primary" @click="handleAddAccount">添加账号</el-button>
|
| 85 |
+
<el-button type="info" @click="fetchAccounts" :loading="false">
|
| 86 |
+
<el-icon :class="{ 'is-loading': appStore.isAccountRefreshing }"><Refresh /></el-icon>
|
| 87 |
+
<span v-if="appStore.isAccountRefreshing">刷新中</span>
|
| 88 |
+
</el-button>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
|
| 92 |
+
<div v-if="filteredKuaishouAccounts.length > 0" class="account-list">
|
| 93 |
+
<el-table :data="filteredKuaishouAccounts" style="width: 100%">
|
| 94 |
+
<el-table-column label="头像" width="80">
|
| 95 |
+
<template #default="scope">
|
| 96 |
+
<el-avatar :src="scope.row.avatar" :size="40" />
|
| 97 |
+
</template>
|
| 98 |
+
</el-table-column>
|
| 99 |
+
<el-table-column prop="name" label="名称" width="180" />
|
| 100 |
+
<el-table-column prop="platform" label="平台">
|
| 101 |
+
<template #default="scope">
|
| 102 |
+
<el-tag
|
| 103 |
+
:type="getPlatformTagType(scope.row.platform)"
|
| 104 |
+
effect="plain"
|
| 105 |
+
>
|
| 106 |
+
{{ scope.row.platform }}
|
| 107 |
+
</el-tag>
|
| 108 |
+
</template>
|
| 109 |
+
</el-table-column>
|
| 110 |
+
<el-table-column prop="status" label="状态">
|
| 111 |
+
<template #default="scope">
|
| 112 |
+
<el-tag
|
| 113 |
+
:type="scope.row.status === '正常' ? 'success' : 'danger'"
|
| 114 |
+
effect="plain"
|
| 115 |
+
>
|
| 116 |
+
{{ scope.row.status }}
|
| 117 |
+
</el-tag>
|
| 118 |
+
</template>
|
| 119 |
+
</el-table-column>
|
| 120 |
+
<el-table-column label="操作">
|
| 121 |
+
<template #default="scope">
|
| 122 |
+
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
| 123 |
+
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
| 124 |
+
</template>
|
| 125 |
+
</el-table-column>
|
| 126 |
+
</el-table>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div v-else class="empty-data">
|
| 130 |
+
<el-empty description="暂无快手账号数据" />
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
</el-tab-pane>
|
| 134 |
+
|
| 135 |
+
<el-tab-pane label="抖音" name="douyin">
|
| 136 |
+
<div class="account-list-container">
|
| 137 |
+
<div class="account-search">
|
| 138 |
+
<el-input
|
| 139 |
+
v-model="searchKeyword"
|
| 140 |
+
placeholder="输入名称或账号搜索"
|
| 141 |
+
prefix-icon="Search"
|
| 142 |
+
clearable
|
| 143 |
+
@clear="handleSearch"
|
| 144 |
+
@input="handleSearch"
|
| 145 |
+
/>
|
| 146 |
+
<div class="action-buttons">
|
| 147 |
+
<el-button type="primary" @click="handleAddAccount">添加账号</el-button>
|
| 148 |
+
<el-button type="info" @click="fetchAccounts" :loading="false">
|
| 149 |
+
<el-icon :class="{ 'is-loading': appStore.isAccountRefreshing }"><Refresh /></el-icon>
|
| 150 |
+
<span v-if="appStore.isAccountRefreshing">刷新中</span>
|
| 151 |
+
</el-button>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<div v-if="filteredDouyinAccounts.length > 0" class="account-list">
|
| 156 |
+
<el-table :data="filteredDouyinAccounts" style="width: 100%">
|
| 157 |
+
<el-table-column label="头像" width="80">
|
| 158 |
+
<template #default="scope">
|
| 159 |
+
<el-avatar :src="scope.row.avatar" :size="40" />
|
| 160 |
+
</template>
|
| 161 |
+
</el-table-column>
|
| 162 |
+
<el-table-column prop="name" label="名称" width="180" />
|
| 163 |
+
<el-table-column prop="platform" label="平台">
|
| 164 |
+
<template #default="scope">
|
| 165 |
+
<el-tag
|
| 166 |
+
:type="getPlatformTagType(scope.row.platform)"
|
| 167 |
+
effect="plain"
|
| 168 |
+
>
|
| 169 |
+
{{ scope.row.platform }}
|
| 170 |
+
</el-tag>
|
| 171 |
+
</template>
|
| 172 |
+
</el-table-column>
|
| 173 |
+
<el-table-column prop="status" label="状态">
|
| 174 |
+
<template #default="scope">
|
| 175 |
+
<el-tag
|
| 176 |
+
:type="scope.row.status === '正常' ? 'success' : 'danger'"
|
| 177 |
+
effect="plain"
|
| 178 |
+
>
|
| 179 |
+
{{ scope.row.status }}
|
| 180 |
+
</el-tag>
|
| 181 |
+
</template>
|
| 182 |
+
</el-table-column>
|
| 183 |
+
<el-table-column label="操作">
|
| 184 |
+
<template #default="scope">
|
| 185 |
+
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
| 186 |
+
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
| 187 |
+
</template>
|
| 188 |
+
</el-table-column>
|
| 189 |
+
</el-table>
|
| 190 |
+
</div>
|
| 191 |
+
|
| 192 |
+
<div v-else class="empty-data">
|
| 193 |
+
<el-empty description="暂无抖音账号数据" />
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
</el-tab-pane>
|
| 197 |
+
|
| 198 |
+
<el-tab-pane label="视频号" name="channels">
|
| 199 |
+
<div class="account-list-container">
|
| 200 |
+
<div class="account-search">
|
| 201 |
+
<el-input
|
| 202 |
+
v-model="searchKeyword"
|
| 203 |
+
placeholder="输入名称或账号搜索"
|
| 204 |
+
prefix-icon="Search"
|
| 205 |
+
clearable
|
| 206 |
+
@clear="handleSearch"
|
| 207 |
+
@input="handleSearch"
|
| 208 |
+
/>
|
| 209 |
+
<div class="action-buttons">
|
| 210 |
+
<el-button type="primary" @click="handleAddAccount">添加账号</el-button>
|
| 211 |
+
<el-button type="info" @click="fetchAccounts" :loading="false">
|
| 212 |
+
<el-icon :class="{ 'is-loading': appStore.isAccountRefreshing }"><Refresh /></el-icon>
|
| 213 |
+
<span v-if="appStore.isAccountRefreshing">刷新中</span>
|
| 214 |
+
</el-button>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<div v-if="filteredChannelsAccounts.length > 0" class="account-list">
|
| 219 |
+
<el-table :data="filteredChannelsAccounts" style="width: 100%">
|
| 220 |
+
<el-table-column label="头像" width="80">
|
| 221 |
+
<template #default="scope">
|
| 222 |
+
<el-avatar :src="scope.row.avatar" :size="40" />
|
| 223 |
+
</template>
|
| 224 |
+
</el-table-column>
|
| 225 |
+
<el-table-column prop="name" label="名称" width="180" />
|
| 226 |
+
<el-table-column prop="platform" label="平台">
|
| 227 |
+
<template #default="scope">
|
| 228 |
+
<el-tag
|
| 229 |
+
:type="getPlatformTagType(scope.row.platform)"
|
| 230 |
+
effect="plain"
|
| 231 |
+
>
|
| 232 |
+
{{ scope.row.platform }}
|
| 233 |
+
</el-tag>
|
| 234 |
+
</template>
|
| 235 |
+
</el-table-column>
|
| 236 |
+
<el-table-column prop="status" label="状态">
|
| 237 |
+
<template #default="scope">
|
| 238 |
+
<el-tag
|
| 239 |
+
:type="scope.row.status === '正常' ? 'success' : 'danger'"
|
| 240 |
+
effect="plain"
|
| 241 |
+
>
|
| 242 |
+
{{ scope.row.status }}
|
| 243 |
+
</el-tag>
|
| 244 |
+
</template>
|
| 245 |
+
</el-table-column>
|
| 246 |
+
<el-table-column label="操作">
|
| 247 |
+
<template #default="scope">
|
| 248 |
+
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
| 249 |
+
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
| 250 |
+
</template>
|
| 251 |
+
</el-table-column>
|
| 252 |
+
</el-table>
|
| 253 |
+
</div>
|
| 254 |
+
|
| 255 |
+
<div v-else class="empty-data">
|
| 256 |
+
<el-empty description="暂无视频号账号数据" />
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</el-tab-pane>
|
| 260 |
+
|
| 261 |
+
<el-tab-pane label="小红书" name="xiaohongshu">
|
| 262 |
+
<div class="account-list-container">
|
| 263 |
+
<div class="account-search">
|
| 264 |
+
<el-input
|
| 265 |
+
v-model="searchKeyword"
|
| 266 |
+
placeholder="输入名称或账号搜索"
|
| 267 |
+
prefix-icon="Search"
|
| 268 |
+
clearable
|
| 269 |
+
@clear="handleSearch"
|
| 270 |
+
@input="handleSearch"
|
| 271 |
+
/>
|
| 272 |
+
<div class="action-buttons">
|
| 273 |
+
<el-button type="primary" @click="handleAddAccount">添加账号</el-button>
|
| 274 |
+
<el-button type="info" @click="fetchAccounts" :loading="false">
|
| 275 |
+
<el-icon :class="{ 'is-loading': appStore.isAccountRefreshing }"><Refresh /></el-icon>
|
| 276 |
+
<span v-if="appStore.isAccountRefreshing">刷新中</span>
|
| 277 |
+
</el-button>
|
| 278 |
+
</div>
|
| 279 |
+
</div>
|
| 280 |
+
|
| 281 |
+
<div v-if="filteredXiaohongshuAccounts.length > 0" class="account-list">
|
| 282 |
+
<el-table :data="filteredXiaohongshuAccounts" style="width: 100%">
|
| 283 |
+
<el-table-column label="头像" width="80">
|
| 284 |
+
<template #default="scope">
|
| 285 |
+
<el-avatar :src="scope.row.avatar" :size="40" />
|
| 286 |
+
</template>
|
| 287 |
+
</el-table-column>
|
| 288 |
+
<el-table-column prop="name" label="名称" width="180" />
|
| 289 |
+
<el-table-column prop="platform" label="平台">
|
| 290 |
+
<template #default="scope">
|
| 291 |
+
<el-tag
|
| 292 |
+
:type="getPlatformTagType(scope.row.platform)"
|
| 293 |
+
effect="plain"
|
| 294 |
+
>
|
| 295 |
+
{{ scope.row.platform }}
|
| 296 |
+
</el-tag>
|
| 297 |
+
</template>
|
| 298 |
+
</el-table-column>
|
| 299 |
+
<el-table-column prop="status" label="状态">
|
| 300 |
+
<template #default="scope">
|
| 301 |
+
<el-tag
|
| 302 |
+
:type="scope.row.status === '正常' ? 'success' : 'danger'"
|
| 303 |
+
effect="plain"
|
| 304 |
+
>
|
| 305 |
+
{{ scope.row.status }}
|
| 306 |
+
</el-tag>
|
| 307 |
+
</template>
|
| 308 |
+
</el-table-column>
|
| 309 |
+
<el-table-column label="操作">
|
| 310 |
+
<template #default="scope">
|
| 311 |
+
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
| 312 |
+
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
| 313 |
+
</template>
|
| 314 |
+
</el-table-column>
|
| 315 |
+
</el-table>
|
| 316 |
+
</div>
|
| 317 |
+
|
| 318 |
+
<div v-else class="empty-data">
|
| 319 |
+
<el-empty description="暂无小红书账号数据" />
|
| 320 |
+
</div>
|
| 321 |
+
</div>
|
| 322 |
+
</el-tab-pane>
|
| 323 |
+
</el-tabs>
|
| 324 |
+
</div>
|
| 325 |
+
|
| 326 |
+
<!-- 添加/编辑账号对话框 -->
|
| 327 |
+
<el-dialog
|
| 328 |
+
v-model="dialogVisible"
|
| 329 |
+
:title="dialogType === 'add' ? '添加账号' : '编辑账号'"
|
| 330 |
+
width="500px"
|
| 331 |
+
:close-on-click-modal="false"
|
| 332 |
+
:close-on-press-escape="!sseConnecting"
|
| 333 |
+
:show-close="!sseConnecting"
|
| 334 |
+
>
|
| 335 |
+
<el-form :model="accountForm" label-width="80px" :rules="rules" ref="accountFormRef">
|
| 336 |
+
<el-form-item label="平台" prop="platform">
|
| 337 |
+
<el-select
|
| 338 |
+
v-model="accountForm.platform"
|
| 339 |
+
placeholder="请选择平台"
|
| 340 |
+
style="width: 100%"
|
| 341 |
+
:disabled="sseConnecting"
|
| 342 |
+
>
|
| 343 |
+
<el-option label="快手" value="快手" />
|
| 344 |
+
<el-option label="抖音" value="抖音" />
|
| 345 |
+
<el-option label="视频号" value="视频号" />
|
| 346 |
+
<el-option label="小红书" value="小红书" />
|
| 347 |
+
</el-select>
|
| 348 |
+
</el-form-item>
|
| 349 |
+
<el-form-item label="名称" prop="name">
|
| 350 |
+
<el-input
|
| 351 |
+
v-model="accountForm.name"
|
| 352 |
+
placeholder="请输入账号名称"
|
| 353 |
+
:disabled="sseConnecting"
|
| 354 |
+
/>
|
| 355 |
+
</el-form-item>
|
| 356 |
+
|
| 357 |
+
<!-- 二维码显示区域 -->
|
| 358 |
+
<div v-if="sseConnecting" class="qrcode-container">
|
| 359 |
+
<div v-if="qrCodeData && !loginStatus" class="qrcode-wrapper">
|
| 360 |
+
<p class="qrcode-tip">请使用对应平台APP扫描二维码登录</p>
|
| 361 |
+
<img :src="qrCodeData" alt="登录二维码" class="qrcode-image" />
|
| 362 |
+
</div>
|
| 363 |
+
<div v-else-if="!qrCodeData && !loginStatus" class="loading-wrapper">
|
| 364 |
+
<el-icon class="is-loading"><Refresh /></el-icon>
|
| 365 |
+
<span>请求中...</span>
|
| 366 |
+
</div>
|
| 367 |
+
<div v-else-if="loginStatus === '200'" class="success-wrapper">
|
| 368 |
+
<el-icon><CircleCheckFilled /></el-icon>
|
| 369 |
+
<span>添加成功</span>
|
| 370 |
+
</div>
|
| 371 |
+
<div v-else-if="loginStatus === '500'" class="error-wrapper">
|
| 372 |
+
<el-icon><CircleCloseFilled /></el-icon>
|
| 373 |
+
<span>添加失败,请稍后再试</span>
|
| 374 |
+
</div>
|
| 375 |
+
</div>
|
| 376 |
+
</el-form>
|
| 377 |
+
<template #footer>
|
| 378 |
+
<span class="dialog-footer">
|
| 379 |
+
<el-button @click="dialogVisible = false" :disabled="sseConnecting && !loginStatus">取消</el-button>
|
| 380 |
+
<el-button
|
| 381 |
+
type="primary"
|
| 382 |
+
@click="submitAccountForm"
|
| 383 |
+
:loading="sseConnecting"
|
| 384 |
+
:disabled="sseConnecting"
|
| 385 |
+
>
|
| 386 |
+
{{ sseConnecting ? '请求中' : '确认' }}
|
| 387 |
+
</el-button>
|
| 388 |
+
</span>
|
| 389 |
+
</template>
|
| 390 |
+
</el-dialog>
|
| 391 |
+
</div>
|
| 392 |
+
</template>
|
| 393 |
+
|
| 394 |
+
<script setup>
|
| 395 |
+
import { ref, reactive, computed, onMounted, onBeforeUnmount } from 'vue'
|
| 396 |
+
import { Refresh, CircleCheckFilled, CircleCloseFilled } from '@element-plus/icons-vue'
|
| 397 |
+
import { ElMessage, ElMessageBox } from 'element-plus'
|
| 398 |
+
import { accountApi } from '@/api/account'
|
| 399 |
+
import { useAccountStore } from '@/stores/account'
|
| 400 |
+
import { useAppStore } from '@/stores/app'
|
| 401 |
+
|
| 402 |
+
// 获取账号状态管理
|
| 403 |
+
const accountStore = useAccountStore()
|
| 404 |
+
// 获取应用状态管理
|
| 405 |
+
const appStore = useAppStore()
|
| 406 |
+
|
| 407 |
+
// 当前激活的标签页
|
| 408 |
+
const activeTab = ref('all')
|
| 409 |
+
|
| 410 |
+
// 搜索关键词
|
| 411 |
+
const searchKeyword = ref('')
|
| 412 |
+
|
| 413 |
+
// 获取账号数据
|
| 414 |
+
const fetchAccounts = async () => {
|
| 415 |
+
if (appStore.isAccountRefreshing) return
|
| 416 |
+
|
| 417 |
+
appStore.setAccountRefreshing(true)
|
| 418 |
+
|
| 419 |
+
try {
|
| 420 |
+
const res = await accountApi.getValidAccounts()
|
| 421 |
+
if (res.code === 200 && res.data) {
|
| 422 |
+
accountStore.setAccounts(res.data)
|
| 423 |
+
ElMessage.success('账号数据获取成功')
|
| 424 |
+
// 标记为已访问
|
| 425 |
+
if (appStore.isFirstTimeAccountManagement) {
|
| 426 |
+
appStore.setAccountManagementVisited()
|
| 427 |
+
}
|
| 428 |
+
} else {
|
| 429 |
+
ElMessage.error('获取账号数据失败')
|
| 430 |
+
}
|
| 431 |
+
} catch (error) {
|
| 432 |
+
console.error('获取账号数据失败:', error)
|
| 433 |
+
ElMessage.error('获取账号数据失败')
|
| 434 |
+
} finally {
|
| 435 |
+
appStore.setAccountRefreshing(false)
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// 页面加载时获取账号数据
|
| 440 |
+
onMounted(() => {
|
| 441 |
+
// 只有第一次进入时才获取数据
|
| 442 |
+
if (appStore.isFirstTimeAccountManagement) {
|
| 443 |
+
fetchAccounts()
|
| 444 |
+
}
|
| 445 |
+
})
|
| 446 |
+
|
| 447 |
+
// 获取平台标签类型
|
| 448 |
+
const getPlatformTagType = (platform) => {
|
| 449 |
+
const typeMap = {
|
| 450 |
+
'快手': 'success',
|
| 451 |
+
'抖音': 'danger',
|
| 452 |
+
'视频号': 'warning',
|
| 453 |
+
'小红书': 'info'
|
| 454 |
+
}
|
| 455 |
+
return typeMap[platform] || 'info'
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
// 过滤后的账号列表
|
| 459 |
+
const filteredAccounts = computed(() => {
|
| 460 |
+
if (!searchKeyword.value) return accountStore.accounts
|
| 461 |
+
return accountStore.accounts.filter(account =>
|
| 462 |
+
account.name.includes(searchKeyword.value)
|
| 463 |
+
)
|
| 464 |
+
})
|
| 465 |
+
|
| 466 |
+
// 按平台过滤的账号列表
|
| 467 |
+
const filteredKuaishouAccounts = computed(() => {
|
| 468 |
+
return filteredAccounts.value.filter(account => account.platform === '快手')
|
| 469 |
+
})
|
| 470 |
+
|
| 471 |
+
const filteredDouyinAccounts = computed(() => {
|
| 472 |
+
return filteredAccounts.value.filter(account => account.platform === '抖音')
|
| 473 |
+
})
|
| 474 |
+
|
| 475 |
+
const filteredChannelsAccounts = computed(() => {
|
| 476 |
+
return filteredAccounts.value.filter(account => account.platform === '视频号')
|
| 477 |
+
})
|
| 478 |
+
|
| 479 |
+
const filteredXiaohongshuAccounts = computed(() => {
|
| 480 |
+
return filteredAccounts.value.filter(account => account.platform === '小红书')
|
| 481 |
+
})
|
| 482 |
+
|
| 483 |
+
// 搜索处理
|
| 484 |
+
const handleSearch = () => {
|
| 485 |
+
// 搜索逻辑已通过计算属性实现
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
// 对话框相关
|
| 489 |
+
const dialogVisible = ref(false)
|
| 490 |
+
const dialogType = ref('add') // 'add' 或 'edit'
|
| 491 |
+
const accountFormRef = ref(null)
|
| 492 |
+
|
| 493 |
+
// 账号表单
|
| 494 |
+
const accountForm = reactive({
|
| 495 |
+
id: null,
|
| 496 |
+
name: '',
|
| 497 |
+
platform: '',
|
| 498 |
+
status: '正常'
|
| 499 |
+
})
|
| 500 |
+
|
| 501 |
+
// 表单验证规则
|
| 502 |
+
const rules = {
|
| 503 |
+
platform: [{ required: true, message: '请选择平台', trigger: 'change' }],
|
| 504 |
+
name: [{ required: true, message: '请输入账号名称', trigger: 'blur' }]
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
// SSE连接状态
|
| 508 |
+
const sseConnecting = ref(false)
|
| 509 |
+
const qrCodeData = ref('')
|
| 510 |
+
const loginStatus = ref('')
|
| 511 |
+
|
| 512 |
+
// 添加账号
|
| 513 |
+
const handleAddAccount = () => {
|
| 514 |
+
dialogType.value = 'add'
|
| 515 |
+
Object.assign(accountForm, {
|
| 516 |
+
id: null,
|
| 517 |
+
name: '',
|
| 518 |
+
platform: '',
|
| 519 |
+
status: '正常'
|
| 520 |
+
})
|
| 521 |
+
// 重置SSE状态
|
| 522 |
+
sseConnecting.value = false
|
| 523 |
+
qrCodeData.value = ''
|
| 524 |
+
loginStatus.value = ''
|
| 525 |
+
dialogVisible.value = true
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
// 编辑账号
|
| 529 |
+
const handleEdit = (row) => {
|
| 530 |
+
dialogType.value = 'edit'
|
| 531 |
+
Object.assign(accountForm, { ...row })
|
| 532 |
+
dialogVisible.value = true
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
// 删除账号
|
| 536 |
+
const handleDelete = (row) => {
|
| 537 |
+
ElMessageBox.confirm(
|
| 538 |
+
`确定要删除账号 ${row.name} 吗?`,
|
| 539 |
+
'警告',
|
| 540 |
+
{
|
| 541 |
+
confirmButtonText: '确定',
|
| 542 |
+
cancelButtonText: '取消',
|
| 543 |
+
type: 'warning',
|
| 544 |
+
}
|
| 545 |
+
)
|
| 546 |
+
.then(async () => {
|
| 547 |
+
try {
|
| 548 |
+
// 调用API删除账号
|
| 549 |
+
const response = await accountApi.deleteAccount(row.id)
|
| 550 |
+
|
| 551 |
+
if (response.code === 200) {
|
| 552 |
+
// 从状态管理中删除账号
|
| 553 |
+
accountStore.deleteAccount(row.id)
|
| 554 |
+
ElMessage({
|
| 555 |
+
type: 'success',
|
| 556 |
+
message: '删除成功',
|
| 557 |
+
})
|
| 558 |
+
} else {
|
| 559 |
+
ElMessage.error(response.msg || '删除失败')
|
| 560 |
+
}
|
| 561 |
+
} catch (error) {
|
| 562 |
+
console.error('删除账号失败:', error)
|
| 563 |
+
ElMessage.error('删除账号失败')
|
| 564 |
+
}
|
| 565 |
+
})
|
| 566 |
+
.catch(() => {
|
| 567 |
+
// 取消删除
|
| 568 |
+
})
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
// SSE事件源对象
|
| 572 |
+
let eventSource = null
|
| 573 |
+
|
| 574 |
+
// 关闭SSE连接
|
| 575 |
+
const closeSSEConnection = () => {
|
| 576 |
+
if (eventSource) {
|
| 577 |
+
eventSource.close()
|
| 578 |
+
eventSource = null
|
| 579 |
+
}
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
// 建立SSE连接
|
| 583 |
+
const connectSSE = (platform, name) => {
|
| 584 |
+
// 关闭可能存在的连接
|
| 585 |
+
closeSSEConnection()
|
| 586 |
+
|
| 587 |
+
// 设置连接状态
|
| 588 |
+
sseConnecting.value = true
|
| 589 |
+
qrCodeData.value = ''
|
| 590 |
+
loginStatus.value = ''
|
| 591 |
+
|
| 592 |
+
// 获取平台类型编号
|
| 593 |
+
const platformTypeMap = {
|
| 594 |
+
'小红书': '1',
|
| 595 |
+
'视频号': '2',
|
| 596 |
+
'抖音': '3',
|
| 597 |
+
'快手': '4'
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
const type = platformTypeMap[platform] || '1'
|
| 601 |
+
|
| 602 |
+
// 创建SSE连接
|
| 603 |
+
const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:5409'
|
| 604 |
+
const url = `${baseUrl}/login?type=${type}&id=${encodeURIComponent(name)}`
|
| 605 |
+
|
| 606 |
+
eventSource = new EventSource(url)
|
| 607 |
+
|
| 608 |
+
// 监听消息
|
| 609 |
+
eventSource.onmessage = (event) => {
|
| 610 |
+
const data = event.data
|
| 611 |
+
console.log('SSE消息:', data)
|
| 612 |
+
|
| 613 |
+
// 如果还没有二维码数据,且数据长度较长,认为是二维码
|
| 614 |
+
if (!qrCodeData.value && data.length > 100) {
|
| 615 |
+
try {
|
| 616 |
+
// 确保数据是有效的base64编码
|
| 617 |
+
// 如果数据已经包含了data:image前缀,直接使用
|
| 618 |
+
if (data.startsWith('data:image')) {
|
| 619 |
+
qrCodeData.value = data
|
| 620 |
+
} else {
|
| 621 |
+
// 否则添加前缀
|
| 622 |
+
qrCodeData.value = `data:image/png;base64,${data}`
|
| 623 |
+
}
|
| 624 |
+
console.log('设置二维码数据,长度:', data.length)
|
| 625 |
+
} catch (error) {
|
| 626 |
+
console.error('处理二维码数据出错:', error)
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
// 如果收到状态码
|
| 630 |
+
else if (data === '200' || data === '500') {
|
| 631 |
+
loginStatus.value = data
|
| 632 |
+
|
| 633 |
+
// 如果登录成功,添加账号到状态管理
|
| 634 |
+
if (data === '200') {
|
| 635 |
+
setTimeout(() => {
|
| 636 |
+
const newId = accountStore.accounts.length > 0 ?
|
| 637 |
+
Math.max(...accountStore.accounts.map(a => a.id)) + 1 : 1
|
| 638 |
+
|
| 639 |
+
const newAccount = {
|
| 640 |
+
id: newId,
|
| 641 |
+
name: accountForm.name,
|
| 642 |
+
platform: accountForm.platform,
|
| 643 |
+
status: '正常',
|
| 644 |
+
avatar: '/vite.svg' // 默认头像
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
// 添加到状态管理
|
| 648 |
+
accountStore.addAccount(newAccount)
|
| 649 |
+
|
| 650 |
+
// 关闭连接
|
| 651 |
+
closeSSEConnection()
|
| 652 |
+
|
| 653 |
+
// 1秒后关闭对话框
|
| 654 |
+
setTimeout(() => {
|
| 655 |
+
dialogVisible.value = false
|
| 656 |
+
sseConnecting.value = false
|
| 657 |
+
ElMessage.success('账号添加成功')
|
| 658 |
+
|
| 659 |
+
// 显示更新账号信息提示并刷新账号列表
|
| 660 |
+
ElMessage({
|
| 661 |
+
type: 'info',
|
| 662 |
+
message: '更新账号信息中...',
|
| 663 |
+
duration: 2000
|
| 664 |
+
})
|
| 665 |
+
|
| 666 |
+
// 触发刷新操作
|
| 667 |
+
isRefreshing.value = true
|
| 668 |
+
fetchAccounts()
|
| 669 |
+
}, 1000)
|
| 670 |
+
}, 1000)
|
| 671 |
+
} else {
|
| 672 |
+
// 登录失败,关闭连接
|
| 673 |
+
closeSSEConnection()
|
| 674 |
+
|
| 675 |
+
// 2秒后重置状态,允许重试
|
| 676 |
+
setTimeout(() => {
|
| 677 |
+
sseConnecting.value = false
|
| 678 |
+
qrCodeData.value = ''
|
| 679 |
+
loginStatus.value = ''
|
| 680 |
+
}, 2000)
|
| 681 |
+
}
|
| 682 |
+
}
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
// 监听错误
|
| 686 |
+
eventSource.onerror = (error) => {
|
| 687 |
+
console.error('SSE连接错误:', error)
|
| 688 |
+
ElMessage.error('连接服务器失败,请稍后再试')
|
| 689 |
+
closeSSEConnection()
|
| 690 |
+
sseConnecting.value = false
|
| 691 |
+
}
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
// 提交账号表单
|
| 695 |
+
const submitAccountForm = () => {
|
| 696 |
+
accountFormRef.value.validate(async (valid) => {
|
| 697 |
+
if (valid) {
|
| 698 |
+
if (dialogType.value === 'add') {
|
| 699 |
+
// 建立SSE连接
|
| 700 |
+
connectSSE(accountForm.platform, accountForm.name)
|
| 701 |
+
} else {
|
| 702 |
+
// 编辑账号逻辑保持不变
|
| 703 |
+
try {
|
| 704 |
+
// 更新状态管理中的账号
|
| 705 |
+
accountStore.updateAccount(accountForm.id, accountForm)
|
| 706 |
+
ElMessage.success('更新成功')
|
| 707 |
+
dialogVisible.value = false
|
| 708 |
+
} catch (error) {
|
| 709 |
+
console.error('更新账号失败:', error)
|
| 710 |
+
ElMessage.error('更新账号失败')
|
| 711 |
+
}
|
| 712 |
+
}
|
| 713 |
+
} else {
|
| 714 |
+
return false
|
| 715 |
+
}
|
| 716 |
+
})
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
// 组件卸载前关闭SSE连接
|
| 720 |
+
onBeforeUnmount(() => {
|
| 721 |
+
closeSSEConnection()
|
| 722 |
+
})
|
| 723 |
+
</script>
|
| 724 |
+
|
| 725 |
+
<style lang="scss" scoped>
|
| 726 |
+
@use '@/styles/variables.scss' as *;
|
| 727 |
+
|
| 728 |
+
@keyframes rotate {
|
| 729 |
+
from {
|
| 730 |
+
transform: rotate(0deg);
|
| 731 |
+
}
|
| 732 |
+
to {
|
| 733 |
+
transform: rotate(360deg);
|
| 734 |
+
}
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
.account-management {
|
| 738 |
+
.page-header {
|
| 739 |
+
margin-bottom: 20px;
|
| 740 |
+
|
| 741 |
+
h1 {
|
| 742 |
+
font-size: 24px;
|
| 743 |
+
color: $text-primary;
|
| 744 |
+
margin: 0;
|
| 745 |
+
}
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
.account-tabs {
|
| 749 |
+
background-color: #fff;
|
| 750 |
+
border-radius: 4px;
|
| 751 |
+
box-shadow: $box-shadow-light;
|
| 752 |
+
|
| 753 |
+
.account-tabs-nav {
|
| 754 |
+
padding: 20px;
|
| 755 |
+
}
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
.account-list-container {
|
| 759 |
+
.account-search {
|
| 760 |
+
display: flex;
|
| 761 |
+
justify-content: space-between;
|
| 762 |
+
margin-bottom: 20px;
|
| 763 |
+
|
| 764 |
+
.el-input {
|
| 765 |
+
width: 300px;
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
.action-buttons {
|
| 769 |
+
display: flex;
|
| 770 |
+
gap: 10px;
|
| 771 |
+
|
| 772 |
+
.el-icon.is-loading {
|
| 773 |
+
animation: rotate 1s linear infinite;
|
| 774 |
+
}
|
| 775 |
+
}
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
.account-list {
|
| 779 |
+
margin-bottom: 20px;
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
.empty-data {
|
| 783 |
+
padding: 40px 0;
|
| 784 |
+
}
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
+
// 二维码容器样式
|
| 788 |
+
.qrcode-container {
|
| 789 |
+
margin-top: 20px;
|
| 790 |
+
display: flex;
|
| 791 |
+
flex-direction: column;
|
| 792 |
+
align-items: center;
|
| 793 |
+
justify-content: center;
|
| 794 |
+
min-height: 250px;
|
| 795 |
+
|
| 796 |
+
.qrcode-wrapper {
|
| 797 |
+
text-align: center;
|
| 798 |
+
|
| 799 |
+
.qrcode-tip {
|
| 800 |
+
margin-bottom: 15px;
|
| 801 |
+
color: #606266;
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
.qrcode-image {
|
| 805 |
+
max-width: 200px;
|
| 806 |
+
max-height: 200px;
|
| 807 |
+
border: 1px solid #ebeef5;
|
| 808 |
+
}
|
| 809 |
+
}
|
| 810 |
+
|
| 811 |
+
.loading-wrapper, .success-wrapper, .error-wrapper {
|
| 812 |
+
display: flex;
|
| 813 |
+
flex-direction: column;
|
| 814 |
+
align-items: center;
|
| 815 |
+
justify-content: center;
|
| 816 |
+
gap: 10px;
|
| 817 |
+
|
| 818 |
+
.el-icon {
|
| 819 |
+
font-size: 48px;
|
| 820 |
+
|
| 821 |
+
&.is-loading {
|
| 822 |
+
animation: rotate 1s linear infinite;
|
| 823 |
+
}
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
span {
|
| 827 |
+
font-size: 16px;
|
| 828 |
+
}
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
.success-wrapper .el-icon {
|
| 832 |
+
color: #67c23a;
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
+
.error-wrapper .el-icon {
|
| 836 |
+
color: #f56c6c;
|
| 837 |
+
}
|
| 838 |
+
}
|
| 839 |
+
}
|
| 840 |
+
</style>
|