Forráskód Böngészése

feat: courseDetail temp

mjh 4 éve
szülő
commit
f67244ba64

+ 141 - 138
src/views/CoursePage/CourseDetail.vue

@@ -3,7 +3,7 @@
     <div class="course-detail-container" v-if="courseInfo!==null">
       <div class="header">
         <div class="course-img">
-          <img alt="" :src="courseInfo.imageUrl">
+          <img alt="" :src="courseInfo.imageUrl === null ? noImgUrl : courseInfo.imageUrl">
         </div>
         <div class="course-info">
           <el-row>课程名称:{{ courseInfo.name }}</el-row>
@@ -26,143 +26,138 @@
           </el-row>
         </div>
       </div>
-      <!--          <el-divider></el-divider>-->
-      <!--          <div class="introduce">-->
-      <!--            <span class="title">简介</span>-->
-      <!--            <br/>-->
-      <!--            <div class="introduce-content">-->
-      <!--              {{ courseInfo.introduce }}-->
-      <!--            </div>-->
-      <!--          </div>-->
-      <!--          <el-divider></el-divider>-->
-      <!--          <div class="course-tabs">-->
-      <!--            <el-radio-group v-model="tabName" size="large">-->
-      <!--              <el-radio-button label="tasks">任务时间轴</el-radio-button>-->
-      <!--              <el-radio-button label="notice">通知栏</el-radio-button>-->
-      <!--              <el-radio-button label="courseware">课件列表</el-radio-button>-->
-      <!--            </el-radio-group>-->
-      <!--            <div v-teacher-permission="{role:role}">-->
-      <!--              <el-popover v-if="tabName==='notice'" v-model:visible="showPopover" :width="160" placement="bottom">-->
-      <!--                <div class="sel-notice-type">-->
-      <!--                  <div :style="{color:themeColor.orange}" class="notice-type-icon">-->
-      <!--                    公告-->
-      <!--                  </div>-->
-      <!--                  <div class="notice-type-txt" @click="selAndInitNotice('announce')">-->
-      <!--                    发布公告-->
-      <!--                  </div>-->
-      <!--                </div>-->
-      <!--                <div class="sel-notice-type">-->
-      <!--                  <div :style="{color:themeColor.blue}" class="notice-type-icon">-->
-      <!--                    作业-->
-      <!--                  </div>-->
-      <!--                  <div class="notice-type-txt" @click="selAndInitNotice('homework')">-->
-      <!--                    发布作业-->
-      <!--                  </div>-->
+      <el-divider></el-divider>
+      <div class="introduce">
+        <el-row class="title">简介</el-row>
+        <el-row class="introduce-content">
+          {{ courseInfo.description === "" ? "无" : courseInfo.description }}
+        </el-row>
+      </div>
+      <el-divider></el-divider>
+      <el-row class="course-tabs">
+        <el-radio-group v-model="tabName" size="large">
+          <el-radio-button label="tasks">任务时间轴</el-radio-button>
+          <el-radio-button label="notice">通知栏</el-radio-button>
+          <el-radio-button label="courseware">课件列表</el-radio-button>
+        </el-radio-group>
+        <el-row v-if="true">
+          <el-popover v-if="isTeacher && tabName==='notice'"
+                      v-model:visible="noticePopover"
+                      :width="160"
+                      placement="bottom">
+            <el-row class="sel-notice-type">
+              <div :style="{color:themeColor.green}" class="notice-type-icon">
+                公告
+              </div>
+              <div class="notice-type-txt">
+                <el-link type="success" href="javascript:void(0);" @click="selAndInitNotice('announcement')">发布公告
+                </el-link>
+              </div>
+            </el-row>
+            <el-row class="sel-notice-type">
+              <div :style="{color:themeColor.orange}" class="notice-type-icon">
+                作业
+              </div>
+              <div class="notice-type-txt">
+                <el-link type="warning" href="javascript:void(0);" @click="selAndInitNotice('homework')">发布作业</el-link>
+              </div>
+            </el-row>
+            <el-row class="sel-notice-type">
+              <div :style="{color:themeColor.red}" class="notice-type-icon">
+                考试
+              </div>
+              <div class="notice-type-txt">
+                <el-link type="danger" href="javascript:void(0);" @click="selAndInitNotice('test')">发布考试</el-link>
+              </div>
+            </el-row>
+            <template #reference>
+              <el-button plain type="primary" @click="noticePopover = true">添加发布
+              </el-button>
+            </template>
+          </el-popover>
+          <el-upload v-if="isTeacher && tabName==='courseware'" action="" :http-request="handleFileUploading"
+                     :on-success="handleFileUploadSuccess" :show-file-list="false">
+            <el-button plain type="primary">上传课件</el-button>
+          </el-upload>
+        </el-row>
+      </el-row>
+      <div class="course-tab-content">
+        <div v-if="tabName==='tasks'" class="tab-tasks">
+          <el-timeline>
+            <el-timeline-item
+              v-for="(task, index) in tasks"
+              :key="index"
+              :timestamp="task.timestamp"
+            >
+              {{ task.content }}
+            </el-timeline-item>
+          </el-timeline>
+        </div>
+        <div v-else-if="tabName==='notice'" class="tab-notice">
+          <NoticeItem v-for="(item,index) in noticeInfoList" :key="index" :notice-info="item"></NoticeItem>
+        </div>
+        <div v-else-if="tabName==='courseware'" class="tab-courseware">
+          <div class="entry-header">
+            <span class="name">文件名</span>
+            <span class="size">文件大小</span>
+            <span class="uploadTime">上传时间</span>
+            <span class="operation">操作</span>
+          </div>
+          <FileEntry v-for="(entry,index) in fileEntryList"
+                     :key="index"
+                     :file-entry-info="entry"
+                     @downloadFileIconClick="handleDownloadFileIconClick"
+          ></FileEntry>
+        </div>
+      </div>
+    </div>
+    <div>
+      <!--          <el-dialog-->
+      <!--            v-model="showNewNoticeDialog"-->
+      <!--            :title="newNoticeType.title"-->
+      <!--            width="40%"-->
+      <!--          >-->
+      <!--            <div class="new-notice-content">-->
+      <!--              <div class="new-notice-item">-->
+      <!--                <span>创建者:&emsp;</span>-->
+      <!--                <div class="flex-vc">-->
+      <!--                  <span>kenny 67</span>-->
+      <!--                  <div :style="{backgroundColor:newNoticeType.color}" class="mini-name-icon">刘</div>-->
       <!--                </div>-->
