添加国家独立设置
This commit is contained in:
@@ -123,7 +123,7 @@
|
||||
:title="$t('workbenchesSetup.editCountry') || '编辑国家'">
|
||||
<span class="material-icons-round text-slate-500 text-base">edit</span>
|
||||
</button>
|
||||
<button @click="refreshCountry" :disabled="isRefreshingCountry"
|
||||
<button @click="refreshCountryFn" :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') || '刷新国家'">
|
||||
<span class="material-icons-round text-slate-500 text-base" :class="{ 'animate-spin': isRefreshingCountry }">refresh</span>
|
||||
@@ -312,18 +312,25 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getCountryName } from '@/utils/countryUtil'
|
||||
import { tkaccountuseinfo, getExpiredTime } from '@/api/account'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useCountryStore } from '@/stores/countryStore'
|
||||
import { useCountryInfo } from '@/composables/useCountryInfo'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const countryStore = useCountryStore()
|
||||
// 使用独立的国家信息管理(不与其他页面共享)
|
||||
const {
|
||||
countryData,
|
||||
countryDataEN,
|
||||
isLoading: isRefreshingCountry,
|
||||
initCountryInfo,
|
||||
refreshCountry,
|
||||
showEditCountryDialog
|
||||
} = useCountryInfo()
|
||||
//导入python交互方法
|
||||
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy, getTkLoginStatus } = usePythonBridge();
|
||||
|
||||
|
||||
//ip国家 - 使用共享 store
|
||||
const countryData = computed(() => countryStore.countryData);
|
||||
const countryDataEN = computed(() => countryStore.countryDataEN);
|
||||
const isRefreshingCountry = computed(() => countryStore.isLoading);
|
||||
//ip国家 - 使用独立的国家信息
|
||||
const countryDataRef = countryData;
|
||||
const countryDataENRef = countryDataEN;
|
||||
let country_info = ref('全部');
|
||||
let country_Lst = ref();
|
||||
//获取主播数量的定时器
|
||||
@@ -417,8 +424,8 @@ onMounted(async () => {
|
||||
tkaccountuse(tkData.value[0].account, 0)
|
||||
tkaccountuse(tkData.value[1].account, 1)
|
||||
|
||||
// 使用共享 store 初始化国家信息
|
||||
countryStore.initCountryInfo(t)
|
||||
// 初始化独立的国家信息
|
||||
initCountryInfo(t)
|
||||
|
||||
setTimeout(() => {
|
||||
// Check if user exists before calling getExpiredTime
|
||||
@@ -436,10 +443,10 @@ onMounted(async () => {
|
||||
}, 1000 * 20)
|
||||
})
|
||||
|
||||
// 编辑国家信息 - 使用共享 store
|
||||
// 编辑国家信息
|
||||
const editCountry = async () => {
|
||||
try {
|
||||
const newCountry = await countryStore.showEditCountryDialog(t);
|
||||
const newCountry = await showEditCountryDialog(t);
|
||||
// 确认后获取该国家的列表
|
||||
if (newCountry) {
|
||||
fetchCountryList(newCountry);
|
||||
@@ -449,12 +456,12 @@ const editCountry = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 刷新国家信息 - 使用共享 store
|
||||
const refreshCountry = async () => {
|
||||
await countryStore.refreshCountry(t);
|
||||
// 刷新国家信息
|
||||
const refreshCountryFn = async () => {
|
||||
await refreshCountry(t);
|
||||
// 刷新成功后获取国家列表
|
||||
if (countryStore.countryData) {
|
||||
fetchCountryList(countryStore.countryData);
|
||||
if (countryData.value) {
|
||||
fetchCountryList(countryData.value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user