|
@@ -281,7 +281,7 @@
|
|
|
{{ item.name }}
|
|
|
</span>
|
|
|
</p>
|
|
|
- <p v-if="createData.modules.length">
|
|
|
+ <p v-if="createData.modules && createData.modules.length">
|
|
|
模块:
|
|
|
<span v-for="(item, index) in createData.modules" :key="index">
|
|
|
{{ item === 'Contest' ? '赛课活动' : (item === 'Training' ? '教培活动' : '教研活动') }}
|
|
@@ -637,9 +637,9 @@ export default {
|
|
|
},
|
|
|
async created () {
|
|
|
this.isLoading = true
|
|
|
+ await this.getRuleList()
|
|
|
await this.initializeData()
|
|
|
this.getWebsite()
|
|
|
- this.getRuleList()
|
|
|
},
|
|
|
computed: {
|
|
|
isTMD() { //是醍摩豆智慧学区
|
|
@@ -652,7 +652,7 @@ export default {
|
|
|
return sessionStorage.getItem('areaId')
|
|
|
},
|
|
|
isEdit() {
|
|
|
- return !!this.$route.params.info
|
|
|
+ return !!this.$route.params.id
|
|
|
},
|
|
|
sasData() {
|
|
|
let info = {
|
|
@@ -689,72 +689,93 @@ export default {
|
|
|
methods: {
|
|
|
initializeData() {
|
|
|
return new Promise((r, j) => {
|
|
|
- if(this.$route.params.info) {
|
|
|
- this.createData = this._.cloneDeep(this.$route.params.info)
|
|
|
- let contest = this._.cloneDeep(this.$route.params.contest)
|
|
|
- // 处理时间显示
|
|
|
- this.actAllTime[0].push(this.$tools.formatTime(this.createData.stime))
|
|
|
- this.actAllTime[0].push(this.$tools.formatTime(this.createData.etime))
|
|
|
- // 基本信息回显
|
|
|
- this.selSchools = this.createData.invitedSchools.map(item => {
|
|
|
- return item.id
|
|
|
- })
|
|
|
- this.posterFile = {
|
|
|
- url: this.createData.posterShow,
|
|
|
- file: undefined,
|
|
|
+ if(this.$route.params.id) {
|
|
|
+ let params = {
|
|
|
+ grant_type: 'read-activity',
|
|
|
+ activityId: this.$route.params.id
|
|
|
}
|
|
|
- this.attachment = this._.cloneDeep(this.createData.attachment)
|
|
|
- this.initStatus(this.createData.modules)
|
|
|
- // 赛课模块回显
|
|
|
- this.contestData.modules = contest.modules
|
|
|
- this.contestData.sign = contest.sign
|
|
|
- this.actAllTime[1].push(this.$tools.formatTime(contest.sign.stime))
|
|
|
- this.actAllTime[1].push(this.$tools.formatTime(contest.sign.etime))
|
|
|
- this.contestData.sign.fields.forEach(item => {
|
|
|
- // 存在相同的字段,但类型不一致
|
|
|
- let sameField = this.infoArr.findIndex(infos => {return infos.field === item.field && infos.type != item.type})
|
|
|
- if(sameField != -1) {
|
|
|
- this.infoArr[sameField] = item
|
|
|
- }
|
|
|
- if(!this.infoArr.find(infos => {return infos.field === item.field})) {
|
|
|
- this.infoArr.push(item)
|
|
|
- }
|
|
|
- this.fields.push(item.field)
|
|
|
- })
|
|
|
- if(contest.modules.includes('upload')) {
|
|
|
- this.actAllTime[2].push(this.$tools.formatTime(contest.upload.stime))
|
|
|
- this.actAllTime[2].push(this.$tools.formatTime(contest.upload.etime))
|
|
|
- this.skWork = true
|
|
|
- this.contestUpload = contest.upload
|
|
|
- contest.upload.fileType.forEach(item => {
|
|
|
- this.fileType.forEach((file, index) => {
|
|
|
- if(file.format.includes(item)) {
|
|
|
- file.isCheck = true
|
|
|
- this.formatType[index].push(item)
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$api.areaActivity.manageAct(params).then(res => {
|
|
|
+ let host = this.$store.state.user.userProfile.blob_uri.split('/' + this.$store.state.userInfo.TEAMModelId)[0]
|
|
|
+ this.createData = this._.cloneDeep(res.activity)
|
|
|
+ this.createData.posterShow = !this.createData.poster ? require('@/assets/image/no-poster-cn1.png') : `${host}/${this.createData.owner}${this.createData.poster}?${this.createData.sas}`
|
|
|
+ this.createData.startTime = this.$tools.formatTime(this.createData.stime, 'yyyy-MM-dd hh:mm:ss')
|
|
|
+ this.createData.endTime = this.$tools.formatTime(this.createData.etime, 'yyyy-MM-dd hh:mm:ss')
|
|
|
+ this.createData.attachment.forEach(attach => {
|
|
|
+ if(attach) {
|
|
|
+ attach.urlShow = `${host}/${this.createData.owner}${attach.url}?${this.createData.sas}`
|
|
|
+ }
|
|
|
})
|
|
|
- this.formatType = this.formatType.map((item, index) => {
|
|
|
- item = item.length === this.fileType[index].format.length ? [] : item
|
|
|
- return item
|
|
|
+ let contest = this._.cloneDeep(res.contest)
|
|
|
+ // 处理时间显示
|
|
|
+ this.actAllTime[0] = []
|
|
|
+ this.actAllTime[0].push(this.$tools.formatTime(res.activity.stime))
|
|
|
+ this.actAllTime[0].push(this.$tools.formatTime(res.activity.etime))
|
|
|
+ console.log('41gr45ege', this.actAllTime[0], res.activity.stime);
|
|
|
+ // 基本信息回显
|
|
|
+ this.selSchools = this.createData.invitedSchools.map(item => {
|
|
|
+ return item.id
|
|
|
})
|
|
|
- }
|
|
|
- if(contest.modules.includes('review')) {
|
|
|
- this.actAllTime[3].push(this.$tools.formatTime(contest.review.stime))
|
|
|
- this.actAllTime[3].push(this.$tools.formatTime(contest.review.etime))
|
|
|
- this.skReview = true
|
|
|
- this.contestReview = contest.review
|
|
|
- this.reviewSel = this.reviewList.findIndex(item => {
|
|
|
- console.log(item.id, contest.review.ruleId);
|
|
|
- return item.id === contest.review.ruleId
|
|
|
+ this.posterFile = {
|
|
|
+ url: this.createData.posterShow,
|
|
|
+ file: undefined,
|
|
|
+ }
|
|
|
+ this.attachment = this._.cloneDeep(this.createData.attachment)
|
|
|
+ this.initStatus(this.createData.modules)
|
|
|
+ // 赛课模块回显
|
|
|
+ this.contestData.modules = contest.modules
|
|
|
+ this.contestData.sign = contest.sign
|
|
|
+ this.actAllTime[1].push(this.$tools.formatTime(contest.sign.stime))
|
|
|
+ this.actAllTime[1].push(this.$tools.formatTime(contest.sign.etime))
|
|
|
+ this.contestData.sign.fields.forEach(item => {
|
|
|
+ // 存在相同的字段,但类型不一致
|
|
|
+ let sameField = this.infoArr.findIndex(infos => {return infos.field === item.field && infos.type != item.type})
|
|
|
+ if(sameField != -1) {
|
|
|
+ this.infoArr[sameField] = item
|
|
|
+ }
|
|
|
+ if(!this.infoArr.find(infos => {return infos.field === item.field})) {
|
|
|
+ this.infoArr.push(item)
|
|
|
+ }
|
|
|
+ this.fields.push(item.field)
|
|
|
})
|
|
|
- }
|
|
|
- if(contest.modules.includes('score')) {
|
|
|
- this.actAllTime[4].push(this.$tools.formatTime(contest.score.stime))
|
|
|
- this.actAllTime[4].push(this.$tools.formatTime(contest.score.etime))
|
|
|
- this.skPublic = true
|
|
|
- this.contestScore = contest.score
|
|
|
- }
|
|
|
+ if(contest.modules.includes('upload')) {
|
|
|
+ this.actAllTime[2].push(this.$tools.formatTime(contest.upload.stime))
|
|
|
+ this.actAllTime[2].push(this.$tools.formatTime(contest.upload.etime))
|
|
|
+ this.skWork = true
|
|
|
+ this.contestUpload = contest.upload
|
|
|
+ contest.upload.fileType.forEach(item => {
|
|
|
+ this.fileType.forEach((file, index) => {
|
|
|
+ if(file.format.includes(item)) {
|
|
|
+ file.isCheck = true
|
|
|
+ this.formatType[index].push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.formatType = this.formatType.map((item, index) => {
|
|
|
+ item = item.length === this.fileType[index].format.length ? [] : item
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(contest.modules.includes('review')) {
|
|
|
+ this.actAllTime[3].push(this.$tools.formatTime(contest.review.stime))
|
|
|
+ this.actAllTime[3].push(this.$tools.formatTime(contest.review.etime))
|
|
|
+ this.skReview = true
|
|
|
+ this.contestReview = contest.review
|
|
|
+ // 不论是否保存为模板,编辑都需要将活动规则加入列表,当成单独的规则
|
|
|
+ let actRule = this._.cloneDeep(res.reviewRule)
|
|
|
+ actRule.currentUse = true
|
|
|
+ if(this.reviewList.find(item => item.id === res.reviewRule.id)) {
|
|
|
+ actRule.haveSame = true
|
|
|
+ }
|
|
|
+ this.reviewList.push(actRule)
|
|
|
+ this.reviewSel = this.reviewList.length - 1
|
|
|
+ }
|
|
|
+ if(contest.modules.includes('score')) {
|
|
|
+ this.actAllTime[4].push(this.$tools.formatTime(contest.score.stime))
|
|
|
+ this.actAllTime[4].push(this.$tools.formatTime(contest.score.etime))
|
|
|
+ this.skPublic = true
|
|
|
+ this.contestScore = contest.score
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
this.createData = {
|
|
|
id: '',
|
|
@@ -849,35 +870,17 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
getRuleList() {
|
|
|
- let params = {
|
|
|
- grant_type: 'rule-list',
|
|
|
- owner: this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
- }
|
|
|
- this.$api.areaActivity.manageAct(params).then(res => {
|
|
|
- if(res.reviewRules) {
|
|
|
- this.reviewList = res.reviewRules
|
|
|
- if(this.isEdit && this.contestData.modules.includes('review')) {
|
|
|
- this.skReview = true
|
|
|
- /* this.reviewSel = this.reviewList.findIndex(item => {
|
|
|
- return item.id === this.contestReview.ruleId
|
|
|
- })
|
|
|
- // 使用的本次活动保存的规则,需要重新加入reviewList
|
|
|
- if(this.reviewSel === -1) {
|
|
|
- // this.$route.params.reviewRule.currentUse = true
|
|
|
- this.reviewList.push(this.$route.params.reviewRule)
|
|
|
- this.reviewSel = this.reviewList.length - 1
|
|
|
- this.reviewList[this.reviewSel].currentUse = true
|
|
|
- } */
|
|
|
- // 不论是否保存为模板,编辑都需要将活动规则加入列表,当成单独的规则
|
|
|
- let actRule = this._.cloneDeep(this.$route.params.reviewRule)
|
|
|
- actRule.currentUse = true
|
|
|
- if(this.reviewList.find(item => item.id === this.$route.params.reviewRule.id)) {
|
|
|
- actRule.haveSame = true
|
|
|
- }
|
|
|
- this.reviewList.push(actRule)
|
|
|
- this.reviewSel = this.reviewList.length - 1
|
|
|
- }
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let params = {
|
|
|
+ grant_type: 'rule-list',
|
|
|
+ owner: this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
}
|
|
|
+ this.$api.areaActivity.manageAct(params).then(res => {
|
|
|
+ if(res.reviewRules) {
|
|
|
+ this.reviewList = res.reviewRules
|
|
|
+ resolve(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
saveActivity() {
|