-      <!--                <div class="sel-notice-type">-->
-      <!--                  <div :style="{color:themeColor.red}" class="notice-type-icon">-->
-      <!--                    考试-->
-      <!--                  </div>-->
-      <!--                  <div class="notice-type-txt" @click="selAndInitNotice('test')">-->
-      <!--                    发布考试-->
-      <!--                  </div>-->
+      <!--              </div>-->
+      <!--              <div class="new-notice-item">-->
+      <!--                <span>所属课程:</span>-->
+      <!--                <div>软件工程与计算 I 2021</div>-->
+      <!--              </div>-->
+      <!--              <div class="new-notice-item">-->
+      <!--                <span>发布时间:</span>-->
+      <!--                <div>2021年12月15日 18时30分</div>-->
+      <!--              </div>-->
+      <!--              <div class="content-description-area">-->
+      <!--                <span>内容描述:</span>-->
+      <!--                <el-input-->
+      <!--                  v-model="newNoticeInfo.noticeDescription"-->
+      <!--                  :rows="4"-->
+      <!--                  placeholder="内容描述"-->
+      <!--                  type="textarea"-->
+      <!--                />-->
+      <!--              </div>-->
+      <!--              <div class="new-notice-item">-->
+      <!--                <span>优先级:&emsp;</span>-->
+      <!--                <div>-->
+      <!--                  <el-radio v-model="newNoticeInfo.priority" border label="1" size="large">重要</el-radio>-->
+      <!--                  <el-radio v-model="newNoticeInfo.priority" border label="2" size="large">一般</el-radio>-->
       <!--                </div>-->
-      <!--                <template #reference>-->
-      <!--                  <el-button plain type="warning" @click="showPopover = true">添加发布-->
-      <!--                  </el-button>-->
-      <!--                </template>-->
-      <!--              </el-popover>-->
-      <!--              <el-upload-->
-      <!--                v-if="tabName==='courseware'"-->
-      <!--                :action="actionUrl"-->
-      <!--                :http-request="handleFileUploading"-->
-      <!--                :on-success="handFileUploadSuccess"-->
-      <!--                :show-file-list="false"-->
-      <!--                class="upload-demo width-100"-->
-      <!--                method="put"-->
-      <!--              >-->
-      <!--                <el-button plain type="primary">上传课件</el-button>-->
-      <!--              </el-upload>-->
+      <!--              </div>-->
       <!--            </div>-->
