Browse Source

活动详情修改信息

XW 1 year ago
parent
commit
93de2777ae

+ 1 - 1
TEAMModelOS/ClientApp/src/view/signupActivity/createActivity.vue

@@ -36,7 +36,7 @@
                         <FormItem label="承办" class="unit-box">
                             <div v-for="(item, index) in createData.cb" :key="index">
                                 <Input v-special-char v-model="createData.cb[index]" placeholder="请输入承办单位名称" style="width: calc(100% - 30px);" />
-                                <Icon type="md-trash" size="20" color="#6e6e6e" v-show="index" @click="editUnit('delete', 'zb', index)" />
+                                <Icon type="md-trash" size="20" color="#6e6e6e" v-show="index" @click="editUnit('delete', 'cb', index)" />
                             </div>
                             <Icon type="md-add-circle" size="20" color="#6e6e6e" @click="editUnit('add', 'cb')" />
                         </FormItem>

+ 362 - 0
TEAMModelOS/ClientApp/src/view/signupActivity/infoComponent/editActInfo.vue

@@ -0,0 +1,362 @@
+<template>
+    <div>
+        <Loading v-show="isLoading"></Loading>
+        <Form :model="editInfo" :label-width="80" ref="editInfo" :rules="editDataRule">
+            <FormItem label="名称" prop="name">
+                <Input v-special-char v-model="editInfo.name" placeholder="请输入活动名称" />
+            </FormItem>
+            <FormItem label="主题" prop="subject">
+                <Input v-special-char v-model="editInfo.subject" placeholder="清输入活动主题" />
+            </FormItem>
+            <FormItem label="简介">
+                <Input v-special-char type="textarea" v-model="editInfo.description" placeholder="请输入活动简介" />
+            </FormItem>
+            <FormItem label="地点">
+                <Input v-special-char v-model="editInfo.address" placeholder="请输入活动地点" />
+            </FormItem>
+            <FormItem label="时间" prop="stime">
+                <DatePicker v-model="actAllTime[0]" :editable="false" @on-change="getCreateTime" type="datetimerange" :options="beforeToday" 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 editInfo.zb" :key="index">
+                    <Input v-special-char v-model="editInfo.zb[index]" placeholder="请输入主办单位名称" style="width: calc(100% - 30px);" />
+                    <Icon type="md-trash" size="20" color="#6e6e6e" v-show="index" @click="editUnit('delete', 'zb', index)" />
+                </div>
+                <Icon type="md-add-circle" size="20" color="#6e6e6e" @click="editUnit('add', 'zb')" />
+            </FormItem>
+            <FormItem label="承办" class="unit-box">
+                <div v-for="(item, index) in editInfo.cb" :key="index">
+                    <Input v-special-char v-model="editInfo.cb[index]" placeholder="请输入承办单位名称" style="width: calc(100% - 30px);" />
+                    <Icon type="md-trash" size="20" color="#6e6e6e" v-show="index" @click="editUnit('delete', 'cb', index)" />
+                </div>
+                <Icon type="md-add-circle" size="20" color="#6e6e6e" @click="editUnit('add', 'cb')" />
+            </FormItem>
+            <FormItem label="免责声明">
+                <Input v-special-char type="textarea" v-model="editInfo.mzsm" placeholder="请输入免责申明..." />
+            </FormItem>
+            <FormItem label="封面">
+                <Upload v-show="!posterFile.url" multiple type="drag" action="" :before-upload="customUpload" :show-upload-list="false" accept=".jpg, .jpeg, .png, .gif">
+                    <div style="padding: 20px 0">
+                        <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
+                        <p>上传主题图片</p>
+                    </div>
+                </Upload>
+                <img v-if="posterFile.url" :src="posterFile.url" alt="" width="500">
+                <p v-show="posterFile.url" class="repeat-upload" @click="repeatUpload">{{$t('td.td58')}}</p>
+            </FormItem>
+            <FormItem label="附件">
+                <Upload multiple type="drag" action="" :before-upload="customUploadFile" :show-upload-list="false" :accept="accept">
+                    <div style="padding: 20px 0">
+                        <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
+                        <p>上传活动文件</p>
+                    </div>
+                </Upload>
+                <template v-if="attachment.length">
+                    <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, item)" />
+                            </span>
+                            <div @click="changeUp(index)" style="width: 100%;">
+                                {{ item.name }}
+                                <!-- <Progress :percent="item.progress" status="active" stroke-color="#7CB7F5" /> -->
+                            </div>
+                        </div>
+                    </div>
+                </template>
+            </FormItem>
+            <Button type="success" long @click="saveInfo()">保存</Button>
+        </Form>
+    </div>
+</template>
+
+<script>
+import BlobTool from "@/utils/blobTool.js"
+export default {
+    props: {
+        actInfo: {
+            type: Object,
+            default: () => {
+                return {}
+            }
+        },
+        editModal: {
+            type: Boolean,
+            default: false,
+        },
+    },
+    data () {
+        return {
+            isLoading: false,
+            editInfo: {stime: null,},
+            actAllTime: [['', '']],
+            accept: '',
+            posterFile: { //封面文件
+                url: '',
+                file: undefined,
+            },
+            isUpload: false,
+            beforeToday: {},
+            attachment: [], //附件
+            attachDel: [], //编辑下删除原有的
+            attachAdd: [], //编辑下新增的
+            editDataRule: {
+                name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }],
+                subject: [{ required: true, message: '活动主题不能为空', trigger: 'blur' }],
+                stime: [{ required: true, type: 'number', message: '请选择活动时间', trigger: 'blur' }],
+            },
+        }
+    },
+    created () {
+    },
+    computed: {
+        isArea() {
+            return localStorage.getItem('platform') === 'area'
+        },
+        areaId() {
+            return sessionStorage.getItem('areaId')
+        },
+        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: {
+        editModal: {
+            handler(n, o) {
+                if(n) {
+                    this.editInfo = {
+                        name: this.actInfo.name,
+                        subject: this.actInfo.subject,
+                        description: this.actInfo.description,
+                        address: this.actInfo.address,
+                        stime: this.actInfo.stime,
+                        etime: this.actInfo.etime,
+                        poster: this.actInfo.poster.includes('CoverImage.jpg') ? this.actInfo.poster : '',
+                        attachment: this._.cloneDeep(this.actInfo.attachment),
+                        zb: this._.cloneDeep(this.actInfo.zb),
+                        cb: this._.cloneDeep(this.actInfo.cb),
+                        mzsm: this.actInfo.mzsm,
+                    }
+                    this.actAllTime = [[]]
+                    // 处理时间显示
+                    this.actAllTime[0].push(this.$tools.formatTime(this.actInfo.stime, 'yyyy-MM-dd hh:mm'))
+                    this.actAllTime[0].push(this.$tools.formatTime(this.actInfo.etime, 'yyyy-MM-dd hh:mm'))
+                    // 基本信息回显
+                    this.posterFile = {
+                        url: this.editInfo.poster,
+                        file: undefined,
+                    }
+                    this.attachment = this._.cloneDeep(this.actInfo.attachment)
+                    let that = this
+                    this.beforeToday = {
+                        disabledDate (date) {
+                            return date && date.valueOf() < that.actInfo.stime
+                        }
+                    }
+                }
+            },
+        },
+    },
+    methods: {
+        // 获取大活动的进行时间
+        getCreateTime(data) {
+            console.log('52fg6regge65e', data);
+            this.actAllTime[0] = data.filter(item => {
+                return item
+            })
+            this.editInfo.stime = this.actAllTime[0].length > 1 ? (new Date(this.actAllTime[0][0])).getTime() : null
+            this.editInfo.etime = this.actAllTime[0].length > 1 ? (new Date(this.actAllTime[0][1])).getTime() : null
+        },
+        editUnit(type, unit, index) {
+            if(type === 'add') {
+                this.editInfo[unit].push('')
+            } else if(type === 'delete') {
+                this.editInfo[unit].splice(index, 1)
+            }
+        },
+        // 文件展示
+        customUpload(file) {
+            // 点击发布活动时,上传到blob,再回传blob地址
+            let newFile = {
+                file: new File([file], "CoverImage.jpg", {type: file.type}),
+                name: 'CoverImage.jpg', //封面固定名称
+                size: file.size,
+                type: file.type,
+                progress: 0,
+            }
+            const reader = new FileReader()
+            reader.readAsDataURL(file)
+            reader.onload = () => {
+                const _base64 = reader.result
+                this.posterFile = {
+                    url: _base64,
+                    file: newFile
+                }
+            }
+            return false
+        },
+        //重新上传
+        repeatUpload() {
+            this.posterFile = {
+                url: '',
+                file: undefined
+            }
+        },
+        customUploadFile(file) {
+            if(this.attachment.find(item => item.name === file.name)) {
+                this.$Message.warning('存在相同文件,请重新上传!')
+                return
+            }
+            let newFile = {
+                file,
+                name: file.name,
+                size: file.size,
+                type: file.type,
+                progress: 0,
+            }
+            this.attachAdd.push(newFile)
+            this.attachment.push(newFile)
+        },
+        // 删除选择的文件
+        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)
+        },
+        async saveInfo() {
+            this.isLoading = true
+            let saving = true
+            this.$refs['editInfo'].validate((valid) => {
+                if (!valid) {
+                    this.$Message.error('请完善信息!');
+                    saving = false
+                }
+            })
+            if(saving) {
+                console.log(11111111);
+                let files = this.posterFile.file ? [this.posterFile.file].concat(this.attachAdd) : this.attachAdd
+                if(this.attachDel.length) {
+                    let delType = await this.deleteBlob(this.attachDel)
+                    if(!delType) {
+                        this.$Message.warning('保存失败!')
+                        return
+                    }
+                
+                }
+                // 2.3 上传 封面 + 附件
+                let fileBlob = await this.uploadBlob(files)
+                // 2023.11.10 处理编辑状态下没有保存已有且未被删除的文件,只保存了当前新增的
+                this.editInfo.attachment = this.attachment.map(item => {
+                    if(item.hash) {
+                        return item
+                    } else {
+                        let newFile = fileBlob.find(files => {
+                            return files.name === item.name
+                        })
+                        newFile.hash = this.$tools.convertFileMD5ToString(newFile.md5)
+                        newFile.cnt = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
+                        return newFile
+                    }
+                })
+                if(this.posterFile.file) {
+                    this.editInfo.poster = fileBlob[0].url
+                } else {
+                    // 编辑状态下的poster 拼接了sas,保存时需去掉
+                    this.editInfo.poster = this.posterFile.url.slice(0, this.posterFile.url.lastIndexOf('?'))
+                }
+                console.log(2222222222);
+
+
+
+                let params = {
+                    grant_type: 'update-activity-base',
+                    activityId: this.actInfo.id,
+                    activityUpdate: this.editInfo
+                }
+                this.$api.areaActivity.manageAct(params).then(res => {
+                    console.log(3333333333);
+                    if(res.code === 200) {
+                        this.$Message.success("保存成功")
+                        this.$emit('saveInfo', res?.activity)
+                    } else {
+                        this.$Message.warning("保存失败")
+                    }
+                }).finally(() => {
+                    this.isLoading = false
+                })
+            } else {
+                this.isLoading = false
+            }
+        },
+        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)
+            })
+        },
+        uploadBlob(fileList) {
+            return new Promise((r, j) => {
+                // 先将封面、附件保存在blob: (区级id/学校编码)/activity/活动id/attachment/文件
+                // 获取初始化Blob需要的数据
+                let code = this.isArea ? this.areaId : this.$store.state.userInfo.schoolCode
+                let scope = this.isArea ? 'area' : 'school'
+                let path = `activity/${this.editInfo.id}/attachment`
+                //初始化Blob
+                let blobTool = new BlobTool(this.sasData.url, code, "?" + this.sasData.sas, scope)
+                let promiseArr = []
+                console.log(fileList);
+                fileList.map(item => {
+                    promiseArr.push(new Promise((r, j) => {
+                        blobTool.upload(item.file, {path, checkSize: false}, {
+                            onProgress: (e) => {
+                                item.progress = parseInt(e.loadedBytes * 100 / item.size)
+                            }
+                        }).then(res => {
+                            r(res)
+                        })
+                    }))
+                })
+                Promise.all(promiseArr).then(res => {
+                    r(res)
+                }).catch(e => {
+                    j(e)
+                })
+            })
+        },
+    },
+}
+</script>
+
+<style lang="less">
+</style>

