-
-
-
-
-
-
- 查看
-
-
-
+
+
+
+
+
{{ certGroup.certificateType }}
+
{{ certGroup.names }}
+
查看证书
+
- 暂无证书
@@ -126,6 +125,7 @@ import { ElMessage, ElForm } from 'element-plus';
import { auths } from '/@/utils/authFunction';
import ProTable from '/@/components/ProTable/index.vue';
import { eventrecordPageGet, eventrecordCertificatesGet } from '/@/api/match/eventRecord';
+import { eventscoreGetCertificateDetailGet } from '/@/api/match/eventscore';
import { merchantcertificationPageGet, merchantcertificationAuditPost } from '/@/api/match/merchantcertification';
import PreviewImage from '/@/components/PreviewImage/index.vue';
@@ -236,6 +236,8 @@ const columnsUser = ref([
const isShowDialog = ref(false);
const table = ref();
const certificates = ref([]);
+const isShowTeamCertificateList = ref(false);
+const certificateList = ref([]);
const onOpenMenu = (row) => {
console.log(row);
@@ -259,25 +261,142 @@ const onOpenMenu = (row) => {
initParamUser.value.refresh = Date.now();
};
-const onCancelB = () => {
- isShowBook.value = false;
-};
-
-// 查看证书
-const isShowBook = ref(false);
-const lookBook = async (row, item) => {
- console.log('查看证书', row, item);
- const registrationIds = row.registrationIds || [];
- if (registrationIds.length === 0) {
- ElMessage.warning('暂无报名记录');
+// 查看证书 - 根据项目类型处理
+const viewCertificates = async (item) => {
+ console.log('查看证书', item);
+ const members = item.members || [];
+ if (members.length === 0) {
+ ElMessage.warning('暂无证书');
return;
}
- const { succeeded, data } = await eventrecordCertificatesGet(registrationIds);
- if (succeeded) {
- certificates.value = data || [];
- isShowBook.value = true;
+
+ if (item.isIndividualProject) {
+ // 个人项目:直接打开证书详情
+ const memberId = members[0].id;
+ try {
+ const { succeeded, data, errors } = await eventscoreGetCertificateDetailGet(memberId);
+ if (succeeded && data) {
+ const imageUrl = data.certificateUrl || data.url || data.Url;
+ if (imageUrl) {
+ openCertificate(imageUrl);
+ } else {
+ ElMessage.warning('暂无证书');
+ }
+ } else {
+ ElMessage.warning('暂无证书');
+ }
+ } catch (error) {
+ console.error('获取证书失败', error);
+ ElMessage.warning('暂无证书');
+ }
} else {
- ElMessage.error(data);
+ // 团队项目:弹出证书列表弹窗
+ await loadTeamCertificates(members);
+ }
+};
+
+// 加载团队证书列表
+const loadTeamCertificates = async (members) => {
+ const certData = {
+ athlete: { names: [], memberIds: [], hasCertificate: false, imageUrls: [] },
+ coach: { names: [], memberIds: [], hasCertificate: false, imageUrls: [] },
+ leader: { names: [], memberIds: [], hasCertificate: false, imageUrls: [] }
+ };
+
+ for (const member of members) {
+ try {
+ const { succeeded, data } = await eventscoreGetCertificateDetailGet(member.id);
+ if (succeeded && data) {
+ const imageUrl = data.certificateUrl || data.url || data.Url;
+ const name = member.name || data.name || '未知';
+
+ // 根据后端返回的 personType 判断类型,而不是证书类型
+ let typeKey = 'athlete';
+ if (member.personType === 2) {
+ typeKey = 'coach';
+ } else if (member.personType === 3) {
+ typeKey = 'leader';
+ }
+
+ if (imageUrl) {
+ certData[typeKey].hasCertificate = true;
+ certData[typeKey].imageUrls.push(imageUrl);
+ }
+ certData[typeKey].names.push(name);
+ certData[typeKey].memberIds.push(member.id);
+ } else {
+ // 即使没有证书,也要添加姓名到列表
+ const name = member.name || '未知';
+ let typeKey = 'athlete';
+ if (member.personType === 2) {
+ typeKey = 'coach';
+ } else if (member.personType === 3) {
+ typeKey = 'leader';
+ }
+ certData[typeKey].names.push(name);
+ certData[typeKey].memberIds.push(member.id);
+ }
+ } catch (error) {
+ console.error('获取证书失败', error);
+ // 即使获取证书失败,也添加姓名到列表中
+ const name = member.name || '未知';
+ let typeKey = 'athlete';
+ if (member.personType === 2) {
+ typeKey = 'coach';
+ } else if (member.personType === 3) {
+ typeKey = 'leader';
+ }
+ certData[typeKey].names.push(name);
+ certData[typeKey].memberIds.push(member.id);
+ }
+ }
+
+ // 构建显示列表
+ certificateList.value = [];
+ if (certData.athlete.names.length > 0) {
+ certificateList.value.push({
+ certificateType: '运动员证书',
+ names: certData.athlete.names.join('、'),
+ hasCertificate: certData.athlete.hasCertificate,
+ imageUrls: certData.athlete.imageUrls,
+ memberIds: certData.athlete.memberIds
+ });
+ }
+ if (certData.coach.names.length > 0) {
+ certificateList.value.push({
+ certificateType: '教练证书',
+ names: certData.coach.names.join('、'),
+ hasCertificate: certData.coach.hasCertificate,
+ imageUrls: certData.coach.imageUrls,
+ memberIds: certData.coach.memberIds
+ });
+ }
+ if (certData.leader.names.length > 0) {
+ certificateList.value.push({
+ certificateType: '领队证书',
+ names: certData.leader.names.join('、'),
+ hasCertificate: certData.leader.hasCertificate,
+ imageUrls: certData.leader.imageUrls,
+ memberIds: certData.leader.memberIds
+ });
+ }
+
+ if (certificateList.value.length === 0) {
+ ElMessage.warning('暂无证书');
+ } else {
+ isShowTeamCertificateList.value = true;
+ }
+};
+
+// 打开证书组
+const openCertificateGroup = (certGroup) => {
+ if (certGroup.imageUrls && certGroup.imageUrls.length > 0) {
+ // 打开第一个证书,或者如果有多个,可以考虑弹窗选择
+ for (const url of certGroup.imageUrls) {
+ if (url) {
+ openCertificate(url);
+ }
+ }
}
};
@@ -290,6 +409,11 @@ const openCertificate = (url) => {
}
};
+// 关闭团队证书列表弹窗
+const onTeamCertificateListClose = () => {
+ certificateList.value = [];
+};
+
// 审核弹窗相关
const isShowAuditDialog = ref(false);
const auditForm = reactive({
@@ -338,29 +462,35 @@ const onCancel = () => {
isShowDialog.value = false;
};
+
diff --git a/vite.config.ts b/vite.config.ts
index e3b664a..b9a165f 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -30,8 +30,8 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
hmr: true,
proxy: {
'/api': {
- // target: 'http://localhost:9996',
- target: 'http://8.153.108.90:9996',
+ target: 'http://localhost:9996',
+ // target: 'http://8.153.108.90:9996',
ws: true,
changeOrigin: true,
secure: false, //解决target使用https出错问题