1
0

2 Commits 176a273bc8 ... 99c0ca34b1

Autor SHA1 Nachricht Datum
  Damon 99c0ca34b1 Merge remote-tracking branch 'origin/seec' into seec vor 4 Jahren
  Damon 0e26c9e635 refactor: MessageVO format(undone), feat: PortalPage course pagination, vor 4 Jahren

BIN
src/assets/carousel.png


+ 0 - 1
src/assets/download.svg

@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645842424351" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2080" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M341.333333 640a42.666667 42.666667 0 0 1-42.666666 42.666667H256a170.666667 170.666667 0 0 1-40.277333-336.554667 298.709333 298.709333 0 0 1 570.154666-81.408A213.333333 213.333333 0 0 1 725.333333 682.666667a42.666667 42.666667 0 0 1 0.042667-85.333334 128 128 0 0 0 36.394667-250.794666l-38.144-11.264-15.914667-36.437334a213.376 213.376 0 0 0-407.296 58.026667l-7.381333 58.368-57.173334 13.824A85.418667 85.418667 0 0 0 256 597.333333h42.666667a42.666667 42.666667 0 0 1 42.666666 42.666667z m321.706667 87.338667a42.666667 42.666667 0 0 1 0 60.330666l-120.917333 120.832c-16.682667 16.64-43.690667 16.64-60.373334 0l-120.917333-120.832a42.666667 42.666667 0 0 1 60.330667-60.330666L469.333333 775.509333V426.666667a42.666667 42.666667 0 0 1 85.333334 0v348.714666l48.042666-48.042666a42.666667 42.666667 0 0 1 60.330667 0z" fill="#8a8a8a" p-id="2081"></path></svg>

+ 0 - 1
src/assets/link.svg

@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644132250628" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3373" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M819.2 887.466667H136.533333V204.8h341.333334V68.266667H136.533333a136.533333 136.533333 0 0 0-136.533333 136.533333v682.666667a136.533333 136.533333 0 0 0 136.533333 136.533333h682.666667a136.533333 136.533333 0 0 0 136.533333-136.533333V546.133333h-136.533333v341.333334z" fill="#409eff" p-id="3374"></path><path d="M955.733333 0h-273.066666a68.266667 68.266667 0 0 0 0 136.533333h108.202666L421.2736 506.129067a68.266667 68.266667 0 1 0 96.597333 96.597333L887.466667 233.130667V341.333333a68.266667 68.266667 0 0 0 136.533333 0V68.266667a68.266667 68.266667 0 0 0-68.266667-68.266667z" fill="#409eff" p-id="3375"></path></svg>

+ 0 - 0
src/assets/SEEC_banner3.png → src/assets/seec-banner.png


+ 11 - 11
src/components/GlobalHeader.vue

@@ -12,7 +12,6 @@
       </el-submenu>
       <el-menu-item index="4">个人中心</el-menu-item>
       <el-menu-item v-if="isTeacher" index="5">教师[临]</el-menu-item>
-      <!--      todo @DQJ 导航栏可能还有变动-->
       <el-menu-item index="6">问题[临]</el-menu-item>
     </el-menu>
     <div id="global-header-icon">
