diff --git a/src/locales/en.ts b/src/locales/en.ts
index 9854101..9ffbfe8 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -670,7 +670,9 @@ export default {
placeTotalGiftCoins: 'Please enter total gift coins',
placeHostDisplayId: 'Please enter host display_id',
placeOwnerId: 'Please enter owner id',
- displayIdRequired: 'Display ID is required'
+ displayIdRequired: 'Display ID is required',
+ exportFileName: 'BigBrother_Data',
+ exportSuccess: 'Export successful'
},
system: {
user: {
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 5b379fe..76f1437 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -671,7 +671,9 @@ export default {
placeTotalGiftCoins: '请输入大哥历史打赏金币总和',
placeHostDisplayId: '请输入大哥所在的直播间的主播display_id',
placeOwnerId: '请输入该数据所属的账号id',
- displayIdRequired: '大哥的display_id不能为空'
+ displayIdRequired: '大哥的display_id不能为空',
+ exportFileName: '大哥数据',
+ exportSuccess: '导出成功'
},
system: {
user: {
diff --git a/src/views/server/bigbrother/index.vue b/src/views/server/bigbrother/index.vue
index 99e9a76..8a40267 100644
--- a/src/views/server/bigbrother/index.vue
+++ b/src/views/server/bigbrother/index.vue
@@ -146,7 +146,11 @@
-
+
+
+ {{ currentLang === 'zh-CN' ? scope.row.region : (scope.row.regionEng || scope.row.region) }}
+
+
@@ -218,7 +222,10 @@ import { getAllocation, getSimpleUserList, getSimpleUserListPage } from '@/api/s
import { useCache } from '@/hooks/web/useCache'
import BigBrotherForm from './BigBrotherForm.vue'
import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store
+import { useLocaleStoreWithOut } from '@/store/modules/locale'
const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉
+const localeStore = useLocaleStoreWithOut()
+const currentLang = computed(() => localeStore.getCurrentLocale.lang)
// 统一用字符串比较,自动识别并翻译 i18n key
function dictLabelI18n(type: string, val: any) {
@@ -351,8 +358,74 @@ const handleDelete = async (id: number) => {
} catch { }
}
-/** 导出按钮操作 */
+/** 导出按钮操作 - 前端导出当前页数据 */
const handleExport = async () => {
+ try {
+ exportLoading.value = true
+
+ // 定义表头(根据表格列顺序)
+ const headers = [
+ t('bigBrother.displayId'),
+ t('bigBrother.uid'),
+ t('bigBrother.nickname'),
+ t('bigBrother.level'),
+ t('bigBrother.fansLevel'),
+ t('bigBrother.hostCoins'),
+ t('bigBrother.followerCount'),
+ t('bigBrother.followingCount'),
+ t('bigBrother.region'),
+ t('bigBrother.historicHighCoins'),
+ t('bigBrother.totalGiftCoins'),
+ t('bigBrother.hostDisplayId'),
+ t('bigBrother.ownerId'),
+ t('newHosts.isAssigned'),
+ t('newHosts.createTime')
+ ]
+
+ // 将当前页数据转换为 CSV 行
+ const rows = list.value.map(row => [
+ row.displayId || '',
+ row.userIdStr || '',
+ row.nickname || '',
+ row.level || '',
+ row.fansLevel || '',
+ row.hostcoins || '',
+ row.followerCount || '',
+ row.followingCount || '',
+ currentLang.value === 'zh-CN' ? (row.region || '') : (row.regionEng || row.region || ''),
+ row.historicHighCoins || '',
+ row.totalGiftCoins || '',
+ row.hostDisplayId || '',
+ row.ownerId || '',
+ row.isAssigned == 1 ? (currentLang.value === 'zh-CN' ? '是' : 'Yes') : (currentLang.value === 'zh-CN' ? '否' : 'No'),
+ row.createTime ? new Date(row.createTime).toLocaleString(currentLang.value === 'zh-CN' ? 'zh-CN' : 'en-US') : ''
+ ])
+
+ // 组装 CSV 内容(添加 BOM 以支持 Excel 正确显示中文)
+ const BOM = '\uFEFF'
+ const csvContent = BOM + [headers, ...rows]
+ .map(row => row.map(cell => `"${String(cell).replace(/"/g, '""')}"`).join(','))
+ .join('\n')
+
+ // 创建 Blob 并下载
+ const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
+ const url = URL.createObjectURL(blob)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = `${t('bigBrother.exportFileName')}_${new Date().toISOString().split('T')[0]}.csv`
+ link.click()
+ URL.revokeObjectURL(url)
+
+ message.success(t('bigBrother.exportSuccess'))
+ } catch (error) {
+ console.error('导出失败:', error)
+ } finally {
+ exportLoading.value = false
+ }
+}
+
+/* ======== 后端导出代码(已注释,保留备用)========
+const handleExportBackend = async () => {
try {
// 先确认是否删除导出的数据
@@ -385,6 +458,7 @@ const handleExport = async () => {
exportLoading.value = false
}
}
+======== 后端导出代码结束 ======== */
/** 查询员工 */
const getAllocationList = async () => {
loading.value = true
diff --git a/src/views/server/newhosts/index.vue b/src/views/server/newhosts/index.vue
index bbe42c1..100ccf9 100644
--- a/src/views/server/newhosts/index.vue
+++ b/src/views/server/newhosts/index.vue
@@ -220,7 +220,7 @@
- {{ t('newHosts.min') == '最小值' ? scope.row.country : scope.row.countryEng }}
+ {{ currentLang === 'zh-CN' ? scope.row.country : (scope.row.countryEng || scope.row.country) }}
@@ -302,7 +302,10 @@ import { ElMessageBox } from 'element-plus'
import { func } from 'vue-types'
import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store
+import { useLocaleStoreWithOut } from '@/store/modules/locale'
const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉
+const localeStore = useLocaleStoreWithOut()
+const currentLang = computed(() => localeStore.getCurrentLocale.lang)
// 统一用字符串比较,自动识别并翻译 i18n key
function dictLabelI18n(type: string, val: any) {