Bläddra i källkod

update 任务编辑问题和任务查看

dusenyao 2 år sedan
förälder
incheckning
ad0acf5fbe

+ 35 - 49
package-lock.json

@@ -17,7 +17,7 @@
         "dayjs": "^1.11.7",
         "element-ui": "^2.15.12",
         "gcls-book-question-ui": "file:../gcls-book-question-ui-0.1.0.tgz",
-        "jquery": "^3.6.1",
+        "jquery": "^3.6.3",
         "js-base64": "^3.7.3",
         "js-cookie": "^3.0.1",
         "jsplumb": "^2.15.6",
@@ -52,15 +52,15 @@
         "eslint-plugin-prettier": "^4.2.1",
         "eslint-plugin-vue": "^9.8.0",
         "html-webpack-plugin": "^5.5.0",
-        "postcss": "^8.4.19",
+        "postcss": "^8.4.20",
         "postcss-html": "^1.5.0",
-        "prettier": "2.8.0",
-        "sass": "^1.56.1",
+        "prettier": "2.8.1",
+        "sass": "^1.57.1",
         "sass-loader": "^10.4.1",
         "script-ext-html-webpack-plugin": "^2.1.5",
         "stylelint": "^14.16.0",
         "stylelint-config-prettier": "^9.0.4",
-        "stylelint-config-recess-order": "^3.0.0",
+        "stylelint-config-recess-order": "^3.1.0",
         "stylelint-config-recommended-vue": "^1.4.0",
         "stylelint-config-standard-scss": "^6.1.0",
         "stylelint-declaration-block-no-ignored-properties": "^2.6.0",
@@ -14075,10 +14075,9 @@
       }
     },
     "node_modules/jquery": {
-      "version": "3.6.1",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/jquery/-/jquery-3.6.1.tgz",
-      "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==",
-      "license": "MIT"
+      "version": "3.6.3",
+      "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.3.tgz",
+      "integrity": "sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg=="
     },
     "node_modules/js-audio-recorder": {
       "version": "1.0.7",
@@ -16950,20 +16949,9 @@
       }
     },
     "node_modules/postcss": {
-      "version": "8.4.19",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/postcss/-/postcss-8.4.19.tgz",
-      "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==",
-      "funding": [
-        {
-          "type": "opencollective",
-          "url": "https://opencollective.com/postcss/"
-        },
-        {
-          "type": "tidelift",
-          "url": "https://tidelift.com/funding/github/npm/postcss"
-        }
-      ],
-      "license": "MIT",
+      "version": "8.4.20",
+      "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.20.tgz",
+      "integrity": "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==",
       "dependencies": {
         "nanoid": "^3.3.4",
         "picocolors": "^1.0.0",
@@ -17792,9 +17780,9 @@
       }
     },
     "node_modules/prettier": {
-      "version": "2.8.0",
-      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.0.tgz",
-      "integrity": "sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA==",
+      "version": "2.8.1",
+      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.1.tgz",
+      "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==",
       "dev": true,
       "bin": {
         "prettier": "bin-prettier.js"
@@ -18789,11 +18777,10 @@
       "license": "MIT"
     },
     "node_modules/sass": {
-      "version": "1.56.1",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/sass/-/sass-1.56.1.tgz",
-      "integrity": "sha512-VpEyKpyBPCxE7qGDtOcdJ6fFbcpOM+Emu7uZLxVrkX8KVU/Dp5UF7WLvzqRuUhB6mqqQt1xffLoG+AndxTZrCQ==",
+      "version": "1.57.1",
+      "resolved": "https://registry.npmmirror.com/sass/-/sass-1.57.1.tgz",
+      "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
         "chokidar": ">=3.0.0 <4.0.0",
         "immutable": "^4.0.0",
@@ -20345,11 +20332,10 @@
       }
     },
     "node_modules/stylelint-config-recess-order": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmmirror.com/stylelint-config-recess-order/-/stylelint-config-recess-order-3.0.0.tgz",