@@ -54,20 +53,21 @@ import InfoCard from "@/components/InfoCard";
 
 export default {
   name: "GlobalHeader",
-  components: {InfoCard},
+  components: { InfoCard },
   data() {
     return {
       quickAccessTitle: "快速访问",
       myUnReadAnnouncements: [],
       myUnReadMessages: [],
       menuIndex: [
-        ["1", "/portal"],
-        ["2", "/task"],
-        ["3-1", "/course"],
-        ["3-2", "/test"],
-        ["4", "/home"],
-        ["5", "/manage"],
-        ["6", "/problem"],
+        ["1", "Portal"],
+        ["2", "Task"],
+        ["3-1", "Course"],
+        ["3-2", "Test"],
+        ["4", "Home"],
+        ["5", "Manage"],
+        ["6", "Problem"],
+        ["7", "CourseDetail"],
       ]
     };
   },
@@ -87,7 +87,7 @@ export default {
     activeMenu() {
       let out = "1";
       this.menuIndex.forEach(i => {
-        if (i[1] === this.$route.path) {
+        if (i[1] === this.$route.name) {
           out = i[0];
         }
       });
@@ -136,7 +136,7 @@ export default {
           target = i[1];
         }
       });
-      this.$router.push(target);
+      this.$router.push({ name: target });
       if (key === "3-1") {
         this.quickAccessTitle = "全部课程";
       } else if (key === "3-2") {

+ 4 - 1
src/views/CoursePage/CourseDetail.vue

@@ -367,6 +367,10 @@ export default {
     },
   },
   mounted() {
+    if (this.$route.params.jump_from_message === "1") {
+      this.tabName = "comment";
+      this.switchTab(this.tabName);
+    }
     this.$apis.getCourseById(this.$route.params.id)
       .then(res => {
         this.courseInfo = res.data.data;
@@ -671,7 +675,6 @@ export default {
         case "comment":
           this.$apis.getCommentsByCourseId(this.$route.params.id)
             .then(res => {
-              console.log(res);
               this.commentTree = res.data.data;
             })
             .catch();

+ 7 - 3
src/views/CoursePage/components/FileEntry.vue

@@ -6,14 +6,17 @@
     <span class="size">{{ fileEntryInfo.size }}</span>
     <span class="upload-time">{{ fileEntryInfo.uploadTime }}</span>
     <span class="operation">
-      <img alt="download" src="../../../assets/download.svg" @click="downloadIconClick">
+      <el-icon @click="downloadIconClick" class="operation-download">
+        <Download/>
+      </el-icon>
     </span>
   </div>
 </template>
 
 <script setup>
 // eslint-disable-next-line no-unused-vars
-import {defineEmits, defineProps} from "vue";
+import { defineEmits, defineProps } from "vue";
+import { Download } from "@element-plus/icons-vue";
 
 // eslint-disable-next-line no-unused-vars
 const props = defineProps({
@@ -83,9 +86,10 @@ const downloadIconClick = function () {
 .operation {
   width: 32px;
   text-align: right;
+
 }
 
-.operation img {
+.operation-download {
   height: 18px;
   width: 18px;
   cursor: pointer;

+ 6 - 10
src/views/MessagePage/MessagePage.vue

@@ -34,7 +34,7 @@
           <MessageCard v-for="i in myUnReadAnnouncement" :key="i.id" :messageVO="i"/>
         </div>
         <div v-else class="message-page-main">
-          {{ myUnReadMessage }}
+          <MessageCard v-for="i in myUnReadMessage" :key="i.id" :messageVO="i"/>
         </div>
       </el-card>
     </el-col>
@@ -42,12 +42,12 @@
 </template>
 
 <script>
-import {Back, Bell, ChatDotRound} from "@element-plus/icons-vue";
+import { Back, Bell, ChatDotRound } from "@element-plus/icons-vue";
 import MessageCard from "@/views/MessagePage/components/MessageCard";
 
 export default {
   name: "MessagePage",
-  components: {MessageCard, ChatDotRound, Bell, Back},
+  components: { MessageCard, ChatDotRound, Bell, Back },
   data() {
     return {
       activeIndex: "1",
@@ -60,13 +60,9 @@ export default {
       return this.activeIndex === "1" ? "通知列表" : "消息列表";
     },
   },
-  created() {
-    this.$apis.getUnreadAnnouncements().then(res => {
-      this.myUnReadAnnouncement = res.data.data;
-    });
-    this.$apis.getUnreadMessages().then(res => {
-      this.myUnReadMessage = res.data.data;
-    });
+  async created() {
+    this.myUnReadAnnouncement = (await this.$apis.getUnreadAnnouncements()).data.data;
+    this.myUnReadMessage = (await this.$apis.getUnreadMessages()).data.data;
   },
   methods: {
     handleSelect(index) {

+ 54 - 17
src/views/MessagePage/components/MessageCard.vue

@@ -1,30 +1,41 @@
 <template>
-  <el-row class="body" @click="this.$router.push('/course/' + jumpLink)">
-    <el-col :span="6" style="display: flex; flex-direction:column; justify-content: space-between">
+  <el-row class="body" @click="jump">
+    <el-col :span="4" style="display: flex; flex-direction:column; justify-content: space-between;margin-left: 4px">
       <el-row>
         <el-tag size="large" type="" v-if="type === 'ANNOUNCEMENT'" class="tag">公告</el-tag>
         <el-tag size="large" type="success" v-else-if="type === 'HOMEWORK'" class="tag">作业</el-tag>
         <el-tag size="large" type="warning" v-else-if="type === 'EXAM'" class="tag">考试</el-tag>
+        <el-tag size="large" type="" v-else-if="type === 'COMMENT'" class="tag">回复</el-tag>
+        <el-tag size="large" type="warning" v-else-if="type === 'COURSE'" class="tag">评论</el-tag>
       </el-row>
       <el-row class="time">
         {{ time }}
       </el-row>
     </el-col>
-    <el-col :span="16" style="display: flex; flex-direction:column; justify-content: space-between">
+    <el-col :span="4" style="display: flex; flex-direction:column; justify-content: space-between">
       <el-row class="title">
         {{ title }}
       </el-row>
+      <el-row class="course" v-if="course!==''">
+        相关课程: {{ course }}
+      </el-row>
       <el-row class="sender">
-        发布者: {{ sender }}
+        {{ sender }}
       </el-row>
+    </el-col>
+    <el-col :span="10">
       <el-row class="content">
         {{ content }}
       </el-row>
     </el-col>
+    <el-col :span="2"/>
     <el-col :span="2" style="display: flex; flex-direction:column; justify-content: center">
-      <el-icon :size="20">
-        <ArrowRightBold/>
-      </el-icon>
+      <div>
+        <span>详情</span>
+        <el-icon :size="20" style="position: relative; top: 5px">
+          <ArrowRightBold/>
+        </el-icon>
+      </div>
     </el-col>
   </el-row>
 </template>
@@ -41,11 +52,13 @@ export default {
     }
   },
   data() {
-    return {};
+    return {
+      course: "",
+    };
   },
   computed: {
     type() {
-      return this.messageVO.type;
+      return this.messageVO.type || this.messageVO.actionType;
     },
     time() {
       const date = new Date(this.messageVO.createdAt);
@@ -55,27 +68,41 @@ export default {
       return Y + M + D;
     },
     title() {
-      return this.messageVO.title;
+      return this.messageVO.title || "回复评论";
     },
     sender() {
-      return this.messageVO.sender.name;
+      return "来自: " + this.messageVO.sender.name;
     },
     content() {
-      return this.messageVO.content.length > 30 ? this.messageVO.content.substring(0, 30) + "..." : this.messageVO.content;
+      return this.messageVO.content.length > 20 ? this.messageVO.content.substring(0, 20) + "..." : this.messageVO.content;
     },
-    jumpLink() {
-      return this.messageVO.courseId;
+  },
+
+  async created() {
+    if (this.messageVO.courseId) {
+      this.course = (await this.$apis.getCourseById(this.messageVO.courseId)).data.data["name"];
     }
   },
+
+  methods: {
+    jump() {
+      if (this.messageVO.courseId) {
+        this.$router.push({ name: "CourseDetail", params: { jump_from_message: "1", id: this.messageVO.courseId } });
+      } else {
+        // todo @mjh
+        alert("todo@mjh,跳转回复所在目标课程页");
+      }
+    }
+  }
 };
 </script>
 
 <style scoped>
 .body {
-  height: 90px;
+  height: 70px;
   border: 1px solid #cccccc;
   border-radius: 10px;
-  padding: 10px;
+  padding: 5px;
 }
 
 .body:hover {
@@ -94,6 +121,12 @@ export default {
 
 .title {
   font-weight: bold;
+  font-size: medium;
+}
+
+.course {
+  font-size: small;
+  color: #999999;
 }
 
 .sender {
@@ -102,7 +135,11 @@ export default {
 }
 
 .content {
+  margin: 10px 20px 0 20px;
+  border-radius: 6px;
+  padding: 10px;
+  background: #f6f6f6;
   font-size: small;
-  color: #999999;
+  color: #777777;
 }
 </style>

+ 31 - 18
src/views/PortalPage/PortalPage.vue

@@ -4,7 +4,7 @@
     <CarouselCard style="grid-column-start: 1; grid-column-end: 3;"/>
 
     <div>
-      <el-card :style="{height: courseRowHeight + 'px'}">
+      <el-card :style="{height: this.courseRowHeight + 'px'}">
         <div class="portal-card-title">
           <div class="portal-card-title-main">我的课程</div>
         </div>
@@ -12,7 +12,7 @@
         <div>
 
           <div v-if="!isLogin"
-               :style="{height: (courseRowHeight - 63) + 'px', marginTop: (courseRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/auth')">
             <el-icon :size="72" color="#bfbfbf">
@@ -22,7 +22,7 @@
           </div>
 
           <div v-if="isLogin && isStudent && myCourseList.length!==0"
-               :style="{height: (courseRowHeight - 63) + 'px'}"
+               :style="{height: (this.courseRowHeight - 63) + 'px'}"
                class="portal-card-main">
             <div class="portal-my-card-main">
               <MyCourseCard v-for="course in myCourseList" :key="course.id" :courseVO="course"/>
@@ -30,7 +30,7 @@
           </div>
 
           <div v-if="isLogin && isStudent && myCourseList.length===0"
-               :style="{height: (courseRowHeight - 63) + 'px', marginTop: (courseRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/course')">
             <el-icon :size="72" color="#bfbfbf">
@@ -40,7 +40,7 @@
           </div>
 
           <div v-show="isLogin && isTeacher"
-               :style="{height: (courseRowHeight - 63) + 'px', marginTop: (courseRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.courseRowHeight - 63) + 'px', marginTop: (this.courseRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/manage')">
             <el-icon :size="72" color="#bfbfbf">
@@ -53,27 +53,33 @@
     </div>
 
     <div>
-      <el-card id="portal-course-card-main" :style="{height: courseRowHeight + 'px'}">
+      <el-card id="portal-course-card-main" :style="{height: this.courseRowHeight + 'px'}">
         <div class="portal-card-title">
           <div class="portal-card-title-main">精选课程</div>
+          <el-pagination v-if="isExpanding && courseList.length > 6"
+                         :page-size="6"
+                         :total="courseList.length"
+                         @current-change="handleCourseCurrentChange"
+                         layout="prev, pager, next"
+                         style="width: 200px; margin: 0 auto 0 auto"/>
           <ElButton plain round type="primary" @click="this.$router.push('/course')">查看全部课程</ElButton>
         </div>
         <el-divider class="portal-card-divider"/>
         <div class="portal-card-content">
-          <CourseCard v-for="item in courseList" :key="item.id" :courseVO="item"/>
+          <CourseCard v-for="item in showCourseList" :key="item.id" :courseVO="item"/>
         </div>
       </el-card>
     </div>
 
     <div>
-      <el-card :style="{height: testRowHeight + 'px'}">
+      <el-card :style="{height: this.testRowHeight + 'px'}">
         <div class="portal-card-title">
           <div class="portal-card-title-main">我的测试</div>
         </div>
         <el-divider class="portal-card-divider"/>
         <div>
           <div v-if="!isLogin"
-               :style="{height: (testRowHeight - 63) + 'px', marginTop: (testRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/auth')">
             <el-icon :size="72" color="#bfbfbf">
@@ -83,7 +89,7 @@
           </div>
 
           <div v-if="isLogin && isStudent && myTestList!==null && myTestList.length!==0"
-               :style="{height: (testRowHeight - 63) + 'px'}"
+               :style="{height: (this.testRowHeight - 63) + 'px'}"
                class="portal-card-main">
             <div class="portal-my-card-main">
               <MyTestCard v-for="test in myTestList" :key="test.id" :testVO="test"/>
@@ -91,7 +97,7 @@
           </div>
 
           <div v-if="isLogin && isStudent && myTestList!==null && myTestList.length===0"
-               :style="{height: (testRowHeight - 63) + 'px', marginTop: (testRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/test')">
             <el-icon :size="72" color="#bfbfbf">
@@ -101,7 +107,7 @@
           </div>
 
           <div v-show="isLogin && isTeacher"
-               :style="{height: (testRowHeight - 63) + 'px', marginTop: (testRowHeight / 2 - 100) + 'px'}"
+               :style="{height: (this.testRowHeight - 63) + 'px', marginTop: (this.testRowHeight / 2 - 100) + 'px'}"
                class="portal-card-main" style="cursor: pointer"
                @click="this.$router.push('/manage')">
             <el-icon :size="72" color="#bfbfbf">
@@ -162,9 +168,11 @@ export default {
   },
   data() {
     return {
+      isExpanding: false,
       activeTestPaneName: "eval",
       evalExamList: [],
       courseList: [],
+      showCourseList_current: 1,
       coderExamList: [],
       myCourseList: [],
       myEvalExamList: [],
@@ -190,19 +198,20 @@ export default {
         return [].concat(this.myEvalExamList).concat(this.myCoderExamList);
       }
     },
+    showCourseList() {
+      return this.courseList.slice((this.showCourseList_current - 1) * 6, this.showCourseList_current * 6);
+    },
   },
 
   //生命周期函数
   created() {
     window.addEventListener("scroll", this.handleResize, true);
   },
+  beforeUnmount() {
+    window.removeEventListener("scroll", this.handleResize,);
+  },
   async mounted() {
     const that = this;
-    window.onresize = () => {
-      return (() => {
-        that.handleResize();
-      })();
-    };
 
     this.courseList = (await this.$apis.getExampleCourses()).data.data;
     this.evalExamList = (await this.$apis.getExampleEvalExams()).data.data;
@@ -233,11 +242,12 @@ export default {
   //其他函数
   methods: {
     handleResize() {
-      if (this.$route.path!=="/portal") return;
+      if (this.$route.path !== "/portal") return;
       // todo @DQJ 可能还得优化
       let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
       if (scrollTop > 100) {
         this.courseRowHeight = 640;
+        this.isExpanding = true;
       }
       this.testRowHeight = Math.max(this.$refs.portalTestCardBodyMain.$el.clientHeight, 300);
     },
@@ -268,6 +278,9 @@ export default {
         }
       }
     },
+    handleCourseCurrentChange(index) {
+      this.showCourseList_current = index;
+    }
   }
 };
 </script>

+ 3 - 3
src/views/PortalPage/components/CarouselCard.vue

@@ -12,9 +12,9 @@ export default {
   data() {
     return {
       contents: [
-        require("@/assets/SEEC_banner3.png"),
-        require("@/assets/SEEC_banner3.png"),
-        require("@/assets/SEEC_banner3.png"),
+        require("@/assets/seec-banner.png"),
+        require("@/assets/seec-banner.png"),
+        require("@/assets/seec-banner.png"),
       ],
     };
   }