+ 367 - 0
TEAMModelOS/ClientApp/src/view/signupActivity/infoComponent/editContest.vue

@@ -0,0 +1,367 @@
+<template>
+    <div class="edit-contest">
+        <Form :model="signInfo" :label-width="80" ref="signInfo" :rules="editDataRule">
+            <FormItem label="报名人数">
+                <InputNumber :min="limitMin" v-model="signInfo.limit" />
+                <span>
+                    <Icon type="md-alert" color="#ffad16" size="17" />
+                    0:默认不限制
+                </span>
+            </FormItem>
+            <FormItem label="报名时间" prop="signEtime">
+                <DatePicker v-model="actAllTime[0]" :editable="false" @on-change="data => getCreateTime(data, 0)" type="datetimerange" :options="beforeToday" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
+            </FormItem>
+        </Form>
+        <template v-if="conModules.includes('upload')">
+            <Form :model="uploadInfo" :label-width="80" ref="uploadInfo" :rules="editDataRule">
+                <FormItem label="上传时间" prop="uploadEtime">
+                    <DatePicker v-model="actAllTime[1]" ref="workPicker" :editable="false" @on-change="data => getCreateTime(data, 1)" type="datetimerange" :options="beforeToday" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
+                </FormItem>
+                <FormItem label="文件类型" v-if="uploadInfo?.fileType" prop="fileType">
+                    <div class="tab-check">
+                        <div v-for="(item, index) in fileType" :key="index" class="file-box">
+                            <Checkbox v-model="item.isCheck">
+                                {{ item.label }}
+                            </Checkbox>
+                            <div v-if="item.isCheck">
+                                <Select v-model="formatType[index]" multiple size="small" style="width: 400px" placeholder="不限格式">
+                                    <Option v-for="(format, index) in item.format" :value="format" :key="index">{{ format }}</Option>
+                                </Select>
+                            </div>
+                        </div>
+                    </div>
+                </FormItem>
+                <FormItem label="文件说明">
+                    <Input v-special-char type="textarea" v-model="uploadInfo.updateDesc" placeholder="请输入作品要求..." />
+                </FormItem>
+            </Form>
+        </template>
+        <template v-if="conModules.includes('review')">
+            <Form :model="reviewInfo" :label-width="80" ref="reviewInfo" :rules="editDataRule">
+                <FormItem label="评审时间" prop="reviewEtime">
+                    <DatePicker v-model="actAllTime[2]" ref="reviewPicker" :editable="false" @on-change="data => getCreateTime(data, 2)" type="datetimerange" :options="beforeToday" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
+                </FormItem>
+            </Form>
+        </template>
+        <template v-if="conModules.includes('score')">
+            <Form :model="scoreInfo" :label-width="80" ref="scoreInfo" :rules="editDataRule">
+                <FormItem label="公示时间" prop="scoreEtime">
+                    <DatePicker v-model="actAllTime[3]" ref="scorePicker" :editable="false" @on-change="data => getCreateTime(data, 3)" type="datetimerange" :options="beforeToday" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.timeHolder')" style="width: 500px"></DatePicker>
+                </FormItem>
+            </Form>
+        </template>
+        <Button type="success" long @click="saveInfo()">保存</Button>
+    </div>
+</template>
+
+<script>
+export default {
+    props: {
+        actInfo: {
+            type: Object,
+            default: () => {
+                return {}
+            }
+        },
+        contestInfo: {
+            type: Object,
+            defualt: () => {
+                return {}
+            }
+        },
+        editModal: {
+            type: Boolean,
+            default: false,
+        },
+    },
+    data () {
+        const validateFileType = (rule, value, callback) => {
+            if(this.fileType.find(item => item.isCheck)) {
+                callback()
+            } else {
+                callback(new Error('Please enter your password'))
+            }
+        }
+        const validateDate = (rule, value, callback) => {
+            console.log(rule, value);
+            if(value != '' && value != null && value != undefined) {
+                callback()
+            } else {
+                callback(new Error('请选择时间'))
+            }
+        }
+        return {
+            signInfo: {},
+            uploadInfo: {},
+            reviewInfo: {},
+            scoreInfo: {},
+            actAllTime: [[], [], [], []],
+            editDataRule: {
+                signEtime: [{ required: true, type: 'number', message: '请选择活动时间', trigger: 'blur', validator: validateDate }],
+                uploadEtime: [{ required: true, type: 'number', message: '请选择活动时间', trigger: 'blur', validator: validateDate }],
+                reviewEtime: [{ required: true, type: 'number', message: '请选择活动时间', trigger: 'blur', validator: validateDate }],
+                scoreEtime: [{ required: true, type: 'number', message: '请选择活动时间', trigger: 'blur', validator: validateDate }],
+                fileType: [{ required: true, message: '请选择填报信息', trigger: 'blur', validator: validateFileType }],
+            },
+            fileType: [
+                {
+                    value: 'documentType',
+                    label: '文档类',
+                    isCheck: false,
+                    format: ['doc', 'docx', 'txt', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf']
+                },
+                {
+                    value: 'audio',
+                    label: '音频类',
+                    isCheck: false,
+                    format: ['mp3', 'wav', 'wma']
+                },
+                {
+                    value: 'video',
+                    label: '视频类',
+                    isCheck: false,
+                    format: ['mp4', 'webm']
+                },
+                {
+                    value: 'img',
+                    label: '图片类',
+                    isCheck: false,
+                    format: ['jpg', 'jpeg', 'png', 'gif']
+                },
+                {
+                    value: 'winrar',
+                    label: '压缩包类',
+                    isCheck: false,
+                    format: ['zip', 'rar', '7zip']
+                },
+            ],
+            formatType: [[], [], [], [], []],
+            beforeToday: {},
+            conModules: [],
+            limitMin: 0,
+        }
+    },
+    watch: {
+        editModal: {
+            handler(n, o) {
+                if(n) {
+                    this.conModules = this.contestInfo.modules
+                    this.signInfo = {
+                        signStime: this.contestInfo.sign.stime,
+                        signEtime: this.contestInfo.sign.etime,
+                        limit: this.contestInfo.sign.limit,
+                    }
+                    this.actAllTime = [[], [], [], []]
+                    this.actAllTime[0].push(this.$tools.formatTime(this.contestInfo.sign.stime, 'yyyy-MM-dd hh:mm'))
+                    this.actAllTime[0].push(this.$tools.formatTime(this.contestInfo.sign.etime, 'yyyy-MM-dd hh:mm'))
+                    if(this.contestInfo.modules.includes('upload')) {
+                        this.uploadInfo = {
+                            uploadStime: this.contestInfo.upload.stime,
+                            uploadEtime: this.contestInfo.upload.etime,
+                            updateDesc: this.contestInfo.upload.desc,
+                        }
+                        if(this.contestInfo.upload.type === 'file') {
+                            this.uploadInfo.fileType = this._.cloneDeep(this.contestInfo.upload.fileType)
+                            this.uploadInfo.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
+                            })
+                        }
+                        this.actAllTime[1].push(this.$tools.formatTime(this.contestInfo.upload.stime, 'yyyy-MM-dd hh:mm'))
+                        this.actAllTime[1].push(this.$tools.formatTime(this.contestInfo.upload.etime, 'yyyy-MM-dd hh:mm'))
+                    }
+                    if(this.contestInfo.modules.includes('review')) {
+                        this.reviewInfo = {
+                            reviewStime: this.contestInfo.review.stime,
+                            reviewEtime: this.contestInfo.review.etime
+                        }
+                        this.actAllTime[2].push(this.$tools.formatTime(this.contestInfo.review.stime, 'yyyy-MM-dd hh:mm'))
+                        this.actAllTime[2].push(this.$tools.formatTime(this.contestInfo.review.etime, 'yyyy-MM-dd hh:mm'))
+                    }
+                    if(this.contestInfo.modules.includes('score')) {
+                        this.scoreInfo = {
+                            scoreStime: this.contestInfo.score.stime,
+                            scoreEtime: this.contestInfo.score.etime
+                        }
+                        this.actAllTime[3].push(this.$tools.formatTime(this.contestInfo.score.stime, 'yyyy-MM-dd hh:mm'))
+                        this.actAllTime[3].push(this.$tools.formatTime(this.contestInfo.score.etime, 'yyyy-MM-dd hh:mm'))
+                    }
+                    // 处理时间显示
+                    let that = this
+                    this.beforeToday = {
+                        disabledDate (date) {
+                            return (date && date.valueOf() < that.actInfo.stime) || (date && date.valueOf() > that.actInfo.etime)
+                        }
+                    }
+                }
+            },
+        },
+        'signInfo.signStime': {
+            handler(n, o) {
+                /* if(this.conModules.includes('upload')) this.$refs.workPicker.handleClear()
+                if(this.conModules.includes('review')) this.$refs.reviewPicker.handleClear()
+                if(this.conModules.includes('score')) this.$refs.scorePicker.handleClear()
+                this.actAllTime = [[], [], [], []] */
+            }
+        },
+    },
+    methods: {
+        getCreateTime(data, index) {
+            console.log(data);
+            let times = data.filter(item => {
+                return item
+            })
+            switch (index) {
+                case 0:
+                    this.signInfo.signStime = times.length > 1 ? (new Date(times[0])).getTime() : null
+                    this.signInfo.signEtime = times.length > 1 ? (new Date(times[1])).getTime() : null
+                    this.actAllTime = [[], [], [], []]
+                    this.actAllTime[0] = times
+                    break
+                case 1:
+                    if(times.length > 1 && !this.signInfo.signEtime) {
+                        // this.$refs.workPicker.handleClear()
+                        this.$Message.warning('请先设置报名时间')
+                        this.actAllTime.splice(1, 1, [])
+                    }
+                    if(times.length > 1 && (new Date(times[1])).getTime() < this.signInfo.signEtime) {
+                        this.$Message.warning('上传结束时间不能早于报名时间')
+                        this.actAllTime.splice(1, 1, [])
+                    }
+                    this.uploadInfo.uploadStime = times.length > 1 ? (new Date(times[0])).getTime() : null
+                    this.uploadInfo.uploadEtime = times.length > 1 ? (new Date(times[1])).getTime() : null
+                    
+                    this.actAllTime.splice(2, 1, [])
+                    this.actAllTime.splice(3, 1, [])
+                    break
+                case 2:
+                    if(times.length > 1 && (!this.signInfo.signEtime || !this.uploadInfo.uploadEtime)) {
+                        this.$Message.warning('请先设置报名时间、上传时间')
+                        this.actAllTime.splice(2, 1, [])
+                    }
+                    if(times.length > 1 && (new Date(times[0])).getTime() < this.signInfo.signEtime || (new Date(times[0])).getTime() < this.uploadInfo.uploadEtime) {
+                        this.$Message.warning('评审必须在报名、上传结束后进行')
+                        this.actAllTime.splice(2, 1, [])
+                    }
+                    this.reviewInfo.reviewStime = times.length > 1 ? (new Date(times[0])).getTime() : null
+                    this.reviewInfo.reviewEtime = times.length > 1 ? (new Date(times[1])).getTime() : null
+                    this.actAllTime.splice(3, 1, [])
+                    break
+                case 3:
+                    if(times.length > 1 && !this.reviewInfo.reviewEtime) {
+                        this.$Message.warning('请先设置评审时间')
+                        this.actAllTime.splice(3, 1, [])
+                    }
+                    if(times.length > 1 && (new Date(times[0])).getTime() < this.reviewInfo.reviewEtime) {
+                        this.$Message.warning('公示必须在评审结束后进行')
+                        this.actAllTime.splice(3, 1, [])
+                    }
+                    this.scoreInfo.scoreStime = times.length > 1 ? (new Date(times[0])).getTime() : null
+                    this.scoreInfo.scoreEtime = times.length > 1 ? (new Date(times[1])).getTime() : null
+                    break
+                default:
+                    break
+            }
+        },
+        saveInfo() {
+            let saving = true
+            this.$refs['signInfo'].validate((valid) => {
+                console.log(valid);
+                if (!valid) {
+                    saving = false
+                }
+            })
+            this.$refs['uploadInfo'].validate((valid) => {
+                console.log(valid);
+                if (!valid) {
+                    saving = false
+                }
+            })
+            this.$refs['reviewInfo'].validate((valid) => {
+                console.log(valid);
+                if (!valid) {
+                    saving = false
+                }
+            })
+            this.$refs['scoreInfo'].validate((valid) => {
+                console.log(valid);
+                if (!valid) {
+                    saving = false
+                }
+            })
+            if(!saving) {
+                this.$Message.error('请完善信息!');
+                return
+            }
+            let params = {
+                grant_type: 'update-contest-base',
+                activityId: this.actInfo.id,
+                contestUpdate: {}
+            }
+            params.contestUpdate = {
+                signStime: this.signInfo.signStime,
+                signEtime: this.signInfo.signEtime,
+                signStime: this.signInfo.signStime,
+                limit: this.signInfo.limit,
+                uploadStime: this.uploadInfo.uploadStime,
+                uploadEtime: this.uploadInfo.uploadEtime,
+                updateDesc: this.uploadInfo.updateDesc,
+            }
+            if(this.contestInfo.upload.type === 'file') {
+                params.contestUpdate.fileType = []
+                this.fileType.forEach((item, index) => {
+                    if(item.isCheck) {
+                        if(this.formatType[index].length) {
+                            params.contestUpdate.fileType = params.contestUpdate.fileType.concat(this.formatType[index])
+                        } else {
+                            params.contestUpdate.fileType = params.contestUpdate.fileType.concat(item.format)
+                        }
+                    }
+                })
+            }
+            if(this.conModules.includes('review')) {
+                params.contestUpdate.reviewStime = this.reviewInfo.reviewStime
+                params.contestUpdate.reviewEtime = this.reviewInfo.reviewEtime
+            }
+            if(this.conModules.includes('score')) {
+                params.contestUpdate.scoreStime = this.scoreInfo.scoreStime
+                params.contestUpdate.scoreEtime = this.scoreInfo.scoreEtime
+            }
+            this.$api.areaActivity.manageAct(params).then(res => {
+                if(res.code === 200) {
+                    this.$Message.success("保存成功")
+                    this.$emit('saveContest', res?.activity)
+                } else {
+                    this.$Message.warning("保存失败")
+                }
+            }).finally(() => {
+                // this.isLoading = false
+            })
+        },
+    }
+}
+</script>
+
+<style lang="less" scoped>
+.edit-contest {
+    
+    .tab-check {
+        margin-bottom: 15px;
+        .file-box {
+            display: flex;
+
+            &>label {
+                width: 100px;
+            }
+        }
+    }
+}
+</style>

