Browse Source

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

CrazyIter_Bin 1 năm trước cách đây
mục cha
commit
5b2d049637

+ 24 - 14
TEAMModelOS/ClientApp/src/view/signupActivity/createActivity.vue

@@ -214,12 +214,13 @@
                                                 </FormItem>
                                                 <FormItem label="评审规则" prop="rule">
                                                     <Select v-model="reviewSel" transfer style="width: calc(100% - 30px);" clearable>
-                                                        <Option v-for="(item, index) in reviewList" :value="index" :key="index" class="review-sel">
+                                                        <Option v-for="(item, index) in reviewList" :value="index" :key="index" :label="item.name" class="review-sel">
                                                             {{ item.name }}
-                                                            <span v-show="item.currentUse" style="color: #2d870e;">({{ '当前活动使用' }})</span>
+                                                            <Tag color="green" v-show="item.currentUse">当前活动使用</Tag>
+                                                            <!-- <span v-if="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" />
+                                                            <Icon type="ios-copy" size="18" color="#5a5a5a" @click.native="reviewEditRule(index, 'copy')" v-show="!item.isAdd && !item.currentUse" />
+                                                            <Icon type="md-create" size="18" color="orange" @click.native="reviewEditRule(index, 'edit')" v-show="item.isAdd || item.currentUse" />
                                                             <Icon type="md-trash" size="18" color="#f45d5d" @click.native="delRule(item, index)" />
                                                         </Option>
                                                     </Select>
@@ -699,7 +700,7 @@ export default {
                         return item.id
                     })
                     this.posterFile = {
-                        url: this.createData.poster,
+                        url: this.createData.posterShow,
                         file: undefined,
                     }
                     this.attachment = this._.cloneDeep(this.createData.attachment)
