Jelajahi Sumber

Merge branch 'develop3.0' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0

CrazyIter 5 tahun lalu
induk
melakukan
f789e462f3

+ 1 - 1
TEAMModelOS.Service/Models/Learn/HomeWorkStudent.cs

@@ -61,7 +61,7 @@ namespace TEAMModelOS.Service.Models.Learn
         /// <summary>
         /// 提交时间
         /// </summary>
-        public string submissionTime { get; set; }
+        public long submissionTime { get; set; }
 
         /// <summary>
         /// 分数

+ 12 - 0
TEAMModelOS/ClientApp/src/api/learnActivity.js

@@ -103,6 +103,18 @@ export default {
         return post('/api/HomeWork/FindStudent', data)
     },
     /*
+    * 老师评分
+    */
+    SetScore: function (data) {
+        return post('/api/HomeWork/Scoring', data)
+    },
+    /*
+    * 打评语
+    */
+    SetComment: function (data) {
+        return post('/api/HomeWork/Comment', data)
+    },
+    /*
     *新增或者编辑自主学子活动
     */
     SaveSelfLearn: function (data) {

+ 41 - 10
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwForm.vue

@@ -12,19 +12,21 @@
 
             <FormItem label="发布时间" prop="publishModel">
                 <RadioGroup v-model="hwForm.publishModel">
-                    <Radio label="0">立即发布</Radio>
-                    <Radio label="1">定时发布</Radio>
+                    <Radio label="0" :disabled="currentState !== 100">立即发布</Radio>
+                    <Radio label="1" :disabled="currentState !== 100">定时发布</Radio>
                 </RadioGroup>
 
                 <DatePicker v-if="hwForm.publishModel === '1'"
                             type="datetime"
+                            :editable="isDateEdit"
+                            :disabled="currentState !== 100"
                             placeholder="请选择发布时间"
                             v-model="hwForm.startTime"
                             style="margin-top:10px"></DatePicker>
             </FormItem>
 
             <FormItem label="结束时间" prop="endTime">
-                <DatePicker type="datetime" placeholder="请选择作业结束时间" v-model="hwForm.endTime"></DatePicker>
+                <DatePicker type="datetime" :editable="isDateEdit" placeholder="请选择作业结束时间" v-model="hwForm.endTime"></DatePicker>
             </FormItem>
 
             <FormItem label="作业描述" prop="description">
@@ -33,7 +35,7 @@
             </FormItem>
 
             <FormItem label="作业附件" prop="attachment">
-                <Upload multiple
+                <!--<Upload multiple
                         type="drag"
                         ref="upload"
                         :before-upload="handleBeforeUpload"
@@ -42,7 +44,8 @@
                         <Icon type="ios-folder-open" size="52"></Icon>
                         <p>选择或者直接拖拽文件上传</p>
                     </div>
-                </Upload>
+                </Upload>-->
+                <UploadFile @successData="getFileUrl" :uploadUrl="uploadUrl" :pathName="userInfo.TEAMModelId.replace('#','')" :quality="1"></UploadFile>
             </FormItem>
 
             <FormItem label="作业记录" prop="isReset" v-show="editable && isEdit">
@@ -67,6 +70,7 @@
 </template>
 <script>
     import E from 'wangeditor'
+    import UploadFile from '@/common/UploadFile.vue'
     export default {
         props: {
             editItem: {
@@ -78,14 +82,19 @@
                 type: Boolean
             }
         },
+        components: { UploadFile },
         data() {
             return {
                 isEdit: false,
-                isBtnLoading:false,
+                isBtnLoading: false,
+                isDateEdit:false,
+                currentState:0,
                 editInfo: null,
                 userInfo:this.$store.state.userInfo,
                 descriptionEditor: null,
-                classRooms:[],
+                classRooms: [],
+                uploadFileList:[],
+                uploadUrl:'',
                 defaultConfig: {
                   uploadImgServer: '/api/file/uploadWangEditor', // 图片上传地址
                   showLinkImg: false, // 是否展示网络图片链接上传
@@ -246,6 +255,7 @@
              * @param item
              */
             doRender(item) {
+                console.log(item)
                 this.hwForm = {
                     name: item.name,
                     target: item.target.map(item => item.classroomCode),
@@ -256,16 +266,37 @@
                     other: item.other,
                     isReset:[]
                 }
+                this.currentState = item.state
                 this.descriptionEditor.txt.html(item.description)
-            }
+            },
+
+
+            getFileUrl(file) { // 获取文件地址
+                console.log(file)
+                this.uploadFileList.push({
+                    schoolCode: this.userInfo.schoolCode,
+                    TEAMModelId: this.userInfo.TEAMModelId,
+                    fileName: file.fileName,
+                    extension: file.extension,
+                    contentType: file.contentType,
+                    type: file.type,
+                    size: file.size,
+                    createTime: file.createTime,
+                    relationNum: 0,
+                    blobUrl: file.blobUrl,
+                    scopeCode: this.demoLoginInfo.TEAMModelId,
+                    sha1Code: file.sha1Code,
+                    compressUrl: file.compressUrl
+                })
+
+                console.log(this.uploadFileList)
+            },
         },
         mounted() {
 
             /** 获取可选教室列表 */
             this.getClassrooms(this.userInfo.TEAMModelId).then(res => this.classRooms = res)
 
-            /** 初始化文件列表 */
-            this.uploadList = this.$refs.upload.fileList;
 
             /** 初始化作业详情的富文本编辑器 */
             let descriptionEditor = new E(this.$refs.descriptionEditor)

+ 121 - 18
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwTable.vue

@@ -34,7 +34,22 @@
                title="查看互评"
                footer-hide
                width="600px">
-            
+
+        </Modal>
+
+        <!-- 下载附件弹窗 -->
+        <Modal v-model="downloadModal"
+               class-name="score-modal component-hw-table"
+               title="作业附件"
+               footer-hide
+               width="600px">
+            <!--<div class="file-list-wrap">
+        <div v-for="(item,index) in currentFileList" :key="index">
+            <a :href="item.blobUrl">{{ item.fileName }}</a>
+        </div>
+    </div>-->
+            <Table border size='small' ref="selection2" :columns="fileColumns" :data="currentFileList" stripe></Table>
+
         </Modal>
 
 
@@ -42,19 +57,43 @@
 </template>
 <script>
     export default {
-        props:['studentsList'],
+        props: ['studentsList'],
         data() {
             return {
                 setScoreModal: false,
-                mutualEvaluationModal:false,
+                downloadModal:false,
+                mutualEvaluationModal: false,
+                userInfo: this.$store.state.userInfo,
+                currentStudent: null,
+                currentHw: null,
                 currentScore: 100,
                 currentComment: '',
+                currentFileList:[],
                 usedCommentList: [
                     '表现很好,继续保持',
                     '仍有很大进步空间',
                     '粗心比较多,一定注意',
                     '下次一定要注意预习'
                 ],
+                fileColumns: [
+                    {
+                        type: 'selection',
+                        width: 60,
+                        align: 'center'
+                    },
+                    {
+                        title: '文件名',
+                        key: 'fileName'
+                    },
+                    {
+                        title: '大小',
+                        width: 100,
+                        key: 'size',
+                        render: (h, params) => {
+                            return h('span',this.$tools.bytesToSize(params.row.size))
+                        }
+                    }
+                ],
                 columns: [
                     {
                         type: 'selection',
@@ -63,12 +102,13 @@
                     },
                     {
                         title: '姓名',
+                        width: 100,
                         key: 'name'
                     },
                     {
                         title: '班级',
                         render: (h, params) => {
-                            return h('span',params.row.classroom.name)
+                            return h('span', params.row.classroom.name)
                         },
                     },
                     {
@@ -77,53 +117,63 @@
                     },
                     {
                         title: '是否提交',
-                        width:100,
                         render: (h, params) => {
-                            return h('span',params.row.submissionBool ? '是' : '否')
+                            return h('span', params.row.submissionBool ? '是' : '否')
                         },
                     },
                     {
                         title: '提交时间',
                         key: 'submitTime',
+                        width: 180,
                         render: (h, params) => {
-                            return h('span',params.row.submissionBool ? params.row.submissionTime : '-')
+                            return h('span', params.row.submissionBool ? this.$tools.formatTime(params.row.submissionTime) : '-')
                         },
                     },
                     {
                         title: '分数',
                         key: 'score',
-                        width:80
+                        width: 80
                     },
                     {
                         title: '操作',
                         key: '',
-                        width:200,
+                        width: 150,
                         render: (h, params) => {
                             let that = this
                             return h('div',
                                 {
                                     domProps: {
-                                        className:'table-tools-icon'
+                                        className: 'table-tools-icon'
                                     }
-                                },[
+                                }, [
                                 h('Icon', {
                                     props: {
                                         type: 'ios-cloud-download-outline',
                                     },
                                     domProps: {
-                                        title:'下载作业'
-                                    }
+                                        title: '下载作业'
+                                    },
+                                    on: {
+                                        click: function () {
+                                            that.downloadModal = true
+                                            that.currentFileList = params.row.content[0].resource
+                                        }
+                                    },
                                 }),
                                 h('Icon', {
                                     props: {
                                         type: 'ios-create-outline'
                                     },
                                     domProps: {
-                                        title:'打分'
+                                        title: '打分'
                                     },
                                     on: {
-                                        click: function() {
+                                        click: function () {
+                                            that.currentStudent = params.row
+                                            that.currentScore = params.row.score
+                                            that.currentComment = params.row.comments[0].comment
                                             that.setScoreModal = true
+
                                         }
                                     },
                                 }),
@@ -132,7 +182,7 @@
                                         type: 'ios-chatbubbles-outline'
                                     },
                                     domProps: {
-                                        title:'查看互评'
+                                        title: '查看互评'
                                     },
                                     on: {
                                         click: function () {
@@ -170,9 +220,62 @@
                 if (!this.currentComment || !this.currentScore) {
                     this.$Message.warning('请填写完整!')
                 } else {
-                    this.$Message.success('点评成功!')
-                    this.setScoreModal = false
+                    let scoreParams = {
+                        id: this.currentStudent.id,
+                        homeWorkId: this.currentStudent.homeWorkId,
+                        score: this.currentScore
+                    }
+
+                    let commentParams = {
+                        id: this.currentStudent.id,
+                        homeWorkId: this.currentStudent.homeWorkId,
+                        fromId: this.userInfo.TEAMModelId,
+                        identity: '0',
+                        comment: this.currentComment
+                    }
+
+                    /* 同时发送评分以及评语请求 */
+                    Promise.all([this.onApiScore(scoreParams), this.onApiComment(commentParams)]).then(res => {
+                        this.$set(this.tableData, 0, res[0])
+                        this.$Message.success('点评成功!')
+                        this.setScoreModal = false
+                    }).catch(err => {
+                        console.log(err)
+                    })
+
                 }
+            },
+
+            /**
+             * 老师评分请求接口
+             * @param params
+             */
+            onApiScore(params) {
+                return new Promise((r, j) => {
+                    this.$api.learnActivity.SetScore(params).then(res => {
+                        if (!res.error && res.result.data) {
+                            r(res.result.data)
+                        } else {
+                            j(500)
+                        }
+                    })
+                })
+            },
+
+            /**
+             * 老师评语请求接口
+             * @param params
+             */
+            onApiComment(params) {
+                return new Promise((r, j) => {
+                    this.$api.learnActivity.SetComment(params).then(res => {
+                        if (!res.error && res.result.data) {
+                            r(res.result.data)
+                        } else {
+                            j(500)
+                        }
+                    })
+                })
             }
         },
         watch: {

+ 0 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/ProgressHistogram.less


+ 73 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/ProgressHistogram.vue

@@ -0,0 +1,73 @@
+<template>
+    <div id="progress-histogram"></div>
+</template>
+<script>
+    export default {
+        data() {
+            return {
+                dataIndex: 1,
+                progressHistogram: undefined,
+                option: {
+                    xAxis: {
+                        type: 'category',
+                        data: ['一次函数初阶', '一次函数进阶', '一次函数高阶', '一次函数总结'],
+                        axisLabel: {
+                            color: 'white'
+                        }
+                    },
+                    yAxis: {
+                        max:240,
+                        name: '人数',
+                        nameTextStyle: {
+                            color:'white'
+                        },
+                        type: 'value',
+                        axisLabel: {
+                            color: 'white'
+                        },
+                        splitLine: {
+                            lineStyle: {
+                                color:['#505050']
+                            }
+                        }
+                    },
+                    series: [{
+                        data: [220, 150, 100, 80],
+                        type: 'bar',
+                        itemStyle: {
+                            color:"#69EFEF"
+                        },
+                        showBackground: true,
+                        backgroundStyle: {
+                            color: 'rgba(0, 20, 220, 0.5)'
+                        },
+                        barMaxWidth: 60,
+                        label: {
+                            show: true,
+                            position:'top'
+                        }
+
+                    }]
+                }
+            }
+        },
+        mounted() {
+            this.progressHistogram = this.$echarts.init(document.getElementById('progress-histogram'))
+            this.progressHistogram.setOption(this.option)
+            this.progressHistogram.on('click', (params) => {
+                console.log("0.0.0.0")
+                console.log(params)
+                this.$emit('clickStep', params)
+            })
+        }
+    }
+</script>
+<style scoped lang="less">
+    @import "./ProgressHistogram.less";
+</style>
+<style>
+    #progress-histogram {
+        width:100%;
+        height:100%;
+    }
+</style>

+ 39 - 0
TEAMModelOS/ClientApp/src/utils/public.js

@@ -162,5 +162,44 @@ export default {
             }
         }
         return arr || null
+    },
+
+    /**
+      *对Date的扩展,将 Date 转化为指定格式的String
+      *月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
+      *年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
+      *例子:
+      *(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
+      *(new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18
+      */
+    formatTime (timestamp, fmt = 'yyyy-MM-dd hh:mm:ss') {
+        let d = new Date()
+        d.setTime(timestamp)
+        var o = {
+            'M+': d.getMonth() + 1, //月份
+            'd+': d.getDate(), //日
+            'h+': d.getHours(), //小时
+            'm+': d.getMinutes(), //分
+            's+': d.getSeconds(), //秒
+            'q+': Math.floor((d.getMonth() + 3) / 3), //季度
+            'S': d.getMilliseconds() //毫秒
+        }
+        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length))
+        for (var k in o)
+            if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
+        return fmt
+    },
+
+    /**
+     * 字节格式转换
+     * @param {any} bytes
+     */
+    bytesToSize(bytes) {
+        if (bytes === 0) return '0 B';
+        let k = 1024,
+            sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
+            i = Math.floor(Math.log(bytes) / Math.log(k));
+        return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i];
     }
+
 }

+ 40 - 9
TEAMModelOS/ClientApp/src/view/selflearning/LearnProgress.less

@@ -13,22 +13,53 @@
         width: 100%;
         height: ~"calc(100% - 45px)";
         padding-right: 10px;
-        .whole-progress-wrap{
-            width:100%;
-            height:300px;
-            display:flex;
-            flex-direction:row;
+
+        .whole-progress-wrap {
+            width: 100%;
+            height: 300px;
+            display: flex;
+            flex-direction: row;
+
+            .progress-histogram-wrap {
+                width: 50%;
+                height: 100%;
+            }
+
+            .progress-detail-wrap {
+                width: 22%;
+                height: 100%;
+                color: white;
+                padding-right: 20px;
+                display:table;
+                padding-top:10px;
+                .student-type-label {
+                    font-size: 16px;
+                    color: #69efef;
+                    border-left: 3px solid #69efef;
+                    line-height: 14px;
+                    padding-left:5px;
+                    display: inline-block;
+                }
+
+                .student-name-wrap {
+                    color: #aaaaaa;
+                    font-size: 14px;
+                    margin-top: 10px;
+                    line-height:30px;
+                }
+            }
         }
     }
 }
 .learn-progress-filter {
-    width: 100%;
+    width: ~"calc(100% - 40px)";
     height: 40px;
     line-height: 40px;
-    background: rgba(50, 50, 50, .9);
-    padding-left: 10px;
+    background: rgba(50, 50, 50, .6);
+    padding-left: 4px;
     border-radius: 5px;
-    margin-bottom: 20px;
+    margin:auto;
+    /*margin-bottom: 20px;*/
 
     .filter-label {
         color: white;

+ 63 - 33
TEAMModelOS/ClientApp/src/view/selflearning/LearnProgress.vue

@@ -1,44 +1,42 @@
 <template>
     <div class="learn-progress-container">
-        
         <div class="learn-progress-main dark-iview-table">
-            <!--<Table v-if="currentView == 0" :columns="columns" :data="data" :show-header="true">
-                <template slot-scope="{ row, index }" slot="progress">
-                    <Progress style="width:200px;" :percent="row.progress" :stroke-width="16" text-inside />
-                </template>
-                <template slot-scope="{ row, index }" slot="action">
-                    <Icon type="ios-people" size="22" style="cursor:pointer;" />
-                </template>
-            </Table>-->
             <vuescroll>
+                <p style="color:#EEEEEE;padding-left:15px;font-size:18px;margin-top:30px;">活动进度概览</p>
                 <div class="whole-progress-wrap">
+                    <div class="progress-histogram-wrap">
+                        <ProgressHistogram @clickStep="clickStep"></ProgressHistogram>
+                    </div>
+                    <div class="progress-detail-wrap" style="margin-right:3%;">
+                        <p class="student-type-label">已完成学生</p>
+                        <p class="student-name-wrap">
+                            <Tag color="#505050" v-for="(item,index) in studentData" style="margin-right:3px;">{{item.name}}</Tag>
+                            <Tag v-for="(item,index) in studentData" style="margin-right:3px;" v-if="index * 5 < (5 - dataIndex) * 5" color="#505050">{{item.name}}</Tag>
+                        </p>
 
+                    </div>
+                    <div class="progress-detail-wrap">
+                        <p class="student-type-label" style="color:red;border-color:red;">未完成学生</p>
+                        <p class="student-name-wrap">
+                            <Tag color="#505050" v-for="(item,index) in studentData" style="margin-right:3px;">{{item.name}}</Tag>
+                            <Tag v-for="(item,index) in studentData" style="margin-right:3px;" v-if="index < dataIndex * 5" color="#505050">{{item.name}}</Tag>
+                        </p>
+                    </div>
                 </div>
+                <p style="color:#EEEEEE;padding-left:15px;font-size:18px;margin-top:50px;margin-bottom:30px;">
+                    学生进度概览
+                </p>
                 <div class="learn-progress-filter dark-iview-select">
                     <span class="filter-label">搜学生:</span>
-                    <Select v-model="model11" filterable style="display:inline-block;width:200px;" size="small">
+                    <Select v-model="model11" filterable style="display: inline-block;width: 200px;" size="small">
                         <Option v-for="item in studentList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                     </Select>
                     <span class="filter-label" style="margin-left:30px;">选班级:</span>
                     <Select v-model="model11" filterable style="display:inline-block;width:200px;" size="small">
                         <Option v-for="item in classroomList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                     </Select>
-                    <div class="right-filter-wrap">
-                        <div class="radio-box-wrap">
-                            <div :class="currentView == 0 ? 'radio-box-item active-radio-box-item':'radio-box-item'" @click="setCurrentView(0)">
-                                <Tooltip content="活动进度总览" placement="bottom" theme="light">
-                                    <Icon type="md-list" size="15" />
-                                </Tooltip>
-                            </div>
-                            <div :class="currentView == 1 ? 'radio-box-item active-radio-box-item':'radio-box-item'" @click="setCurrentView(1)">
-                                <Tooltip content="学习自学概况" placement="bottom" theme="light">
-                                    <Icon type="md-person" size="15" />
-                                </Tooltip>
-                            </div>
-                        </div>
-                    </div>
                 </div>
-                <Table :columns="studentColumns" :data="studentData" :show-header="true">
+                <Table :columns="studentColumns" :data="studentData" :show-header="true" style="margin:0px 25px;">
                     <template slot-scope="{ row, index }" slot="isComplete">
                         <Icon size="20" type="md-checkmark" color="aqua" v-if="row.isComplete == 1" />
                         <span v-else>--</span>
@@ -52,10 +50,15 @@
     </div>
 </template>
 <script>
+    import ProgressHistogram from '@/components/learnactivity/ProgressHistogram.vue'
     export default {
+        components: {
+            ProgressHistogram
+        },
         data() {
             return {
-                model11:'',
+                dataIndex: 1,
+                model11: '',
                 currentView: 0,
                 studentList: [],
                 classroomList: [],
@@ -68,12 +71,12 @@
                     {
                         title: '完成进度',
                         slot: 'progress',
-                        align:'center'
+                        align: 'center'
                     },
                     {
                         title: '操作',
                         slot: 'action',
-                        width:150
+                        width: 150
                     }
                 ],
                 data: [
@@ -144,6 +147,30 @@
                     {
                         name: '老夫子',
                         isComplete: 1,
+                    },
+                    {
+                        name: '张飞',
+                        isComplete: 1
+                    },
+                    {
+                        name: '孔子',
+                        isComplete: 0,
+                    },
+                    {
+                        name: '柏拉图',
+                        isComplete: 1,
+                    },
+                    {
+                        name: '苏格拉底',
+                        isComplete: 1,
+                    },
+                    {
+                        name: '杜威',
+                        isComplete: 0,
+                    },
+                    {
+                        name: '老夫子11',
+                        isComplete: 1,
                     }
                 ],
                 studentColumns: [
@@ -155,32 +182,35 @@
                     {
                         title: '一次函数初阶',
                         slot: 'isComplete',
-                        align:'center'
+                        align: 'center'
                     },
                     {
                         title: '一次函数进阶',
                         slot: 'isComplete',
-                        align:'center'
+                        align: 'center'
                     },
                     {
                         title: '一次函数高阶',
                         slot: 'isComplete',
-                        align:'center'
+                        align: 'center'
                     },
                     {
                         title: '一次函数总结',
                         slot: 'isComplete',
-                        align:'center'
+                        align: 'center'
                     },
                     {
                         title: '操作',
                         slot: 'action',
-                        width:150
+                        width: 150
                     }
                 ],
             }
         },
         methods: {
+            clickStep(data) {
+                this.dataIndex = data.dataIndex
+            },
             setCurrentView(index) {
                 this.currentView = index
             }

+ 4 - 2
TEAMModelOS/ClientApp/src/view/selflearning/ManageHomeWork.vue

@@ -20,7 +20,9 @@
                             <p class="hw-item-name">{{ item.name }}</p>
                             <div class="hw-item-info">
                                 <span class="hw-item-nums">提交人数: 10 / 20</span>
-                                <span class="hw-item-status">进行中</span>
+                                <span class="hw-item-status"
+                                      :style="{ background: (item.state === 100 ? '#0BADD4' : item.state === 200 ? '#0fb68b' : '#949594')}"
+                                      >{{ item.state === 100 ? '待发布' : item.state === 200 ? '进行中' : '已结束' }}</span>
                             </div>
                         </div>
                     </div>
@@ -34,7 +36,7 @@
             <div class="hw-box-header">
                 <span>作业详情</span>
                 <div class="hw-box-header-tools">
-                    <span class="hw-box-header-tools-tool"><Icon type="md-create" size="18" title="编辑" @click="onEditHw"/></span>
+                    <span class="hw-box-header-tools-tool" v-show="currentHw.state !== 300"><Icon type="md-create" size="18" title="编辑" @click="onEditHw"/></span>
                 </div>
             </div>
             <vuescroll>