-    </div>
-    <!--          <div class="course-tab-content">-->
-    <!--            <div v-if="tabName==='tasks'" class="tab-tasks">-->
-    <!--              <el-timeline>-->
-    <!--                <el-timeline-item-->
-    <!--                  v-for="(task, index) in tasks"-->
-    <!--                  :key="index"-->
-    <!--                  :timestamp="task.timestamp"-->
-    <!--                >-->
-    <!--                  {{ task.content }}-->
-    <!--                </el-timeline-item>-->
-    <!--              </el-timeline>-->
-    <!--            </div>-->
-    <!--            <div v-else-if="tabName==='notice'" class="tab-notice">-->
-    <!--              <NoticeItem v-for="(item,index) in noticeInfoList" :key="index" :notice-info="item"></NoticeItem>-->
-    <!--            </div>-->
-    <!--            <div v-else-if="tabName==='courseware'" class="tab-courseware">-->
-    <!--              <div class="entry-header">-->
-    <!--                <span class="name">文件名</span>-->
-    <!--                <span class="size">文件大小</span>-->
-    <!--                <span class="uploadTime">上传时间</span>-->
-    <!--                <span class="operation">操作</span>-->
-    <!--              </div>-->
-    <!--              <FileEntry v-for="(entry,index) in fileEntryList"-->
-    <!--                         :key="index"-->
-    <!--                         :file-entry-info="entry"-->
-    <!--                         @downloadFileIconClick="handleDownloadFileIconClick"-->
-    <!--              ></FileEntry>-->
-
-    <!--            </div>-->
-    <!--          </div>-->
-    <!--        </div>-->
-    <!--        <div>-->
-    <!--          <el-dialog-->
-    <!--            v-model="showNewNoticeDialog"-->
-    <!--            :title="newNoticeType.title"-->
-    <!--            width="40%"-->
-    <!--          >-->
-    <!--            <div class="new-notice-content">-->
-    <!--              <div class="new-notice-item">-->
-    <!--                <span>创建者:&emsp;</span>-->
-    <!--                <div class="flex-vc">-->
-    <!--                  <span>kenny 67</span>-->
-    <!--                  <div :style="{backgroundColor:newNoticeType.color}" class="mini-name-icon">刘</div>-->
-    <!--                </div>-->
-    <!--              </div>-->
-    <!--              <div class="new-notice-item">-->
-    <!--                <span>所属课程:</span>-->
-    <!--                <div>软件工程与计算 I 2021</div>-->
-    <!--              </div>-->
-    <!--              <div class="new-notice-item">-->
-    <!--                <span>发布时间:</span>-->
-    <!--                <div>2021年12月15日 18时30分</div>-->
-    <!--              </div>-->
-    <!--              <div class="content-description-area">-->
-    <!--                <span>内容描述:</span>-->
-    <!--                <el-input-->
-    <!--                  v-model="newNoticeInfo.noticeDescription"-->
-    <!--                  :rows="4"-->
-    <!--                  placeholder="内容描述"-->
-    <!--                  type="textarea"-->
-    <!--                />-->
-    <!--              </div>-->
-    <!--              <div class="new-notice-item">-->
-    <!--                <span>优先级:&emsp;</span>-->
-    <!--                <div>-->
-    <!--                  <el-radio v-model="newNoticeInfo.priority" border label="1" size="large">重要</el-radio>-->
-    <!--                  <el-radio v-model="newNoticeInfo.priority" border label="2" size="large">一般</el-radio>-->
-    <!--                </div>-->
-    <!--              </div>-->
-    <!--            </div>-->
-    <!--            <div class="new-notice-btn">-->
-    <!--              <el-button style="margin-right: 32px" type="primary">确认</el-button>-->
-    <!--              <el-button type="danger">取消</el-button>-->
+      <!--            <div class="new-notice-btn">-->
+      <!--              <el-button style="margin-right: 32px" type="primary">确认</el-button>-->
+      <!--              <el-button type="danger">取消</el-button>-->
 
-    <!--            </div>-->
+      <!--            </div>-->
 
-    <!--          </el-dialog>-->
-    <!--        </div>-->
+      <!--          </el-dialog>-->
+    </div>
   </div>
 </template>
 
@@ -170,6 +165,7 @@
 import NoticeItem from "./components/NoticeItem";
 import FileEntry from "./components/FileEntry";
 import {ElMessageBox, ElMessage} from "element-plus";
