|
@@ -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: 'Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR'
|
|
|
+ } // 秘钥形式的登录上传
|
|
|
+ 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() {
|