+ 60 - 11
TEAMModelOS/ClientApp/src/view/signupActivity/infoGoing.vue

@@ -14,7 +14,7 @@
                     {{ actInfo.name }}
                 </p>
                 <div class="btn-box" v-show="isArea || actInfo.scope === 'school'">
-                    <Button type="primary" size="small" @click="editAct()" style="margin-right: 10px;">编辑</Button>
+                    <Button type="primary" size="small" @click="editModal = true" style="margin-right: 10px;">编辑</Button>
                     <Button type="warning" size="small" @click="delAct()">删除</Button>
                 </div>
                 <!-- <div class="btn-box">
@@ -66,7 +66,10 @@
                             </div>
                         </div>
                         <div class="sk-info" v-if="contestInfo">
-                            <div class="info-title">赛课活动</div>
+                            <div class="info-title">
+                                <span>赛课活动</span>
+                                <Icon type="md-create" size="16" style="margin-left: 10px;" @click="editConModal = true" />
+                            </div>
                             <p>
                                 报名时间:
                                 <span>{{ contestInfo.sign.startTime }} - {{ contestInfo.sign.endTime }}</span>
@@ -123,8 +126,15 @@
         <Modal v-model="schoolModal" title="参与本次活动的学校">
             <Table :columns="schoolCloumns" :data="schoolList"></Table>
         </Modal>
