12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481 |
- <template>
- <div class="sb-container" v-if="chapInfo && chapInfo.chapterInfo">
- <div class="steps-box" v-for="(step, stepI) in toolChoose()" :key="stepI">
- <div class="step-title">
- <div class="step">
- <span>步骤{{ stepI + 1 }}</span>
- </div>
- <div
- class="do"
- v-if="isCloseList[stepI] && worksStudent[stepI] && worksStudent[stepI].length > 4"
- @click="contract(stepI)"
- :class="{ close: isCloseList[stepI] && isCloseList[stepI].isClose == '1' }"
- >
- {{ isCloseList[stepI].isClose == '1' ? '展开' : '收缩' }}
- </div>
- </div>
- <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="video/mp4, video/quicktime, video/x-msvideo,image/*"
- style="display: none"
- multiple
- @change="beforeUpload($event, step.tool[0], stepI)"
- v-if="step.tool[0] === 50"
- />
- <input
- type="file"
- accept="video/mp4, video/quicktime, video/x-msvideo,image/*"
- style="display: none"
- @change="beforeUpload($event, step.tool[0], stepI)"
- v-else
- />
- </div>
- <div
- class="tool-box"
- v-else-if="tools[step.tool[0]] && canWork2.indexOf(step.tool[0]) !== -1"
- @click="addWork(step.tool[0], stepI, step)"
- >
- <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
- <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
- </div>
- <div class="tool-box" v-else-if="tools[step.tool[0]]">
- <div class="tool-img"><img :src="tools[step.tool[0]].img" /></div>
- <div class="tool-name">{{ tools[step.tool[0]].name }}</div>
- </div>
- <div
- class="works-box"
- v-if="isWorkTool.indexOf(step.tool[0]) !== -1 && worksStudent[stepI] && worksStudent[stepI].length"
- >
- <div class="title">作业预览</div>
- <div class="works">
- <Works
- class="work"
- v-for="(work, workI) in isCloseList[stepI].isClose == 0
- ? worksStudent[stepI]
- : worksStudent[stepI].slice(0, 4)"
- :key="stepI + '-' + workI"
- :work="work"
- >
- </Works>
- </div>
- </div>
- <div
- class="no-works-box"
- v-if="isWorkTool.indexOf(step.tool[0]) !== -1 && noWorksS[stepI] && noWorksS[stepI].length"
- >
- <div class="title">未提交</div>
- <div class="no-works-box-students">
- <div
- v-for="(student, noI) in noWorksS[stepI]"
- :key="stepI + '-' + noI"
- class="student"
- @click="teacherSubmit(step.tool[0], student, $event, step)"
- >
- {{ student.student }}
- <input
- v-if="canWork.indexOf(step.tool[0]) !== -1"
- type="file"
- accept="video/mp4, video/quicktime, video/x-msvideo,image/*"
- style="display: none"
- @change="beforeUpload2($event, stepI)"
- />
- </div>
- </div>
- </div>
- </div>
- <div v-if="!toolChoose().length" class="noMssage">
- <img src="@/assets/images/course/isNoMessage.png" />
- </div>
- <div v-if="proVisible" class="mask">
- <div class="progressBox">
- <div class="lbox"><img src="@/assets/images/loading.gif" />上传中,请稍后</div>
- <div style="margin-bottom: 10px" v-if="pVisible">
- <span>{{ isFinishSize }}M</span> / <span>{{ isAllSize }}M</span>
- </div>
- <el-progress
- :text-inside="true"
- :stroke-width="20"
- :percentage="progress"
- style="width: 80%"
- v-if="pVisible"
- ></el-progress>
- </div>
- </div>
- <answerPanel
- v-if="answerPanelVisible"
- @setPanelVisible="setPanelVisible"
- :panelVisible="answerPanelVisible"
- :courseid="courseid"
- :courseType="courseType"
- :taskCount="taskCount"
- :toolindex="toolindex"
- :isTeacher="isTeacher"
- :answerQ="answerQ"
- :sStudent="sStudent"
- ></answerPanel>
- <askPanel
- v-if="askPanelVisible"
- @setAskPanelVisible="setAskPanelVisible"
- :panelVisible="askPanelVisible"
- :courseid="courseid"
- :courseType="courseType"
- :taskCount="taskCount"
- :toolindex="toolindex"
- :isTeacher="isTeacher"
- :askJson="askJson"
- :sStudent="sStudent"
- ></askPanel>
- <choosePanel
- v-if="choosePanelVisible"
- @setChoosePanelVisible="setChoosePanelVisible"
- :panelVisible="choosePanelVisible"
- :courseid="courseid"
- :courseType="courseType"
- :taskCount="taskCount"
- :toolindex="toolindex"
- :isTeacher="isTeacher"
- :chooseJson="chooseJson"
- :sStudent="sStudent"
- ></choosePanel>
- </div>
- </template>
- <script>
- import '@/assets/js/aws-sdk-2.235.1.min.js'
- import * as imageConversion from 'image-conversion'
- import {
- getCourseWorks,
- getCourseWorksStudentJuri,
- addCourseWorksR,
- addCourseWorksTeacher,
- addCourseWorks5,
- addCourseWorksPl
- } from '@/api/course'
- import { tools } from '@/const/index'
- import Works from './works.vue'
- import { mapGetters } from 'vuex'
- import answerPanel from './answerPanel.vue'
- import askPanel from './askPanel.vue'
- import choosePanel from './choosePanel.vue'
- export default {
- props: {
- chapInfo: {
- type: Object,
- default: () => {}
- },
- courseDetail: {
- type: Object,
- default: () => {}
- },
- courseType: {
- type: Number,
- default: 0
- },
- taskCount: {
- type: Number,
- default: 0
- },
- courseid: {
- type: String,
- default: ''
- },
- tcid: {
- type: String,
- default: ''
- },
- oid: {
- type: String,
- default: ''
- },
- isLoading: {
- type: Boolean
- },
- answerPanelVisible: {
- type: Boolean
- },
- askPanelVisible: {
- type: Boolean
- },
- choosePanelVisible: {
- type: Boolean
- }
- },
- components: {
- Works,
- answerPanel,
- askPanel,
- choosePanel
- },
- data() {
- return {
- worksStudent: [],
- isWorksS: [],
- isCloseList: [],
- noWorksS: [],
- isWorkTool: [16, 32, 57, 4, 45, 15, 1, 3, 6, 7, 26, 41, 47, 48, 52, 50, 40, 63], //, 49
- canWork: [16, 50], //, 49
- canWork2: [15,4,45],
- fileType: 0,
- tools: tools,
- proVisible: false,
- pVisible: false,
- progress: 0,
- isFinishSize: 0,
- isAllSize: 0,
- sTool: 0,
- sStudent: {},
- isTeacher: false,
- toolindex: 0,
- answerQ: '',
- askJson: {},
- chooseJson: {}
- }
- },
- watch: {
- courseid(newValue, oldValue) {
- this.getWorks()
- },
- courseType(newValue, oldValue) {
- this.getWorks()
- },
- taskCount(newValue, oldValue) {
- this.getWorks()
- },
- isLoading(newValue) {
- if (newValue) {
- this.getWorks()
- }
- },
- answerPanelVisible(newValue) {
- if (!newValue) {
- this.getWorks()
- }
- },
- askPanelVisible(newValue) {
- if (!newValue) {
- this.getWorks()
- }
- },
- choosePanelVisible(newValue) {
- if (!newValue) {
- this.getWorks()
- }
- },
- },
- computed: {
- ...mapGetters(['userinfo']),
- toolChoose() {
- return () => {
- let toolchoose = this.chapInfo.chapterInfo[0].taskJson[this.taskCount].toolChoose
- toolchoose = toolchoose.filter(el => {
- return el.tool.length
- })
- return toolchoose
- }
- }
- },
- methods: {
- setPanelVisible(bool) {
- this.$emit('update:answerPanelVisible', bool)
- },
- setAskPanelVisible(bool) {
- this.$emit('update:askPanelVisible', bool)
- },
- setChoosePanelVisible(bool) {
- this.$emit('update:choosePanelVisible', bool)
- },
- arrayToArray(arrayo, arrayt) {
- const array1 = arrayo
- const array2 = arrayt
- const commonElements = []
- for (let i = 0; i < array1.length; i++) {
- for (let j = 0; j < array2.length; j++) {
- if (array1[i] === array2[j]) {
- commonElements.push(array1[i])
- }
- }
- }
- return commonElements
- },
- getWorks() {
- // 教师查看全部作业
- const params = {
- cid: this.courseid,
- s: this.courseType,
- t: this.taskCount
- }
- getCourseWorks(params)
- .then(res => {
- const works = res[0]
- const f = res[3]
- const steps = this.chapInfo.chapterInfo[0].taskJson[this.taskCount].toolChoose
- const worksStudent = []
- const isCloseList = []
- const groupStudent = []
- const groupStudentUid = []
- const isWorksS = []
- const wordPan = ['PDF', 'DOC', 'DOCX', 'PPT', 'PPTX', 'XLSX', 'XLS']
- const videoPan = [
- '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'
- ]
- console.log(works)
- for (var step = 0; step < steps.length; step++) {
- worksStudent[step] = []
- if (!isCloseList[step] || isCloseList[step].isClose === undefined) {
- isCloseList[step] = { isClose: 0 }
- }
- groupStudent[step] = []
- isWorksS[step] = []
- groupStudentUid[step] = []
- if (steps[step].tool[0] === 49) {
- for (var gA = 0; gA < steps[step].groupJson.group.length; gA++) {
- groupStudent[step][gA] = []
- groupStudentUid[step][gA] = []
- worksStudent[step][gA] = []
- isCloseList[step][gA] = []
- for (var g = 0; g < f.length; g++) {
- if (
- f[g].ttype === 2 &&
- this.tcid &&
- this.arrayToArray(f[g].classid.split(','), this.tcid.split(',')).length === 0
- ) {
- continue
- }
- if (gA === f[g].group && f[g].tool === step) {
- this.groupStudent[step][gA].push(f[g])
- this.groupStudentUid[step][gA].push(f[g].userid)
- }
- }
- }
- this.$forceUpdate()
- }
- for (var j = 0; j < works.length; j++) {
- if (
- works[j].ttype === 2 &&
- this.tcid &&
- this.arrayToArray(works[j].classid.split(','), this.tcid.split(',')).length === 0
- ) {
- continue
- }
- var likesCount = 0
- var commentCount = 0
- var isLikes = false
- var commentJson = []
- if (step === works[j].tool) {
- if (
- (works[j].type === 1 ||
- works[j].type === 4 ||
- works[j].type === 5 ||
- works[j].type === 6 ||
- works[j].type === 12 ||
- works[j].type === 7) &&
- steps[step].tool[0] !== 15 &&
- steps[step].tool[0] !== 4 &&
- steps[step].tool[0] !== 45 &&
- steps[step].tool[0] !== 50 &&
- steps[step].tool[0] !== 32 &&
- steps[step].tool[0] !== 57 &&
- steps[step].tool[0] !== 52
- ) {
- if (
- wordPan.indexOf(
- works[j].content.split('.')[works[j].content.split('.').length - 1].toLocaleUpperCase()
- ) !== -1 &&
- steps[step].tool[0] === 16 &&
- (works[j].atool ? parseInt(works[j].atool) : '') !== 50
- ) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 1,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (
- videoPan.indexOf(
- works[j].content.split('.')[works[j].content.split('.').length - 1].toLocaleUpperCase()
- ) !== -1 &&
- steps[step].tool[0] === 16 &&
- (works[j].atool ? parseInt(works[j].atool) : '') !== 50
- ) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 3,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 6 && (works[j].atool ? parseInt(works[j].atool) : '') !== 50) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 4,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 7 && (works[j].atool ? parseInt(works[j].atool) : '') !== 50) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 5,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (
- works[j].type === 12 &&
- steps[step].tool[0] === (works[j].atool ? parseInt(works[j].atool) : '')
- ) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 12,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (
- works[j].type === 1 &&
- steps[step].tool[0] === (works[j].atool ? parseInt(works[j].atool) : '')
- ) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 0,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 1 && !parseInt(works[j].atool ? parseInt(works[j].atool) : '')) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 0,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- }
- } else if (works[j].type === 3 && steps[step].tool[0] === 15) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 2,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 2 && steps[step].tool[0] === 4) {
- // 问卷
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 4,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 8 && steps[step].tool[0] === 45) {
- // 选择题
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 8,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 9 && steps[step].tool[0] === 47) {
- // 选择题
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 9,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 10 && steps[step].tool[0] === 48) {
- // 选择题
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 10,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 13 && steps[step].tool[0] === 52) {
- // 选择题
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name,
- type: 13,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (works[j].type === 11 && steps[step].tool[0] === 49) {
- const _gindex = JSON.parse(works[j].content)
- if (groupStudentUid[step][_gindex.groupIndex].indexOf(works[j].userid) !== -1) {
- worksStudent[step][_gindex.groupIndex].push({
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: _gindex.url,
- sName: works[j].name,
- type: _gindex.type,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- })
- }
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (steps[step].tool[0] === 50 && (works[j].atool ? parseInt(works[j].atool) : '') === 50) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name ? works[j].name : works[j].userid,
- type: works[j].type === 1 ? 0 : works[j].type === 4 ? 1 : 3,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (steps[step].tool[0] === 32 && (works[j].atool ? parseInt(works[j].atool) : '') === 32) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name ? works[j].name : works[j].userid,
- type: 12,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- } else if (steps[step].tool[0] === 57 && (works[j].atool ? parseInt(works[j].atool) : '') === 57) {
- const _works = {
- userid: works[j].userid,
- ateacher: works[j].ateacher,
- wid: works[j].id,
- works: works[j].content,
- sName: works[j].name ? works[j].name : works[j].userid,
- type: 12,
- time: works[j].time,
- score: works[j].score,
- img: works[j].img,
- likesCount: likesCount,
- commentCount: commentCount,
- isLikes: isLikes,
- commentJson: commentJson
- }
- worksStudent[step].push(_works)
- isWorksS[step].push({ uid: works[j].userid, sName: works[j].name })
- }
- }
- }
- }
- // if (worksStudent[step] && worksStudent[step].length) {
- // worksStudent[step] = worksStudent[step].sort(function(a, b) {
- // const jscoreA = a.score ? JSON.parse(a.score).wScore : 0
- // const jscoreB = b.score ? JSON.parse(b.score).wScore : 0
- // var scoreA = parseFloat(jscoreA)
- // var scoreB = parseFloat(jscoreB)
- // if (scoreA === scoreB) {
- // return b.likesCount - a.likesCount
- // }
- // return scoreB - scoreA
- // })
- // }
- this.worksStudent = worksStudent
- this.isCloseList = isCloseList
- this.groupStudent = groupStudent
- this.groupStudentUid = groupStudentUid
- this.isWorksS = isWorksS
- this.$forceUpdate()
- this.selectWorksStudent()
- })
- .catch(err => {
- console.error(err)
- })
- },
- selectWorksStudent() {
- const params = {
- oid: this.oid,
- cid: this.courseDetail.juri
- }
- getCourseWorksStudentJuri(params)
- .then(res => {
- var a = res[0]
- for (var i = 0; i < this.isWorksS.length; i++) {
- this.noWorksS[i] = []
- var studentK = []
- for (var z = 0; z < this.isWorksS[i].length; z++) {
- studentK.push(this.isWorksS[i][z].uid)
- }
- studentK = studentK.join(',')
- for (var j = 0; j < a.length; j++) {
- if (studentK.indexOf(a[j].userid) === -1) {
- if (this.tcid) {
- if (this.arrayToArray(a[j].classid.split(','), this.tcid.split(',')).length) {
- this.noWorksS[i].push({
- student: a[j].name,
- userid: a[j].userid
- })
- }
- } else {
- this.noWorksS[i].push({
- student: a[j].name,
- userid: a[j].userid
- })
- }
- }
- }
- }
- this.$forceUpdate()
- })
- .catch(err => {
- console.log(err)
- })
- },
- contract(i) {
- if (this.isCloseList[i].isClose === 0) {
- this.isCloseList[i].isClose = 1
- } else {
- this.isCloseList[i].isClose = 0
- }
- this.$forceUpdate()
- },
- addImg(e) {
- var el = e.currentTarget
- el.getElementsByTagName('input')[0].click()
- e.target.value = ''
- },
- pngToWhiteBg(file) {
- const _file = file
- const read = new FileReader()
- read.readAsDataURL(file) // 文件转base64
- return new Promise((resolve, reject) => {
- read.onload = e => {
- const img = new Image()
- img.src = e.target.result
- // eslint-disable-next-line space-before-function-paren
- img.onload = async () => {
- // 生成canvas
- const canvas = document.createElement('canvas')
- const context = canvas.getContext('2d')
- // 绘制图片到canvas上
- canvas.width = img.width
- canvas.height = img.height
- // 在canvas绘制前填充白色背景
- context.fillStyle = '#fff'
- context.fillRect(0, 0, canvas.width, canvas.height)
- context.drawImage(img, 0, 0)
- const base64 = canvas.toDataURL(file['type'], 1)
- const newFile = this.dataUrlToFile(base64, _file)
- resolve(newFile)
- }
- }
- })
- },
- dataUrlToFile(dataurl, file) {
- const arr = dataurl.split(',')
- const mime = arr[0].match(/:(.*?);/)[1]
- const bstr = atob(arr[1])
- let n = bstr.length
- const u8arr = new Uint8Array(n)
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n)
- }
- // return new Blob([u8arr], { type: mime });
- return new File([new Blob([u8arr], { type: mime })], file.name, {
- type: mime
- })
- },
- async beforeUpload(event, type, i) {
- // this.$message.success('进入上传')
- var file = ''
- const files = event.target.files
- const plfile = []
- for (let cfindex2 = 0; cfindex2 < files.length; cfindex2++) {
- if (files.length > 1) {
- this.pVisible = false
- } else {
- this.pVisible = true
- }
- file = files[cfindex2]
- 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 &&
- type !== 4
- ) {
- 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
- if (cfindex2 === files.length - 1 || cfindex2 > files.length - 1) {
- 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 (type === 16) {
- 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.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
- }
- plfile.push({
- fileType: _ftype,
- url: data.Location,
- username: _this.userinfo.userid
- })
- if (cfindex2 === files.length - 1 || cfindex2 > files.length - 1) {
- _this.addCourseWorksPl(plfile, i)
- }
- }
- 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)
- }
- })
- }
- },
- addCourseWorks(data, toolindex) {
- var typesql
- 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
- }
- const params = [
- {
- uid: this.userinfo.userid,
- cid: this.courseid,
- stage: this.courseType,
- task: this.taskCount,
- tool: toolindex,
- content: data,
- type: typesql
- }
- ]
- addCourseWorksR(params)
- .then(res => {
- this.$toast({
- message: '添加成功',
- type: 'success'
- })
- setTimeout(() => {
- this.getWorks()
- }, 2000)
- })
- .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(files, toolindex) {
- const _files = files
- 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, content) {
- 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 = ''
- } else if (tool === 15) {
- this.isTeacher = false
- this.answerQ = content.answerQ
- this.setPanelVisible(true)
- }
- }
- },
- addWork(tool, toolindex, content) {
- this.sStudent = {}
- this.toolindex = toolindex
- if (tool === 15) {
- this.isTeacher = true
- this.answerQ = content.answerQ
- this.setPanelVisible(true)
- } else if (tool === 4) {
- this.isTeacher = true
- this.askJson = content
- this.setAskPanelVisible(true)
- }else if(tool == 45){
- this.isTeacher = true
- this.chooseJson = content
- this.setChoosePanelVisible(true)
- }
- }
- },
- mounted() {
- this.getWorks()
- }
- }
- </script>
- <style lang="scss" scoped>
- .sb-container {
- width: 100%;
- box-sizing: border-box;
- padding: 0 15px 60px;
- .steps-box {
- width: 100%;
- border-bottom: 1px solid rgb(239, 239, 239);
- padding: 15px 0;
- .step-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 0.8rem;
- .step {
- font-size: 18px;
- font-weight: bold;
- display: flex;
- height: 100%;
- align-items: center;
- &::before {
- content: '';
- height: 100%;
- width: 3px;
- display: block;
- margin-right: 0.2rem;
- background-image: linear-gradient(180deg, #2c5cbd, #a1cff4);
- }
- }
- .do {
- font-size: 14px;
- color: #b9b9b9;
- display: flex;
- align-items: center;
- cursor: pointer;
- &::after {
- content: '';
- width: 5px;
- height: 5px;
- border-top: 2px solid #b9b9b9;
- border-left: 2px solid #b9b9b9;
- transform: rotate(-135deg);
- transition: all 0.5s;
- margin-left: 5px;
- }
- &.close {
- &::after {
- transform: rotate(-45deg);
- }
- }
- }
- }
- }
- .tool-box {
- margin: 10px 0;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 1.5rem;
- .tool-img {
- width: 1.5rem;
- border-radius: 15px;
- box-shadow: 0 1px 8px 0 #14141424;
- > img {
- width: 100%;
- height: auto;
- object-fit: cover;
- }
- }
- .tool-name {
- font-size: 14px;
- margin-top: 5px;
- white-space: nowrap;
- }
- }
- .works-box {
- .title {
- font-size: 14px;
- color: #858585;
- }
- .works {
- margin: 10px 0 0;
- display: flex;
- flex-wrap: wrap;
- .work {
- }
- }
- }
- .no-works-box {
- margin-top: 10px;
- .title {
- font-size: 14px;
- color: #858585;
- }
- .no-works-box-students {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- margin: 10px 0 0;
- .student {
- background: #7cbcf1;
- color: #fff;
- width: 70px;
- height: 20px;
- text-align: center;
- line-height: 20px;
- border-radius: 5px;
- margin: 0 15px 10px 0;
- padding: 5px;
- font-size: 14px;
- cursor: pointer;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-word;
- max-width: 70px;
- // @include textoverflow();
- }
- }
- }
- .noMssage {
- width: 100%;
- height: 5rem;
- display: flex;
- align-items: center;
- justify-content: center;
- > img {
- width: 3rem;
- }
- }
- }
- </style>
|