<template>
|
<div class="top-qna">
|
<el-icon class="help-icon" color="#707070" size="17" @click="dropdownClick('guide')">
|
<QuestionFilled />
|
</el-icon>
|
<!-- <el-dropdown @command="dropdownClick">
|
<el-icon class="help-icon" color="#707070" size="17">
|
<QuestionFilled />
|
</el-icon>
|
<template #dropdown>
|
<el-dropdown-menu>
|
<el-dropdown-item command="guide">入门指南</el-dropdown-item>
|
<el-dropdown-item command="systemupdate">系统更新</el-dropdown-item>
|
</el-dropdown-menu>
|
</template>
|
</el-dropdown> -->
|
</div>
|
</template>
|
|
<script setup>
|
import { listDataAPI } from '@/api/helpCenter/helpCenter';
|
import { useRouter } from 'vue-router';
|
import { ElMessage } from 'element-plus';
|
const router = useRouter();
|
const systemupdateFilePath = ref(null);
|
const rumenPath = ref(null);
|
const fileData = ref([]);
|
const loading = ref(false);
|
const getlistDataAPI = async () => {
|
loading.value = true;
|
try {
|
const res = await listDataAPI();
|
if (res.data.code === 200 && res.data.data) {
|
fileData.value = res.data.data;
|
const systemUpdateItem = res.data.data.find(item => item.id === 4); //系统更新
|
const rumenItem = res.data.data.find(item => item.id === 2); //入门指南
|
|
if (systemUpdateItem) {
|
systemupdateFilePath.value = systemUpdateItem.filePath;
|
} else {
|
console.warn('暂无系统更新');
|
}
|
|
if (rumenItem) {
|
rumenPath.value = rumenItem.filePath;
|
} else {
|
console.warn('暂无入门指南');
|
}
|
} else {
|
ElMessage.error('获取帮助数据失败');
|
}
|
} catch (error) {
|
console.error('获取数据出错:', error);
|
ElMessage.error('请求失败');
|
} finally {
|
loading.value = false;
|
}
|
};
|
const dropdownClick = val => {
|
if (loading.value) {
|
ElMessage.warning('数据正在加载,请稍后');
|
return;
|
}
|
|
if (val === 'guide') {
|
if (!rumenPath.value) {
|
ElMessage.warning('暂无入门指南文件');
|
return;
|
}
|
|
window.open(rumenPath.value, '_blank');
|
} else if (val === 'systemupdate') {
|
if (!systemupdateFilePath.value) {
|
ElMessage.warning('暂无系统更新文件');
|
return;
|
}
|
window.open(systemupdateFilePath.value, '_blank');
|
}
|
};
|
|
onMounted(() => {
|
getlistDataAPI();
|
});
|
</script>
|
|
<style lang="scss" scoped>
|
.top-qna {
|
display: flex;
|
align-items: center;
|
font-size: 18px;
|
justify-content: center;
|
cursor: pointer;
|
.help-icon {
|
width: 25px;
|
height: 25px;
|
}
|
.theme-white .el-dropdown {
|
color: none !important;
|
}
|
}
|
</style>
|