@@ -857,15 +858,24 @@ export default {
                     this.reviewList = res.reviewRules
                     if(this.isEdit && this.contestData.modules.includes('review')) {
                         this.skReview = true
-                        this.reviewSel = this.reviewList.findIndex(item => {
+                        /* this.reviewSel = this.reviewList.findIndex(item => {
                             return item.id === this.contestReview.ruleId
                         })
                         // 使用的本次活动保存的规则,需要重新加入reviewList
                         if(this.reviewSel === -1) {
-                            this.$route.params.reviewRule.currentUse = true
+                            // 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
                     }
                 }
             })
@@ -882,7 +892,6 @@ export default {
                         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]);
@@ -899,7 +908,7 @@ export default {
                         params.Contest.review = this.contestReview
                         let reviewRule = this._.cloneDeep(this.reviewList[this.reviewSel])
                         // 使用旧模板,为防止upsertAsTemplate: 1 就保存为新的模板,强制改为0
-                        if(!reviewRule.isAdd) {
+                        if(!reviewRule.isAdd && !reviewRule.currentUse) {
                             reviewRule.upsertAsTemplate = 0
                         } else {
                             // 防止规则创建后又修改了活动名称,需重置 sourceName
@@ -915,7 +924,6 @@ export default {
                         })
                         params.reviewConfig = reviewRule
                         // params.reviewConfig = this.reviewList[this.reviewSel]
-                        console.log(params.reviewConfig);
                     }
                     if(item === 'score') {
                         params.Contest.score = this.contestScore
@@ -932,7 +940,9 @@ export default {
                         let types = await this.saveTeacher()
                     }
                     this.$Message.success('创建成功!')
-                    this.$router.go(-1)
+                    this.$router.push({
+                        name: this.isArea ? 'areaActivityProcess' : 'activityManage',
+                    })
                 } else {
                     if(res.code === 25 || res.code === 26 || res.code === 27) {
                         this.$Message.warning('填报信息未配置学段、学科,无法进行作品分配!')
@@ -1043,7 +1053,7 @@ export default {
                         // this.createData.attachment.shift()
                     } else {
                         // 编辑状态下的poster 拼接了sas,保存时需去掉
-                        this.createData.poster = this.posterFile.url.slice(0, this.posterFile.url.lastIndexOf('?'))
+                        // this.createData.poster = this.posterFile.url.slice(0, this.posterFile.url.lastIndexOf('?'))
                     }
                     console.log(this.createData.attachment);
                     // 3. 若有新创建的评审规则,需先保存,保存大活动时由后端一起保存
@@ -1453,8 +1463,8 @@ export default {
             }
         },
         saveRule(data) {
-            let {info, isEdit} = data
-            console.log(info, isEdit);
+            let {info, isEdit, isTemplate} = data
+            console.log('153486778', info);
             if(isEdit) {
                 this.reviewList.splice(this.reviewSel, 1, info)
                 // this.reviewList[this.reviewSel] = info

+ 18 - 6
TEAMModelOS/ClientApp/src/view/signupActivity/infoComponent/ruleDrawer.vue

@@ -103,7 +103,7 @@
                 <!-- 编辑时 -->
                 <div v-show="ruleType === 1">
                     <Button type="primary" @click="saveEdit()">保存</Button>
-                    <Button @click="cancelEdit()" style="margin-left: 10px;">取消</Button>
+                    <!-- <Button @click="cancelEdit()" style="margin-left: 10px;">取消</Button> -->
                 </div>
             </template>
         </template>
@@ -346,16 +346,28 @@ export default {
         },
         // 新建保存
         save(type) {
-            if(type === 'mould') {
-                this.ruleInfo.upsertAsTemplate = 1
-            }
+            this.ruleInfo.upsertAsTemplate = type === 'mould' ? 1 : 0
             this.$emit('saveRule', {info: this.ruleInfo, isEdit: false})
         },
         // 编辑完成后保存
         saveEdit() {
             if(this.needEdit) {
-                console.log('gregg', this.ruleInfo);
-                this.$emit('saveRule', {info: this.ruleInfo, isEdit: true})
+                if(this.ruleInfo.haveSame) {
+                    this.$Modal.confirm({
+                        title: '是否同时修改模板内容',
+                        content: '如果确认修改,会在活动保存后同步修改模板内容',
+                        onOk: () => {
+                            this.ruleInfo.upsertAsTemplate = 1
+                            this.$emit('saveRule', {info: this.ruleInfo, isEdit: true, isTemplate: true})
+                        },
+                        onCancel: () => {
+                            this.$emit('saveRule', {info: this.ruleInfo, isEdit: true})
+                        }
+                    })
+                } else {
+                    this.$emit('saveRule', {info: this.ruleInfo, isEdit: true})
+                }
+                // this.$emit('saveRule', {info: this.ruleInfo, isEdit: true})
                 /* let params = {
                     grant_type: 'rule-update',
                     reviewConfig: this.ruleInfo

+ 2 - 7
TEAMModelOS/ClientApp/src/view/signupActivity/infoComponent/skContent.vue

@@ -242,23 +242,18 @@ export default {
                     key: 'teamNameContest',
                     align: 'center'
                 },
-                {
-                    title: '学校',
-                    key: 'schoolName',
-                    align: 'center'
-                },
                 {
                     title: '参赛状态',
                     slot: 'joinStatus',
                     align: 'center'
                     // width: 100,
                 },
-                {
+                /* {
                     title: '报名时间',
                     key: 'joinTime',
                     align: 'center'
                     // width: 100,
-                },
+                }, */
                 /* {
                     title: '作品',
                     slot: 'uploadContestType',

+ 58 - 19
TEAMModelOS/ClientApp/src/view/signupActivity/infoGoing.vue

@@ -110,12 +110,12 @@
 		<div v-if="previewStatus" class="image-viewer">
 			<div style="width:fit-content;position:relative;margin:auto;">
 				<Icon type="md-close" class="close-icon" @click="previewStatus = false" />
-				<video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.url" width="870"
+				<video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.urlShow" width="870"
 					controls="controls" style="max-height: 800px;">
 					{{$t('teachContent.tips8')}}
 				</video>
 				<audio v-else-if="previewFile.type == 'audio'" controls>
-					<source :src="previewFile.url">
+					<source :src="previewFile.urlShow">
 					{{$t('teachContent.notAudio')}}
 				</audio>
 			</div>
@@ -223,19 +223,6 @@ export default {
         }
     },
     created () {
-        this.actInfo = this.$route.params.info
-        if(!this.actInfo) {
-            this.$router.go(-1)
-        }
-        this.isLoading = true
-        if(this.actInfo.scope === 'area') {
-            this.sasData.sas = this.$store.state.user.userProfile.areas.find(item => {
-                return item.areaId === this.actInfo.owner
-            }).sas
-            this.getInviteTea()
-        } else {
-            this.sasData.sas = this.$store.state.user.schoolProfile.blob_sas
-        }
         this.getActInfo()
     },
     computed: {
@@ -247,18 +234,40 @@ export default {
     },
     methods: {
         getActInfo() {
+            this.isLoading = true
             let params = {
-                grant_type: 'read-Contest',
-                activityId: this.actInfo.id
+                activityId: this.$route.params.id
             }
-            this.$api.areaActivity.manageAct(params).then(res => {
+            this.$api.areaActivity.getActInfo(params).then(res => {
                 if(res.code === 200) {
+                    if(!res?.activity) {
+                        this.$router.go(-1)
+                        return
+                    }
+                    let host = this.$store.state.user.userProfile.blob_uri.split('/' + this.$store.state.userInfo.TEAMModelId)[0]
+                    this.actInfo = res.activity
+                    this.actInfo.posterShow = !this.actInfo.poster ? require('@/assets/image/no-poster-cn1.png') : `${host}/${this.actInfo.owner}${this.actInfo.poster}?${this.actInfo.sas}`
+                    this.actInfo.startTime = this.$tools.formatTime(this.actInfo.stime, 'yyyy-MM-dd hh:mm:ss')
+                    this.actInfo.endTime = this.$tools.formatTime(this.actInfo.etime, 'yyyy-MM-dd hh:mm:ss')
+                    this.actInfo.attachment.forEach(attach => {
+                        if(attach) {
+                            attach.urlShow = `${host}/${this.actInfo.owner}${attach.url}?${this.actInfo.sas}`
+                        }
+                    })
                     res.contest.modules.forEach(item => {
                         res.contest[item].startTime = this.$tools.formatTime(res.contest[item].stime, 'yyyy-MM-dd hh:mm:ss')
                         res.contest[item].endTime = this.$tools.formatTime(res.contest[item].etime, 'yyyy-MM-dd hh:mm:ss')
                     })
                     this.contestInfo = res.contest
                     this.ruleInfo = res.reviewRule
+                    if(this.actInfo.scope === 'area') {
+                        this.sasData.sas = this.$store.state.user.userProfile.areas.find(item => {
+                            return item.areaId === this.actInfo.owner
+                        }).sas
+                        this.getInviteTea()
+                    } else {
+                        this.sasData.sas = this.$store.state.user.schoolProfile.blob_sas
+                    }
                     if(this.actInfo.scope != 'school' && this.actInfo.invitedSchools.length) {
                         this.getSchoolList()
                     }
@@ -341,7 +350,7 @@ export default {
         },
         /* 预览 */
         async onPreview(item) {
-            let url = item.url
+            let url = item.urlShow
             if (this.$tools.getSuffix(item.name) === 'pdf') {
                 window.open('/web/viewer.html?file=' + encodeURIComponent(url));
             } else if(item.type === 'doc') {
@@ -492,6 +501,36 @@ export default {
             }
         }
     }
+    
+    .image-viewer {
+        background-color: rgba(0, 0, 0, 0.8);
+        z-index: 9999;
+        width: 100%;
+        height: 100%;
+        position: fixed;
+        top: 0;
+        left: 0;
+        overflow-y: scroll;
+        overflow-x: hidden;
+        text-align: center;
+        /*display: flex;
+        justify-content: center;
+        align-items: center;*/
+        padding: 50px;
+        padding-top: 8%;
+
+        .close-icon {
+            position: absolute;
+            right: -16px;
+            top: -16px;
+            font-size: 24px;
+            color: black;
+            cursor: pointer;
+            border-radius: 50px;
+            background: white;
+            padding: 2px;
+        }
+    }
 }
 </style>
 

+ 62 - 25
TEAMModelOS/ClientApp/src/view/signupActivity/infoReleased.vue

@@ -159,19 +159,6 @@
                         <!-- <TabPane key="jy" label="教研活动" name="jy">
                             暂未填写内容
                         </TabPane> -->
-                        <div v-if="previewStatus" class="image-viewer">
-                            <div style="width:fit-content;position:relative;margin:auto;">
-                                <Icon type="md-close" class="close-icon" @click="previewStatus = false" />
-                                <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.url" width="870"
-                                    controls="controls" style="max-height: 800px;">
-                                    {{$t('teachContent.tips8')}}
-                                </video>
-                                <audio v-else-if="previewFile.type == 'audio'" controls>
-                                    <source :src="previewFile.url">
-                                    {{$t('teachContent.notAudio')}}
-                                </audio>
-                            </div>
-                        </div>
                     </Tabs>
                 </div>
             </div>
@@ -179,6 +166,19 @@
         <Drawer title="评审规则" :width="50" v-model="ruleDrawer">
             <RuleDrawer :ruleDrawerAdd="0" :ruleInfoParent="ruleInfo" />
         </Drawer>
+		<div v-if="previewStatus" class="image-viewer">
+			<div style="width:fit-content;position:relative;margin:auto;">
+				<Icon type="md-close" class="close-icon" @click="previewStatus = false" />
+				<video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.urlShow" width="870"
+					controls="controls" style="max-height: 800px;">
+					{{$t('teachContent.tips8')}}
+				</video>
+				<audio v-else-if="previewFile.type == 'audio'" controls>
+					<source :src="previewFile.urlShow">
+					{{$t('teachContent.notAudio')}}
+				</audio>
+			</div>
+		</div>
     </div>
 </template>
 
@@ -191,6 +191,7 @@ export default {
     data () {
         return {
             isLoading: false,
+            actInfo: undefined,
             contestInfo: undefined,
             ruleInfo: {
                 name: '',
@@ -203,16 +204,9 @@ export default {
         }
     },
     created () {
-        if(this.actInfo) {
-            this.getActInfo()
-        } else {
-            this.$router.go(-1)
-        }
+        this.getActInfo()
     },
     computed: {
-        actInfo() {
-            return this.$route.params.info || undefined
-        },
         isArea() {
             return localStorage.getItem('platform') === 'area'
         },
@@ -221,11 +215,25 @@ export default {
         getActInfo() {
             this.isLoading = true
             let params = {
-                grant_type: 'read-Contest',
-                activityId: this.$route.params.info.id
+                grant_type: 'read-activity',
+                activityId: this.$route.params.id
             }
             this.$api.areaActivity.manageAct(params).then(res => {
                 if(res.code === 200) {
+                    if(!res?.activity) {
+                        this.$router.go(-1)
+                        return
+                    }
+                    let host = this.$store.state.user.userProfile.blob_uri.split('/' + this.$store.state.userInfo.TEAMModelId)[0]
+                    this.actInfo = res.activity
+                    this.actInfo.posterShow = !this.actInfo.poster ? require('@/assets/image/no-poster-cn1.png') : `${host}/${this.actInfo.owner}${this.actInfo.poster}?${this.actInfo.sas}`
+                    this.actInfo.startTime = this.$tools.formatTime(this.actInfo.stime, 'yyyy-MM-dd hh:mm:ss')
+                    this.actInfo.endTime = this.$tools.formatTime(this.actInfo.etime, 'yyyy-MM-dd hh:mm:ss')
+                    this.actInfo.attachment.forEach(attach => {
+                        if(attach) {
+                            attach.urlShow = `${host}/${this.actInfo.owner}${attach.url}?${this.actInfo.sas}`
+                        }
+                    })
                     res.contest.modules.forEach(item => {
                         res.contest[item].startTime = this.$tools.formatTime(res.contest[item].stime, 'yyyy-MM-dd hh:mm:ss')
                         res.contest[item].endTime = this.$tools.formatTime(res.contest[item].etime, 'yyyy-MM-dd hh:mm:ss')
@@ -328,7 +336,7 @@ export default {
         },
         /* 预览 */
         async onPreview(item) {
-            let url = item.url
+            let url = item.urlShow
             if (this.$tools.getSuffix(item.name) === 'pdf') {
                 window.open('/web/viewer.html?file=' + encodeURIComponent(url));
             } else if(item.type === 'doc') {
@@ -340,7 +348,6 @@ export default {
             } else {
                 this.previewFile = item
                 this.previewStatus = true
-                console.log(this.previewFile.type);
             }
         },
         /* 下载 */
@@ -489,5 +496,35 @@ export default {
             }
         }
     }
+    
+    .image-viewer {
+        background-color: rgba(0, 0, 0, 0.8);
+        z-index: 9999;
+        width: 100%;
+        height: 100%;
+        position: fixed;
+        top: 0;
+        left: 0;
+        overflow-y: scroll;
+        overflow-x: hidden;
+        text-align: center;
+        /*display: flex;
+        justify-content: center;
+        align-items: center;*/
+        padding: 50px;
+        padding-top: 8%;
+
+        .close-icon {
+            position: absolute;
+            right: -16px;
+            top: -16px;
+            font-size: 24px;
+            color: black;
+            cursor: pointer;
+            border-radius: 50px;
+            background: white;
+            padding: 2px;
+        }
+    }
 }
 </style>

+ 2 - 2
TEAMModelOS/ClientApp/src/view/signupActivity/processActivity.vue

@@ -137,14 +137,14 @@ export default {
                 {
                     name: this.isArea ? 'areaInfoProcess' : 'infoProcess',
                     params: {
-                        info: data
+                        id: data.id
                     },
                 })
             } else {
                 this.$router.push({
                     name: this.isArea ? 'areaInfoActivity' : 'infoActivity',
                     params: {
-                        info: data
+                        id: data.id
                     }
                 })
             }

+ 15 - 1
TEAMModelOS/Controllers/System/BlobController.cs

@@ -653,7 +653,21 @@ namespace TEAMModelOS.Controllers
                         blobContainerName =cntrs;
                     }
                     else {
-                        return BadRequest("只能删除本人管理的文件夹");
+                        if (json.TryGetProperty("prefix", out JsonElement _prefixjson) && _prefixjson.ValueKind.Equals(JsonValueKind.String))
+                        {
+                            if (_prefixjson.GetString().Contains(id))
+                            {
+                                blobContainerName=cntrs;
+
+                            }
+                            else { return BadRequest("只能删除本人管理的文件夹"); }
+
+                        }
+                        else {
+
+                            return BadRequest("只能删除本人管理的文件夹");
+                        }
+                       
                     }
                 }
             }