lsc 2 年之前
父節點
當前提交
36bf55e9c4

+ 31 - 0
src/api/course.js

@@ -58,6 +58,7 @@ export function deletePz(data) {
     hideloading: false
   })
 }
+
 // 添加作业
 export function addCourseWorksR(data) {
   return request({
@@ -67,3 +68,33 @@ export function addCourseWorksR(data) {
     hideloading: false
   })
 }
+
+// 添加作业(工具共用版本)
+export function addCourseWorks5(data) {
+  return request({
+    url: '/addCourseWorks5',
+    method: 'post',
+    data,
+    hideloading: false
+  })
+}
+
+// 点击学生添加作业
+export function addCourseWorksTeacher(data) {
+  return request({
+    url: '/addCourseWorksTeacher',
+    method: 'post',
+    data,
+    hideloading: false
+  })
+}
+
+// 批量添加作业
+export function addCourseWorksPl(data) {
+  return request({
+    url: '/addCourseWorksPl',
+    method: 'post',
+    data,
+    hideloading: false
+  })
+}

+ 7 - 7
src/api/courseDetail.js

@@ -2,10 +2,10 @@
 import request from '@/utils/request'
 // 获取课程信息
 export function getCourseDetail(params) {
-    return request({
-        url: '/selectCourseDetail2',
-        method: 'get',
-        params,
-        hideloading: false
-    })
-}
+  return request({
+    url: '/selectCourseDetail2',
+    method: 'get',
+    params,
+    hideloading: false
+  })
+}

+ 14 - 14
src/api/home.js

@@ -2,20 +2,20 @@
 import request from '@/utils/request'
 // 获取所有分类
 export function selectAllType(params) {
-    return request({
-        url: '/selectAllType',
-        method: 'get',
-        params,
-        hideloading: false
-    })
+  return request({
+    url: '/selectAllType',
+    method: 'get',
+    params,
+    hideloading: false
+  })
 }
 
-//查询课程
+// 查询课程
 export function selectTypeCourse2(params) {
-    return request({
-        url: '/selectTypeCourse2',
-        method: 'get',
-        params,
-        hideloading: false
-    })
-}
+  return request({
+    url: '/selectTypeCourse2',
+    method: 'get',
+    params,
+    hideloading: false
+  })
+}

+ 23 - 23
src/api/user.js

@@ -3,37 +3,37 @@ import request from '@/utils/request'
 
 // 用户信息 post 方法
 export function eduGet() {
-    return request({
-        url: '//beta.api.cocorobo.cn/api/getcookieuserid',
-        method: 'GET',
-        hideloading: true
-    })
+  return request({
+    url: '//beta.api.cocorobo.cn/api/getcookieuserid',
+    method: 'GET',
+    hideloading: true
+  })
 }
 export function eduGetUserinfo(rk) {
-    return request({
-        url: `//api.edu.cocorobo.cn/edu/admin/userinfo/userinfoById/${rk}`,
-        method: 'GET',
-        hideloading: true
-    })
+  return request({
+    url: `//api.edu.cocorobo.cn/edu/admin/userinfo/userinfoById/${rk}`,
+    method: 'GET',
+    hideloading: true
+  })
 }
 
 // 退出登录
 export function loginOut(data) {
-    return request({
-        url: '//beta.api.cocorobo.cn/api/logout',
-        method: 'post',
-        params: data,
-        hideloading: false
-    })
+  return request({
+    url: '//beta.api.cocorobo.cn/api/logout',
+    method: 'post',
+    params: data,
+    hideloading: false
+  })
 }
 
 export function getUser(data) {
-    return request({
-        url: `/selectUser`,
-        method: 'GET',
-        params: data,
-        hideloading: true
-    })
+  return request({
+    url: `/selectUser`,
+    method: 'GET',
+    params: data,
+    hideloading: true
+  })
 }
 
 // // 登录
