|
@@ -23,7 +23,7 @@
|
|
|
<Input v-model="createData.address" placeholder="请输入活动地点"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="时间">
|
|
|
- <DatePicker :editable="false" @on-change="getCreateTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
+ <DatePicker v-model="actAllTime[0]" :editable="false" @on-change="getCreateTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
</FormItem>
|
|
|
<FormItem label="主办" class="unit-box">
|
|
|
<div v-for="(item, index) in createData.zb" :key="index">
|
|
@@ -102,7 +102,7 @@
|
|
|
<div style="margin-top: 20px;">
|
|
|
<div :key="index" v-for="(item, index) in attachment" class="uploadHm">
|
|
|
<span style="float: right;margin-right: 55px;" v-show="!isUpload">
|
|
|
- <Icon type="md-close" size="18" @click="delUpload(index)" />
|
|
|
+ <Icon type="md-close" size="18" @click="delUpload(index, item)" />
|
|
|
</span>
|
|
|
<div @click="changeUp(index)" style="width: 100%;">
|
|
|
{{ item.name }}
|
|
@@ -127,7 +127,7 @@
|
|
|
<div class="content-box">
|
|
|
<div>
|
|
|
<FormItem label="报名时间">
|
|
|
- <DatePicker :editable="false" @on-change="getActTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
+ <DatePicker v-model="actAllTime[1]" :editable="false" @on-change="getActTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
</FormItem>
|
|
|
<FormItem label="报名人数">
|
|
|
<InputNumber :min="0" v-model="contestData.sign.limit" />
|
|
@@ -138,11 +138,11 @@
|
|
|
</FormItem>
|
|
|
<FormItem label="填报信息">
|
|
|
<CheckboxGroup v-model="fields">
|
|
|
- <Checkbox v-for="(item, index) in infoArr" :key="index" :label="item.value">
|
|
|
+ <Checkbox v-for="(item, index) in infoArr" :key="index" :label="item.field">
|
|
|
<span>
|
|
|
{{ item.label }}
|
|
|
<Icon type="md-create" size="18" color="orange" v-show="index > 4" @click.stop.native.prevent="changeFiled(2, item)" />
|
|
|
- <Icon type="md-trash" size="16" color="#6e6e6e" v-show="item.value === item.label" @click.stop.native.prevent="delField(index)" />
|
|
|
+ <Icon type="md-trash" size="16" color="#6e6e6e" v-show="item.field === item.label" @click.stop.native.prevent="delField(index)" />
|
|
|
</span>
|
|
|
</Checkbox>
|
|
|
<Icon type="md-add-circle" @click="changeFiled(1)" size="18" />
|
|
@@ -163,7 +163,7 @@
|
|
|
</p>
|
|
|
<div v-show="skWork">
|
|
|
<FormItem label="上传时间">
|
|
|
- <DatePicker :editable="false" @on-change="getWorkTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
+ <DatePicker v-model="actAllTime[2]" :editable="false" @on-change="getWorkTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
|
|
|
</FormItem>
|
|
|
<FormItem label="作品类型">
|
|
|
<RadioGroup v-model="contestUpload.type">
|
|
@@ -203,12 +203,13 @@
|
|
|
</p>
|
|
|
<div v-show="skReview">
|
|
|
<FormItem label="评审时间">
|
|
|
- <DatePicker :editable="false" @on-change="getReviewTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" transfer style="width: 500px"></DatePicker>
|
|
|
+ <DatePicker v-model="actAllTime[3]" :editable="false" @on-change="getReviewTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" transfer style="width: 500px"></DatePicker>
|
|
|
</FormItem>
|
|
|
<FormItem label="评审规则">
|
|
|
<Select v-model="reviewSel" transfer style="width: calc(100% - 30px);">
|
|
|
<Option v-for="(item, index) in reviewList" :value="index" :key="index" class="review-sel">
|
|
|
{{ item.name }}
|
|
|
+ <span v-show="item.currentUse" style="color: #2d870e;">({{ '当前活动使用' }})</span>
|
|
|
<Icon type="md-eye" size="18" color="#077fd8" @click.native="reviewEditRule(index, 'preview')" />
|
|
|
<Icon type="ios-copy" size="18" color="#5a5a5a" @click.native="reviewEditRule(index, 'copy')" v-show="!item.isAdd" />
|
|
|
<Icon type="md-create" size="18" color="orange" @click.native="reviewEditRule(index, 'edit')" v-show="item.isAdd" />
|
|
@@ -225,7 +226,7 @@
|
|
|
</p>
|
|
|
<div v-show="skPublic">
|
|
|
<FormItem label="公示时间">
|
|
|
- <DatePicker :editable="false" @on-change="getPublicTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" transfer style="width: 500px"></DatePicker>
|
|
|
+ <DatePicker v-model="actAllTime[4]" :editable="false" @on-change="getPublicTime" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" transfer style="width: 500px"></DatePicker>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -247,7 +248,7 @@
|
|
|
<p>主题:{{ createData.subject }}</p>
|
|
|
<p>简介:{{ createData.description }}</p>
|
|
|
<p>地点:{{ createData.address }}</p>
|
|
|
- <p>时间:{{ createTime[0] }} - {{ createTime[1] }}</p>
|
|
|
+ <p>时间:{{ actAllTime[0][0] }} - {{ actAllTime[0][1] }}</p>
|
|
|
<p>主办:
|
|
|
<span v-for="(item, index) in createData.zb" :key="index" class="multiple-box">
|
|
|
{{ item }}
|
|
@@ -279,7 +280,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<Button style="margin-top: 16px; margin-right: 16px;" @click="last" v-show="current">上一步</Button>
|
|
|
- <Button style="margin-top: 16px;" type="primary" @click="next">{{ current === 2 ? '发布活动' : '下一步'}}</Button>
|
|
|
+ <Button style="margin-top: 16px;" type="primary" @click="nextNew">{{ current === 2 ? '发布活动' : '下一步'}}</Button>
|
|
|
</vuescroll>
|
|
|
</div>
|
|
|
<Drawer title="评审规则" :width="50" :closable="false" v-model="ruleDrawer" class="light-iview-form" @on-close="closeRule()">
|
|
@@ -399,6 +400,7 @@
|
|
|
|
|
|
<script>
|
|
|
import BlobTool from "@/utils/blobTool.js"
|
|
|
+import { file } from 'jszip'
|
|
|
export default {
|
|
|
data() {
|
|
|
let that = this
|
|
@@ -529,6 +531,8 @@ export default {
|
|
|
file: undefined,
|
|
|
},
|
|
|
attachment: [], //附件
|
|
|
+ attachDel: [], //编辑下删除原有的
|
|
|
+ attachAdd: [], //编辑下新增的
|
|
|
createTime: [],
|
|
|
createData: { // 活动基本信息
|
|
|
/* owner: '', //学校编码/区级id
|
|
@@ -550,6 +554,7 @@ export default {
|
|
|
attachment: [],
|
|
|
modules: [], //Contest/赛课活动 Training/线上培训 Research/教研活动 */
|
|
|
},
|
|
|
+ actAllTime: [[], [], [], [], []],
|
|
|
contestData: {
|
|
|
modules: ['sign'],
|
|
|
sign: {
|
|
@@ -637,7 +642,8 @@ export default {
|
|
|
areaInfo: undefined,
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ async created () {
|
|
|
+ await this.initializeData()
|
|
|
this.dataRuleMould = [{
|
|
|
id: this.$tools.randomNum(10000, 99999) + '',
|
|
|
label: '',
|
|
@@ -661,27 +667,6 @@ export default {
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
- this.createData = {
|
|
|
- id: '',
|
|
|
- owner: this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode, //学校编码/区级id
|
|
|
- ownerName: this.isArea ? sessionStorage.getItem('areaName') : this.$store.state.user.schoolProfile.school_base.name, //学校名称/学区名称
|
|
|
- publish: 0, //发布状态 0未发布 1已发布 2已结束
|
|
|
- name: '',
|
|
|
- subject: '',
|
|
|
- description: '',
|
|
|
- address: '',
|
|
|
- stime: '',
|
|
|
- etime: '',
|
|
|
- zb: [''], //主办方
|
|
|
- cb: [''], //承办方
|
|
|
- scope: this.isTMD ? 'public' : (this.isArea ? 'area' : 'school'), //public公开/area区级/school校级
|
|
|
- invitedSchools: [], //邀请的学校列表
|
|
|
- joinMode: 'enroll', //enroll/报名制 invite/邀请制
|
|
|
- mzsm: '', //免责声明
|
|
|
- poster: '',
|
|
|
- attachment: [],
|
|
|
- modules: [], //Contest/赛课活动 Training/线上培训 Research/教研活动
|
|
|
- }
|
|
|
this.ruleInfo = {
|
|
|
name: '',
|
|
|
desc: null,
|
|
@@ -704,6 +689,23 @@ export default {
|
|
|
areaId() {
|
|
|
return sessionStorage.getItem('areaId')
|
|
|
},
|
|
|
+ isEdit() {
|
|
|
+ return !!this.$route.params.info
|
|
|
+ },
|
|
|
+ sasData() {
|
|
|
+ let info = {
|
|
|
+ url: this.$store.state.user.userProfile.blob_uri.split('/' + this.$store.state.userInfo.TEAMModelId)[0],
|
|
|
+ sas: ''
|
|
|
+ }
|
|
|
+ if(this.isArea) {
|
|
|
+ info.sas = this.$store.state.user.userProfile.areas.find(item => {
|
|
|
+ return item.areaId === this.areaId
|
|
|
+ }).sas
|
|
|
+ } else {
|
|
|
+ info.sas = this.$store.state.user.schoolProfile.blob_sas
|
|
|
+ }
|
|
|
+ return info
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
'createData.scope': {
|
|
@@ -778,7 +780,110 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ 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.poster,
|
|
|
+ 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('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
|
|
|
+ this.reviewSel = this.reviewList.findIndex(item => {
|
|
|
+ console.log(item.id, contest.review.ruleId);
|
|
|
+ return item.id === contest.review.ruleId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ 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: '',
|
|
|
+ owner: this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode, //学校编码/区级id
|
|
|
+ ownerName: this.isArea ? sessionStorage.getItem('areaName') : this.$store.state.user.schoolProfile.school_base.name, //学校名称/学区名称
|
|
|
+ publish: 0, //发布状态 0未发布 1已发布 2已结束
|
|
|
+ name: '',
|
|
|
+ subject: '',
|
|
|
+ description: '',
|
|
|
+ address: '',
|
|
|
+ stime: '',
|
|
|
+ etime: '',
|
|
|
+ zb: [''], //主办方
|
|
|
+ cb: [''], //承办方
|
|
|
+ scope: this.isTMD ? 'public' : (this.isArea ? 'area' : 'school'), //public公开/area区级/school校级
|
|
|
+ invitedSchools: [], //邀请的学校列表
|
|
|
+ joinMode: 'enroll', //enroll/报名制 invite/邀请制
|
|
|
+ mzsm: '', //免责声明
|
|
|
+ poster: '',
|
|
|
+ attachment: [],
|
|
|
+ modules: [], //Contest/赛课活动 Training/线上培训 Research/教研活动
|
|
|
+ }
|
|
|
+ this.contestData = {
|
|
|
+ modules: ['sign'],
|
|
|
+ sign: {
|
|
|
+ fields: [], //填报信息
|
|
|
+ stime: '',
|
|
|
+ etime: '',
|
|
|
+ limit: 0, //报名人数
|
|
|
+ type: 0, //0个人 1团队
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ r(true)
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取当前区级的权限
|
|
|
getWebsite() {
|
|
|
if(this.isArea) {
|
|
@@ -839,9 +944,20 @@ export default {
|
|
|
owner: this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
}
|
|
|
this.$api.areaActivity.manageAct(params).then(res => {
|
|
|
- console.log(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
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -854,12 +970,16 @@ export default {
|
|
|
params.Contest = this.contestData
|
|
|
this.contestData.modules.forEach(item => {
|
|
|
if(item === 'upload') {
|
|
|
+ this.contestUpload.fileType = []
|
|
|
this.fileType.forEach((item, index) => {
|
|
|
if(item.isCheck) {
|
|
|
+ console.log(this.contestUpload.fileType);
|
|
|
if(this.formatType[index].length) {
|
|
|
this.contestUpload.fileType = this.contestUpload.fileType.concat(this.formatType[index])
|
|
|
+ console.log(this.formatType[index]);
|
|
|
} else {
|
|
|
this.contestUpload.fileType = this.contestUpload.fileType.concat(item.format)
|
|
|
+ console.log(item.format);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -953,65 +1073,103 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- async next() {
|
|
|
- if(this.current === 2) {
|
|
|
- // 在调用后端接口前进行以下操作:
|
|
|
- // 1. 由前端创建本次活动的id
|
|
|
- // this.createId = this.$tools.guid()
|
|
|
- this.createData.id = this.$tools.guid()
|
|
|
- // 2. 将封面、附件上传至blob,并填充createData中的poster attachment
|
|
|
- let poster = await this.uploadBlob([this.posterFile.file])
|
|
|
- let fjFile = await this.uploadBlob(this.attachment)
|
|
|
- this.createData.poster = poster[0].url
|
|
|
- this.createData.attachment = fjFile
|
|
|
- this.createData.attachment.forEach(item => {
|
|
|
- item.hash = this.$tools.convertFileMD5ToString(item.md5)
|
|
|
- item.cnt = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
- })
|
|
|
- // 3. 若有新创建的评审规则,需先保存,保存大活动时由后端一起保存
|
|
|
- this.saveActivity()
|
|
|
- } else {
|
|
|
- this.createData.invitedSchools = []
|
|
|
- this.contestData.sign.fields = []
|
|
|
- this.showSchools.forEach(item => {
|
|
|
- if(this.selSchools.includes(item.id)) {
|
|
|
- this.createData.invitedSchools.push({
|
|
|
- id: item.id,
|
|
|
- name: item.name,
|
|
|
- picture: item.picture
|
|
|
- })
|
|
|
+ async nextNew() {
|
|
|
+ switch(this.current) {
|
|
|
+ case 2: //保存活动
|
|
|
+ // 1. 由前端创建本次活动的id
|
|
|
+ if(!this.isEdit) this.createData.id = this.$tools.guid()
|
|
|
+ // 2. 将封面、附件上传至blob,并填充 createData 中的 poster attachment
|
|
|
+ // 2.1 先合并 封面 + 要上传的附件
|
|
|
+ let files = this.posterFile.file ? [this.posterFile.file].concat(this.attachAdd) : this.attachAdd
|
|
|
+ console.log(files);
|
|
|
+ // 2.2 编辑状态下需先删除原已上传的附件
|
|
|
+ if(this.attachDel.length) {
|
|
|
+ let delType = await this.deleteBlob(this.attachDel)
|
|
|
+ if(!delType) {
|
|
|
+ this.$Message.warning('保存失败!')
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
- this.fields.forEach(item => {
|
|
|
- let infos = this.infoArr.find(info => {
|
|
|
- return info.field === item
|
|
|
+ // 2.3 上传 封面 + 附件
|
|
|
+ let fileBlob = await this.uploadBlob(files)
|
|
|
+ console.log(fileBlob);
|
|
|
+ // 2023.11.10 处理编辑状态下没有保存已有且未被删除的文件,只保存了当前新增的
|
|
|
+ this.createData.attachment = this.attachment.map(item => {
|
|
|
+ console.log(item);
|
|
|
+ if(item.hash) {
|
|
|
+ return item
|
|
|
+ } else {
|
|
|
+ let newFile = fileBlob.find(files => {
|
|
|
+ return files.name === item.name
|
|
|
+ })
|
|
|
+ console.log(newFile);
|
|
|
+ newFile.hash = this.$tools.convertFileMD5ToString(newFile.md5)
|
|
|
+ newFile.cnt = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
+ return newFile
|
|
|
+ }
|
|
|
})
|
|
|
- if(infos) this.contestData.sign.fields.push(infos)
|
|
|
- })
|
|
|
- this.current += 1
|
|
|
+ /* this.createData.attachment = fileBlob.map(item => {
|
|
|
+ item.hash = this.$tools.convertFileMD5ToString(item.md5)
|
|
|
+ item.cnt = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
+ return item
|
|
|
+ }) */
|
|
|
+ // 编辑状态下,未修改封面,posterFile.file为空,不需要重新赋值poster
|
|
|
+ if(this.posterFile.file) {
|
|
|
+ this.createData.poster = fileBlob[0].url
|
|
|
+ this.createData.attachment.shift()
|
|
|
+ } else {
|
|
|
+ // 编辑状态下的poster 拼接了sas,保存时需去掉
|
|
|
+ this.createData.poster = this.posterFile.url.slice(0, this.posterFile.url.lastIndexOf('?'))
|
|
|
+ }
|
|
|
+ // 3. 若有新创建的评审规则,需先保存,保存大活动时由后端一起保存
|
|
|
+ this.saveActivity()
|
|
|
+ break
|
|
|
+ case 1:
|
|
|
+ // 加入发布活动页面前需保存学校列表、填报信息
|
|
|
+ console.log(111111111);
|
|
|
+ this.createData.invitedSchools = []
|
|
|
+ this.contestData.sign.fields = []
|
|
|
+ this.showSchools.forEach(item => {
|
|
|
+ if(this.selSchools.includes(item.id)) {
|
|
|
+ this.createData.invitedSchools.push({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name,
|
|
|
+ picture: item.picture
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.infoArr.forEach(item => {
|
|
|
+ if(this.fields.includes(item.field)) {
|
|
|
+ this.contestData.sign.fields.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ default:
|
|
|
+ this.current += 1
|
|
|
+ console.log(33333333333)
|
|
|
+ break
|
|
|
}
|
|
|
},
|
|
|
uploadBlob(fileList) {
|
|
|
return new Promise((r, j) => {
|
|
|
// 先将封面、附件保存在blob: (区级id/学校编码)/activity/活动id/attachment/文件
|
|
|
// 获取初始化Blob需要的数据
|
|
|
- let sasData = {
|
|
|
+ /* let sasData = {
|
|
|
url: this.$store.state.user.userProfile.blob_uri.split('/' + this.$store.state.userInfo.TEAMModelId)[0],
|
|
|
sas: '',
|
|
|
- }
|
|
|
+ } */
|
|
|
let code = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
let scope = this.isArea ? 'area' : 'school'
|
|
|
let path = `activity/${this.createData.id}/attachment`
|
|
|
- if(this.isArea) {
|
|
|
+ /* if(this.isArea) {
|
|
|
sasData.sas = this.$store.state.user.userProfile.areas.find(item => {
|
|
|
return item.areaId === this.areaId
|
|
|
}).sas
|
|
|
} else {
|
|
|
sasData.sas = this.$store.state.user.schoolProfile.blob_sas
|
|
|
}
|
|
|
- console.log(sasData);
|
|
|
+ console.log(sasData); */
|
|
|
//初始化Blob
|
|
|
- let blobTool = new BlobTool(sasData.url, code, "?" + sasData.sas, scope)
|
|
|
+ let blobTool = new BlobTool(this.sasData.url, code, "?" + this.sasData.sas, scope)
|
|
|
let promiseArr = []
|
|
|
console.log(fileList);
|
|
|
fileList.map(item => {
|
|
@@ -1032,17 +1190,35 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ deleteBlob(files) {
|
|
|
+ return new Promise((r, j) => {
|
|
|
+ //初始化Blob
|
|
|
+ let code = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
|
|
|
+ let scope = this.isArea ? 'area' : 'school'
|
|
|
+ let blobTool = new BlobTool(this.sasData.url, code, "?" + this.sasData.sas, scope)
|
|
|
+ let fileUrl = files.map(item => {
|
|
|
+ return item.blob
|
|
|
+ })
|
|
|
+ console.log(fileUrl);
|
|
|
+ blobTool.deleteBlobBatch(fileUrl).then(() => {
|
|
|
+ r(true)
|
|
|
+ }).catch(() => {
|
|
|
+ j(false)
|
|
|
+ })
|
|
|
+ r(true)
|
|
|
+ })
|
|
|
+ },
|
|
|
last() {
|
|
|
this.current -= 1
|
|
|
},
|
|
|
// 获取大活动的进行时间
|
|
|
getCreateTime(data) {
|
|
|
- this.createTime = data.filter(item => {
|
|
|
+ this.actAllTime[0] = data.filter(item => {
|
|
|
return item
|
|
|
})
|
|
|
- if (this.createTime.length > 1) {
|
|
|
- this.createData.stime = (new Date(this.createTime[0])).getTime()
|
|
|
- this.createData.etime = (new Date(this.createTime[1])).getTime()
|
|
|
+ if (this.actAllTime[0].length > 1) {
|
|
|
+ this.createData.stime = (new Date(this.actAllTime[0][0])).getTime()
|
|
|
+ this.createData.etime = (new Date(this.actAllTime[0][1])).getTime()
|
|
|
}
|
|
|
},
|
|
|
// 优课评选的报名时间
|
|
@@ -1087,9 +1263,6 @@ export default {
|
|
|
},
|
|
|
// 文件展示
|
|
|
customUpload(file) {
|
|
|
- // 点击发布活动时,上传到blob,再回传blob地址
|
|
|
- // sas等根据get-school-info areas 中有返回url、sas
|
|
|
- console.log(file);
|
|
|
// 有限制格式
|
|
|
/* if(this.homeworkInfo.extLimit.length) {
|
|
|
let extension = file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length).toLowerCase()
|
|
@@ -1102,9 +1275,11 @@ export default {
|
|
|
this.$Message.warning(this.$t("studentWeb.homework.sizeOver"))
|
|
|
return false
|
|
|
} */
|
|
|
+ // 点击发布活动时,上传到blob,再回传blob地址
|
|
|
+ console.log(file);
|
|
|
let newFile = {
|
|
|
- file,
|
|
|
- name: file.name,
|
|
|
+ file: new File([file], "CoverImage.jpg", {type: file.type}),
|
|
|
+ name: 'CoverImage.jpg', //封面固定名称
|
|
|
size: file.size,
|
|
|
type: file.type,
|
|
|
progress: 0,
|
|
@@ -1118,7 +1293,6 @@ export default {
|
|
|
file: newFile
|
|
|
}
|
|
|
}
|
|
|
- // this.posterFile = newFile
|
|
|
return false
|
|
|
},
|
|
|
//重新上传
|
|
@@ -1130,6 +1304,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
customUploadFile(file) {
|
|
|
+ if(this.attachment.find(item => {
|
|
|
+ return item.name === file.name
|
|
|
+ })) {
|
|
|
+ this.$Message.warning('存在相同文件,请重新上传!')
|
|
|
+ return
|
|
|
+ }
|
|
|
let newFile = {
|
|
|
file,
|
|
|
name: file.name,
|
|
@@ -1148,13 +1328,25 @@ export default {
|
|
|
hash: '',
|
|
|
cnt: '', //容器名: 公开(醍摩豆智慧学区id) 区级(区级编码) 校级(学校编码)
|
|
|
} */
|
|
|
+ this.attachAdd.push(newFile)
|
|
|
this.attachment.push(newFile)
|
|
|
},
|
|
|
// 删除选择的文件
|
|
|
- delUpload(index) {
|
|
|
+ delUpload(index, data) {
|
|
|
+ // 编辑状态下,删除已经保存在blob的文件需加入数组
|
|
|
+ if(this.isEdit && data.blob) {
|
|
|
+ this.attachDel.push(data)
|
|
|
+ } else {
|
|
|
+ // 新增的需从 attachAdd 删除
|
|
|
+ let delIndex = this.attachAdd.findIndex(item => {
|
|
|
+ return item.name === data.name
|
|
|
+ })
|
|
|
+ if(delIndex != -1) this.attachAdd.splice(delIndex, 1)
|
|
|
+ }
|
|
|
this.attachment.splice(index, 1)
|
|
|
},
|
|
|
initStatus(data) {
|
|
|
+ console.log(data);
|
|
|
this.tabListShow = this.tabList.filter(item => {
|
|
|
return data.includes(item.name)
|
|
|
})
|