-      "integrity": "sha512-uNXrlDz570Q7HJlrq8mNjgfO/xlKIh2hKVKEFMTG1/ih/6tDLcTbuvO1Zoo2dnQay990OAkWLDpTDOorB+hmBw==",
+      "version": "3.1.0",
+      "resolved": "https://registry.npmmirror.com/stylelint-config-recess-order/-/stylelint-config-recess-order-3.1.0.tgz",
+      "integrity": "sha512-LXR6zD5O9cS1a9gbLbuKvWLs7qmHj4xm5MQ5KhhwZPMhtQP9da3F6Jsp/NAUdsAwDQEnT1ShU16YVdgN6p4a/w==",
       "dev": true,
-      "license": "ISC",
       "dependencies": {
         "stylelint-order": "5.x"
       },
@@ -33576,9 +33562,9 @@
       }
     },
     "jquery": {
-      "version": "3.6.1",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/jquery/-/jquery-3.6.1.tgz",
-      "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw=="
+      "version": "3.6.3",
+      "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.3.tgz",
+      "integrity": "sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg=="
     },
     "js-audio-recorder": {
       "version": "1.0.7",
@@ -35600,9 +35586,9 @@
       "dev": true
     },
     "postcss": {
-      "version": "8.4.19",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/postcss/-/postcss-8.4.19.tgz",
-      "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==",
+      "version": "8.4.20",
+      "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.20.tgz",
+      "integrity": "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==",
       "requires": {
         "nanoid": "^3.3.4",
         "picocolors": "^1.0.0",
@@ -36120,9 +36106,9 @@
       "dev": true
     },
     "prettier": {
-      "version": "2.8.0",
-      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.0.tgz",
-      "integrity": "sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA==",
+      "version": "2.8.1",
+      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.1.tgz",
+      "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==",
       "dev": true
     },
     "prettier-linter-helpers": {
@@ -36818,9 +36804,9 @@
       "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
     },
     "sass": {
-      "version": "1.56.1",
-      "resolved": "https://repo.huaweicloud.com/repository/npm/sass/-/sass-1.56.1.tgz",
-      "integrity": "sha512-VpEyKpyBPCxE7qGDtOcdJ6fFbcpOM+Emu7uZLxVrkX8KVU/Dp5UF7WLvzqRuUhB6mqqQt1xffLoG+AndxTZrCQ==",
+      "version": "1.57.1",
+      "resolved": "https://registry.npmmirror.com/sass/-/sass-1.57.1.tgz",
+      "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
       "dev": true,
       "requires": {
         "chokidar": ">=3.0.0 <4.0.0",
@@ -38147,9 +38133,9 @@
       "dev": true
     },
     "stylelint-config-recess-order": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmmirror.com/stylelint-config-recess-order/-/stylelint-config-recess-order-3.0.0.tgz",
-      "integrity": "sha512-uNXrlDz570Q7HJlrq8mNjgfO/xlKIh2hKVKEFMTG1/ih/6tDLcTbuvO1Zoo2dnQay990OAkWLDpTDOorB+hmBw==",
+      "version": "3.1.0",
+      "resolved": "https://registry.npmmirror.com/stylelint-config-recess-order/-/stylelint-config-recess-order-3.1.0.tgz",
+      "integrity": "sha512-LXR6zD5O9cS1a9gbLbuKvWLs7qmHj4xm5MQ5KhhwZPMhtQP9da3F6Jsp/NAUdsAwDQEnT1ShU16YVdgN6p4a/w==",
       "dev": true,
       "requires": {
         "stylelint-order": "5.x"

+ 5 - 5
package.json

@@ -22,7 +22,7 @@
     "dayjs": "^1.11.7",
     "element-ui": "^2.15.12",
     "gcls-book-question-ui": "file:../gcls-book-question-ui-0.1.0.tgz",
-    "jquery": "^3.6.1",
+    "jquery": "^3.6.3",
     "js-base64": "^3.7.3",
     "js-cookie": "^3.0.1",
     "jsplumb": "^2.15.6",
@@ -57,15 +57,15 @@
     "eslint-plugin-prettier": "^4.2.1",
     "eslint-plugin-vue": "^9.8.0",
     "html-webpack-plugin": "^5.5.0",
-    "postcss": "^8.4.19",
+    "postcss": "^8.4.20",
     "postcss-html": "^1.5.0",
-    "prettier": "2.8.0",
-    "sass": "^1.56.1",
+    "prettier": "2.8.1",
+    "sass": "^1.57.1",
     "sass-loader": "^10.4.1",
     "script-ext-html-webpack-plugin": "^2.1.5",
     "stylelint": "^14.16.0",
     "stylelint-config-prettier": "^9.0.4",
-    "stylelint-config-recess-order": "^3.0.0",
+    "stylelint-config-recess-order": "^3.1.0",
     "stylelint-config-recommended-vue": "^1.4.0",
     "stylelint-config-standard-scss": "^6.1.0",
     "stylelint-declaration-block-no-ignored-properties": "^2.6.0",

+ 13 - 0
src/api/course.js

@@ -654,3 +654,16 @@ export function GetCSItemTaskStudentList(data) {
     data
   });
 }
+
+/**
+ * 提交任务作业(学员提交)
+ * @param {Object} data
+ */
+export function SubmitTaskHomework_Student(data) {
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_LearnWebSI,
+    params: getRequestParams('teaching-task_manager-SubmitTaskHomework_Student'),
+    data
+  });
+}

