@@ -830,6 +830,8 @@ import {
830830} from ' @arco-design/web-vue/es/icon'
831831import AddressHistory from ' @/components/AddressHistory.vue'
832832import PlayerSelector from ' @/components/PlayerSelector.vue'
833+ import configService from ' @/api/services/config'
834+ import siteService from ' @/api/services/site'
833835import {
834836 getCSPConfig ,
835837 saveCSPConfig ,
@@ -958,9 +960,17 @@ const saveAddress = async (configType) => {
958960 // 如果是点播配置,尝试使用配置服务设置地址并自动设置直播配置地址
959961 if (configType === ' vodConfig' ) {
960962 try {
961- const configService = (await import (' @/api/services/config' )).default
962963 await configService .setConfigUrl (addressValue)
963964
965+ // 清除缓存并刷新点播数据,确保下次换源时列表是最新的
966+ try {
967+ await siteService .loadSitesFromConfig (true ) // 强制刷新配置数据
968+ console .log (' 点播配置保存后已刷新缓存数据' )
969+ } catch (refreshError) {
970+ console .error (' 刷新点播数据失败:' , refreshError)
971+ // 即使刷新失败也不影响保存成功的提示
972+ }
973+
964974 // 检查是否自动设置了直播配置地址
965975 const liveConfigUrl = configService .getLiveConfigUrl ()
966976 if (liveConfigUrl && liveConfigUrl !== addressSettings .liveConfig ) {
@@ -971,9 +981,9 @@ const saveAddress = async (configType) => {
971981 savedAddresses .liveConfig = liveConfigUrl
972982 localStorage .setItem (' addressSettings' , JSON .stringify (savedAddresses))
973983
974- Message .success (' 点播配置保存成功,已自动设置直播配置地址 ' )
984+ Message .success (' 点播配置保存成功,已自动设置直播配置地址并刷新数据 ' )
975985 } else {
976- Message .success (' 点播配置保存成功' )
986+ Message .success (' 点播配置保存成功,已刷新点播数据 ' )
977987 }
978988 } catch (error) {
979989 console .error (' 设置配置服务失败:' , error)
@@ -982,7 +992,6 @@ const saveAddress = async (configType) => {
982992 } else if (configType === ' liveConfig' ) {
983993 // 如果是直播配置,使用配置服务设置直播配置地址
984994 try {
985- const configService = (await import (' @/api/services/config' )).default
986995 await configService .setLiveConfigUrl (addressValue)
987996 Message .success (' 直播配置地址保存成功' )
988997 } catch (error) {
@@ -1044,7 +1053,6 @@ const testAddress = async (configType) => {
10441053 addressTesting[configType] = true
10451054 try {
10461055 // 使用配置服务验证配置地址
1047- const configService = (await import (' @/api/services/config' )).default
10481056 const isValid = await configService .validateConfigUrl (addressValue)
10491057
10501058 if (isValid) {
@@ -1081,7 +1089,6 @@ const resetLiveConfig = async () => {
10811089 addressSaving .liveConfigReset = true
10821090 try {
10831091 // 使用配置服务重置直播配置地址
1084- const configService = (await import (' @/api/services/config' )).default
10851092 const success = await configService .resetLiveConfigUrl ()
10861093
10871094 if (success) {
@@ -1423,7 +1430,6 @@ const loadConfig = async () => {
14231430 }
14241431
14251432 // 兼容旧的配置地址设置
1426- const configService = (await import (' @/api/services/config' )).default
14271433 const savedUrl = configService .getConfigUrl ()
14281434 if (savedUrl && ! addressSettings .vodConfig ) {
14291435 addressSettings .vodConfig = savedUrl
0 commit comments