diff --git a/src/components/edit/tinymce.vue b/src/components/edit/tinymce.vue
index ae3794a9..1f5b8185 100644
--- a/src/components/edit/tinymce.vue
+++ b/src/components/edit/tinymce.vue
@@ -64,71 +64,27 @@
-
-
-
-
{{ matchs.length }}
参与比赛
@@ -129,16 +122,6 @@
-
- 全部文章
- 热门文章
- 最近发布
-
-
发布文章
@@ -152,7 +135,7 @@
class="article-item"
v-for="(article, index) in articles"
:key="index"
- @click="viewArticle(article.id)"
+ @click="viewArticle(article)"
>
![]()
@@ -168,7 +151,7 @@
{{ formatDate(article.publishTime) }}
-
+
@@ -244,14 +227,6 @@ export default {
key: "article",
tab: "我的文章",
},
- {
- key: "app",
- tab: "我的收藏",
- },
- {
- key: "project",
- tab: "我的评论",
- },
],
noTitleKey: "article",
matchs: [],
@@ -294,18 +269,33 @@ export default {
},
methods: {
// 获取比赛信息
+ // 修改 fetchCompetitions 方法
fetchCompetitions() {
this.teamSpinning = true;
this.$api
.RegistrationAll()
.then((res) => {
+ // 筛选当前用户的比赛记录
this.matchs = res.data.filter((match) => {
- return match.studentId == this.$store.state.user.userId;
+ return match.studentId === this.$store.state.user.userId;
});
+
+ // 更新比赛卡片显示
+ this.matchs = this.matchs.map((match) => ({
+ ...match,
+ // 确保所需字段都存在
+ competitionName: match.competitionName || "未命名比赛",
+ competitionType: match.competitionType || "未分类",
+ registrationTime:
+ match.registrationTime || new Date().toISOString(),
+ awardLevel: match.awardLevel || "暂无成绩",
+ }));
+
this.teamSpinning = false;
})
.catch((err) => {
console.error("获取比赛信息失败:", err);
+ this.$message.error("获取比赛信息失败");
this.teamSpinning = false;
});
},
@@ -447,12 +437,13 @@ export default {
// 查看文章详情
viewArticle(id) {
- this.$router.push(`/community/pages?id=${id}`);
+ console.log("id", id);
+ this.$router.push(`/community/pages?id=${id?.articleId}`);
},
// 创建新文章
createNewArticle() {
- this.$router.push("/write");
+ this.$router.push("/community/publish");
},
// 标签相关方法
diff --git a/src/views/communtiy/Projects.vue b/src/views/communtiy/Projects.vue
deleted file mode 100644
index 156e556c..00000000
--- a/src/views/communtiy/Projects.vue
+++ /dev/null
@@ -1,175 +0,0 @@
-
-
-
-
-
-
-
- 类目一
- 类目二
- 类目三
- 类目四
- 类目五
- 类目六
- 类目七
- 类目八
- 类目九
- 类目十
-
-
-
-
-
-
-
-
-
- 王昭君
-
-
-
-
-
-
- 优秀
- 普通
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.description }}
-
-
-
-
{{ item.updatedAt | fromNow }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/communtiy/pages.vue b/src/views/communtiy/pages.vue
index 4ae3a68e..90294057 100644
--- a/src/views/communtiy/pages.vue
+++ b/src/views/communtiy/pages.vue
@@ -146,13 +146,10 @@
data-wow-delay="0.25s"
id="cmt225"
>
+
删除
@@ -160,17 +157,17 @@
- V游客
- 沙发
+ {{ getUserRole(item.userId) }}
+ {{ getUserName(item.userId) }}
+ {{ index === 0 ? '沙发' : `${index + 1}楼` }}
{{
@@ -178,7 +175,8 @@
}}
- {{ item.commentContent }}
+ {{ item.commentContent }}
+
@@ -213,6 +211,7 @@ export default {
msg: "",
comments: [],
users: [],
+ userMap: {}, // 用于缓存用户信息
};
},
@@ -322,20 +321,49 @@ export default {
console.log(error);
});
},
- getuser() {
- AllUser()
- .then((response) => {
- this.users = response.data;
- })
- .catch((error) => {
- console.error("Failed to load users:", error);
- });
+ // 获取用户信息并缓存
+ async getuser() {
+ try {
+ const response = await AllUser();
+ this.users = response.data;
+ // 创建用户信息映射
+ this.userMap = this.users.reduce((map, user) => {
+ map[user.userId] = user;
+ return map;
+ }, {});
+ } catch (error) {
+ console.error("Failed to load users:", error);
+ this.$message.error("获取用户信息失败");
+ }
},
+
+ // 获取用户名
getUserName(userId) {
- const user = this.users.find((u) => u.userId === userId);
- return user ? user.userName : "未知用户";
+ return this.userMap[userId]?.userName || "未知用户";
},
- },
+
+ // 获取用户头像
+ getUserAvatar(userId) {
+ return this.userMap[userId]?.avatar || "https://onlinephoto.oss-cn-chengdu.aliyuncs.com/hangtian/touxiang.jpg";
+ },
+
+ // 获取用户角色
+ getUserRole(userId) {
+ const user = this.userMap[userId];
+ if (!user) return "V";
+
+ switch(user.role) {
+ case "admin":
+ return "管理员";
+ case "teacher":
+ return "教师";
+ case "student":
+ return "学生";
+ default:
+ return "V";
+ }
+ },
+ }
};
@@ -357,4 +385,50 @@ button {
.router-link-exact-active {
color: none;
}
+
+.delete-btn {
+ display: flex;
+ justify-content: flex-end;
+ padding: 5px 10px;
+ color: #ff4d4f;
+ cursor: pointer;
+ font-size: 14px;
+ transition: all 0.3s;
+}
+
+.delete-btn:hover {
+ color: #ff7875;
+}
+
+.msgname {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.autlv {
+ padding: 2px 6px;
+ border-radius: 3px;
+ font-size: 12px;
+}
+
+.aut-6.vs {
+ background-color: #3690cf;
+ color: white;
+}
+
+.dot {
+ color: #999;
+ font-size: 12px;
+}
+
+.interact-time {
+ color: #999;
+ font-size: 12px;
+}
+
+.msgarticle {
+ margin-top: 8px;
+ line-height: 1.6;
+}