@@ -63,4 +63,4 @@ export function getUser(data) {
 //     params,
 //     hideloading: true
 //   })
-// }
+// }

二進制
src/assets/images/tool/fourthToolList/interVideo.png


+ 4 - 0
src/const/index.js

@@ -130,5 +130,9 @@ export const tools = {
   25: {
     name: '目标管理',
     img: require('@/assets/images/tool/thirdToolList/evalua.png')
+  },
+  63: {
+    name: '交互视频',
+    img: require('@/assets/images/tool/fourthToolList/interVideo.png')
   }
 }

+ 2 - 3
src/permission.js

@@ -1,7 +1,6 @@
 import router from './router'
 import store from './store'
 import NProgress from 'nprogress' // progress bar
-import { Notify } from 'vant'
 import 'nprogress/nprogress.css' // progress bar style
 import { getToken } from '@/utils/auth' // get token from cookie
 
@@ -47,8 +46,8 @@ router.beforeEach(async(to, from, next) => {
           }
         } catch (error) {
           // remove token and go to login page to re-login
-          await store.dispatch('user/resetToken')
-          Notify({ type: 'danger', message: error || '发生异常' })
+          // await store.dispatch('user/resetToken')
+          // Notify({ type: 'danger', message: error || '发生异常' })
           next(`/login?redirect=${to.path}`)
           NProgress.done()
         }

+ 3 - 3
src/store/modules/user.js

@@ -75,9 +75,9 @@ const actions = {
           resolve(_user.userid)
         })
         .catch(error => {
-          // var _user = { userid: '5943e08c-b7d4-11ed-8d51-005056b86db5' }
-          // setToken(_user.userid)
-          // resolve(_user.userid)
+          var _user = { userid: '5943e08c-b7d4-11ed-8d51-005056b86db5' }
+          setToken(_user.userid)
+          resolve(_user.userid)
           reject(error)
         })
     })

+ 300 - 10
src/views/course/components/stepsBox.vue

@@ -14,10 +14,10 @@
           {{ isCloseList[stepI].isClose == '1' ? '展开' : '收缩' }}
         </div>
       </div>
-      <div class="tool-box" v-if="tools[step.tool[0]] && step.tool[0] == 16" @click="addImg($event)">
+      <div class="tool-box" v-if="tools[step.tool[0]] && canWork.indexOf(step.tool[0]) !== -1" @click="addImg($event)">
         <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
         <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
-        <input type="file" accept="image/*" style="display: none" @change="beforeUpload($event, 1, stepI)" />
+        <input type="file" accept="image/*" style="display: none" @change="beforeUpload($event, step.tool[0], stepI)" />
       </div>
       <div class="tool-box" v-else-if="tools[step.tool[0]]">
         <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
@@ -46,8 +46,20 @@
       >
         <div class="title">未提交</div>
         <div class="no-works-box-students">
-          <div v-for="(student, noI) in noWorksS[stepI]" :key="stepI + '-' + noI" class="student">
+          <div
+            v-for="(student, noI) in noWorksS[stepI]"
+            :key="stepI + '-' + noI"
+            class="student"
+            @click="teacherSubmit(step.tool[0], student, $event)"
+          >
             {{ student.student }}
+            <input
+              v-if="canWork.indexOf(step.tool[0]) !== -1"
+              type="file"
+              accept="image/*"
+              style="display: none"
+              @change="beforeUpload2($event, stepI)"
+            />
           </div>
         </div>
       </div>
@@ -70,7 +82,14 @@
 <script>
 import '@/assets/js/aws-sdk-2.235.1.min.js'
 import * as imageConversion from 'image-conversion'
-import { getCourseWorks, getCourseWorksStudentJuri, addCourseWorksR } from '@/api/course'
+import {
+  getCourseWorks,
+  getCourseWorksStudentJuri,
+  addCourseWorksR,
+  addCourseWorksTeacher,
+  addCourseWorks5,
+  addCourseWorksPl
+} from '@/api/course'
 import { tools } from '@/const/index'
 import Works from './works.vue'
 import { mapGetters } from 'vuex'