+import variables from "@/utils/variables";
 
 export default {
   name: "CourseDetail",
@@ -181,6 +177,7 @@ export default {
   },
   data() {
     const themeColor = {
+      green: "#67C23A",
       orange: "#E38800",
       blue: "#1989FA",
       red: "#F56C6C"
@@ -188,6 +185,10 @@ export default {
     return {
       courseInfo: null,
       isCourseSelected: false,
+      noImgUrl: variables.noImgUrl,
+      themeColor,
+      tabName: "notice",
+      noticePopover: false,
 
       newNoticeType: {
         type: "",
@@ -220,8 +221,6 @@ export default {
         }],
       postNoticeInfo: {},
       showNewNoticeDialog: false,
-      tabName: "tasks",
-      showPopover: false,
       fileEntryList: [{
         id: 1,
         name: "课程作业",
@@ -259,7 +258,10 @@ export default {
   },
   computed: {
     isStudent() {
-      return ["STUDENT", "ADMIN", "SEEC"].indexOf(this.$store.state.user.role);
+      return ["STUDENT", "ADMIN", "SEEC"].indexOf(this.$store.state.user.role) !== -1;
+    },
+    isTeacher() {
+      return ["TEACHER", "ADMIN", "SEEC"].indexOf(this.$store.state.user.role) !== -1;
     },
   },
   async mounted() {
@@ -282,8 +284,9 @@ export default {
     },
 
     selAndInitNotice(noticeType) {
-      Object.assign(this.newNoticeType, this.noticeTypeMap[noticeType]);
-      this.showNewNoticeDialog = true;
+      console.log(noticeType);
+      // Object.assign(this.newNoticeType, this.noticeTypeMap[noticeType]);
+      // this.showNewNoticeDialog = true;
     },
     handleFileUploading() {
     },

+ 5 - 3
src/views/CoursePage/style/CourseDetail.css

@@ -1,5 +1,5 @@
 .course-detail-page {
-    min-height: 100vh;
+    /*min-height: 100vh;*/
     display: flex;
     flex-direction: column;
     align-items: center;
@@ -33,12 +33,14 @@
 .header {
     display: flex;
     justify-content: flex-start;
-    align-items: center;
+    /*align-items: center;*/
 }
 
 .course-img {
     width: 400px;
+    height: 225px;
     object-fit: contain;
+    object-position: center center;
 }
 
 .course-img > img {
@@ -53,7 +55,7 @@
 }
 
 .course-info > div {
-    margin-bottom: 15px;
+    margin-bottom: 16.5px;
 }
 
 .course-info > div:last-child {

+ 12 - 17
src/views/ManagePage/ManagePage.vue

@@ -1,7 +1,8 @@
 <template>
   <el-row id="manage-page-body">
     <el-col :span="3">
-      <el-menu background-color="#f8f9fb" default-active="1" style="position: fixed; width: 180px;" @select="handleSelect">
+      <el-menu background-color="#f8f9fb" default-active="1" style="position: fixed; width: 180px;"
+               @select="handleSelect">
         <el-menu-item index="0">
           <el-icon>
             <Back/>
@@ -152,10 +153,10 @@
 
 <script>
 import CourseCard from "@/components/CourseCard";
-import { ElMessage, ElMessageBox } from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
 import GlobalFooter from "@/components/GlobalFooter";
 import client from "@/utils/oss";
-import { Back, Document } from "@element-plus/icons-vue";
+import {Back, Document} from "@element-plus/icons-vue";
 
 export default {
   name: "ManagePage",
@@ -240,10 +241,10 @@ export default {
       //
       courseType: "all",
       courseTypeOptions: [
-        { value: "all", label: "全部课程" },
-        { value: "pending", label: "未开始" },
-        { value: "start", label: "正在进行" },
-        { value: "end", label: "已结束" },
+        {value: "all", label: "全部课程"},
+        {value: "pending", label: "未开始"},
+        {value: "start", label: "正在进行"},
+        {value: "end", label: "已结束"},
       ],
     };
   },
@@ -259,10 +260,10 @@ export default {
         this.$router.push("portal");
       }
       if (index === "1") {
-        document.getElementById("app").scrollIntoView({ behavior: "smooth" });
+        document.getElementById("app").scrollIntoView({behavior: "smooth"});
       }
       if (index === "2") {
-        document.querySelector("#manage-page-divider").scrollIntoView({ behavior: "smooth" });
+        document.querySelector("#manage-page-divider").scrollIntoView({behavior: "smooth"});
       }
       this.activeIndex = index;
     },
@@ -402,7 +403,7 @@ export default {
       this.form.price = String(item.price);
       this.form.moocUrl = item.moocUrl;
       this.form.fileList = item.imageUrl === null ? [] : [{
-        name: "/seecoder/image-" + item.name + ".jpg",
+        name: item.name + "-image.jpg",
         url: item.imageUrl
       }];
       this.form.imageUrl = item.imageUrl;
@@ -419,13 +420,7 @@ export default {
                 this.myCourseList.splice(i, 1);
               }
             }
-            client.delete("/seecoder/image-" + item.name + ".jpg")
-              .then(() => {
-                ElMessage.success(res.data.data);
-              })
-              .catch(err => {
-                console.log(err);
-              });
+            ElMessage.success(res.data.data);
           })
           .catch(err => {
             ElMessage.error(err);