feat: 文章标题链接使用正确H5 URL格式,域名从系统配置动态读取

This commit is contained in:
stefanfeng
2026-04-01 16:58:51 +08:00
parent 7448fdcba1
commit da4744f333

View File

@@ -85,11 +85,12 @@
<script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getInteractions, retryInteraction, exportInteractions, cancelInteraction } from '@/api'
import { getInteractions, retryInteraction, exportInteractions, cancelInteraction , getSystemConfigs } from '@/api'
const records = ref([])
const total = ref(0)
const loading = ref(false)
const articleBaseDomain = ref('https://fat-open.99hui.com') // 默认测试环境
const page = ref(1)
const pageSize = ref(20)
const dateRange = ref(null)
@@ -104,9 +105,24 @@ function onDateChange(v) {
load()
}
// 构造文章详情页 URL
// 构造文章详情页 URLH5 分享页面)
function getArticleUrl(articleId) {
return `https://fat-open.99hui.com/api/huihuibusiness/news/open/${articleId}`
if (!articleId) return '#'
return `${articleBaseDomain.value}/huihui-h5/#/news/share?id=${articleId}&login=no`
}
// 从系统配置获取业务接口域名,用于拼接文章链接
async function loadArticleDomain() {
try {
const res = await getSystemConfigs()
const cfgs = res.data || []
const bizUrl = cfgs.find(c => c.config_key === 'news_platform_base_url')?.config_value || ''
if (bizUrl) {
// 从 https://99hui.com/api/huihuibusiness 提取 https://99hui.com
const parts = bizUrl.split('/')
if (parts.length >= 3) articleBaseDomain.value = parts[0] + '//' + parts[2]
}
} catch(e) {}
}
async function load() {
@@ -161,7 +177,11 @@ async function handleExport() {
const a = document.createElement('a'); a.href = url; a.download = 'interactions.xlsx'; a.click()
}
onMounted(() => { load(); window.addEventListener('page-refresh', load) })
onMounted(() => {
loadArticleDomain()
load()
window.addEventListener('page-refresh', load)
})
onUnmounted(() => window.removeEventListener('page-refresh', load))
</script>
<style scoped>