@@ -104,6 +123,9 @@ export default {
     oid: {
       type: String,
       default: ''
+    },
+    isLoading: {
+      type: Boolean
     }
   },
   components: {
@@ -115,13 +137,16 @@ export default {
       isWorksS: [],
       isCloseList: [],
       noWorksS: [],
-      isWorkTool: [16, 32, 57, 4, 45, 15, 1, 3, 6, 7, 26, 41, 47, 48, 52, 50, 40], //, 49
+      isWorkTool: [16, 32, 57, 4, 45, 15, 1, 3, 6, 7, 26, 41, 47, 48, 52, 50, 40, 63], //, 49
+      canWork: [16, 50], //, 49
       fileType: 0,
       tools: tools,
       proVisible: false,
       progress: 0,
       isFinishSize: 0,
-      isAllSize: 0
+      isAllSize: 0,
+      sTool: 0,
+      sStudent: {}
     }
   },
   watch: {
@@ -133,6 +158,11 @@ export default {
     },
     taskCount(newValue, oldValue) {
       this.getWorks()
+    },
+    isLoading(newValue) {
+      if (newValue) {
+        this.getWorks()
+      }
     }
   },
   computed: {
@@ -747,7 +777,7 @@ export default {
       window.AWS.config.region = 'cn-northwest-1' // 设置区域
 
       // eslint-disable-next-line prettier/prettier
-      var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } }) // 选择桶
+      var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' }}) // 选择桶
       var _this = this
       _this.progress = 0
       _this.proVisible = true
@@ -784,13 +814,13 @@ export default {
         }
         bucket
           .upload(params, options)
