无人机管理后台前端(已迁走)
张含笑
2025-09-01 2ca94de8ede18ac07ccfd8dec7b6f6a707adde9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<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>