-        <Modal v-model="editModal" title="编辑活动基本信息">
-            
+        <Modal v-model="editArtModal" title="编辑活动基本信息" width="40" :footer-hide="true">
+            <vuescroll>
+                <editActInfo :actInfo="actInfo" :editModal="editArtModal" @saveInfo="saveInfo"></editActInfo>
+            </vuescroll>
+        </Modal>
+        <Modal v-model="editConModal" title="编辑赛课活动信息" width="40" :footer-hide="true">
+            <vuescroll>
+                <editContest :actInfo="actInfo" :contestInfo="contestInfo" :editModal="editConModal" @saveInfo="saveContest"></editContest>
+            </vuescroll>
         </Modal>
     </div>
 </template>
@@ -132,10 +142,14 @@
 <script>
 import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
 import skContent from './infoComponent/skContent.vue'
+import editActInfo from './infoComponent/editActInfo.vue'
+import editContest from './infoComponent/editContest.vue'
 export default {
     components: {
         PersonalPhoto,
-        skContent
+        skContent,
+        editActInfo,
+        editContest,
     },
     data () {
         return {
@@ -191,11 +205,13 @@ export default {
                 },
             ],
             schoolList: [],
-            editModal: false,
-            editInfo: {},
+            editArtModal: false,
+            editConModal: false,
+            actInfo: undefined,
         }
     },
     created () {
+        this.actInfo = this.$route.params.info
         if(!this.actInfo) {
             this.$router.go(-1)
         }
@@ -211,9 +227,6 @@ export default {
         this.getActInfo()
     },
     computed: {
-        actInfo() {
-            return this.$route.params.info
-        },
         isArea() {
             return localStorage.getItem('platform') === 'area'
         },
@@ -228,7 +241,6 @@ export default {
             }
             this.$api.areaActivity.manageAct(params).then(res => {
                 if(res.code === 200) {
-                    this.editInfo = this.actInfo
                     res.contest.modules.forEach(item => {
                         res.contest[item].startTime = this.$tools.formatTime(res.contest[item].stime, 'yyyy-MM-dd')
                         res.contest[item].endTime = this.$tools.formatTime(res.contest[item].etime, 'yyyy-MM-dd')
@@ -307,6 +319,36 @@ export default {
         async onDownload(item) {
             this.$tools.doDownloadByUrl(item.url, item.name)
         },
+        saveInfo(info) {
+            let sas = this.actInfo.sas
+            this.actInfo = info
+            this.actInfo.startTime = this.$tools.formatTime(this.actInfo.stime, 'yyyy-MM-dd')
+            this.actInfo.endTime = this.$tools.formatTime(this.actInfo.etime, 'yyyy-MM-dd')
+            this.actInfo.sas = sas
+            this.actInfo.poster = !info.poster ? require('@/assets/image/no-poster-cn1.png') : `${info.poster}?${sas}`
+            this.actInfo.attachment.forEach(attach => {
+                if(attach) {
+                    attach.url = `${attach.url}?${sas}`
+                }
+            })
+            this.editModal = false
+        },
+        saveContest(info) {
+            /* this.contestInfo.sign.stime = info.signStime
+            this.contestInfo.sign.stime = info.signEtime
+            this.contestInfo.sign.startTime = this.$tools.formatTime(info.signStime, 'yyyy-MM-dd')
+            this.contestInfo.sign.endTime = this.$tools.formatTime(info.signEtime, 'yyyy-MM-dd')
+            this.contestInfo.sign.limit = info.limit
+            this.contestInfo.sign.stime = info.signStime
+            this.contestInfo.sign.stime = info.signEtime
+            this.contestInfo.sign.startTime = this.$tools.formatTime(info.signStime, 'yyyy-MM-dd')
+            this.contestInfo.sign.endTime = this.$tools.formatTime(info.signEtime, 'yyyy-MM-dd')
+            this.contestInfo.sign.stime = info.signStime
+            this.contestInfo.sign.stime = info.signEtime
+            this.contestInfo.sign.startTime = this.$tools.formatTime(info.signStime, 'yyyy-MM-dd')
+            this.contestInfo.sign.endTime = this.$tools.formatTime(info.signEtime, 'yyyy-MM-dd') */
+            this.editConModal = false
+        },
     }
 }
 </script>
@@ -377,6 +419,13 @@ export default {
             padding: 10px;
             margin-bottom: 10px;
             margin-top: 25px;
+
+            .ivu-icon{
+                cursor: pointer;
+                &:hover {
+                    color: #049f04;
+                }
+            }
         }
 
         .attach-name {