소스 검색

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

chenmy 2 년 전
부모
커밋
3636eeea01

+ 8 - 2
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -2585,7 +2585,10 @@ const LANG_EN_US = {
             ansTimeTips: '(Default is 0, which means unlimited time)',
             sheetErr: 'Failed to process the answer card',
             noAuth: 'Not authorized',
-            noSchool: 'Not joined a school'
+            noSchool: 'Not joined a school',
+            sort1: 'Reselect test paper',
+            sort2: 'OMR test only supports papers sorted by question type, please re-select papers',
+            sort3: 'OMR test does not support papers sorted by question number',
         },
         // ManualPaper.vue
         manual: {
@@ -6427,7 +6430,10 @@ const LANG_EN_US = {
             signNow: 'Sign in now',
             signOk: 'Sign in successfully',
             unStart: 'Not started to sign in',
-            school: 'School:'
+            school: 'School:',
+            upd1: 'Modify cover',
+            upd2: 'Modification successful',
+            upd3: 'Modification failed',
         },
         mgt: {
             all: 'All',

+ 8 - 2
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -2585,7 +2585,10 @@ const LANG_ZH_CN = {
             ansTimeTips: '(默认为0,代表不限时)',
             sheetErr: '答题卡处理失败',
             noAuth: '未授权',
-            noSchool: '未加入学校'
+            noSchool: '未加入学校',
+            sort1:'重新挑选试卷',
+            sort2:'阅卷评测暂不支持题号排序的试卷,请重新挑选试卷',
+            sort3:'阅卷评测不能挑选题号排序的试卷',
         },
         // ManualPaper.vue
         manual: {
@@ -6432,7 +6435,10 @@ const LANG_ZH_CN = {
             signNow: '立即签到',
             signOk: '签到成功',
             unStart: '未开始签到',
-            school: '学校:'
+            school: '学校:',
+            upd1:'修改封面',
+            upd2:'修改成功',
+            upd3:'修改失败',
         }
     },
     //研修

+ 8 - 2
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -2586,7 +2586,10 @@ const LANG_ZH_TW = {
             ansTimeTips: '(預設為0,代表不限時)',
             sheetErr: '答題卡處理失敗',
             noAuth: '未授權',
-            noSchool: '未加入學校'
+            noSchool: '未加入學校',
+            sort1: '重新挑選試卷',
+            sort2: '閱卷評測暫不支持以題號排序的試卷,請重新挑選試卷',
+            sort3: '閱卷評測不能挑選以題號排序的試卷',
         },
         //ManualPaper.vue
         manual: {
@@ -6431,7 +6434,10 @@ const LANG_ZH_TW = {
             signNow: '立即簽到',
             signOk: '簽到成功',
             unStart: '未開始簽到',
-            school: '學校:'
+            school: '學校:',
+            upd1: '修改封面',
+            upd2: '修改成功',
+            upd3: '修改失敗',
         }
     },
     //研習

+ 5 - 1
TEAMModelOS/ClientApp/src/api/train.js

@@ -16,6 +16,10 @@ export default {
     findSummaryTrain: function (data) {
         return post('/common/study/find-summary', data)
     },
+    //更新研修活动
+    updTrain: function (data) {
+        return post('/common/study/update', data)
+    },
     // 查询研修活动
     findTrainByTeacher: function (data) {
         return post('/common/study/find-by-teacher', data)
@@ -58,6 +62,6 @@ export default {
     getProvTeacherList: function (data) {
         return post('/sc/check-teacher-bind', data)
     }
-    
+
 }
 

+ 38 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/CreatePrivEva.vue

@@ -25,7 +25,7 @@
                                         <Icon type="ios-information-circle-outline" color="#1cc0f3" style="margin-left:5px" />
                                     </Tooltip>
                                 </label>
-                                <Select v-model="evaluationInfo.source">
+                                <Select v-model="evaluationInfo.source" @on-change="checkItemSort">
                                     <!-- 暂时取消创建课中评量 -->
                                     <Option v-for="(item,index) in $GLOBAL.EV_MODE()" v-show="index != 1" :label="item.label" :value="item.value" :key="index" :disabled="index > 1 && (!$store.state.userInfo.hasSchool || !$store.state.user.schoolProfile.svcStatus.VABAJ6NV)">
                                         <div>
@@ -310,11 +310,48 @@ export default {
             //     })
             // }
         },
+        //设置评测模式后检查试卷itemSort
+        checkItemSort() {
+            if (this.evaluationInfo.source == '2') {
+                let p = this.evaluationInfo.paperInfo.find(paper => paper.itemSort == 1)
+                if (p) {
+                    this.$Modal.confirm({
+                        title: this.$t('learnActivity.createEv.sort1'),
+                        content: this.$t('learnActivity.createEv.sort2'),
+                        onOk: () => {
+                            for (let i = 0; i < this.evaluationInfo.paperInfo.length; i++) {
+                                if (this.evaluationInfo.paperInfo[i].itemSort == 1) {
+                                    let defaultPaper = {
+                                        periodName: this.evaluationInfo.name,
+                                        periodId: this.evaluationInfo.id,
+                                        subjectName: this.evaluationInfo.paperInfo[i].subjectName,
+                                        subjectId: this.evaluationInfo.paperInfo[i].subjectId,
+                                        createType: 'manualPaper',
+                                        score: 100,
+                                        item: [],
+                                        filter: {},
+                                        name: this.$t('learnActivity.createEv.defaultPaper'),
+                                        time: 0 //作答时间
+                                    }
+                                    this.evaluationInfo.paperInfo.splice(i, 1, this._.cloneDeep(defaultPaper))
+                                }
+                            }
+                        },
+                        onCancel:()=>{
+                            this.evaluationInfo.source = '0'
+                        }
+                    })
+                }
+            }
+        },
         /**
          * 处理挑选试卷事件
          * @param data
          */
         selectPaper(data) {
+            if (this.evaluationInfo.source == '2' && data.itemSort == 1) {
+                return this.$Message.warning(this.$t('learnActivity.createEv.sort3'))
+            }
             let simplePaper = data
             this.$Modal.confirm({
                 title: this.$t('learnActivity.createEv.stPaperTitle'),

+ 38 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/CreateSchoolEva.vue

@@ -25,7 +25,7 @@
                                         <Icon type="ios-information-circle-outline" color="#1cc0f3" style="margin-left:5px" />
                                     </Tooltip>
                                 </label>
-                                <Select v-model="evaluationInfo.source">
+                                <Select v-model="evaluationInfo.source" @on-change="checkItemSort">
                                     <!-- 校本评测开放创建课中评量 2022530调整不能发布课中评测,没有做物联网-->
                                     <Option v-for="(item,index) in $GLOBAL.EV_MODE()" v-show="index != 1" :label="item.label" :value="item.value" :key="index" :disabled="index > 1 && !$store.state.user.schoolProfile.svcStatus.VABAJ6NV">
                                         <div>
@@ -334,7 +334,6 @@ export default {
         },
         treeChange(data) {
             this.evaluationInfo.targets = data
-            console.log('对象数据', data)
             // 组件内部已实现教学班和行政班二选一
             let finalData = data
             let classData = finalData.filter(item => {
@@ -393,11 +392,48 @@ export default {
                 })
             }
         },
+        //设置评测模式后检查试卷itemSort
+        checkItemSort() {
+            if (this.evaluationInfo.source == '2') {
+                let p = this.evaluationInfo.paperInfo.find(paper => paper.itemSort == 1)
+                if (p) {
+                    this.$Modal.confirm({
+                        title: this.$t('learnActivity.createEv.sort1'),
+                        content: this.$t('learnActivity.createEv.sort2'),
+                        onOk: () => {
+                            for (let i = 0; i < this.evaluationInfo.paperInfo.length; i++) {
+                                if (this.evaluationInfo.paperInfo[i].itemSort == 1) {
+                                    let defaultPaper = {
+                                        periodName: this.evaluationInfo.name,
+                                        periodId: this.evaluationInfo.id,
+                                        subjectName: this.evaluationInfo.paperInfo[i].subjectName,
+                                        subjectId: this.evaluationInfo.paperInfo[i].subjectId,
+                                        createType: 'manualPaper',
+                                        score: 100,
+                                        item: [],
+                                        filter: {},
+                                        name: this.$t('learnActivity.createEv.defaultPaper'),
+                                        time: 0 //作答时间
+                                    }
+                                    this.evaluationInfo.paperInfo.splice(i, 1, this._.cloneDeep(defaultPaper))
+                                }
+                            }
+                        },
+                        onCancel:()=>{
+                            this.evaluationInfo.source = '0'
+                        }
+                    })
+                }
+            }
+        },
         /**
          * 处理挑选试卷事件
          * @param data
          */
         selectPaper(data) {
+            if (this.evaluationInfo.source == '2' && data.itemSort == 1) {
+                return this.$Message.warning(this.$t('learnActivity.createEv.sort3'))
+            }
             let simplePaper = data
             this.$Modal.confirm({
                 title: this.$t('learnActivity.createEv.stPaperTitle'),

+ 8 - 3
TEAMModelOS/ClientApp/src/view/learnactivity/ManualPaper.vue

@@ -58,9 +58,14 @@
                             <span class="info-bold">{{ item.scoring.length > 0 ? item.scoring.length : 0 }}</span>
                         </span>
                         <span class="info-item">
-                            <Icon type="md-time" style="margin-right:8px" size="14"/>
+                            <Icon type="md-time" style="margin-right:8px" size="14" />
                             <span class="info-bold">{{$jsFn.dateFormat(item.createTime)}}</span>
                         </span>
+                        <span class="info-item">{{$t('evaluation.paperList.sortType')}}:
+                            <span class="info-bold">
+                                {{ item.itemSort === 1 ? $t('evaluation.paperList.sortByOrder') : $t('evaluation.paperList.sortByType') }}
+                            </span>
+                        </span>
                     </div>
 
                     <span v-if="item.id == selectedId" style="margin-left:20px;display:block;" class="paper-item-tools">
@@ -145,7 +150,7 @@ export default {
             },
             routeScope: '',
             gradeIds: undefined,
-            subId:''
+            subId: ''
         }
     },
     methods: {
@@ -288,7 +293,7 @@ export default {
                 this.subId = this.subjectId
                 this.checkFirst()
             },
-            immediate:true
+            immediate: true
         },
         source: {
             handler(n, o) {

+ 38 - 1
TEAMModelOS/ClientApp/src/view/mycourse/exam/CreatePrivExam.vue

@@ -25,7 +25,7 @@
                                         <Icon type="ios-information-circle-outline" color="#1cc0f3" style="margin-left:5px" />
                                     </Tooltip>
                                 </label>
-                                <Select v-model="evaluationInfo.source">
+                                <Select v-model="evaluationInfo.source" @on-change="checkItemSort">
                                     <!-- 暂时取消创建课中评量 -->
                                     <Option v-for="(item,index) in $GLOBAL.EV_MODE()" v-show="index != 1" :label="item.label" :value="item.value" :key="index" :disabled="index > 1 && (!$store.state.userInfo.hasSchool || !$store.state.user.schoolProfile.svcStatus.VABAJ6NV)">
                                         <div>
@@ -345,11 +345,48 @@ export default {
         confirmToManage() {
             this.$router.go(-1)
         },
+        //设置评测模式后检查试卷itemSort
+        checkItemSort() {
+            if (this.evaluationInfo.source == '2') {
+                let p = this.evaluationInfo.paperInfo.find(paper => paper.itemSort == 1)
+                if (p) {
+                    this.$Modal.confirm({
+                        title: this.$t('learnActivity.createEv.sort1'),
+                        content: this.$t('learnActivity.createEv.sort2'),
+                        onOk: () => {
+                            for (let i = 0; i < this.evaluationInfo.paperInfo.length; i++) {
+                                if (this.evaluationInfo.paperInfo[i].itemSort == 1) {
+                                    let defaultPaper = {
+                                        periodName: this.evaluationInfo.name,
+                                        periodId: this.evaluationInfo.id,
+                                        subjectName: this.evaluationInfo.paperInfo[i].subjectName,
+                                        subjectId: this.evaluationInfo.paperInfo[i].subjectId,
+                                        createType: 'manualPaper',
+                                        score: 100,
+                                        item: [],
+                                        filter: {},
+                                        name: this.$t('learnActivity.createEv.defaultPaper'),
+                                        time: 0 //作答时间
+                                    }
+                                    this.evaluationInfo.paperInfo.splice(i, 1, this._.cloneDeep(defaultPaper))
+                                }
+                            }
+                        },
+                        onCancel: () => {
+                            this.evaluationInfo.source = '0'
+                        }
+                    })
+                }
+            }
+        },
         /**
          * 处理挑选试卷事件
          * @param data
          */
         selectPaper(data) {
+            if (this.evaluationInfo.source == '2' && data.itemSort == 1) {
+                return this.$Message.warning(this.$t('learnActivity.createEv.sort3'))
+            }
             let simplePaper = data
             this.$Modal.confirm({
                 title: this.$t('learnActivity.createEv.stPaperTitle'),

+ 1 - 1
TEAMModelOS/ClientApp/src/view/student-account/stuMgt/StuMgt.vue

@@ -790,7 +790,7 @@ export default {
                 } else {
                     this.tableShowData.push(...temp)
                 }
-            }, 1000)
+            }, 500)
         },
         //获取学校基础信息
         getSchoolProfile() {

+ 31 - 5
TEAMModelOS/ClientApp/src/view/teachermgmt/components/mgt/TeacherMgt.vue

@@ -40,8 +40,8 @@
                 </Button>
             </div>
             <div class="mgt-teacher-table" id="mgt-teacher-table">
-                <vuescroll>
-                    <Table stripe class="scrollstyle" :height="tableHeight" ref="selection" :columns="tableColumns" :data="tableData" @on-selection-change="selectTeachers">
+                <Scroll style="height:100%" :on-reach-bottom="scrollLoad" height="100%" :distance-to-edge="[15, 15]">
+                    <Table stripe class="scrollstyle" ref="selection" :columns="tableColumns" :data="tableDataShow" @on-selection-change="selectTeachers">
                         <template slot-scope="{ row }" slot="picture">
                             <PersonalPhoto :name="row.name || row.iname" :picture="row.picture" />
                         </template>
@@ -76,7 +76,7 @@
                             <InputNumber :min="0" placeholder="-" v-model="row.size" @on-change="handleSetSpace($event,row)" /> GB
                         </template>
                     </Table>
-                </vuescroll>
+                </Scroll>
             </div>
         </div>
         <!-- 权限授权面板 -->
@@ -307,6 +307,7 @@ export default {
     },
     data() {
         return {
+            tableDataShow: [],
             teacherInfo: {
                 name: '',
                 id: '',
@@ -390,7 +391,9 @@ export default {
             authData: [],
             authStatus: {},
             jobTitle: '',
-            subjectFilter: []
+            subjectFilter: [],
+            pageNum: 30,
+            curPage: 1
         }
     },
     computed: {
@@ -723,6 +726,17 @@ export default {
         },
     },
     methods: {
+        scrollLoad() {
+            setTimeout(() => {
+                let start = (this.curPage++ - 1) * this.pageNum
+                let temp = this.tableData.slice(start, start + this.pageNum)
+                if (temp.length == 0 && start != 0) {
+                    this.$Message.info(this.$t('stuAccount.isBottom'))
+                } else {
+                    this.tableDataShow.push(...temp)
+                }
+            }, 500)
+        },
         confirmUpdateTeacher() {
             let sIds = this.teacherInfo.subjectsPath.map(item => item[item.length - 1])
             let params = {
@@ -1203,7 +1217,7 @@ export default {
                             res.authoritylist.splice(i, 1)
                             --i
                         }
-                        if(this.$store.state.config.srvAdr == 'Global' && res.authoritylist[i].category === 'train'){
+                        if (this.$store.state.config.srvAdr == 'Global' && res.authoritylist[i].category === 'train') {
                             res.authoritylist.splice(i, 1)
                             --i
                         }
@@ -1331,6 +1345,15 @@ export default {
         if (routerData && routerData.openSpace) this.openPanel('space')
     },
     watch: {
+        filters: {
+            handler(n, o) {
+                this.curPage = 1
+                this.tableDataShow = []
+                this.scrollLoad()
+            },
+            deep: true,
+            immediate: true
+        },
         teachers: {
             handler(n, o) {
                 this.getTeachersTemp()
@@ -1346,6 +1369,9 @@ export default {
 @import "./TeacherMgt.less";
 </style>
 <style lang="less">
+.mgt-teacher-table .ivu-scroll-container {
+    height: 100%;
+}
 .el-cascader-custom {
     z-index: 99999 !important;
 }

+ 145 - 64
TEAMModelOS/ClientApp/src/view/train/TrainDetail.less

@@ -1,31 +1,36 @@
-.train-detail-container{
+.train-detail-container {
     width: 100%;
     height: 100%;
     padding: 15px;
     background: #f7f7f7;
 }
-.detail-wrap{
+
+.detail-wrap {
     display: flex;
     flex-direction: row;
     justify-content: space-around;
     padding-bottom: 10px;
 }
-.my-card-content{
+
+.my-card-content {
     display: flex;
     flex-direction: row;
     justify-content: space-around;
     align-items: center;
     padding-bottom: 10px;
 }
-.detail-left{
+
+.detail-left {
     width: 70%;
     min-height: 700px;
 }
-.detail-right{
+
+.detail-right {
     width: 28%;
     min-height: 700px;
 }
-.train-top-info{
+
+.train-top-info {
     background: white;
     width: 100%;
     min-height: 240px;
@@ -33,26 +38,59 @@
     display: flex;
     align-items: center;
     position: relative;
-    &:hover{
+
+    &:hover {
         box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
         border-color: #eee;
     }
-    .img-box{
+
+    .img-box {
         width: 380px;
         height: 200px;
         background-size: cover;
         background-repeat: no-repeat;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        position: relative;
+
+        span {
+            position: relative;
+            z-index: 99;
+            color: white;
+            cursor: pointer;
+            display: none;
+            font-size: 16px;
+            user-select: none;
+        }
+
+        &:hover span {
+            display: block;
+        }
+
+        &:hover::after {
+            content: " ";
+            position: absolute;
+            left: 0px;
+            right: 0px;
+            bottom: 0px;
+            top: 0px;
+            background: rgba(0, 0, 0, 0.8);
+        }
     }
-    .infos{
+
+    .infos {
         flex: 1;
         margin-left: 20px;
         padding: 10px;
-        .title{
+
+        .title {
             font-size: 16px;
             font-weight: 600;
             margin-bottom: 15px;
         }
-        .hour{
+
+        .hour {
             margin-left: 10px;
             display: inline-block;
             font-size: 12px;
@@ -61,7 +99,8 @@
             padding: 0px 5px;
             border-radius: 4px;
         }
-        .status-pending{
+
+        .status-pending {
             margin-left: 10px;
             display: inline-block;
             font-size: 12px;
@@ -70,7 +109,8 @@
             padding: 0px 5px;
             border-radius: 4px;
         }
-        .status-going{
+
+        .status-going {
             margin-left: 10px;
             display: inline-block;
             font-size: 12px;
@@ -79,7 +119,8 @@
             padding: 0px 5px;
             border-radius: 4px;
         }
-        .status-finish{
+
+        .status-finish {
             margin-left: 10px;
             display: inline-block;
             font-size: 12px;
@@ -88,22 +129,27 @@
             padding: 0px 5px;
             border-radius: 4px;
         }
-        .info-item{
+
+        .info-item {
             margin-top: 5px;
         }
-        .info-label{
+
+        .info-label {
             color: #a5a5a5;
-            white-space: nowrap; 
+            white-space: nowrap;
         }
-        .upload-text{
+
+        .upload-text {
             color: #2d8cf0;
             cursor: pointer;
             user-select: none;
-            &:hover{
+
+            &:hover {
                 text-decoration: underline;
             }
         }
-        .text-info{
+
+        .text-info {
             color: #aaaaaa;
             margin-left: 5px;
             user-select: none;
@@ -111,7 +157,7 @@
     }
 }
 
-.train-data-wrap{
+.train-data-wrap {
     margin-top: 10px;
     width: 100%;
     min-height: 400px;
@@ -119,30 +165,37 @@
     margin-bottom: 10px;
     padding-bottom: 10px;
     background: white;
-    &:hover{
+
+    &:hover {
         box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
         border-color: #eee;
     }
 }
-.tab-pane-wrap{
+
+.tab-pane-wrap {
     padding: 0px 10px;
 }
-.num-info{
+
+.num-info {
     font-size: 26px;
     margin-right: 5px;
     display: inline-block;
     width: 80px;
 }
-.success-color{
+
+.success-color {
     color: #19be6b;
 }
-.warning-color{
+
+.warning-color {
     color: #ff9900;
 }
-.error-color{
+
+.error-color {
     color: #ed4014;
 }
-.to-train-mgt{
+
+.to-train-mgt {
     position: fixed;
     right: 50px;
     bottom: 50px;
@@ -152,20 +205,23 @@
     padding: 10px;
     border-radius: 50%;
     box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.2);
-    &:hover{
+
+    &:hover {
         color: #2d8cf0;
         background: #f9f9f9;
     }
 }
-.train-detail-text{
+
+.train-detail-text {
     color: #2d8cf0;
-    position: absolute;    
+    position: absolute;
     right: 30px;
     top: 15px;
     cursor: pointer;
     user-select: none;
 }
-.back-item{
+
+.back-item {
     background: white;
     width: 100%;
     height: 35px;
@@ -173,19 +229,23 @@
     margin-bottom: 20px;
     padding-left: 10px;
     cursor: pointer;
-    &:hover{
+
+    &:hover {
         box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
         border-color: #eee;
     }
 }
-.qr-code-item{
+
+.qr-code-item {
     margin: 10px 0px;
 }
-.qr-code-label{
+
+.qr-code-label {
     font-size: 16px;
     display: inline-block;
     width: 120px;
 }
+
 .qr-code-wrap {
     position: fixed;
     left: 0px;
@@ -194,34 +254,39 @@
     bottom: 0px;
     background: rgba(103, 103, 103, 0.27);
     z-index: 99999;
-    display:flex;
+    display: flex;
     display: flex;
     justify-content: center;
     align-items: center;
 }
-.qr-code-title{
+
+.qr-code-title {
     margin-bottom: 10px;
     text-align: center;
     font-size: 22px;
     // color: #2b85e4;
 }
-.tea-info-item{
+
+.tea-info-item {
     margin-top: 5px;
 }
-.tea-info-label{
+
+.tea-info-label {
     color: #a5a5a5;
     margin-top: 10px;
 }
-.file-list-box{
+
+.file-list-box {
     min-height: 180px;
     padding: 50px 10px;
-    .file-prog-item{
+
+    .file-prog-item {
         margin-bottom: 20px;
     }
-    .file-name{
 
-    }
-    .file-prog{
+    .file-name {}
+
+    .file-prog {
         float: right;
         font-size: 12px;
         margin-right: 20px;
@@ -229,6 +294,7 @@
         margin-left: 5px;
     }
 }
+
 .image-viewer {
     background-color: rgba(0, 0, 0, 0.8);
     z-index: 9999;
@@ -240,8 +306,9 @@
     overflow-y: scroll;
     overflow-x: hidden;
     text-align: center;
-    padding:50px;
-    padding-top:8%;
+    padding: 50px;
+    padding-top: 8%;
+
     .close-icon {
         position: absolute;
         right: -16px;
@@ -249,71 +316,83 @@
         font-size: 24px;
         color: black;
         cursor: pointer;
-        border-radius:50px;
-        background:white;
-        padding:2px;
+        border-radius: 50px;
+        background: white;
+        padding: 2px;
         z-index: 9999;
     }
 }
-.uploading-title{
+
+.uploading-title {
     text-align: center;
     font-size: 16px;
     color: #17233d;
     font-weight: 600;
 }
-.train-file-item{
+
+.train-file-item {
     margin-right: 30px;
     cursor: pointer;
-    white-space: nowrap; 
+    white-space: nowrap;
     user-select: none;
     position: relative;
-    &:hover{
+
+    &:hover {
         text-decoration: underline;
         color: #2d8cf0;
     }
-    &:hover .delete-train-file{
+
+    &:hover .delete-train-file {
         opacity: 1;
     }
 }
-.delete-train-file{
+
+.delete-train-file {
     color: #ed4014;
     opacity: 0;
     position: absolute;
     top: 3px;
 }
-.area-tips{
+
+.area-tips {
     color: #ed4014;
     float: right;
     margin-right: 10px;
 }
-.publish-area-activity{
+
+.publish-area-activity {
     margin-top: 20px;
     padding: 50px 15px;
     width: 100%;
     margin-bottom: 10px;
     background: white;
-    &:hover{
+
+    &:hover {
         box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
         border-color: #eee;
     }
 }
-.unpublish-icon{
+
+.unpublish-icon {
     color: #ff9900;
     font-size: 80px;
     display: block;
 }
-.publish-tips{
+
+.publish-tips {
     font-size: 12px;
     text-align: center;
     margin-top: 15px;
     color: #999999;
 }
-.choose-teacher-btn{
+
+.choose-teacher-btn {
     margin: auto;
     display: block;
     margin-top: 20px;
 }
-.hw-file-item{
+
+.hw-file-item {
     display: inline-block;
     cursor: pointer;
     margin-top: 5px;
@@ -322,12 +401,14 @@
     margin-right: 20px;
     border-radius: 5px;
 }
-.hw-file-item-active{
+
+.hw-file-item-active {
     background: #2d8cf0;
     border: none;
     color: white;
 }
-.province-tips{
+
+.province-tips {
     color: #ed4014;
     margin-top: 10px;
     font-weight: 600;

+ 38 - 3
TEAMModelOS/ClientApp/src/view/train/TrainDetail.vue

@@ -14,7 +14,13 @@
                         </span>
                     </div>
                     <div class="train-top-info">
-                        <div class="img-box" :style="{backgroundColor: '#f0f0f0',backgroundImage: `url(${trainInfo.img || defImg})`}"></div>
+                        <div class="img-box" :style="{backgroundColor: '#f0f0f0',backgroundImage: `url(${trainInfo.img || defImg})`}">
+                            <Upload ref="upd-poster" :show-upload-list="false" :headers="updHeader" :on-error="handleUpdErr" type="drag" action="/blob/public-upload" :format="['jpg','png','jpeg']" :on-format-error="handleFormatError" :on-success="success">
+                                <span @click="setUpload('poster')">
+                                    {{$t('train.detail.upd1')}}
+                                </span>
+                            </Upload>
+                        </div>
                         <div class="infos">
                             <p class="title">
                                 <span>{{trainInfo.topic}}</span>
@@ -92,7 +98,7 @@
                                 <span v-if="trainFiles.length">
                                     <span class="train-file-item" v-for="(item,index) in trainFiles" :key="index" @click="handlePreviewFile('file',index)">
                                         {{item.name}}
-                                        <Icon class="delete-train-file" type="md-close" @click="deleteFile('file',index)" />
+                                        <Icon class="delete-train-file" type="md-close" @click.stop="deleteFile('file',index)" />
                                     </span>
                                     <Upload action="" multiple :show-upload-list="false" :before-upload="handleUpload" style="display:inline-block">
                                         <span class="upload-text" @click="setUpload('file')">{{$t('td.td126')}}</span>
@@ -520,6 +526,7 @@ export default {
     },
     data() {
         return {
+            updHeader: {},
             hwPreviewFile: {},
             modalLoading: false,
             selections: [],
@@ -874,6 +881,27 @@ export default {
         }
     },
     methods: {
+        success(response, file, fileList) {
+            this.$api.train.updTrain({
+                id: this.trainInfo.id,
+                code: this.trainInfo.code.replace('Study-', ''),
+                img: response.url
+            }).then(
+                res => {
+                    this.trainInfo.img = response.url
+                    this.$Message.success(this.$t('train.detail.upd2'))
+                },
+                err => {
+                    this.$Message.error(this.$t('train.detail.upd3'))
+                }
+            )
+        },
+        handleFormatError(file) {
+            this.$Message.warning(this.$t('train.create.uploadErr'));
+        },
+        handleUpdErr() {
+            this.$Message.error(this.$t('updModal.updErr'))
+        },
         publishAreaActivity() {
             let params = {
                 study: this.trainInfo,
@@ -1097,11 +1125,14 @@ export default {
                 }
             }).then(
                 res => {
+                    let url = res.url
                     res.url = res.url + schoolSas.sas
                     if (this.uploadType === 'video') {
                         this.trainVideo = res
-                    } else {
+                    } else if (this.uploadType === 'file') {
                         this.trainFiles.push(res)
+                    } else if (this.uploadType === 'poster') {
+
                     }
                 },
                 err => {
@@ -1793,6 +1824,10 @@ export default {
         }
     },
     created() {
+        if (localStorage.getItem('auth_token')) {
+            this.updHeader['x-auth-authtoken'] = localStorage.getItem('auth_token')
+            this.updHeader['authorization'] = 'Bearer ' + localStorage.getItem('access_token')
+        }
         this.defImg = require("@/assets/image/def-train-poster.jpg")
         let routerData = this.$route
         console.log(routerData)

+ 36 - 0
TEAMModelOS/Controllers/Common/StudyController.cs

@@ -130,6 +130,42 @@ namespace TEAMModelOS.Controllers.Common
         }
 
 
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "teacher,admin")]
+        [HttpPost("update")]
+        [Authorize(Roles = "IES")]
+        public async Task<IActionResult> update(JsonElement request)
+        {
+            try
+            {
+                if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
+                if (!request.TryGetProperty("img", out JsonElement img)) return BadRequest();
+                if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
+                var client = _azureCosmos.GetCosmosClient();
+                var response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.GetString(), new PartitionKey($"Study-{code}"));
+                if (response.Status == 200)
+                {
+                    var json = await JsonDocument.ParseAsync(response.ContentStream);
+                    Study study = json.ToObject<Study>();
+                    study.img = img.GetString();
+                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(study, study.id, new PartitionKey($"{study.code}"));
+                    return Ok(new { code = 200 });
+                }
+                else {
+                    return Ok(new { code = 404 });
+                }
+              
+                
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"OS,{_option.Location},study/save()\n{ex.Message}\n{ex.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
+                return Ok(new { code = 500 });
+            }
+
+        }
+
+
         /// <summary>
         /// 签到
         /// </summary>