(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ef47dc24"],{"14ef":function(t,e,a){},"299f":function(t,e,a){},"5c9d":function(t,e,a){"use strict";a("a95e")},7684:function(t,e,a){"use strict";a("299f")},9204:function(t,e,a){"use strict";a.d(e,"a",(function(){return i})),a.d(e,"b",(function(){return l})),a.d(e,"d",(function(){return r})),a.d(e,"c",(function(){return c}));var s=a("cf45");const i=(t,e)=>{if(t){let a="yyyy/MM/dd HH:mm";return e&&(a=e),Object(s["f"])(t,a)}return""},l=(t,e)=>{if(t){let a="yyyy-MM-dd HH:mm:ss";return e&&(a=e),Object(s["f"])(t,a)}return""},r=(t,e)=>{if(t||0===t){let a=0;return e&&(a=e),t.toFixed(a)}return""};function n(t){return t<10&&(t="0"+t),t}const c=function(t){t=Math.round(t/1e3);let e=0,a=0;return t<60?e=Number(t).toFixed(0):(a=Math.floor(t/60),e=Math.floor(t-60*a)),`${n(a)}分${n(e)}秒`}},a95e:function(t,e,a){},ab43:function(t,e,a){"use strict";var s=a("23e7"),i=a("c65b"),l=a("59ed"),r=a("825a"),n=a("46c4"),c=a("c5cc"),o=a("9bdd"),d=a("2a62"),u=a("2baa"),h=a("f99f"),f=a("c430"),m=!f&&!u("map",(function(){})),p=!f&&!m&&h("map",TypeError),g=f||m||p,b=c((function(){var t=this.iterator,e=r(i(this.next,t)),a=this.done=!!e.done;if(!a)return o(t,this.mapper,[e.value,this.counter++],!0)}));s({target:"Iterator",proto:!0,real:!0,forced:g},{map:function(t){r(this);try{l(t)}catch(e){d(this,"throw",e)}return p?i(p,this,t):new b(n(this),{mapper:t})}})},c8a1:function(t,e,a){"use strict";a.d(e,"a",(function(){return x}));a("d9e2");var s=a("8ce4"),i=a("7b67");const l=t=>i["c"]+"consumer/tagQuestion/"+t,r=(t={})=>Object(s["a"])(l("assignment/myList"),"get",t),n=t=>Object(s["a"])(l("attempt/start"),"post_json",{assignmentId:t}),c=t=>Object(s["a"])(l("attempt/"+t),"get",{}),o=(t,e)=>Object(s["a"])(l(`attempt/${t}/draft`),"put",{answers:e}),d=(t,e)=>Object(s["a"])(l(`attempt/${t}/submit`),"post_json",e),u=(t={})=>Object(s["a"])(l("teacher/paperList"),"get",t),h=t=>Object(s["a"])(l("teacher/assignmentStudents"),"get",t),f=t=>Object(s["a"])(l("teacher/attemptDetail"),"get",{attemptId:t}),m=()=>Object(s["a"])(l("teacher/clazzList"),"get",{}),p=()=>Object(s["a"])(l("teacher/publishedPapers"),"get",{}),g=t=>Object(s["a"])(l("teacher/assignment/save"),"post_json",t),b=t=>Object(s["a"])(l("teacher/assignment/update"),"post_json",t),v=t=>Object(s["a"])(l("teacher/assignment/delete"),"post_json",{id:t});var y=a("2ca2");class x{static async call(t){const[e]=await t;if(!e||2e4!==e.code)throw new Error(e&&e.msg||"请求失败");return e.data}static async myAssignments(t=1,e=20,a=""){const s=await this.call(r({page:t,size:e,status:a}));return y["a"].generateListMybatisPlus(s)}static start(t){return this.call(n(t))}static attempt(t){return this.call(c(t))}static saveDraft(t,e){return this.call(o(t,e))}static submit(t,e){return this.call(d(t,e))}static async teacherPaperList(t=1,e=20,a={}){const s=await this.call(u(Object.assign({page:t,size:e},a)));return y["a"].generateListMybatisPlus(s)}static async assignmentStudents(t={},e=1,a=20){const s=await this.call(h(Object.assign({},t,{page:e,size:a})));return y["a"].generateListMybatisPlus(s)}static teacherAttemptDetail(t){return this.call(f(t))}static teacherClazzList(){return this.call(m())}static teacherPublishedPapers(){return this.call(p())}static teacherSaveAssignment(t){return this.call(g(t))}static teacherUpdateAssignment(t){return this.call(b(t))}static teacherDeleteAssignment(t){return this.call(v(t))}}},c91f:function(t,e,a){"use strict";a("14ef")},e2f9:function(t,e,a){"use strict";a("e9f5"),a("910d");var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"list-filter"},[e("div",{staticClass:"flex flex-start"},[t.searchFilter.search.length>0?e("div",{staticClass:"search-container flex flex-start"},[e("span",{staticClass:"title"}),e("div",{staticClass:"flex flex-start"},[t._l(t.searchFilter.search,(function(a,s){return[e("div",{staticClass:"fl"},["input"===a.type?e("el-input",{staticClass:"search-item",staticStyle:{width:"200px"},attrs:{size:"small",placeholder:a.label},model:{value:a.value,callback:function(e){t.$set(a,"value",e)},expression:"item.value"}}):t._e()],1)]}))],2)]):t._e(),t.searchFilter.filter.length>0?e("div",{staticClass:"filter-container flex flex-start"},[e("span",{staticClass:"title"}),e("div",{staticClass:"flex flex-start flex-wrap"},[t._l(t.searchFilter.filter,(function(a,s){return a.hidden?t._e():["select"===a.type?e("div",{staticClass:"filter-item"},[a.hideTitle?t._e():e("span",{staticClass:"title"},[t._v(t._s(a.label)+":")]),e("el-select",{staticClass:"select",attrs:{size:"small"},on:{change:t=>a.change(a.data[t])},model:{value:a.value,callback:function(e){t.$set(a,"value",e)},expression:"item.value"}},t._l(a.data,(function(t,a){return e("el-option",{key:a,attrs:{value:t.value,label:t.label}})})),1)],1):t._e(),"timeRange"===a.type?e("div",{staticClass:"filter-item"},[e("el-date-picker",{attrs:{type:"daterange","end-placeholder":a.label[1],"start-placeholder":a.label[0],"default-time":["00:00:00","23:59:59"]},on:{change:a.change},model:{value:a.value,callback:function(e){t.$set(a,"value",e)},expression:"item.value"}})],1):t._e()]}))],2)]):t._e()]),e("div",{staticClass:"search-bottom flex flex-around"},[e("div",{staticClass:"flex flex-start"},[e("el-button",{staticClass:"button",attrs:{plain:"",icon:"el-icon-delete",type:"default",size:"small"},on:{click:t.clickCleanBtn}},[t._v("重置 ")]),e("el-button",{staticClass:"button",attrs:{icon:"el-icon-search",type:"primary",size:"small"},on:{click:t.clickSearchBtn}},[t._v("查询 ")])],1)]),e("div",{staticClass:"flex flex-end"},[t._t("right-container")],2)])},i=[],l=(a("7d54"),{name:"listSearchFilter",props:{searchFilter:{type:Object,default:{search:[],filter:[]}}},data(){return{document:{}}},methods:{clickSearchBtn(){let t={};this.searchFilter.search.forEach(e=>{(0===e.value||e.value)&&(e.format?t[e.key]=e.format(e.value):t[e.key]=e.value)}),this.searchFilter.filter.forEach(e=>{(0===e.value||e.value)&&(e.format?t=Object.assign(t,e.format(e.value)):t[e.key]=e.value)}),this.$emit("clickSearchFilterBtn",t)},clickCleanBtn(){this.searchFilter.search.forEach(t=>{(0===t.value||t.value)&&(t.value="")}),this.searchFilter.filter.forEach(t=>{(0===t.value||t.value)&&(t.value="")}),this.clickSearchBtn()}}}),r=l,n=(a("7684"),a("2877")),c=Object(n["a"])(r,s,i,!1,null,"0c385262",null);e["a"]=c.exports},f918:function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"page-container paper-assignment"},[e("list-search-filter",{attrs:{"search-filter":t.searchFilter},on:{clickSearchFilterBtn:e=>t.clickSearchFilterBtn(e)}},[e("div",{attrs:{slot:"right-container"},slot:"right-container"},[e("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:t.openCreate}},[t._v("新建下发")])],1)]),e("div",{staticClass:"table-container"},[e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:t.records,"element-loading-text":"加载中","header-cell-style":{background:"#fafafa",color:"#555"},fit:""}},[e("el-table-column",{attrs:{prop:"paperName",label:"题单","min-width":"200","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{prop:"clazzName",label:"教学班","min-width":"120","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"作答时间","min-width":"280"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t._f("dateFormat2")(e.row.startTime))+" 至 "+t._s(t._f("dateFormat2")(e.row.endTime))+" ")]}}])}),e("el-table-column",{attrs:{label:"作答策略",width:"100",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s("ONCE"===e.row.attemptPolicy?"仅一次":"可重复")+" ")]}}])}),e("el-table-column",{attrs:{label:"结果展示",width:"100",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.showResult?"展示":"不展示")+" ")]}}])}),e("el-table-column",{attrs:{label:"状态",width:"100",align:"center"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("el-tag",{attrs:{size:"small",type:t.statusTagType(a.row.status)}},[t._v(" "+t._s(t.statusText(a.row.status))+" ")])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"160",align:"center","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(a){return["CANCELLED"===a.row.status?[e("span",{staticClass:"op-hint"},[t._v("已撤销")])]:[e("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(e){return t.openExtend(a.row)}}},[t._v("延期")]),"NOT_STARTED"===a.row.status?e("el-button",{staticClass:"danger",attrs:{type:"text",size:"mini"},on:{click:function(e){return t.cancel(a.row)}}},[t._v("撤销")]):e("el-tooltip",{attrs:{content:"题单已开始或已截止，无法撤销，仅可延期",placement:"top"}},[e("span",{staticClass:"op-hint"},[t._v("不可撤销")])])]]}}])})],1),t.loading||t.records.length?t._e():e("el-empty",{attrs:{description:"暂无下发记录，点击右上角「新建下发」"}})],1),t.page.totalElements>0?e("div",{staticClass:"pagination-container"},[e("el-pagination",{attrs:{background:"","current-page":t.page.number,"page-size":t.page.size,layout:"total,prev, pager, next,sizes,jumper",total:t.page.totalElements,"page-count":t.page.totalPage},on:{"current-change":e=>t.pageChange(e),"update:currentPage":function(e){return t.$set(t.page,"number",e)},"update:current-page":function(e){return t.$set(t.page,"number",e)},"update:pageSize":function(e){return t.$set(t.page,"size",e)},"update:page-size":function(e){return t.$set(t.page,"size",e)},"size-change":e=>t.pageSizeChange(e)}})],1):t._e(),e("el-dialog",{attrs:{title:"新建题单下发",visible:t.dialog,width:"780px","close-on-click-modal":!1,"custom-class":"assignment-dialog"},on:{"update:visible":function(e){t.dialog=e}}},[e("el-form",{staticClass:"assign-form",attrs:{"label-width":"110px",size:"small"}},[e("div",{staticClass:"form-section"},[e("div",{staticClass:"form-section-title"},[t._v("基本信息")]),e("el-form-item",{attrs:{label:"题单",required:""}},[e("el-select",{staticStyle:{width:"100%"},attrs:{filterable:"",placeholder:"选择已发布的题单"},model:{value:t.form.paperId,callback:function(e){t.$set(t.form,"paperId",e)},expression:"form.paperId"}},t._l(t.papers,(function(t){return e("el-option",{key:t.id,attrs:{label:`${t.name}（${t.questionCount} 题）`,value:t.id}})})),1)],1)],1),e("div",{staticClass:"form-section"},[e("div",{staticClass:"form-section-title"},[t._v("下发对象")]),e("el-form-item",{attrs:{label:"教学班",required:""}},[e("el-transfer",{attrs:{filterable:"","filter-placeholder":"搜索教学班",data:t.clazzTransfer,titles:["可选教学班","已选教学班"],props:{key:"key",label:"label"}},model:{value:t.form.clazzIds,callback:function(e){t.$set(t.form,"clazzIds",e)},expression:"form.clazzIds"}}),e("div",{staticClass:"form-tip"},[t._v("同一题单可同时下发给多个教学班，每个班级独立一条下发记录")])],1)],1),e("div",{staticClass:"form-section"},[e("div",{staticClass:"form-section-title"},[t._v("作答时间")]),e("el-form-item",{attrs:{label:"日期区间",required:""}},[e("div",{staticClass:"date-range"},[e("el-date-picker",{staticStyle:{width:"160px"},attrs:{type:"date",placeholder:"开始日期"},model:{value:t.form.startDate,callback:function(e){t.$set(t.form,"startDate",e)},expression:"form.startDate"}}),e("span",{staticClass:"range-sep"},[t._v("至")]),e("el-date-picker",{staticStyle:{width:"160px"},attrs:{type:"date",placeholder:"截止日期"},model:{value:t.form.endDate,callback:function(e){t.$set(t.form,"endDate",e)},expression:"form.endDate"}})],1),e("div",{staticClass:"form-tip"},[t._v("开始日 00:00:00 起，截止日 23:59:59 止；截止日期须晚于开始日期")])])],1),e("div",{staticClass:"form-section"},[e("div",{staticClass:"form-section-title"},[t._v("作答策略")]),e("el-form-item",{attrs:{label:"作答次数"}},[e("el-radio-group",{model:{value:t.form.attemptPolicy,callback:function(e){t.$set(t.form,"attemptPolicy",e)},expression:"form.attemptPolicy"}},[e("el-radio",{attrs:{label:"UNLIMITED"}},[t._v("允许重复作答")]),e("el-radio",{attrs:{label:"ONCE"}},[t._v("仅一次")])],1)],1),e("el-form-item",{attrs:{label:"提交后结果"}},[e("el-switch",{attrs:{"active-text":"展示对错","inactive-text":"不展示"},model:{value:t.form.showResult,callback:function(e){t.$set(t.form,"showResult",e)},expression:"form.showResult"}}),e("div",{staticClass:"form-tip"},[t._v("开启后学生提交即可查看对错与参考答案；默认关闭")])],1)],1)]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{size:"small"},on:{click:function(e){t.dialog=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",size:"small",loading:t.saving},on:{click:t.save}},[t._v("确认下发")])],1)],1),e("el-dialog",{attrs:{title:"延期",visible:t.extendDialog,width:"420px","close-on-click-modal":!1},on:{"update:visible":function(e){t.extendDialog=e}}},[e("el-form",{attrs:{"label-width":"100px",size:"small"}},[e("el-form-item",{attrs:{label:"当前截止"}},[e("span",{staticClass:"extend-current"},[t._v(t._s(t._f("dateFormat2")(t.extendRow&&t.extendRow.endTime)))])]),e("el-form-item",{attrs:{label:"新的截止日",required:""}},[e("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"date",placeholder:"选择新的截止日期"},model:{value:t.extendDate,callback:function(e){t.extendDate=e},expression:"extendDate"}})],1),e("el-alert",{attrs:{type:"info",closable:!1,title:"延期后截止时间为所选日期 23:59:59，且必须晚于当前截止时间","show-icon":""}})],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{size:"small"},on:{click:function(e){t.extendDialog=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",size:"small",loading:t.extending},on:{click:t.confirmExtend}},[t._v("确认延期")])],1)],1)],1)},i=[],l=(a("e9f5"),a("910d"),a("ab43"),a("c8a1")),r=a("5c8a"),n=a("9204"),c=a("e2f9"),o={name:"teacherTagPaperAssignment",components:{ListSearchFilter:c["a"]},filters:{dateFormat2:n["b"]},data(){return{loading:!1,saving:!1,extending:!1,dialog:!1,extendDialog:!1,extendRow:null,extendDate:null,records:[],page:{number:1,size:20,totalElements:0,totalPage:0},query:{},searchFilter:{search:[{type:"input",label:"请输入题单名称",key:"keyword",value:""}],filter:[{type:"select",label:"教学班",key:"clazzId",value:"",data:[]},{type:"select",label:"状态",key:"status",value:"",data:[{label:"未开始",value:"NOT_STARTED"},{label:"进行中",value:"IN_PROGRESS"},{label:"已截止",value:"EXPIRED"}]}]},papers:[],clazzes:[],form:{paperId:"",clazzIds:[],startDate:null,endDate:null,attemptPolicy:"UNLIMITED",showResult:!1}}},computed:{clazzTransfer(){return this.clazzes.map(t=>({key:t.id,label:t.name}))}},created(){this.load(),this.loadClazzFilter()},methods:{async loadClazzFilter(){try{const t=await l["a"].teacherClazzList()||[];this.$set(this.searchFilter.filter[0],"data",t.map(t=>({label:t.name,value:t.id})))}catch(t){Object(r["d"])(t.message)}},clickSearchFilterBtn(t){this.query=t,this.page.number=1,this.load()},async load(){this.loading=!0;try{const[t,e]=await l["a"].teacherPaperList(this.page.number,this.page.size,this.query);this.records=t||[],this.page=Object.assign({},this.page,e)}catch(t){Object(r["d"])(t.message)}finally{this.loading=!1}},pageChange(t){this.page.number=t,this.load()},pageSizeChange(t){this.page.size=t,this.page.number=1,this.load()},async openCreate(){try{this.papers=await l["a"].teacherPublishedPapers()||[],this.clazzes=await l["a"].teacherClazzList()||[]}catch(t){return Object(r["d"])(t.message)}return this.papers.length?this.clazzes.length?(this.form={paperId:this.papers[0].id,clazzIds:[],startDate:null,endDate:null,attemptPolicy:"UNLIMITED",showResult:!1},void(this.dialog=!0)):Object(r["d"])("您还没有关联任何教学班"):Object(r["d"])("暂无已发布的题单，请先到管理后台创建并发布题单")},async save(){if(!this.form.paperId)return Object(r["d"])("请选择题单");if(!this.form.clazzIds.length)return Object(r["d"])("请选择教学班");if(!this.form.startDate||!this.form.endDate)return Object(r["d"])("请选择作答时间");if(this.formatDay(this.form.startDate)>=this.formatDay(this.form.endDate))return Object(r["d"])("截止日期必须晚于开始日期");this.saving=!0;try{await l["a"].teacherSaveAssignment({paperId:this.form.paperId,clazzIds:this.form.clazzIds,startTime:this.formatDay(this.form.startDate)+" 00:00:00",endTime:this.formatDay(this.form.endDate)+" 23:59:59",attemptPolicy:this.form.attemptPolicy,showResult:this.form.showResult}),Object(r["e"])("下发成功"),this.dialog=!1,this.load()}catch(t){Object(r["d"])(t.message)}finally{this.saving=!1}},openExtend(t){this.extendRow=t,this.extendDate=this.toDate(t.endTime),this.extendDialog=!0},async confirmExtend(){if(!this.extendDate)return Object(r["d"])("请选择新的截止日期");const t=this.extendRow,e=this.toDate(t.startTime)?this.formatDay(t.startTime):"";if(e&&this.formatDay(this.extendDate)<=e)return Object(r["d"])("新的截止日期必须晚于开始日期");const a=this.toDate(t.endTime)?this.formatDay(t.endTime):"";if(a&&this.formatDay(this.extendDate)<=a)return Object(r["d"])("新的截止日期必须晚于当前截止时间，只能延长");this.extending=!0;try{await l["a"].teacherUpdateAssignment({id:t.assignmentId,endTime:this.formatDay(this.extendDate)+" 23:59:59"}),Object(r["e"])("延期成功"),this.extendDialog=!1,this.load()}catch(s){Object(r["d"])(s.message)}finally{this.extending=!1}},async cancel(t){const e=await this.$confirm("撤销后学生将无法再看到该下发，确认撤销？","确认撤销",{type:"warning"}).catch(()=>!1);if(e)try{await l["a"].teacherDeleteAssignment(t.assignmentId),Object(r["e"])("已撤销"),this.load()}catch(a){Object(r["d"])(a.message)}},toDate(t){if(!t)return null;if(t instanceof Date)return t;const e=new Date(String(t).replace(/-/g,"/"));return isNaN(e.getTime())?new Date(Number(t)):e},formatDay(t){const e=this.toDate(t);if(!e||isNaN(e.getTime()))return"";const a=t=>(t<10?"0":"")+t;return e.getFullYear()+"-"+a(e.getMonth()+1)+"-"+a(e.getDate())},statusText(t){const e={NOT_STARTED:"未开始",IN_PROGRESS:"进行中",EXPIRED:"已截止",CANCELLED:"已撤销"};return e[t]||t},statusTagType(t){const e={NOT_STARTED:"info",IN_PROGRESS:"",EXPIRED:"warning",CANCELLED:"danger"};return void 0!==e[t]?e[t]:"info"}}},d=o,u=(a("c91f"),a("5c9d"),a("2877")),h=Object(u["a"])(d,s,i,!1,null,"63aa35b2",null);e["default"]=h.exports}}]);