粉丝更新

This commit is contained in:
2025-07-08 21:23:12 +08:00
parent e415d50c7c
commit 65e24c51d9
16 changed files with 1707 additions and 48 deletions

View File

@@ -105,7 +105,7 @@
<!-- 列表区域 -->
<ContentWrap>
<!-- PC 端使用 table -->
<el-table v-if="!isMobile" v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"
<el-table v-if="!isMobile" v-loading="loading" :data="list" :stripe="true"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
@@ -318,35 +318,35 @@ const handleExport = async () => {
exportLoading.value = false
}
}
/** 查询员工 */
const getAllocationList = async () => {
loading.value = true
allocationUserList.value = []
try {
const data = await getAllocation(wsCache.get('user').user.deptId)
console.log('data', data)
data.forEach((item) => {
if (wsCache.get('user').user.id == item.id) {
// /** 查询员工 */
// const getAllocationList = async () => {
// loading.value = true
// allocationUserList.value = []
// try {
// const data = await getAllocation(wsCache.get('user').user.deptId)
// console.log('data', data)
// data.forEach((item) => {
// if (wsCache.get('user').user.id == item.id) {
} else {
allocationUserList.value.push({
label: item.nickname,
value: item.id
})
}
// } else {
// allocationUserList.value.push({
// label: item.nickname,
// value: item.id
// })
// }
})
console.log(allocationUserList.value)
} finally {
loading.value = false
}
}
// })
// console.log(allocationUserList.value)
// } finally {
// loading.value = false
// }
// }
function openHtml(item, id) {
let data = item
data.operationStatus = 1
EmployeeHostsApi.updateEmployeeHosts(data).then(res => {
EmployeeHostsApi.updateEmployeeHosts({ id: data.id, operationStatus: 1 }).then(res => {
getList()
})
window.open(`https://www.tiktok.com/@${id}`)
@@ -376,25 +376,51 @@ const handleSelectionChange = (val) => {
}
function exportAi() {
if (selectHostList.value.length != 0) {
const data = []
selectHostList.value.forEach((item) => {
data.push(item.hostsId)
})
navigator.clipboard.writeText(data.join('\n'))
.then(() => {
ElMessage.success('复制成功' + selectHostList.value.length + '条数据')
})
.catch(err => {
ElMessage.error('复制失败')
})
} else {
if (selectHostList.value.length === 0) {
ElMessage.error('请选择主播')
return
}
const data = selectHostList.value.map(item => item.hostsId).join('\n')
const copyToClipboard = async (text) => {
// 优先使用 Clipboard API
if (navigator.clipboard && window.isSecureContext) {
try {
await navigator.clipboard.writeText(text)
ElMessage.success('✅ 复制成功 ' + selectHostList.value.length + ' 条数据')
} catch (err) {
ElMessage.error('❌ 复制失败')
console.error(err)
}
} else {
// fallback 兼容方案
const textarea = document.createElement('textarea')
textarea.value = text
textarea.style.position = 'fixed' // 避免跳动
textarea.style.opacity = '0'
document.body.appendChild(textarea)
textarea.select()
try {
const result = document.execCommand('copy')
if (result) {
ElMessage.success('✅(兼容模式)复制成功 ' + selectHostList.value.length + ' 条数据')
} else {
ElMessage.error('❌(兼容模式)复制失败')
}
} catch (err) {
ElMessage.error('❌(兼容模式)复制异常')
console.error(err)
} finally {
document.body.removeChild(textarea)
}
}
}
copyToClipboard(data)
}
function AllocationFun() {
console.log(allocationUser.value)
console.log(selectHostList.value)
@@ -404,7 +430,7 @@ const isMobile = ref(window.innerWidth <= 768)
onMounted(() => {
getList()
getAllocationList()
// getAllocationList()
//实时监听实际还是电脑
window.addEventListener('resize', () => {
if ((window.innerWidth <= 768) != isMobile.value) {