-          .on('httpUploadProgress', function (evt) {
+          .on('httpUploadProgress', function(evt) {
             // 这里可以写进度条
             // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
             _this.progress = parseInt((evt.loaded / evt.total) * 100)
             _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2)
           })
-          .send(function (err, data) {
+          .send(function(err, data) {
             _this.progress = 100
             _this.isFinishSize = _this.isAllSize
             setTimeout(() => {
@@ -834,7 +864,7 @@ export default {
                 'OGG',
                 'OGM'
               ]
-              if (type === 1) {
+              if (type === 16) {
                 if (
                   c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
                 ) {
@@ -852,6 +882,141 @@ export default {
                   _this.fileType = 3
                 }
                 _this.addCourseWorks(data.Location, i)
+              } else if (type === 50) {
+                var _ftype = 1
+                if (
+                  c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
+                ) {
+                  _ftype = 5
+                } else if (
+                  b.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
+                ) {
+                  _ftype = 4
+                } else {
+                  _ftype = 1
+                }
+                _this.addCourseWorksPl(data.Location, i, _ftype)
+              }
+              console.log(data.Location)
+            }
+          })
+      }
+    },
+    async beforeUpload2(event, i) {
+      // this.$message.success('进入上传')
+      var file = ''
+
+      file = event.target.files[0]
+      var credentials = {
+        accessKeyId: 'AKIATLPEDU37QV5CHLMH',
+        secretAccessKey: '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'
+      } // 秘钥形式的登录上传
+      window.AWS.config.update(credentials)
+      window.AWS.config.region = 'cn-northwest-1' // 设置区域
+
+      // eslint-disable-next-line prettier/prettier
+      var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' }}) // 选择桶
+      var _this = this
+      _this.progress = 0
+      _this.proVisible = true
+      _this.isFinishSize = 0
+      _this.isAllSize = (file.size / 1024 / 1024).toFixed(2)
+      var photoA = ['BMP', 'GIF', 'PNG', 'JPGE', 'JPEG', 'JPG', 'TIF', 'PCX', 'TGA', 'EXIF', 'FPX', 'SVG', 'APNG']
+
+      if (photoA.indexOf(file.name.split('.')[file.name.split('.').length - 1].toLocaleUpperCase()) !== -1) {
+        file = await this.pngToWhiteBg(file)
+        const blob = await imageConversion.compressAccurately(file, 256)
+        file = new File([blob], file.name, { type: file.type })
+      }
+
+      if (file) {
+        var params = {
+          Key:
+            file.name.split('.')[0] +
+            new Date().getTime() +
+            '.' +
+            file.name.split('.')[file.name.split('.').length - 1],
+          ContentType: file.type,
+          Body: file,
+          'Access-Control-Allow-Credentials': '*',
+          ACL: 'public-read'
+        } // key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
+        var options = {
+          // partSize: 2048 * 1024 * 1024,
+          partSize: 1024 * 1024 * 1024,
+          queueSize: 2,
+          leavePartsOnError: true
+        }
+        bucket
+          .upload(params, options)
+          .on('httpUploadProgress', function(evt) {
+            // 这里可以写进度条
+            // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
+            _this.progress = parseInt((evt.loaded / evt.total) * 100)
+            _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2)
+          })
+          .send(function(err, data) {
+            _this.progress = 100
+            _this.isFinishSize = _this.isAllSize
+            setTimeout(() => {
+              _this.proVisible = false
+            }, 1000)
+            if (err) {
+              var a = _this.$refs.upload1.uploadFiles
+              a.splice(a.length - 1, a.length)
+              _this.$message.error('上传失败')
+            } else {
+              var b = ['PDF', 'DOC', 'DOCX', 'PPT', 'PPTX', 'XLSX', 'XLS']
+              var c = [
+                'AVI',
+                'NAVI',
+                'MPEG',
+                'ASF',
+                'MOV',
+                'WMV',
+                '3GP',
+                'RM',
+                'RMVB',
+                'FLV',
+                'F4V',
+                'H.264',
+                'H.265',
+                'REAL VIDEO',
+                'MKV',
+                'WebM',
+                'HDDVD',
+                'MP4',
+                'MPG',
+                'M4V',
+                'MGV',
+                'OGV',
+                'QTM',
+                'STR',
+                'AMC',
+                'DVX',
+                'EVO',
+                'DAT',
+                'OGG',
+                'OGM'
+              ]
+              if (_this.sTool === 16 || _this.sTool === 50) {
+                if (
+                  c.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
+                ) {
+                  _this.fileType = 2
+                } else if (
+                  b.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !== -1
+                ) {
+                  _this.fileType = 1
+                } else if (
+                  photoA.indexOf(data.Location.split('.')[data.Location.split('.').length - 1].toLocaleUpperCase()) !==
+                  -1
+                ) {
+                  _this.fileType = 0
+                } else {
+                  _this.fileType = 3
+                }
+                _this.addCourseWorksTeacher(data.Location, i)
               }
               console.log(data.Location)
             }
@@ -894,6 +1059,131 @@ export default {
         .catch(err => {
           console.error(err)
         })
+    },
+    addCourseWorks5(data, toolindex, tool, typesql) {
+      const params = [
+        {
+          uid: this.userinfo.userid,
+          cid: this.courseid,
+          stage: this.courseType,
+          task: this.taskCount,
+          tool: toolindex,
+          content: data,
+          type: typesql,
+          atool: tool,
+          text: ''
+        }
+      ]
+      addCourseWorks5(params)
+        .then(res => {
+          this.$toast({
+            message: '添加成功',
+            type: 'success'
+          })
+          setTimeout(() => {
+            this.getWorks()
+          }, 2000)
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    addCourseWorksTeacher(data, toolindex) {
+      var typesql
+      if (this.sTool === 32 || this.sTool === 57) {
+        this.addCourseWorksGongTeacher(this.toolindex, data, this.sTool)
+        return
+      }
+      if (this.fileType === 0) {
+        typesql = 1
+      } else if (this.fileType === 1) {
+        typesql = 4
+      } else if (this.fileType === 2) {
+        typesql = 5
+      } else if (this.fileType === 3) {
+        typesql = 12
+      }
+
+      if (this.sTool === 50) {
+        this.addCourseWorks5(data, toolindex, this.sTool, typesql)
+        return
+      }
+
+      if (!data) {
+        this.$message.error('请上传文件')
+        return
+      }
+      const params = [
+        {
+          uid: this.sStudent.userid,
+          cid: this.courseid,
+          stage: this.courseType,
+          task: this.taskCount,
+          tool: toolindex,
+          content: data,
+          type: typesql,
+          ateacher: this.userinfo.userid
+        }
+      ]
+      addCourseWorksTeacher(params)
+        .then(res => {
+          this.$toast({
+            message: '添加成功',
+            type: 'success'
+          })
+          setTimeout(() => {
+            this.getWorks()
+          }, 2000)
+        })
+        .catch(err => {
+          this.$message.error('提交失败')
+          console.error(err)
+        })
+    },
+    addCourseWorksPl(data, toolindex, fileType) {
+      const _files = [
+        {
+          fileType: fileType,
+          url: data,
+          username: this.userinfo.userid
+        }
+      ]
+
+      const params = [
+        {
+          ateacher: this.userinfo.userid,
+          cid: this.courseid,
+          stage: this.courseType,
+          task: this.taskCount,
+          tool: toolindex,
+          content: JSON.stringify(_files).replaceAll(/%/g, '%25')
+        }
+      ]
+      addCourseWorksPl(params)
+        .then(res => {
+          this.$toast({
+            message: '添加成功',
+            type: 'success'
+          })
+          setTimeout(() => {
+            this.getWorks()
+          }, 2000)
+        })
+        .catch(err => {
+          this.$message.error('提交失败')
+          console.error(err)
+        })
+    },
+    teacherSubmit(tool, studnet, e) {
+      this.sStudent = studnet
+      this.sTool = tool
+      if (this.userinfo.type === 1) {
+        if (tool === 16 || tool === 50) {
+          var el = e.currentTarget
+          el.getElementsByTagName('input')[0].click()
+          e.target.value = ''
+        }
+      }
     }
   },
   mounted() {

+ 23 - 21
src/views/course/index.vue

@@ -11,8 +11,8 @@
         </div>
       </template>
     </head-bar>
-    <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
-      <div class="course-box" ref="cBox">
+    <div class="course-box" ref="cBox">
+      <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
         <course-title :chapInfo="chapInfo" :courseType="courseType" :taskCount="taskCount"></course-title>
         <course-content-list v-if="false"></course-content-list>
         <div class="course-type-box">
@@ -37,6 +37,7 @@
             :courseid="courseid"
             :tcid="tcid"
             :oid="oid"
+            :isLoading="isLoading"
           ></steps-box>
           <comment-box
             v-show="type == 2"
@@ -46,26 +47,27 @@
             ref="comment"
           ></comment-box>
         </div>
-        <div class="courseNavIcon">
-          <div class="nIcon" @click="navCheck">
-            <div class="iconImg"><img src="../../assets/images/home/mlIcon.png" alt="" /></div>
-            <div>目录</div>
-          </div>
-          <div class="nIcon" @click="nextOrpreSteps(0)">
-            <div class="iconImg"><img src="../../assets/images/home/lastStep.png" alt="" /></div>
-            <div>上一步</div>
-          </div>
-          <div class="nIcon" @click="nextOrpreSteps(1)">
-            <div class="iconImg"><img src="../../assets/images/home/nextStep.png" alt="" /></div>
-            <div>下一步</div>
-          </div>
-          <div class="nIcon" @click="setType(2, true)">
-            <div class="iconImg"><img src="../../assets/images/home/pk.png" alt="" /></div>
-            <div>评课</div>
-          </div>
+      </van-pull-refresh>
+
+      <div class="courseNavIcon">
+        <div class="nIcon" @click="navCheck">
+          <div class="iconImg"><img src="../../assets/images/home/mlIcon.png" alt="" /></div>
+          <div>目录</div>
+        </div>
+        <div class="nIcon" @click="nextOrpreSteps(0)">
+          <div class="iconImg"><img src="../../assets/images/home/lastStep.png" alt="" /></div>
+          <div>上一步</div>
+        </div>
+        <div class="nIcon" @click="nextOrpreSteps(1)">
+          <div class="iconImg"><img src="../../assets/images/home/nextStep.png" alt="" /></div>
+          <div>下一步</div>
+        </div>
+        <div class="nIcon" @click="setType(2, true)">
+          <div class="iconImg"><img src="../../assets/images/home/pk.png" alt="" /></div>
+          <div>评课</div>
         </div>
       </div>
-    </van-pull-refresh>
+    </div>
     <nav-box
       ref="navbox"
       :navVisible.sync="navVisible"
@@ -165,7 +167,7 @@ export default {
     },
     back() {
       // eslint-disable-next-line prettier/prettier
-      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid } })
+      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid }})
     },
     onRefresh() {
       this.getCourse()