+ 9 - 5
src/components/select/SelectCourse.vue

@@ -78,7 +78,7 @@ export default {
 </script>
 
 <script setup>
-import { inject, ref, unref, watch, computed } from 'vue';
+import { inject, ref, unref, watch, watchEffect, computed } from 'vue';
 import { GetCourseBookListByCSItemID } from '@/api/select';
 import { GetBookChapterStruct } from '@/api/course';
 import { useShowCourseware } from '@/components/course/courseware';
@@ -138,10 +138,14 @@ function confirm() {
   currentCourse.value = '';
 }
 
-GetCourseBookListByCSItemID({ cs_item_id: unref(cs_item_id) }).then(({ book_list: list }) => {
-  book_list.value = list;
-  if (book_list.value.length > 0) {
-    curBook.value = book_list.value[0];
+watchEffect(() => {
+  if (unref(cs_item_id)) {
+    GetCourseBookListByCSItemID({ cs_item_id: unref(cs_item_id) }).then(({ book_list: list }) => {
+      book_list.value = list;
+      if (book_list.value.length > 0) {
+        curBook.value = book_list.value[0];
+      }
+    });
   }
 });
 

+ 22 - 25
src/layouts/components/BreadCrumb.vue

@@ -22,34 +22,31 @@
 
 <script>
 export default {
-  name: 'BreadCrumb',
-  data() {
-    return {
-      routerList: []
-    };
-  },
-  computed: {
-    isShow() {
-      return this.routerList.length > 0;
-    }
-  },
-  watch: {
-    $route() {
-      this.getBreadcrumb();
-    }
-  },
-  created() {
-    this.getBreadcrumb();
-  },
-  methods: {
-    getBreadcrumb() {
-      this.routerList = this.$route.matched.filter((item) => item.meta && item.meta.title);
-      this.$emit('update:isShowNav', this.isShow);
-    }
-  }
+  name: 'BreadCrumb'
 };
 </script>
 
+<script setup>
+import { ref, computed, watch } from 'vue';
+import { useRoute } from 'vue-router/composables';
+
+const route = useRoute();
+let routerList = ref([]);
+const isShow = computed(() => routerList.value.length > 0);
+
+const emits = defineEmits(['update:isShowNav']);
+
+function getBreadcrumb() {
+  routerList.value = route.matched.filter((item) => item.meta && item.meta.title);
+  emits('update:isShowNav', isShow.value);
+}
+getBreadcrumb();
+
+watch(route, () => {
+  getBreadcrumb();
+});
+</script>
+
 <style lang="scss">
 .breadcrumb {
   z-index: 999;

+ 1 - 1
src/views/course_details/index.vue

@@ -84,7 +84,7 @@
               </template>
               <div v-else></div>
 
-              <div v-if="!readonly">
+              <div v-if="!readonly && !(!is_buy && backTime === 0)">
                 <span v-show="CourseData.price !== 0" class="price">
                   ¥
                   <span class="price_1" v-text="changePrice('1', CourseData.price)"></span>

+ 2 - 2
src/views/main/components/OldTaskList.vue

@@ -21,7 +21,7 @@
         @click="taskLink_outside(id)"
       >
         <div class="task-item-top">
-          <svg-icon icon-class="arrival" :style="getItemIconStyle(cid)" />
+          <svg-icon icon-class="arrival" :style="getItemIconColor(cid)" />
           <span class="cs-item-name">
             {{ cs_item_name }} - {{ name }}
             <span v-if="teaching_type === 10" class="enter-live" @click.stop="taskLink(teaching_type, id)">
@@ -66,7 +66,7 @@ defineProps({
 });
 
 const $t = inject('$t');
-let { getItemStyle, getItemIconStyle } = useTaskItem();
+let { getItemStyle, getItemIconColor } = useTaskItem();
 
 const router = useRouter();
 let { taskLink, taskLink_outside } = useTaskLink(router);

+ 2 - 2
src/views/main/components/TaskList.js

@@ -144,7 +144,7 @@ export function useTaskItem() {
     };
   }
 
-  function getItemIconStyle(id) {
+  function getItemIconColor(id) {
     if (!courseIdList.value.includes(id)) courseIdList.value.push(id);
     const i = courseIdList.value.indexOf(id) % 7;
 
@@ -153,7 +153,7 @@ export function useTaskItem() {
     };
   }
 
-  return { getItemStyle, getItemIconStyle };
+  return { getItemStyle, getItemIconColor };
 }
 
 /**

+ 52 - 20
src/views/main/components/TaskList.vue

@@ -2,24 +2,18 @@
   <div>
     <ul class="task-list">
       <li
-        v-for="(
-          { task_list, cs_item_id, cs_item_name, course_id, course_name, task_time_type, is_live_task_group }, i
-        ) in taskGroupList"
+        v-for="({ task_list, cs_item_id, cs_item_name, course_id, course_name, task_time_type }, i) in taskGroupList"
         :key="i"
         class="task-item"
       >
         <div class="task-item-top">
-          <svg-icon icon-class="arrival" class-name="arrival" :style="getItemIconStyle(course_id)" />
+          <svg-icon icon-class="arrival" class-name="arrival" :style="getItemIconColor(course_id)" />
           <span class="cs-item-name">
-            <span @click="$router.push(`/task_view/${cs_item_id}?task_time_type=${task_time_type}`)">
-              {{ cs_item_name }}
-            </span>
             <span
-              v-if="is_live_task_group === 'true'"
-              class="enter-live"
-              @click.stop="taskLink(task_list[0].teaching_type, task_list[0].id)"
+              :style="getItemIconColor(course_id)"
+              @click="$router.push(`/task_view/${cs_item_id}?task_time_type=${task_time_type}`)"
             >
-              {{ $t('Key616') }} >
+              {{ cs_item_name }}
             </span>
           </span>
           <span class="task-button" :style="{ 'background-color': buttonColorList.get(task_time_type) }">
@@ -30,10 +24,28 @@
           <div class="course-name" @click="changeTab(menuList[1].tab, course_id)">
             {{ course_name }}
           </div>
-          <ul v-if="is_live_task_group === 'false'">
-            <li v-for="({ id, name }, j) in task_list" :key="id">{{ j + 1 }}. {{ name }}</li>
+          <ul>
+            <li v-for="({ id, name, teaching_type, time_space_view_txt, finish_status }, j) in task_list" :key="id">
+              <span>{{ j + 1 }}.</span>
+              <span>{{ ` ${name} ${liveTeachingType === teaching_type ? time_space_view_txt : ''}` }}</span>
+              <template v-if="liveTeachingType === teaching_type">
+                <template v-if="finish_status === 1">
+                  <span
+                    class="enter-live"
+                    :style="{ color: finishStatusList[finish_status].color }"
+                    @click.stop="taskLink(task_list[0].teaching_type, task_list[0].id)"
+                  >
+                    {{ $t('Key616') }} >
+                  </span>
+                </template>
+                <template v-else>
+                  <span :style="{ color: finishStatusList[finish_status].color }">
+                    {{ finishStatusList[finish_status].name }}
+                  </span>
+                </template>
+              </template>
+            </li>
           </ul>
-          <div v-if="is_live_task_group === 'true'" class="time-txt">时间 {{ task_list[0].time_space_view_txt }}</div>
         </div>
       </li>
     </ul>
@@ -51,6 +63,7 @@ import { inject } from 'vue';
 import { useRouter } from 'vue-router/composables';
 import { menuList } from '../index';
 import { useTaskLink, useTaskItem, getTimeTypeName, buttonColorList } from './TaskList';
+import { taskClassify } from '@/views/teacher/create_course/step_three/components/data/constant.js';
 
 defineProps({
   timeUnit: {
@@ -63,9 +76,28 @@ defineProps({
   }
 });
 
+const finishStatusList = [
+  {
+    value: 0,
+    name: '未开始',
+    color: '#FEA014'
+  },
+  {
+    value: 1,
+    name: '进行中',
+    color: '#2A76E8'
+  },
+  {
+    value: 2,
+    name: '已结束',
+    color: '#E04A4A'
+  }
+];
+
 const router = useRouter();
+const liveTeachingType = taskClassify[4].teaching_type;
 let { taskLink } = useTaskLink(router);
-let { getItemIconStyle } = useTaskItem();
+let { getItemIconColor } = useTaskItem();
 
 let changeTab = inject('changeTab');
 </script>
@@ -100,11 +132,6 @@ let changeTab = inject('changeTab');
       .cs-item-name {
         flex: 1;
         margin-left: 10px;
-
-        .enter-live {
-          margin-left: 12px;
-          color: #808080;
-        }
       }
 
       .task-button {
@@ -129,6 +156,11 @@ let changeTab = inject('changeTab');
         margin-top: 8px;
         color: #7f7f7f;
         cursor: text;
+
+        .enter-live {
+          margin-left: 12px;
+          cursor: pointer;
+        }
       }
 
       .time-txt {

+ 5 - 1
src/views/main/curricula_list/student.vue

@@ -92,7 +92,7 @@ export default {
 </script>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, onActivated } from 'vue';
 import { PageQueryMyJoinCourseList_Student } from '@/api/table';
 import {
   GetFinishStatusList_Course,
@@ -135,6 +135,10 @@ function queryMyCourseList(course_id = '') {
 }
 queryMyCourseList(props.courseId);
 
+onActivated(() => {
+  if (props.courseId.length > 0) queryMyCourseList(props.courseId);
+});
+
 let finish_status_list = ref([]); // 完成状态列表
 GetFinishStatusList_Course().then(({ finish_status_list: list }) => {
   finish_status_list.value = list;

+ 5 - 1
src/views/main/curricula_list/teacher.vue

@@ -104,7 +104,7 @@ export default {
 </script>
 
 <script setup>
-import { ref, inject } from 'vue';
+import { ref, inject, onActivated } from 'vue';
 import { PageQueryMyCourseList } from '@/api/table';
 import { GetFinishStatusList_Course } from '@/api/select';
 import { ReleaseCourse, DeleteCourse } from '@/api/course';
@@ -148,6 +148,10 @@ function queryMyCourseList(course_id = '') {
 }
 queryMyCourseList(props.courseId);
 
+onActivated(() => {
+  if (props.courseId.length > 0) queryMyCourseList(props.courseId);
+});
+
 const router = useRouter();
 function studentList(id) {
   router.push(`/student_list/index/${id}`);

+ 40 - 5
src/views/new_task_view/components/common/FileView.vue

@@ -11,7 +11,7 @@
           {{ name }}
         </div>
       </div>
-      <div class="file-download">
+      <div class="file-download" @click="allDownload">
         <svg-icon icon-class="course-download" />
         全部下载
       </div>
@@ -37,9 +37,31 @@
     <hr />
     <div class="student-download">
       <div class="student-download-title">学生上传:</div>
-      <div class="select-file">
-        <el-button size="small">选择文件</el-button>
-        <span class="tip">支持批量上传,上传格式支持mp3; mp4; jpg; png文件</span>
+      <template v-if="!isTeacher">
+        <div class="select-file">
+          <el-upload action="no" :http-request="upload" multiple :show-file-list="false">
+            <el-button size="small">选择文件</el-button>
+          </el-upload>
+          <span class="tip">支持批量上传,上传格式支持mp3; mp4; jpg; png文件</span>
+        </div>
+      </template>
+      <div class="preview-file-content">
+        <div
+          v-for="{ file_id, file_name } in homeworkList"
+          v-show="curFileType === fileTypeList[0].type || curFileFormat.includes(getFileType(file_name))"
+          :key="file_id"
+          class="file-item"
+        >
+          <div class="file-item-image">
+            <div class="file-operation">
+              <svg-icon icon-class="course-preview" @click="showFileVisible(file_name, file_id)" />
+              <span class="vertical-bar"></span>
+              <svg-icon icon-class="course-download" @click="downloadFileUrl(file_id, file_name)" />
+            </div>
+            <img :src="getFileImage(getFileType(file_name))" />
+          </div>
+          <span class="nowrap-ellipsis">{{ file_name }}</span>
+        </div>
       </div>
     </div>
   </div>
@@ -57,10 +79,14 @@ import { allowFormat, documentFormat, pictureFormat, videoFormat, audioFormat, c
 import { getFileType } from '@/utils/filter';
 import { downloadFileUrl } from '@/utils/common';
 
-defineProps({
+const props = defineProps({
   accessoryList: {
     type: Array,
     required: true
+  },
+  homeworkList: {
+    type: Array,
+    required: true
   }
 });
 
@@ -125,6 +151,15 @@ function getFileImage(type) {
 }
 
 const showFileVisible = inject('showFileVisible');
+const isTeacher = inject('isTeacher');
+const $t = inject('$t');
+
+// 全部下载
+function allDownload() {
+  props.accessoryList.forEach(({ file_id, file_name }) => {
+    downloadFileUrl(file_id, file_name);
+  });
+}
 </script>
 
 <style lang="scss" scoped>

+ 16 - 5
src/views/new_task_view/components/common/SubtaskItem.vue

@@ -23,17 +23,28 @@
         <div class="subtask-title">{{ subtaskData.name }}</div>
         <div v-html="subtaskData.content"></div>
       </div>
-      <div v-for="(item, i) in subtaskData.info_block_list" :key="`preview-${i}`" class="subtask-content-item">
-        <template v-if="item.info_block_type === taskClassify[1].type">
+      <div
+        v-for="(
+          { info_block_type, courseware_list, file_list, message_list, homework_list }, i
+        ) in subtaskData.info_block_list"
+        :key="`preview-${i}`"
+        class="subtask-content-item"
+      >
+        <template v-if="info_block_type === taskClassify[1].type">
           <CoursewareView
-            v-for="(data, j) in item.courseware_list"
+            v-for="(data, j) in courseware_list"
             :key="`course-${j}`"
             :courseware-id="data.courseware_id"
             :group-id-selected-info="data.group_id_selected_info"
           />
         </template>
-        <FileView v-if="item.info_block_type === taskClassify[2].type" :file-id-list="item.accessory_list" />
-        <MessageView v-if="item.info_block_type === taskClassify[3].type" :message-list="item.message_list" />
+        <FileView
+          v-if="info_block_type === taskClassify[2].type"
+          :accessory-list="file_list"
+          :homework-list="homework_list"
+          @addHomework="addHomework"
+        />
+        <MessageView v-if="info_block_type === taskClassify[3].type" :message-list="message_list" />
       </div>
     </div>
   </div>

+ 1 - 0
src/views/new_task_view/components/student/index.vue

@@ -25,6 +25,7 @@
           <FileView
             v-if="[taskClassify[2].teaching_type, taskClassify[4].teaching_type].includes(curTaskObject.teaching_type)"
             :accessory-list="curTaskObject.accessory_list"
+            :homework-list="curTaskObject.homework_list"
           />
           <MessageView
             v-if="[taskClassify[3].teaching_type].includes(curTaskObject.teaching_type)"

+ 1 - 0
src/views/new_task_view/components/teacher/index.vue

@@ -25,6 +25,7 @@
           <FileView
             v-if="[taskClassify[2].teaching_type, taskClassify[4].teaching_type].includes(curTaskObject.teaching_type)"
             :accessory-list="curTaskObject.accessory_list"
+            :homework-list="curTaskObject.homework_list"
           />
           <MessageView
             v-if="[taskClassify[3].teaching_type].includes(curTaskObject.teaching_type)"

+ 44 - 0
src/views/new_task_view/components/utils/homework.js

@@ -0,0 +1,44 @@
+import { inject } from 'vue';
+import { isAllowFileType, fileTypeSizeLimit } from '@/utils/validate';
+import { Message } from 'element-ui';
+import { fileUpload } from '@/api/app';
+
+export function useHomework() {
+  const $t = inject('$t');
+
+  /**
+   * 添加到作业列表
+   * @param {Array} homeworkList
+   * @param {Array} addFiles
+   */
+  function addHomework(homeworkList, addFiles) {
+    homeworkList.push({ ...addFiles });
+  }
+
+  /**
+   *  提交作业
+   * @param {Object} file
+   */
+  function uploadHomework(file) {
+    const fileName = file.file.name;
+    if (!isAllowFileType(fileName)) {
+      Message.error(`【${fileName}】${$t('Key335')}`);
+      return;
+    }
+
+    if (fileTypeSizeLimit(file.file.name, file.file.size)) {
+      return Message.error(`${fileName}文件大小超出限制`);
+    }
+
+    fileUpload('Mid', file).then(({ file_info_list }) => {
+      if (file_info_list.length > 0) {
+        // const { file_id, file_name, file_url } = file_info_list[0];
+        // file_list.value.push({ file_id, file_name, file_url });
+      }
+    });
+  }
+
+  return {
+    addHomework
+  };
+}

+ 15 - 14
src/views/new_task_view/index.js

@@ -32,22 +32,22 @@ function convertDataFormatTaskList(list) {
     // 学生列表转换为学生id列表
     item.custom_student_id_list = item.custom_student_list.map(({ student_id }) => student_id);
     // 教材转换
-    item._coursewares = JSON.parse(JSON.stringify(item.courseware_list));
+    // item._coursewares = JSON.parse(JSON.stringify(item.courseware_list));
     // 文件转换
-    item._files = filesTransform(item.accessory_list);
+    // item._files = filesTransform(item.accessory_list);
 
-    item.child_task_list.forEach(({ info_block_list }) => {
-      info_block_list.forEach(({ info_block_type, courseware_list, file_list }, i, arr) => {
-        if (info_block_type === 'courseware') {
-          arr[i]._coursewares = JSON.parse(JSON.stringify(courseware_list));
-          return;
-        }
-        if (info_block_type === 'file') {
-          arr[i]._files = filesTransform(file_list);
-          return;
-        }
-      });
-    });
+    // item.child_task_list.forEach(({ info_block_list }) => {
+    //   info_block_list.forEach(({ info_block_type, courseware_list, file_list }, i, arr) => {
+    //     if (info_block_type === 'courseware') {
+    //       arr[i]._coursewares = JSON.parse(JSON.stringify(courseware_list));
+    //       return;
+    //     }
+    //     if (info_block_type === 'file') {
+    //       arr[i]._files = filesTransform(file_list);
+    //       return;
+    //     }
+    //   });
+    // });
   });
   return list;
 }
@@ -57,6 +57,7 @@ export function useTask() {
   const id = route.params.id;
   const task_time_type = Number(route.query.task_time_type);
   const isTeacher = store.getters.isTeacher;
+  provide('isTeacher', isTeacher);
 
   let curStudentId = ref('');
   let taskData = ref({});

+ 1 - 0
src/views/new_task_view/index.vue

@@ -56,6 +56,7 @@ import { useTask } from './index';
 import { useTaskType, TASK_EXPLAIN } from './components/data/TaskType';
 import { useScale, useWheel, scale } from '@/views/teacher/create_course/step_three/components/utils/wheel';
 import { useMouseEvent } from '@/views/teacher/create_course/step_three/components/utils/mouseEvent';
+import { SubmitTaskHomework_Student } from '@/api/course';
 
 import StudentView from './components/student/index.vue';
 import TeacherView from './components/teacher/index.vue';

+ 3 - 3
src/views/teacher/create_course/step_two/SelectBook.vue

@@ -49,9 +49,9 @@
               :total="total_count"
               :current-page="cur_page"
               :page-size="page_capacity"
-              @prev-click="changePage(queryBookList)"
-              @next-click="changePage(queryBookList)"
-              @current-change="changePage(queryBookList)"
+              @prev-click="changePage($event, queryBookList)"
+              @next-click="changePage($event, queryBookList)"
+              @current-change="changePage($event, queryBookList)"
             />
             <div>
               <el-button class="prev-step" @click="prevCourseInfo">