优化
This commit is contained in:
@@ -59,6 +59,9 @@ export default {
|
|||||||
countryRequired: 'Please enter country name',
|
countryRequired: 'Please enter country name',
|
||||||
countrySetSuccess: 'Country Set Successfully',
|
countrySetSuccess: 'Country Set Successfully',
|
||||||
unknown: 'Unknown',
|
unknown: 'Unknown',
|
||||||
|
editCountry: 'Edit Country',
|
||||||
|
editCountryPrompt: 'Please enter country name (in Chinese)',
|
||||||
|
editCountryTitle: 'Edit Country',
|
||||||
},
|
},
|
||||||
hostList: {
|
hostList: {
|
||||||
placeCountry: 'Select country',
|
placeCountry: 'Select country',
|
||||||
@@ -176,6 +179,9 @@ export default {
|
|||||||
countryRequired: 'Please enter country name',
|
countryRequired: 'Please enter country name',
|
||||||
countrySetSuccess: 'Country Set Successfully',
|
countrySetSuccess: 'Country Set Successfully',
|
||||||
unknown: 'Unknown',
|
unknown: 'Unknown',
|
||||||
|
editCountry: 'Edit Country',
|
||||||
|
editCountryPrompt: 'Please enter country name (in Chinese)',
|
||||||
|
editCountryTitle: 'Edit Country',
|
||||||
},
|
},
|
||||||
countries: {
|
countries: {
|
||||||
// ... (truncated common countries for brevity, or include all if critical. I'll include a subset or all if possible. The file read showed all.)
|
// ... (truncated common countries for brevity, or include all if critical. I'll include a subset or all if possible. The file read showed all.)
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ export default {
|
|||||||
countryRequired: '请输入国家名称',
|
countryRequired: '请输入国家名称',
|
||||||
countrySetSuccess: '国家设置成功',
|
countrySetSuccess: '国家设置成功',
|
||||||
unknown: '未知',
|
unknown: '未知',
|
||||||
|
editCountry: '编辑国家',
|
||||||
|
editCountryPrompt: '请输入国家名称(中文)',
|
||||||
|
editCountryTitle: '编辑国家',
|
||||||
},
|
},
|
||||||
hostList: {
|
hostList: {
|
||||||
placeCountry: '选择国家',
|
placeCountry: '选择国家',
|
||||||
@@ -176,6 +179,9 @@ export default {
|
|||||||
countryRequired: '请输入国家名称',
|
countryRequired: '请输入国家名称',
|
||||||
countrySetSuccess: '国家设置成功',
|
countrySetSuccess: '国家设置成功',
|
||||||
unknown: '未知',
|
unknown: '未知',
|
||||||
|
editCountry: '编辑国家',
|
||||||
|
editCountryPrompt: '请输入国家名称(中文)',
|
||||||
|
editCountryTitle: '编辑国家',
|
||||||
},
|
},
|
||||||
countries: {
|
countries: {
|
||||||
AD: "安道尔", AE: "阿拉伯联合酋长国", AF: "阿富汗", AG: "安提瓜和巴布达", AI: "安圭拉", AL: "阿尔巴尼亚", AM: "亚美尼亚", AO: "安哥拉", AQ: "南极洲", AR: "阿根廷", AS: "美属萨摩亚", AT: "奥地利", AU: "澳大利亚", AU1: "澳大利亚", AW: "阿鲁巴", AX: "奥兰群岛", AZ: "阿塞拜疆",
|
AD: "安道尔", AE: "阿拉伯联合酋长国", AF: "阿富汗", AG: "安提瓜和巴布达", AI: "安圭拉", AL: "阿尔巴尼亚", AM: "亚美尼亚", AO: "安哥拉", AQ: "南极洲", AR: "阿根廷", AS: "美属萨摩亚", AT: "奥地利", AU: "澳大利亚", AU1: "澳大利亚", AW: "阿鲁巴", AX: "奥兰群岛", AZ: "阿塞拜疆",
|
||||||
|
|||||||
@@ -126,6 +126,55 @@ export const useCountryStore = defineStore('country', () => {
|
|||||||
await fetchCountryInfo(t, true)
|
await fetchCountryInfo(t, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动设置国家信息
|
||||||
|
* @param {string} countryName - 国家名称(中文)
|
||||||
|
* @param {Function} t - 国际化函数(可选)
|
||||||
|
*/
|
||||||
|
const setCountryManually = (countryName, t = null) => {
|
||||||
|
if (!countryName || countryName.trim() === '') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
countryData.value = countryName.trim()
|
||||||
|
countryDataEN.value = countryName.trim()
|
||||||
|
hasInitialized.value = true
|
||||||
|
lastFetchTime.value = Date.now()
|
||||||
|
|
||||||
|
if (t) {
|
||||||
|
ElMessage.success(t('workbenchesSetup.countrySetSuccess') || t('hostsList.countrySetSuccess') || '国家设置成功')
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示编辑国家的弹窗
|
||||||
|
* @param {Function} t - 国际化函数
|
||||||
|
*/
|
||||||
|
const showEditCountryDialog = (t) => {
|
||||||
|
ElMessageBox.prompt(
|
||||||
|
t('workbenchesSetup.editCountryPrompt') || t('hostsList.editCountryPrompt') || '请输入国家名称(中文)',
|
||||||
|
t('workbenchesSetup.editCountryTitle') || t('hostsList.editCountryTitle') || '编辑国家',
|
||||||
|
{
|
||||||
|
confirmButtonText: t('workbenchesSetup.confirm') || t('hostsList.confirm') || '确定',
|
||||||
|
cancelButtonText: t('workbenchesSetup.cancel') || t('hostsList.cancel') || '取消',
|
||||||
|
inputPlaceholder: t('workbenchesSetup.countryPlaceholder') || t('hostsList.countryPlaceholder') || '例如:美国、日本、英国',
|
||||||
|
inputValue: countryData.value, // 预填充当前值
|
||||||
|
inputValidator: (value) => {
|
||||||
|
if (!value || value.trim() === '') {
|
||||||
|
return t('workbenchesSetup.countryRequired') || t('hostsList.countryRequired') || '请输入国家名称'
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(({ value }) => {
|
||||||
|
setCountryManually(value, t)
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消编辑
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// 状态
|
// 状态
|
||||||
countryData,
|
countryData,
|
||||||
@@ -139,5 +188,7 @@ export const useCountryStore = defineStore('country', () => {
|
|||||||
refreshCountry,
|
refreshCountry,
|
||||||
showCountryInputDialog,
|
showCountryInputDialog,
|
||||||
initCountryInfo,
|
initCountryInfo,
|
||||||
|
setCountryManually,
|
||||||
|
showEditCountryDialog,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ export function usePythonBridge() {
|
|||||||
if (!inElectron) return;
|
if (!inElectron) return;
|
||||||
await window.electronAPI.tk.loginTikTok();
|
await window.electronAPI.tk.loginTikTok();
|
||||||
};
|
};
|
||||||
|
// loginTikTok
|
||||||
|
const loginBigTikTok = async () => {
|
||||||
|
if (!inElectron) return;
|
||||||
|
await window.electronAPI.tk.loginBigTikTok();
|
||||||
|
};
|
||||||
// loginBackStage
|
// loginBackStage
|
||||||
const loginBackStage = async (data) => {
|
const loginBackStage = async (data) => {
|
||||||
if (!inElectron) return;
|
if (!inElectron) return;
|
||||||
@@ -228,6 +232,7 @@ export function usePythonBridge() {
|
|||||||
fetchDataCount,
|
fetchDataCount,
|
||||||
loginBackStage,
|
loginBackStage,
|
||||||
loginTikTok,
|
loginTikTok,
|
||||||
|
loginBigTikTok,
|
||||||
givePyAnchorId,
|
givePyAnchorId,
|
||||||
backStageloginStatus,
|
backStageloginStatus,
|
||||||
backStageloginStatusCopy,
|
backStageloginStatusCopy,
|
||||||
|
|||||||
@@ -112,6 +112,11 @@
|
|||||||
<div class="bg-slate-50 px-4 py-2 rounded-xl border border-slate-100 text-sm flex items-center gap-2">
|
<div class="bg-slate-50 px-4 py-2 rounded-xl border border-slate-100 text-sm flex items-center gap-2">
|
||||||
<span class="text-slate-500">{{ $t('hostsList.currentNetwork') || '当前网络' }}:</span>
|
<span class="text-slate-500">{{ $t('hostsList.currentNetwork') || '当前网络' }}:</span>
|
||||||
<span class="font-bold text-primary">{{ countryData }}</span>
|
<span class="font-bold text-primary">{{ countryData }}</span>
|
||||||
|
<button @click="editCountry" :disabled="isRefreshingCountry"
|
||||||
|
class="p-1 rounded-md hover:bg-slate-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
|
:title="$t('hostsList.editCountry') || '编辑国家'">
|
||||||
|
<span class="material-icons-round text-slate-500 text-base">edit</span>
|
||||||
|
</button>
|
||||||
<button @click="refreshCountry" :disabled="isRefreshingCountry"
|
<button @click="refreshCountry" :disabled="isRefreshingCountry"
|
||||||
class="p-1 rounded-md hover:bg-slate-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
class="p-1 rounded-md hover:bg-slate-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
:title="$t('hostsList.refreshCountry') || '刷新国家'">
|
:title="$t('hostsList.refreshCountry') || '刷新国家'">
|
||||||
@@ -303,7 +308,7 @@ const sortNameOptions = ref([
|
|||||||
const {
|
const {
|
||||||
givePyAnchorId,
|
givePyAnchorId,
|
||||||
exportToExcel,
|
exportToExcel,
|
||||||
loginTikTok,
|
loginBigTikTok,
|
||||||
controlTask,
|
controlTask,
|
||||||
getBrotherInfo,
|
getBrotherInfo,
|
||||||
Specifystreaming,
|
Specifystreaming,
|
||||||
@@ -394,6 +399,7 @@ const getlist = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getBigBrother() {
|
function getBigBrother() {
|
||||||
|
queryFormData.value.isRunning = true;
|
||||||
const settingData = { ...queryFormData.value, tenantId: userInfo.value.tenantId, region: countryData.value };
|
const settingData = { ...queryFormData.value, tenantId: userInfo.value.tenantId, region: countryData.value };
|
||||||
|
|
||||||
// Save settings
|
// Save settings
|
||||||
@@ -401,7 +407,7 @@ function getBigBrother() {
|
|||||||
|
|
||||||
controlTask(JSON.stringify(settingData)).then(() => {
|
controlTask(JSON.stringify(settingData)).then(() => {
|
||||||
isRunnings.value = true;
|
isRunnings.value = true;
|
||||||
queryFormData.value.isRunning = true;
|
|
||||||
startTimerfun();
|
startTimerfun();
|
||||||
|
|
||||||
// Start polling stats
|
// Start polling stats
|
||||||
@@ -555,9 +561,14 @@ function exportList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openTikTok() {
|
function openTikTok() {
|
||||||
loginTikTok();
|
loginBigTikTok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 编辑国家信息 - 使用共享 store
|
||||||
|
const editCountry = () => {
|
||||||
|
countryStore.showEditCountryDialog(t);
|
||||||
|
};
|
||||||
|
|
||||||
// 刷新国家信息 - 使用共享 store
|
// 刷新国家信息 - 使用共享 store
|
||||||
const refreshCountry = async () => {
|
const refreshCountry = async () => {
|
||||||
await countryStore.refreshCountry(t);
|
await countryStore.refreshCountry(t);
|
||||||
|
|||||||
@@ -118,8 +118,13 @@
|
|||||||
<div class="flex items-center gap-2 text-slate-500">
|
<div class="flex items-center gap-2 text-slate-500">
|
||||||
<span>{{ $t('workbenchesSetup.network') }}:</span>
|
<span>{{ $t('workbenchesSetup.network') }}:</span>
|
||||||
<span class="text-blue-600 font-bold">{{ locale == 'zh' ? countryData : countryDataEN }}</span>
|
<span class="text-blue-600 font-bold">{{ locale == 'zh' ? countryData : countryDataEN }}</span>
|
||||||
<button @click="refreshCountry" :disabled="isRefreshingCountry"
|
<button @click="editCountry" :disabled="isRefreshingCountry"
|
||||||
class="ml-1 p-1 rounded-md hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
class="ml-1 p-1 rounded-md hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
|
:title="$t('workbenchesSetup.editCountry') || '编辑国家'">
|
||||||
|
<span class="material-icons-round text-slate-500 text-base">edit</span>
|
||||||
|
</button>
|
||||||
|
<button @click="refreshCountry" :disabled="isRefreshingCountry"
|
||||||
|
class="p-1 rounded-md hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
:title="$t('workbenchesSetup.refreshCountry') || '刷新国家'">
|
:title="$t('workbenchesSetup.refreshCountry') || '刷新国家'">
|
||||||
<span class="material-icons-round text-slate-500 text-base" :class="{ 'animate-spin': isRefreshingCountry }">refresh</span>
|
<span class="material-icons-round text-slate-500 text-base" :class="{ 'animate-spin': isRefreshingCountry }">refresh</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -431,6 +436,11 @@ onMounted(async () => {
|
|||||||
}, 1000 * 20)
|
}, 1000 * 20)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 编辑国家信息 - 使用共享 store
|
||||||
|
const editCountry = () => {
|
||||||
|
countryStore.showEditCountryDialog(t);
|
||||||
|
};
|
||||||
|
|
||||||
// 刷新国家信息 - 使用共享 store
|
// 刷新国家信息 - 使用共享 store
|
||||||
const refreshCountry = async () => {
|
const refreshCountry = async () => {
|
||||||
await countryStore.refreshCountry(t);
|
await countryStore.refreshCountry(t);
|
||||||
|
|||||||
Reference in New Issue
Block a user