Prechádzať zdrojové kódy

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

XW 3 rokov pred
rodič
commit
7935c5b8ae

+ 11 - 1
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -583,6 +583,16 @@
 								menuName: 'personalSurvey',
 								isShow: true
 							},
+							{
+							    icon: 'iconfont icon-hw',
+							    name: this.$t('system.menu.homework'),
+							    router: '/home/manageHomeWork',
+							    tag: this.$t('system.menu.preview'),
+							    role: 'teacher|admin',
+							    permission: '',
+							    menuName: 'manageHomeWork',
+								isShow:true
+							},
 							// 自主学习和作业活动暂时隐藏
 							// {
 							//     icon: 'iconfont icon-learning-self',
@@ -905,7 +915,7 @@
 <style lang="less">
 	// html,
 	// body {
-	// 	font-family: '微软雅黑','Microsoft JhengHei', 'ALI';
+	// 	font-family: 'ALI';
 	// }
 
 	.biz-menu .ivu-menu-vertical .ivu-menu-item-group-title {

+ 0 - 220
TEAMModelOS/ClientApp/src/components/homework/BaseHwForm.less

@@ -1,220 +0,0 @@
-@main-bgColor: rgb(40,40,40); //主背景颜色
-@borderColor: #424242;
-@primary-color:#1CC0F3;
-@primary-textColor: #fff; //文本主颜色
-@second-textColor: #CBCBCB; //文本副级颜色
-@primary-fontSize: 14px;
-@second-fontSize: 16px;
-
-.component-hw-form {
-    padding: 20px 20px 50px 20px;
-
-    .ivu-form .ivu-form-item-label {
-        color: @second-textColor;
-    }
-
-    .ivu-form-item:not(:first-child) {
-        margin-top: 30px;
-    }
-
-    .ivu-form .btn-save {
-        width: 48%;
-        background: @primary-color;
-        border: none;
-        height: 38px;
-    }
-
-    .ivu-form .btn-reset {
-        width: 48%;
-        border: none;
-        height: 38px;
-    }
-	
-	.ivu-form textarea{
-		height: 150px;
-	}
-
-    .ivu-input::-webkit-input-placeholder {
-        color: #939393;
-    }
-
-    .ivu-input, .ivu-select-single .ivu-select-selection,
-    .ivu-select-multiple .ivu-select-selection {
-        background: #353535;
-        border: none;
-        margin-top: 10px;
-        height: 40px;
-        line-height: 40px;
-        color: @primary-textColor;
-    }
-
-    .ivu-select-multiple .ivu-select-selection {
-        height: auto;
-    }
-
-    .ivu-tag {
-        border: none;
-        background: @primary-color;
-        height: 28px;
-        line-height: 28px;
-
-        i {
-            top: 8px;
-            color: #fff;
-        }
-
-        .ivu-tag-text {
-            color: #fff;
-        }
-    }
-
-    .ivu-select {
-        color: @second-textColor;
-    }
-
-    .ivu-input-prefix i, .ivu-input-suffix i {
-        line-height: 60px;
-    }
-
-    .ivu-select-single .ivu-select-selection .ivu-select-placeholder,
-    .ivu-select-multiple .ivu-select-selection .ivu-select-placeholder,
-    .ivu-select-single .ivu-select-selection .ivu-select-selected-value {
-        height: 40px;
-        line-height: 40px;
-    }
-
-    .ivu-date-picker {
-        width: 100%;
-        margin-top: -20px;
-    }
-
-    .ivu-radio-wrapper, .ivu-checkbox-wrapper {
-        color: @second-textColor;
-    }
-
-    .ivu-radio-wrapper:not(:first-child),
-    .ivu-checkbox-wrapper:not(:first-child) {
-        margin-left: 15px;
-    }
-
-    .ivu-radio-inner:after {
-        background: @primary-color;
-    }
-
-    .ivu-upload-drag {
-        background: #353535;
-        margin-top: 10px;
-        border: 1px dashed #6c6e71;
-        color: @second-textColor;
-
-        .ivu-icon {
-            color: @primary-color;
-            font-weight: bold;
-        }
-    }
-
-    .ivu-checkbox-group {
-        margin-left: 5px;
-    }
-
-    .ivu-checkbox-checked .ivu-checkbox-inner {
-        border-color: @primary-color;
-        background: @primary-color;
-    }
-
-    .ivu-upload-list-file,
-    .ivu-upload-list-file > span i {
-        color: @second-textColor;
-        margin-right: 5px;
-    }
-
-    .ivu-upload-list-file:hover {
-        background: #3b3b3b;
-
-        span {
-            color: @second-textColor;
-        }
-    }
-
-    .ivu-upload-list-remove {
-        margin-top: 5px;
-        font-size: 22px;
-    }
-
-    .btn-choose-content {
-        position: absolute;
-        right: 10px;
-        top: -43px;
-        text-decoration: underline;
-        color: aquamarine;
-        cursor:pointer;
-    }
-
-    .ivu-select-single .ivu-select-selection .ivu-select-placeholder {
-        color: #939393;
-    }
-
-    .w-e-toolbar {
-        background: @main-bgColor !important;
-        border-color: @borderColor !important;
-        margin-top: 10px;
-        z-index: 1 !important;
-
-        .w-e-menu {
-            z-index: 1 !important;
-        }
-    }
-
-    .w-e-text-container {
-        background: #3b3b3b;
-        border-color: @borderColor !important;
-        z-index: 1 !important;
-    }
-
-    .w-e-text {
-        color: #fff;
-        /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
-        &::-webkit-scrollbar {
-            width: 4px;
-            height: 16px;
-            background-color: #0E0D0D;
-        }
-        /*定义滚动条轨道 内阴影+圆角*/
-        &::-webkit-scrollbar-track {
-            -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-            border-radius: 10px;
-            background-color: #484848;
-        }
-        /*定义滑块 内阴影+圆角*/
-        &::-webkit-scrollbar-thumb {
-            border-radius: 0;
-            -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
-            background-color: #989191;
-        }
-    }
-
-    .w-e-toolbar .w-e-menu:hover i {
-        color: #fff;
-    }
-
-    .hw-form-disabled {
-
-        .ivu-input, .ivu-select-single .ivu-select-selection,
-        .ivu-select-selection,
-        .ivu-date-picker-focused input {
-            background: transparent;
-            border: none;
-            font-size: @second-fontSize;
-            font-weight: bold;
-            box-shadow: none;
-        }
-
-        .ivu-icon {
-            display: none !important;
-        }
-
-        .ivu-select-multiple .ivu-tag span:not(.ivu-select-max-tag) {
-            margin-right: 10px;
-        }
-    }
-}

+ 552 - 386
TEAMModelOS/ClientApp/src/components/homework/BaseHwForm.vue

@@ -1,400 +1,566 @@
 <template>
-    <div class="component-hw-form">
-        <Form ref="hwForm" :model="hwForm" label-position="top" :rules="ruleValidate" :disabled="!hwFormEdit">
-            <FormItem label="作业名称" prop="name">
-                <Input :class="!hwFormEdit ? 'hw-form-disabled':''" v-model="hwForm.name" placeholder="请输入作业名称"></Input>
-            </FormItem>
-            <FormItem label="" prop="other">
-                <CheckboxGroup v-model="hwForm.other">
-                    <Checkbox label="view">开放观摩</Checkbox>
-                    <Checkbox label="comment">开放互评</Checkbox>
-                </CheckboxGroup>
-            </FormItem>
-            <FormItem label="作业对象" prop="target">
-                <Select multiple v-model="hwForm.target" :class="!hwFormEdit ? 'hw-form-disabled':''" placeholder="请选择作业发布对象">
-                    <OptionGroup label="个人班级">
-                    	<Option v-for="item in classRooms.filter(i=>i.scope === 'private')" :value="item.id" :key="item.id">{{ item.name }}</Option>
-                    </OptionGroup>
-                    <OptionGroup label="校本班级">
-                    	<Option v-for="item in classRooms.filter(i=>i.scope === 'school')" :value="item.id" :key="item.id">{{ item.name }}</Option>
-                    </OptionGroup>
-                </Select>
-            </FormItem>
-            <FormItem label="发布时间" prop="publishModel">
-                <RadioGroup v-model="hwForm.publishModel" v-show="hwFormEdit">
-                    <Radio label="0" :disabled="currentState !== 100 && !isAdd">立即发布</Radio>
-                    <Radio label="1" :disabled="currentState !== 100 && !isAdd">定时发布</Radio>
-                </RadioGroup>
-
-                <DatePicker type="datetime"
-                            :class="!hwFormEdit ? 'hw-form-disabled':''"
-                            :editable="isDateEdit"
-                            :disabled="(currentState !== 100 && !isAdd) || hwForm.publishModel === '0'"
-                            placeholder="请选择发布时间"
-                            v-model="hwForm.startTime"
-                            style="margin-top:10px"></DatePicker>
-
-            </FormItem>
-
-            <FormItem label="结束时间" prop="endTime">
-                <DatePicker :class="!hwFormEdit ? 'hw-form-disabled':''" type="datetime" :editable="isDateEdit && hwForm.startTime" placeholder="请选择作业结束时间" v-model="hwForm.endTime" :options="endTimeOptions"></DatePicker>
-            </FormItem>
-			
-			<!-- <FormItem label="起止时间" prop="endTime">
-				<DatePicker type="datetimerange" @on-change="onDateRangeChange" placeholder="Select date and time" style="width: 300px"></DatePicker>
-			</FormItem> -->
-
-            <FormItem label="作业描述" prop="description">
-                <!-- <div ref="descriptionEditor" style="text-align:left" v-show="hwFormEdit"></div> -->
-				<Input v-model="hwForm.description" type="textarea" placeholder="" :class="!hwFormEdit ? 'hw-form-disabled':''" v-show="hwFormEdit"/>
-                <div v-html="hwForm.description" v-show="!hwFormEdit" style="margin:10px;font-size:16px;font-weight:bold;color:#fff"></div>
-                <!--<Input v-model="hwForm.description" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入作业内容描述">--></Input>
-            </FormItem>
-
-            <FormItem label="作业附件" prop="attachment" v-show="hwFormEdit" style="position:relative">
-                <span class="btn-choose-content" @click="onRelateContent">关联内容</span>
-                <UploadFile ref="uploadRef"
-                            @successData="getFileUrl"
-                            :uploadUrl="uploadUrl"
-                            :defaultFileList="defaultFileList"
-                            :pathName="userInfo.TEAMModelId.replace('#','')"
-                            :quality="1"></UploadFile>
-            </FormItem>
-
-            <FormItem label="作业附件" v-show="!hwFormEdit">
-                <div v-for="item in defaultFileList" :key="item.id" style="margin:10px 0">
-                    <span><Icon type="md-checkmark" color="#1BC6B0" size="20" /></span>
-                    <span style="margin-left:10px">{{ item.fileName }}</span>
-                </div>
-                <span v-show="!defaultFileList.length" style="margin-left:10px">暂无数据</span>
-            </FormItem>
-
-            <FormItem label="作业记录" prop="isReset" v-show="editable && isEdit">
-                <CheckboxGroup v-model="hwForm.isReset">
-                    <Checkbox label="reset">清空作业提交记录</Checkbox>
-                </CheckboxGroup>
-            </FormItem>
-
-            <FormItem v-show="hwFormEdit">
-                <Button type="primary" class="btn-save" @click="handleSubmit('hwForm')" :loading="isBtnLoading">保存</Button>
-                <Button @click="handleCancel('hwForm')" class="btn-reset" style="margin-left: 8px">取消</Button>
-            </FormItem>
-        </Form>
-
-        <!-- 关联内容弹窗 -->
-        <Modal v-model="isRelatedContent" width="880" footer-hide class="relate-modal related-modal">
-            <div class="modal-header" slot="header">内容关联</div>
-            <ChooseContent :showSyllabus="isFalse"
-                           :showOther="isFalse"
-                           :showQuestion="isFalse"
-                           @on-file-change="onSelectFile"></ChooseContent>
-
-            <Button class="modal-btn" :loading="isLoading" @click="onConfirmRelate">确认</Button>
-        </Modal>
-    </div>
+	<div class="component-vote-form light-iview-form light-el-input">
+		<Form ref="voteForm" :model="voteForm" label-position="top" :rules="ruleValidate" :disabled="!voteFormEdit"
+			hide-required-mark>
+			<FormItem :label="$t('homework.form.name')" prop="name">
+				<Input :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.name"
+					:placeholder="$t('homework.form.namePlace')"></Input>
+			</FormItem>
+			<FormItem :label="$t('homework.form.target')" prop="classes">
+				<!-- 预览状态 -->
+				<div v-if="!voteFormEdit && curVoteItem" class="vote-class">
+					<span v-for="item in classNameArr" class="vote-class-item">{{ item.name }}</span>
+				</div>
+				<!-- 编辑状态 -->
+				<div v-else>
+					<BaseClassSelectPri :classes="classTargets" :scope="classType" @onChange="onTargetChange"
+						ref="classSelectRef" v-if="getCurScope === 'private' && curVoteItem"></BaseClassSelectPri>
+				</div>
+			</FormItem>
+			<FormItem :label="$t('learnActivity.createEv.startTime')" v-if="!isImmediate || !voteFormEdit"
+				prop="startTime">
+				<DatePicker v-show="voteFormEdit" type="datetime" :options="startOption" format="yyyy/MM/dd HH:mm"
+					v-model="voteForm.startTime" split-panels :placeholder="$t('learnActivity.createEv.sTimeHolder')"
+					style="width:100%" @on-change="onChangeSTime"></DatePicker>
+				<div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
+					{{ $tools.formatTime(voteForm.startTime,'yyyy-MM-dd hh:mm') }}
+				</div>
+			</FormItem>
+			<FormItem :label="$t('learnActivity.createEv.endTime')" prop="endTime">
+				<DatePicker v-show="voteFormEdit" type="datetime" :options="endOption" format="yyyy/MM/dd HH:mm"
+					v-model="voteForm.endTime" split-panels @on-change="onChangeEndTime"
+					:placeholder="$t('learnActivity.createEv.eTimeHolder')" style="width:100%"></DatePicker>
+				<div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
+					{{ $tools.formatTime(voteForm.endTime,'yyyy-MM-dd hh:mm') }}
+				</div>
+			</FormItem>
+
+			<FormItem :label="$t('homework.form.description')" prop="description">
+				<div ref="descriptionEditor" style="text-align:left" v-show="voteFormEdit"></div>
+				<div v-html="voteForm.description" v-show="!voteFormEdit"
+					style="margin:10px;font-size:16px;font-weight:bold;"></div>
+			</FormItem>
+
+
+			<FormItem :label="$t('homework.form.attachments')">
+				<BaseUpload simpleUpload v-show="voteFormEdit"></BaseUpload>
+				<div class="attachments-list">
+					<div class="attachments-item" v-for="(item,index) in attachmentsArr" :key="index">
+						<span class="name">{{ item.name }}</span>
+						<span class="name">{{ getSizeByBytes(item.size) }}</span>
+					</div>
+				</div>
+			</FormItem>
+
+			<FormItem :label="$t('homework.form.other')">
+				<!-- <CheckboxGroup v-model="voteForm.allowSupply">
+					<Checkbox label="allowSupply">{{ $t('homework.form.allowFix') }}</Checkbox>
+				</CheckboxGroup>
+				<CheckboxGroup v-model="voteForm.typeLimit">
+					<Checkbox label="typeLimit">{{ $t('homework.form.allowFileType') }}</Checkbox>
+				</CheckboxGroup> -->
+			</FormItem>
+
+			<FormItem v-show="voteFormEdit">
+				<Button type="primary" class="btn-save" @click="handleSubmit('voteForm')"
+					:loading="isBtnLoading">{{ $t('homework.form.save') }}</Button>
+				<Button @click="handleCancel('voteForm')" class="btn-reset"
+					style="margin-left: 8px">{{ $t('homework.form.cancel') }}</Button>
+			</FormItem>
+		</Form>
+	</div>
 </template>
 <script>
-    import E from '@/utils/wangEditor.js'
-    import UploadFile from '@/common/UploadFile.vue'
-    import ChooseContent from '@/components/selflearn/NewChooseContent'
-    export default {
-        props: {
-            editItem: {
-                default: null,
-                type: Object
-            },
-            editable: {
-                default: false,
-                type: Boolean
-            }
-        },
-        components: { UploadFile, ChooseContent },
-        data() {
-            return {
-                isFalse:false,
-                isLoading:false,
-                isRelatedContent:false,
-                isAdd:true,
-                isEdit: false,
-                isBtnLoading: false,
-                isDateEdit: false,
-                hwFormEdit:false,
-                currentState:0,
-                editInfo: null,
-                userInfo:this.$store.state.userInfo,
-                descriptionEditor: null,
-                classRooms: [],
-                uploadFileList: [],
-                defaultFileList: [],
-                relateFileList:[],
-                uploadUrl:'',
-                defaultConfig: {
-                  showLinkImg: false, // 是否展示网络图片链接上传
-                  uploadFileName: 'files', // 上传图片后台获取的文件名
-                  menus:this.$tools.wangEditorMenuSimple
-
-                },
-                hwForm: {
-                    name: '',
-                    target: [],
-                    endTime: '',
-                    publishModel:'0',
-                    startTime:'',
-                    description: '',
-                    isReset:[],
-                    other: []
-                },
-                defaultParams: {
-                    code: "",
-                    name: "",
-                    target: [],
-                    publishModel: "0",
-                    startTime: 0,
-                    endTime: 0,
-                    resource: []
-                },
-                uploadList:[],
-				endTimeOptions: {
-					disabledDate : date => {
-						return date && date.valueOf() < this.getDisableDays;
+	import E from 'wangeditor'
+	export default {
+		props: {
+			editItem: {
+				type: Object,
+				default: null
+			},
+			editable: {
+				type: Boolean,
+				default: false
+			}
+		},
+		data(vm) {
+			const _this = this
+			return {
+				props: {
+					multiple: true,
+					value: 'id',
+					label: 'name',
+				},
+				attachmentsArr:[],
+				schoolTarget: [],
+				classTargets: [],
+				classNameArr: [],
+				classType: 'private',
+				curVoteItem: null,
+				isAdd: true,
+				isEdit: false,
+				isBtnLoading: false,
+				isDateEdit: false,
+				voteFormEdit: true,
+				currentState: 0,
+				editInfo: null,
+				userInfo: this.$store.state.userInfo,
+				descriptionEditor: null,
+				classRooms: [],
+				uploadFileList: [],
+				uploadUrl: '',
+				defaultConfig: {
+					uploadImgShowBase64: true,
+					menus: this.$tools.wangEditorMenuSimple,
+				},
+				voteOptions: [...new Array(2).keys()], // 默认四个选项,
+				voteOptionsContent: [],
+				isImmediate: true,
+				voteForm: {
+					name: '',
+					classes: [],
+					startTime: '',
+					endTime: '',
+					description: '',
+					allowSupply:false,
+					typeLimit:false,
+				},
+				defaultParams: {
+					code: "",
+					name: "",
+					classes: [],
+					publishModel: "0",
+					status: 0,
+					startTime: 0,
+					endTime: 0,
+				},
+				uploadList: [],
+				options3: {
+					disabledDate: (date) => {
+						//这里写上自己的逻辑,返回true,表示当前日期需要设置为不可选
+						return date && date.valueOf() < Date.now() - 86400000;
 					}
 				},
-                ruleValidate: {
-                    name: [
-                        { required: true, message: '作业名称不能为空', trigger: 'blur' }
-                    ],
-                    publishModel: [
-                        { required: true, trigger: 'change' }
-                    ],
-                    description: [
-                        { required: true, message: '作业描述不能为空', trigger: 'blur' }
-                    ],
-                    target: [
-                        { required: true, message: '作业对象不能为空' }
-                    ],
-                    endTime: [
-                        { required: true, type: 'date', message: '请设置结束时间', trigger: 'change' }
-                    ]
-                    
-                }
-            }
-        },
-        methods: {
-            /**
-             * 提交新增作业表单
-             * @param name FormName
-             */
-            handleSubmit(name) {
-                this.$refs[name].validate((valid) => {
-                    if (valid && this.getSimpleText(this.hwForm.description)) {
-                        let params = Object.assign({}, this.defaultParams)
-                        let target = []
-                        let isReset = this.hwForm.isReset.length > 0
-                        params.code = this.userInfo.TEAMModelId
-                        params.name = this.hwForm.name
-                        params.publishModel = this.hwForm.publishModel
-                        params.startTime = this.hwForm.publishModel === '1' ? Math.round(this.hwForm.startTime.getTime()) : new Date().getTime()
-                        params.endTime = Math.round(this.hwForm.endTime.getTime())
-                        params.description = this.hwForm.description
-                        params.other = this.hwForm.other
-                        params.resource = this.defaultFileList
-                        if (this.isEdit && this.editInfo.id) {
-                            params.id = this.editInfo.id
-                            params.createTime = this.editInfo.createTime
-                        }
-
-                        /** 替换作业对象格式 */
-                        this.hwForm.target.forEach(item => {
-                            target.push({
-                                classroomCode: item,
-                                classroomName: this.classRooms.filter(i => i.classroomCode === item)[0].classroomName,
-                                code: this.classRooms.filter(i => i.classroomCode === item)[0].scopeCode
-                            })
-                        })
-
-                        params.target = target
-                        this.isBtnLoading = true
-                        this.saveorUpdataHw({ homeWork: params, reset: isReset }).then(res => {
-                            this.$Message.success((this.isEdit && this.editInfo.id) ? '修改成功!' : '添加成功!')
-                            this.hwFormEdit = false
-                            this.$emit('onAddSuccess')
-                            this.isBtnLoading = false
-                        }).catch(error => {
-                            console.log(error)
-                            this.isBtnLoading = false
-                        })
-                    } else {
-                        this.$Message.error('请将信息填写完整')
-                    }
-                })
-            },
-
-            onRelateContent() {
-                this.isRelatedContent = true
-            },
-
-            onConfirmRelate() {
-                this.isRelatedContent = false
-                console.log(this.relateFileList)
-                console.log(this.defaultFileList)
-                this.defaultFileList = this.defaultFileList.concat(this.relateFileList)
-            },
-
-
-            onSelectFile(val) {
-                this.relateFileList = val.files
-                
-            },
-
-            /**
-             * 获取当前教师的所有班级数据
-             * @param teacherId 老师的醍摩豆ID
-             */
-            getClassrooms(teacherId) {
-                return new Promise((r, j) => {
-                    this.$api.learnActivity.FindClassroomByTeacherId({ code:teacherId }).then(res => {
-                        if (!res.error && res.result.data) {
-                            r(res.result.data)
-                        } else {
-                            j(500)
-                            this.$Message.error('获取数据失败')
-                        }
-                    })
-                })
-                
-            },
-
-            // 提取富文本内容中的文本
-            getSimpleText(html) {
-            	var r = /<(?!img|video|audio).*?>/g;
-            	return html.replace(r, "");
-            },
-
-            /**
-             * 重置表单
-             * @param name
-             */
-            handleCancel() {
-                this.hwFormEdit = false
-                this.doRender(this.editInfo)
-
-            },
-
-            /**
-             * 重置表单
-             * @param name
-             */
-            handleReset(name) {
-                this.$refs[name].resetFields();
-                this.descriptionEditor.txt.clear()
-
-            },
-
-            /** 附件上传之前钩子 限制附件上传个数 */
-            handleBeforeUpload () {
-                const check = this.uploadList.length < 5;
-                if (!check) {
-                    this.$Notice.warning({
-                        title: '最多只能上传5个附件'
-                    });
-                }
-                return check;
-            },
-
-            /**
-             * 新增作业或者编辑作业
-             * @param data
-             */
-            saveorUpdataHw(data) {
-                return new Promise((r, j) => {
-                    this.$api.learnActivity.SaveorUpdataHomeWork(data).then(res => {
-                        if (!res.error) {
-                            r(res.result.data)
-                        } else {
-                            j(res.error)
-                        }
-                    })
-                })
-                
-            },
-
-            /**
-             * 回显作业详情
-             * @param item
-             */
-            doRender(item) {
-                console.log(item)
-                
-                this.hwForm = {
-                    name: item.name,
-                    target: item.target.map(item => item.classroomCode),
-                    publishModel: item.publishModel,
-                    startTime: item.publishModel === '0' ? new Date(new Date().getTime()) : new Date(item.startTime),
-                    endTime: item.endTime ? new Date(item.endTime) : '',
-                    description: item.description,
-                    other: item.other,
-                    isReset:[]
-                }
-                this.currentState = item.state
-                this.defaultFileList = item.resource
-                this.defaultFileList = JSON.parse(JSON.stringify(item.resource))
-                // this.descriptionEditor.txt.html(item.description)
-                //this.uploadFileList = item.resource.length ? item.resource : []
-            },
-
-
-            getFileUrl(file) { // 获取文件地址
-                //if (this.isEdit && this.uploadFileList.length) return
-                //this.uploadFileList.push({
-                //    fileName: file.fileName,
-                //    type: file.type,
-                //    size: file.size,
-                //    blobUrl: file.blobUrl,
-                //    sha1Code: file.sha1Code,
-                //    compressUrl: file.compressUrl
-                //})
-                //console.log(this.uploadFileList)
-            },
-        },
-        mounted() {
-
-            /** 获取可选班级列表 */
-            this.getClassrooms(this.userInfo.TEAMModelId).then(res => this.classRooms = res)
+				ruleValidate: {
+					name: [{
+						required: true,
+						message: vm.$t('homework.form.ruleName'),
+						trigger: 'blur'
+					}],
+					// description: [{
+					// 	// required: true,
+					// 	message: vm.$t('homework.form.ruleDescription'),
+					// 	trigger: 'blur'
+					// }],
+					startTime: [{
+						required: true,
+						type: 'date',
+						message: this.$t('learnActivity.createEv.errTips8'),
+						trigger: 'change'
+					}],
+					endTime: [{
+						required: true,
+						type: 'date',
+						message: this.$t('learnActivity.createEv.errTips9'),
+						trigger: 'change'
+					}]
+				},
+				startOption: {
+					disabledDate(date) {
+						return date && date.valueOf() < Date.now() - 86400000
+					}
+				},
+				endOption: {
+					disabledDate(date) {
+						let data = _this.voteForm.startTime ? _this.voteForm.startTime : Date.now()
+						return data && data > date.valueOf() + 86400000
+					}
+				},
+				classIds: [],
+				groupList: [],
+				targetType: '',
+				schList: [],
+				csOptions: [],
+				areaId: sessionStorage.getItem('areaId'),
+			}
+		},
+		created() {
+			/** 获取可选班级列表 */
+			this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
+				console.log(res)
+				this.classRooms = res
+			})
+		},
+		methods: {
+			treeChange(data) {
+				console.log('选择数据', this.schoolTarget)
+			},
+			getAreaTargets() {
+				this.$api.ability.findAreaGroup({
+					id: this.areaId
+				}).then(
+					res => {
+						if (res.gr && res.gr.length) {
+							this.schList = res.gr
+							this.csOptions = []
+							res.gr.forEach(sItem => {
+								let i = {
+									id: sItem.id,
+									name: sItem.sname,
+									children: []
+								}
+								sItem.name.forEach((gItem, gIndex) => {
+									i.children.push({
+										id: sItem.sname + '-' + gItem,
+										name: sItem.sname + '-' + gItem,
+									})
+								})
+								if (!i.children.length) {
+									i.children.push({
+										id: sItem.sname + '-' + '所有老师(未分组)',
+										name: sItem.sname + '-' + '所有老师(未分组)'
+									})
+								}
+								this.csOptions.push(i)
+							})
+						}
+						console.log(this.schList)
+
+					},
+					err => {
+						console.log(err)
+					}
+				)
+			},
+			onClassTypeChange(val) {
+				this.voteForm.classes = []
+			},
+
+			onTargetChange(data) {
+				this.voteForm.classes = this.getCurScope === 'school' ? data : data.map(i => i.split('/')[1])
+				this.voteForm.targets = this.getCurScope === 'school' ? [] : data
+			},
+
+			onChangeSTime(val) {
+				let endTime = this.voteForm.endTime || Date.now()
+				if (new Date(val).getTime() >= new Date(endTime).getTime()) {
+					this.voteForm.endTime = null
+				}
+			},
+
+			onChangeEndTime(val) {
+				if (val.indexOf('00:00') > 0) {
+					val = val.replace('00:00', '23:59')
+					this.voteForm.endTime = val
+				}
+			},
+			/**
+			 * 提交新增投票表单
+			 * @param name FormName
+			 */
+			async handleSubmit(name) {
+				this.isBtnLoading = true
+				let hasTargets = this.voteForm.classes.length
+				this.$refs[name].validate(async (valid) => {
+					if (valid && this.getSimpleText(this.voteForm.description) && hasTargets) {
+						console.log(this.voteForm)
+						let classSelectScope = this.$refs.classSelectRef
+							.evaluationInfo.scope
+						let isSchoolClass = this.$refs.classSelectRef.evaluationInfo.scope === 'school' &&
+							this.$refs.classSelectRef.privateClassType === 'school'
+						let params = Object.assign({}, this.defaultParams)
+						let areaParams = null
+						let target = []
+						let fileName = this.$tools.guid()
+						let isReset = this.voteForm.isReset.length > 0
+						let isPersonal = this.$route.name === 'personalVote' && classSelectScope ===
+							'private'
+						let isSchool = this.$route.name === 'manageVote'
+
+						params.code = this.getCurCode
+						params.scope = isPersonal ? 'private' : 'school'
+						params.name = this.voteForm.name
+						params.startTime = !this.isImmediate ? new Date(this.voteForm.startTime)
+						.getTime() : -1
+						params.endTime = new Date(this.voteForm.endTime).getTime()
+						params.description = this.voteForm.description
+						params.targets = this.voteForm.targets
+						params.selectMax = this.voteForm.selectMax || 1
+						params.secret = this.voteForm.secret.indexOf('secret') > -1
+						params.repeat = this.voteForm.repeat.indexOf('repeat') > -1
+						params.options = this.voteOptionsContent
+						// 新增参数
+						params.owner = isSchool ? 'school' : 'teacher'
+						params.creatorId = this.$store.state.userInfo.TEAMModelId
+						params.voteNum = this.voteForm.selectMax
+						params.times = this.voteForm.times
+						params.school = params.scope === 'school' ? this.$store.state.userInfo.schoolCode :
+							null
+						params.tchLists = []
+						params.classes = []
+						params.stuLists = []
+						if (this.isEdit && this.editInfo.id && this.editInfo.code) {
+							params.id = this.editInfo.id
+						}
+
+						if (isSchoolClass) {
+							params.classes = this.voteForm.classes
+							params.targetType = 'student'
+						} else {
+							params.stuLists = this.voteForm.classes
+							params.targetType = 'student'
+						}
+						/* 保存BLOB以及COSMOS */
+						this.saveorUpdateVote(params).then(res => {
+							this.$Message.success((this.isEdit && this.editInfo.id) ? this.$t(
+								'vote.form.editSuc') : this.$t(
+								'vote.form.addSuc'))
+							this.$emit('onAddSuccess')
+							this.isBtnLoading = false
+						}).catch(error => {
+							this.isBtnLoading = false
+							console.log(error)
+						})
+					} else {
+						this.isBtnLoading = false
+						if (!optionComplete) {
+							this.$Message.error(this.$t('homework.form.noOptionTip'))
+						} else if (!hasTargets) {
+							this.$Message.error(this.$t('homework.form.ruleClasses'))
+						} else if (!this.getSimpleText(this.voteForm.description)) {
+							this.$Message.error('投票详情不能为空!')
+						} else {
+							this.$Message.error(this.$t('homework.form.noCompleteTip'))
+						}
+					}
+				})
+			},
+
+			/**
+			 * 获取当前教师的所有班级数据
+			 * @param teacherId 老师的醍摩豆ID
+			 */
+			getClassrooms(teacherId) {
+				return new Promise((r, j) => {
+					this.$api.learnActivity.FindClassroomByTeacherId({
+						id: teacherId,
+						code: this.$store.state.userInfo.schoolCode
+					}).then(res => {
+						if (!res.error && res.courses) {
+							this.$store.dispatch('user/getSchoolProfile').then(schoolProfile => {
+								//    let schoolClasses =  schoolProfile.school_classes
+								// console.log(schoolClasses)
+								r(res.courses)
+							}).catch(err => {
+								r([])
+							})
+
+						} else {
+							j(500)
+							this.$Message.error(this.$t('homework.form.getDataFailTip'))
+						}
+					})
+				})
+			},
+
+			// 提取富文本内容中的文本
+			getSimpleText(html) {
+				var r = /<(?!img|video|audio).*?>/g;
+				return html.replace(r, "");
+			},
+
+			/**
+			 * 重置表单
+			 * @param name
+			 */
+			handleReset(name) {
+				this.$refs[name].resetFields();
+				this.descriptionEditor.txt.clear()
+
+			},
+
+			/**
+			 * 重置表单
+			 * @param name
+			 */
+			handleCancel() {
+				// 如果是新增的问卷点击取消编辑 则需要进行特殊处理
+				if (!this.curVoteItem.id) {
+					this.$emit('onCancelVote')
+				}
+				this.voteFormEdit = false
+				this.doRender(this.editInfo)
+
+			},
+
+			/** 附件上传之前钩子 限制附件上传个数 */
+			handleBeforeUpload() {
+				const check = this.uploadList.length < 5;
+				if (!check) {
+					this.$Notice.warning({
+						title: this.$t('homework.form.attachmentMaxTip')
+					});
+				}
+				return check;
+			},
+
+			/**
+			 * 新增投票或者编辑投票
+			 * @param data
+			 */
+			saveorUpdateVote(data) {
+				return new Promise((r, j) => {
+					if (this.curVoteItem.owner === 'school') {
+						this.$api.learnActivity.SaveorUpdataVote(data).then(res => {
+							if (!res.error) {
+								r(res)
+							} else {
+								j(res.error)
+							}
+						}).catch(e => j(e))
+					} else {
+						this.$api.ability.saveAreaVote(data).then(res => {
+							if (!res.error) {
+								r(res)
+							} else {
+								j(res.error)
+							}
+						}).catch(e => j(e))
+					}
+				})
+
+			},
+
+			/**
+			 * 回显投票详情
+			 * @param item
+			 */
+			async doRender(item) {
+				console.log('需要渲染的投票对象', item)
+				if (item.targetType === 'research') {
+					console.log(this.groupList);
+					let groupNameArr = []
+					item.tchLists.forEach(i => {
+						let findObj = this.groupList.find(j => j.id === i)
+						if (findObj) {
+							groupNameArr.push(findObj)
+						}
+					})
+					this.classNameArr = groupNameArr
+				} else {
+					this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : item
+						.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []
+				}
+				console.log(this.classNameArr);
+
+				this.classType = item.classes.length ? 'school' : 'private'
+				this.classTargets = this.getCurScope === 'school' ? item.classes : item.targets
+				this.targetType = item.targetType
+				console.log(this.classNameArr)
+				this.voteForm = null
+				this.voteForm = {
+					name: item.name,
+					code: item.code,
+					targets: item.targets,
+					classes: item.classes.length ? item.classes : item.stuLists,
+					startTime: item.startTime ? new Date(item.startTime) : '',
+					endTime: item.endTime ? new Date(item.endTime) : '',
+					description: item.description,
+					allowSupply:item.allowSupply,
+					typeLimit:false,
+					attachments:item.attachments || []
+				}
+				this.isImmediate = true
+				this.descriptionEditor.txt.html(item.description)
+
+				this.$nextTick(() => {
+					this.curVoteItem = JSON.parse(JSON.stringify(item))
+					this.$refs.voteForm.validateField('name')
+					this.$refs.voteForm.validateField('classes')
+					this.$refs.voteForm.validateField('description')
+				})
+			},
+
+			/* 根据班级ID集合换取班级名称 */
+			getClassNameByIds(ids) {
+				return new Promise((r, j) => {
+					this.$api.learnActivity.getClassNameByIds({
+						classes: ids,
+						school: this.$store.state.userInfo.schoolCode
+					}).then(res => {
+						if (!res.error) {
+							r(res.classInfos)
+						}
+					}).catch(e => {
+						j(e)
+					})
+				})
+			},
+
+			/* 根据班级ID获取班级名称 */
+			getTargetName(classId) {
+				return this.classNameArr.find(i => i.id === classId) ? this.classNameArr.find(i => i.id === classId).name :
+					this.$t('homework.form.noMatchDataTip')
+			},
+			
+			/* 根据字节数转换为大小 */
+			getSizeByBytes(bytes) {
+			    return bytes / 1024 < 1024 ? (bytes / 1024).toFixed(1) + 'KB' : bytes / 1024 / 1024 < 1024 ? (bytes / 1024 / 1024).toFixed(1) + 'M' : (bytes / 1024 / 1024 / 1024).toFixed(1) + 'G'
+			},
+		},
+		mounted() {
+			let descriptionEditor = new E(this.$refs.descriptionEditor)
+			descriptionEditor.config.onchange = (html) => {
+				this.voteForm.description = html
+			}
+			descriptionEditor.config.height = 200
+			this.$editorTools.initSimpleEditor(descriptionEditor, this)
+			descriptionEditor.create()
+			this.descriptionEditor = descriptionEditor
 
 
-            /** 初始化作业详情的富文本编辑器 */
-            // let descriptionEditor = new E(this.$refs.descriptionEditor)
-            // descriptionEditor.customConfig = this.defaultConfig
-            // descriptionEditor.customConfig.onchange = (html) => { this.hwForm.description = html }
-            // descriptionEditor.create()
-            // this.descriptionEditor = descriptionEditor
-        },
-        computed:{
-			getDisableDays(){
-				return this.hwForm.startTime
+			if (this.editItem && this.editItem.name) {
+				console.log(this.editItem)
+				this.editInfo = JSON.parse(JSON.stringify(this.editItem))
+				this.doRender(this.editInfo)
 			}
+
+		},
+		computed: {
+			getDisableDays() {
+				return this.voteForm.startTime
+			},
+			getCurCode() {
+				return this.$store.state.userInfo.TEAMModelId
+			},
+			getCurScope() {
+				return this.$route.name === 'manageHomeWork' ? 'private' : 'school'
+			},
+			
 		},
 		watch: {
-            editItem: {
-                handler(newValue) {
-                    /** 编辑回显 */
-                    if (newValue) {
-                        this.doRender(JSON.parse(JSON.stringify(newValue)))
-                        this.isEdit = true
-                        this.editInfo = newValue
-                    } else {
-                        /** 新增 */
-                        this.handleReset('hwForm')
-                        this.isEdit = false
-                        this.editInfo = null
-                    }
-                },
-                deep: true
-            }
-        }
-    }
+			editItem: {
+				handler(newValue) {
+					/** 编辑回显 */
+					if (newValue) {
+						console.log(newValue)
+						this.doRender(JSON.parse(JSON.stringify(newValue)))
+						this.isEdit = true
+						this.editInfo = JSON.parse(JSON.stringify(newValue))
+
+					} else {
+						/** 新增 */
+						console.log(newValue)
+						this.handleReset('voteForm')
+						this.isEdit = false
+						this.editInfo = null
+					}
+				},
+			}
+		}
+	}
 </script>
 
 <style lang="less">
-@import "./BaseHwForm.less";
+	@import "../vote/BaseVoteForm.less";
 </style>

+ 17 - 3
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.less

@@ -1,6 +1,6 @@
-@main-bgColor: rgb(40,40,40); //��������ɫ
+@main-bgColor: rgb(40,40,40); 
 @borderColor: #424242;
-@primary-color: #70B1E7;
+@primary-color: #1fb06d;
 @primary-textColor: #393939; //�ı�����ɫ
 @second-textColor: #636363; //�ı�������ɫ
 @primary-fontSize: 14px;
@@ -10,7 +10,21 @@
     padding: 20px 20px 50px 20px;
 	background-color: #fff;
 	
-
+	.attachments-list{
+		.attachments-item{
+			margin: 5px 0;
+			padding: 2px 10px;
+			display: flex;
+			justify-content: space-between;
+			cursor: pointer;
+			&:hover{
+				background-color: rgba(147, 147, 147, 0.3);
+			}
+			.name{
+				color: #218ce3;
+			}
+		}
+	}
 	
 	.vote-class{
 		display: flex;

+ 5 - 0
TEAMModelOS/ClientApp/src/css/site.css

@@ -10,6 +10,11 @@ html[white] {
 	/*背景顏色*/
 }
 
+/* @font-face {
+	font-family:'ALI';
+	src: url('../static/font/Alibaba-PuHuiTi-Regular.otf');
+} */
+
 .backdrop {
 	background-color: var(--bg-color);
 	width: 100%;

+ 72 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/homework.js

@@ -0,0 +1,72 @@
+export default {
+    noVoteData:'No HomeWorking data yet',
+	list:'HomeWork Activity List',
+	pending:'Scheduled',
+	going:'In progress',
+	finish:'Has ended',
+	voteDetails:'HomeWork Details',
+	edit:'Edit',
+	voteResult:'HomeWork Data',
+	optionView:'View option list',
+	stuListView:'View student list',
+	defaultName:'Default HomeWork Name',
+	isExistTip:'Unsaved HomeWork activity already exists!',
+	getDataFailTip:'Failed to obtain data!',
+	serverErrorTip:'HomeWork activity interface is being adjusted, please try again later!',
+	deleteVote:'Delete HomeWork',
+	deleteConfirmTip:'Are you sure to delete this HomeWork activity?',
+	deleteSuc:'Delete successfully',
+	deleteFail:'Failed to delete',
+	option:'Option',
+	noVote:"Didn't Vote",
+	noData:'No data yet',
+	getClassDataFailTip:'Error in obtaining class student data',
+	form:{
+		name:'HomeWork Name',
+		namePlace:'Please enter HomeWork name',
+		target:'HomeWork Participant',
+		privateClass:'Personal Class',
+		schoolClass:'School Class',
+		targetPlace:'Please select the HomeWork participant',
+		noFoundText:'No class created yet',
+		time:'Start Time',
+		endTimePlace:'Please select the HomeWork ending time',
+		description:'HomeWork Description',
+		optionSetting:'Option Settings',
+		addOption:'Add Option',
+		selectNum:'Vote Number',
+		attachments:'Attachment',
+		allowFix:'Allow supplementary homework',
+		allowFileType:'Limit job submission format',
+		once:'Once',
+		day:'Daily',
+		week:'Weekly',
+		month:'Monthy',
+		year:'Yearly',
+		other:'Other',
+		openSecret:'Enable anonymous voting',
+		openRepeat:'Allow repeat voting',
+		save:'Save',
+		cancel:'Cancel',
+		editSuc:'Edit successfully',
+		addSuc:'Add successfully',
+		noCompleteTip:'Please fill in the information completely',
+		noOptionTip:'Voting options cannot be empty!',
+		attachmentMaxTip:'Maximum of 5 attachments can be uploaded',
+		optionNumsTip:'Maximum of 10 options only',
+		noMatchDataTip:'No matching data',
+		ruleName:'HomeWork name cannot be empty',
+		ruleDescription:'HomeWork description cannot be empty',
+		ruleClasses:'HomeWork participant cannot be empty',
+		ruleTime:'Please set the start time',
+		ruleDate:'Date cannot be empty',
+		ruleStartTime:'Start time cannot be earlier than the current time'
+	},
+	optionBarTitle:'Option Distribution Bar Chart',
+	optionPieTitle:'Option Distribution Pie Chart',
+	optionMaxTip:'The current vote number is greater than option number, please be sure to allow repeat voting!',
+	alreadyVote:'Voted',
+	name:'Name',
+	className:'Class',
+	rate:'Ratio'
+}

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/index.js

@@ -40,6 +40,7 @@ import tip from './tip'
 import selflearn from './selflearn'
 import notify from './notify'
 import jyzx from './jyzx';
+import homework from './homework';
 export default {
   schoolBaseInfo,
   classMgmt,
@@ -83,6 +84,7 @@ export default {
   selflearn,
   notify,
   jyzx,
+  homework,
   test: '测试',
   formConfigP: {
     input: 'Please Enter ',

+ 72 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/homework.js

@@ -0,0 +1,72 @@
+export default {
+	noVoteData:'暂无作业数据',
+    list:'作业活动列表',
+	pending:'待发布',
+	going:'进行中',
+	finish:'已结束',
+	voteDetails:'作业详情',
+	edit:'编辑',
+	voteResult:'作业数据',
+	optionView:'选项清单试图',
+	stuListView:'学生清单视图',
+	defaultName:'预设作业名称',
+	isExistTip:'已存在未保存的作业活动!',
+	getDataFailTip:'获取数据失败!',
+	serverErrorTip:'作业活动接口调整中,请稍后再试!',
+	deleteVote:'删除作业',
+	deleteConfirmTip:'确认删除该作业活动?',
+	deleteSuc:'删除成功',
+	deleteFail:'删除失败',
+	option:'选项',
+	noVote:'未作业',
+	noData:'暂无数据',
+	getClassDataFailTip:'获取班级学生数据异常',
+	form:{
+		name:'作业名称',
+		namePlace:'请输入作业名称',
+		target:'作业对象',
+		privateClass:'个人班级',
+		schoolClass:'学校班级',
+		targetPlace:'请选择作业发布对象',
+		noFoundText:'暂未创建班级',
+		time:'起止时间',
+		endTimePlace:'请选择作业结束时间',
+		description:'作业描述',
+		optionSetting:'选项设置',
+		addOption:'添加选项',
+		selectNum:'可作业数',
+		attachments:'作业附件',
+		allowFix:'允许补交作业',
+		allowFileType:'限制作业提交格式',
+		once:'单次',
+		day:'每日',
+		week:'每周',
+		month:'每月',
+		year:'每年',
+		other:'其他',
+		openSecret:'开启匿名作业',
+		openRepeat:'允许重复作业',
+		save:'保存',
+		cancel:'取消',
+		editSuc:'修改成功',
+		addSuc:'添加成功',
+		noCompleteTip:'请将信息填写完整',
+		noOptionTip:'作业选项不能为空!',
+		attachmentMaxTip:'最多只能上传5个附件',
+		optionNumsTip:'最多只能有10个选项',
+		noMatchDataTip:'未匹配数据',
+		ruleName:'作业名称不能为空',
+		ruleDescription:'作业描述不能为空',
+		ruleClasses:'作业对象不能为空',
+		ruleTime:'请设置起止时间',
+		ruleDate:'日期不能为空',
+		ruleStartTime:'开始时间不能早于当前时间'
+	},
+	optionBarTitle:'选项分布柱状图',
+	optionPieTitle:'选项分布饼图',
+	optionMaxTip:'当前作业数大于选项数,请务必勾选 允许重复作业 !',
+	alreadyVote:'已作业',
+	name:'姓名',
+	className:'班级',
+	rate:'占比'
+}

+ 64 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/train.js

@@ -0,0 +1,64 @@
+export default{
+    create:{
+        lastStep:'上一步',
+        nextStep:'下一步',
+        baseInfo:'基础信息',
+        detailInfo:'详情信息',
+        advancedTitle:'高级设置',
+        publishTitle:'发布活动',
+        typeLabel:'类型',
+        hour:'学时',
+        target:'对象',
+        poster:'上传封面',
+        posterTips1:'1、格式支持:jpg、png、jpeg,大小不超过3M;',
+        posterTips2:'2、图片最佳比例400 * 300。',
+        presenter:'主讲人',
+        presenterHolder:'请输入主讲人',
+        topic:'培训主题',
+        topicHolder:'请输入培训主题',
+        trainTime:'培训时间',
+        timeHolder:'请设置培训时间',
+        address:'培训地点',
+        addressHolder:'请输入培训地点',
+        content:'培训内容',
+        contentHolder:'请输入活动描述',
+        signLabel:'现场签到',
+        hwLabel:'布置作业',
+        quLabel:'问卷反馈',
+        examLabel:'评测反馈',
+        hwName:'作业名称',
+        hwNameHolder:'请输入作业名称',
+        hwDesc:'作业描述',
+        hwDescHolder:'请输入作业描述',
+        endTime:'截止时间',
+        endTimeHolder:'请设置截止时间',
+        quName:'问卷名称',
+        quNameHolder:'请输入问卷名称',
+        quDesc:'问卷描述',
+        quDescHolder:'请输入问卷描述',
+        quItems:'问卷题目',
+        quItemsHolder:'请添加问卷题目',
+        addItem:'添加题目',
+        examName:'评测名称',
+        examNameHolder:'请输入评测名称',
+        examDesc:'评测描述',
+        examDescHolder:'请输入评测描述',
+        examItem:'评测题目',
+        examItemHolder:'请添加评测题目',
+        publishOk:'发布成功',
+        viewInfo:'查看信息',
+        back:'返回列表',
+        addItemTitle:'添加题目',
+        hwSet:'作业设置',
+        surveySet:'问卷设置',
+        examSet:'评测设置',
+        uploadErr:'请上传正确格式的封面图片!',
+        surveyOk:'问卷保存成功',
+        surveyErr:'问卷保存失败',
+        hwOk:'作业保存成功',
+        hwErr:'作业保存失败',
+        examOk:'评测保存成功',
+        examErr:'评测保存失败',
+        fullInfo:'请完善信息!'
+    }
+}

+ 72 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/homework.js

@@ -0,0 +1,72 @@
+export default {
+	noVoteData: '暫無作業數據',
+	list: '作業活動清單',
+	pending: '待發佈',
+	going: '進行中',
+	finish: '已結束',
+	voteDetails: '作業詳情',
+	edit: '編輯',
+	voteResult: '作業數據',
+	optionView: '選項清單查閱',
+	stuListView: '學生清單查閱',
+	defaultName: '預設作業名稱',
+	isExistTip: '已存在未儲存的作業活動!',
+	getDataFailTip: '獲取資料失敗!',
+	serverErrorTip: '作業活動介面調整中,請稍後再試!',
+	deleteVote: '刪除作業',
+	deleteConfirmTip: '確認刪除該作業活動?',
+	deleteSuc: '刪除成功',
+	deleteFail: '刪除失敗',
+	option: '選項',
+	noVote: '未作業',
+	noData: '暫無資料',
+	getClassDataFailTip: '獲取班級學生資料異常',
+	form: {
+		name: '作業名稱',
+		namePlace: '請輸入作業名稱',
+		target: '作業對象',
+		privateClass: '個人班級',
+		schoolClass: '學校班級',
+		targetPlace: '請選擇作業發佈對象',
+		noFoundText: '暫未建立班級',
+		time: '開始時間',
+		endTimePlace: '請選擇作業結束時間',
+		description: '作業描述',
+		optionSetting: '選項設定',
+		addOption: '加入選項',
+		selectNum: '可作業數',
+		attachments: '作業附件',
+		allowFix: '允許補交作業',
+		allowFileType: '限製作業提交格式',
+		once: '單次',
+		day: '每日',
+		week: '每週',
+		month: '每月',
+		year: '每年',
+		other: '其他',
+		openSecret: '開啟匿名作業',
+		openRepeat: '允許重複作業',
+		save: '儲存',
+		cancel: '取消',
+		editSuc: '修改成功',
+		addSuc: '加入成功',
+		noCompleteTip: '請將資訊填寫完整',
+		noOptionTip: '作業選項不能為空!',
+		attachmentMaxTip: '最多只能上傳5個附件',
+		optionNumsTip: '最多只能有10個選項',
+		noMatchDataTip: '未匹配數據',
+		ruleName: '作業名稱不能為空',
+		ruleDescription: '作業描述不能為空',
+		ruleClasses: '作業對象不能為空',
+		ruleTime: '請設定開始時間',
+		ruleDate: '日期不能為空',
+		ruleStartTime: '開始時間不能早於目前時間'
+	},
+	optionBarTitle: '選項分佈長條圖',
+	optionPieTitle: '選項分佈圓餅圖',
+	optionMaxTip: '當前作業數大於選項數,請務必勾選允許重複作業!',
+	alreadyVote: '已作業',
+	name: '姓名',
+	className: '班級',
+	rate: '比例'
+}

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/index.js

@@ -40,6 +40,7 @@ import tip from './tip'
 import selflearn from './selflearn'
 import notify from './notify'
 import jyzx from './jyzx';
+import homework from './homework';
 export default {
   schoolBaseInfo,
   classMgmt,
@@ -83,6 +84,7 @@ export default {
   selflearn,
   notify,
   jyzx,
+  homework,
   test: '測試',
   formConfigP: {
     input: '請輸入',

+ 1 - 0
TEAMModelOS/ClientApp/src/view/homework/ManageHomeWork.less

@@ -14,6 +14,7 @@
     height: 100%;
     display: flex;
     flex-direction: row;
+	font-family: 'ALI';
 
     .hw-col {
         height: 100%;

+ 508 - 294
TEAMModelOS/ClientApp/src/view/homework/ManageHomeWork.vue

@@ -1,370 +1,584 @@
 <template>
 	<div class="hw-container">
 		<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
-		<!-- 作业活动列表 -->
-		<div class="hw-col hw-list-box">
-			<div class="hw-box-header">
-				<span>作业活动列表</span>
-				<div>
-					<Icon type="md-trash" class="to-create-icon" @click="onDeleteHw" style="margin-left:10px" v-show="hwList.length" />
-					<Icon type="md-add" class="to-create-icon" @click="goToCreate" />
-				</div>
-			</div>
-			<vuescroll>
-				<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoadList"></Loading>
-				<div class="hw-item-wrap">
-					<div v-if="hwList.length === 0">
-						<EmptyData :top="50"></EmptyData>
-					</div>
-					<div style="width:100%" v-else>
-						<div :class='["hw-item",index === activeHwIndex ? "item-active":""]' v-for="(item,index) in hwList" :key="index"
-						 @click="onHwClick(item,index)">
-							<p class="hw-item-name">{{ item.name }}</p>
-							<div class="hw-item-info">
-								<span class="hw-item-nums">
-									<Icon type="md-time" size="14" style="margin-right:5px" />{{ $tools.formatTime(item.startTime) }}</span>
-								<span class="hw-item-status" :style="{ background: (item.status === 100 ? '#0BADD4' : item.status === 200 ? '#1CC0F3' : '#949594')}">{{ item.status === 100 ? '待发布' : item.status === 200 ? '进行中' : '已结束' }}</span>
-							</div>
+		<div class="hw-box dark-iview-split">
+			<Split v-model="split1" ref="leftSplit">
+				<div slot="left" class="demo-split-pane">
+					<!-- 投票活动列表 -->
+					<div class="hw-col hw-list-box" v-if="!isFromRecord">
+						<div class="hw-box-header">
+							<span>{{ $t('homework.list') }}</span>
+							<span>
+								<Icon type="md-trash" class="to-create-icon" @click="onDeleteHw()"
+									style="margin-left:10px"
+									v-if="voteList.length" />
+								<Icon type="md-add" class="to-create-icon" @click="goToCreate"/>
+							</span>
 						</div>
-					</div>
+						<vuescroll>
+							<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoadList">
+							</Loading>
+							<div class="hw-item-wrap">
+								<div v-if="voteList.length === 0">
+									<EmptyData :top="50"></EmptyData>
+								</div>
+								<div style="width:100%" v-else>
+									<div :class='["hw-item",index === activeVoteIndex ? "item-active":""]'
+										v-for="(item,index) in voteList" :key="index" @click="onVoteClick(item,index)">
+										<p class="hw-item-name">
+											<!-- <span class="owner-tag" v-if="item.owner === 'school'">校</span>
+											<span class="owner-tag" v-if="item.owner === 'area'" style="background-color: #dc6f28;">区</span> -->
+											{{ item.name }}
+										</p>
+										<div class="hw-item-info">
+											<span class="hw-item-nums">
+												<Icon type="md-time" size="14" style="margin-right:5px" />
+												{{ $tools.formatTime(item.startTime || item.createTime,'yyyy-MM-dd hh:mm') }}
+											</span>
+											<span class="hw-item-status"
+												:style="{ background: (item.progress === 'pending' ? '#0BADD4' : item.progress === 'going' ? '#1fb06d' : '#949594')}">{{ item.progress === 'pending' ? $t('homework.pending') : item.progress === 'going' ? $t('homework.going') : $t('homework.finish') }}</span>
+										</div>
+									</div>
+								</div>
 
-				</div>
-			</vuescroll>
-		</div>
-
-		<!-- 作业基础信息展示 -->
-		<div class="hw-col hw-info-box" v-show="currentHw.status !== 300">
-			<div class="hw-box-header">
-				<span>作业详情</span>
-				<div class="hw-box-header-tools">
-					<span class="hw-box-header-tools-tool" v-show="currentHw.status !== 300 && hwList.length">
-						<Icon type="md-create" size="18" title="编辑" @click="onEditHw" /></span>
-					<span class="hw-box-header-tools-tool" v-show="currentHw.status === 200 && hwList.length">
-						<Icon type="md-undo" size="18" title="取消发布" @click="onCancelHw" style="margin-left:8px;" /></span>
-				</div>
-			</div>
-			<vuescroll ref="hwDetailsScroll">
-				<div class="hw-info-wrap">
-					<div v-show="hwList.length === 0">
-						<EmptyData :top="50"></EmptyData>
+							</div>
+						</vuescroll>
 					</div>
-					<BaseHwForm :editItem="currentHw" @onAddSuccess="onAddSuccess" ref="hwForm" v-show="hwList.length"></BaseHwForm>
-				</div>
-			</vuescroll>
-		</div>
-
-		<!-- 作业提交数据 -->
-		<div class="hw-col hw-data-box" :style="{ width: currentHw.status !== 300 ? '55%' : '85%' }">
-			<div class="hw-box-header">
-				<span>作业数据</span>
-				<div class="hw-box-header-tools">
-					<!--<span class="hw-box-header-tools-tool"><Icon type="md-podium" />数据分析</span>-->
 				</div>
-			</div>
-			<vuescroll>
-				<div class="hw-data-wrap">
-					<div v-if="hwList.length === 0 || currentHw.status === 100">
-						<EmptyData :top="50"></EmptyData>
-					</div>
-					<BaseHwTable :studentsList="studentsList" :hwId="currentHw.id" :isSimpleColumns="false" v-else></BaseHwTable>
+				<div slot="right" class="demo-split-pane">
+					<Split v-model="split2">
+						<div slot="left" class="demo-split-pane" ref="voteFormBox">
+							<!-- 投票基础信息展示 -->
+							<div class="hw-col hw-info-box">
+								<div class="hw-box-header">
+									<span>{{ $t('homework.voteDetails') }}</span>
+									<div class="hw-box-header-tools">
+										<span class="hw-box-header-tools-tool"
+											v-show="currentVote.progress === 'pending'">
+											<!-- <Icon type="md-create" size="18" :title="$t('homework.edit')"
+												@click="onEditVote"
+												v-if="($access.can('admin.*|schoolAc-upd') || isPrivate) && !isAreaVote && currentVote.owner === 'school'" /> -->
+										</span>
+									</div>
+								</div>
+								<vuescroll ref="voteFormScroll">
+									<div v-show="voteList.length === 0">
+										<EmptyData :top="50"></EmptyData>
+									</div>
+									<div class="hw-info-wrap" v-show="voteList.length !== 0">
+										<BaseHwForm :editItem="currentVote" @onAddSuccess="onAddSuccess"
+											ref="voteForm" @onCancelVote="onCancelVote"></BaseHwForm>
+									</div>
+								</vuescroll>
+							</div>
+						</div>
+						<div slot="right" class="demo-split-pane">
+							<!-- 投票提交数据 -->
+							<div class="hw-col hw-data-box">
+								<div class="hw-box-header">
+									<span>{{ $t('homework.voteResult') }}</span>
+									<div class="hw-box-header-tools">
+										<div>
+											<!-- <span class="hw-box-header-tools-tool" @click="changeTableView" v-if="!currentVote.secret">
+												<Icon type="md-podium" />
+												{{ isOptionView ? $t('homework.stuListView') : $t('homework.optionView') }}
+											</span> -->
+										</div>
+										<div>
+											<Button class="btn-save" v-if="isFromRecord" icon="md-arrow-round-back"
+												@click="goBackRecord">{{ $t('survey.backToRecord') }}</Button>
+										</div>
+										
+									</div>
+								</div>
+								<div v-if="voteList.length === 0 || hasNewAdd || currentVote.progress === 'pending'">
+									<EmptyData :top="50"></EmptyData>
+								</div>
+								<div class="hw-data-wrap" style="height:90%;padding-top: 10px;" ref="baseQnRef" v-else>
+									<!-- <vuescroll>
+										<div style="display:flex;background-color: #f8f8f9;margin: 0 20px 20px 20px;" v-if="tableData.length">
+											<BaseVotePie pieId="votePie" :pieData="studentsTable"
+												v-show="tableData.length || isAreaVote"></BaseVotePie>
+											<BaseVoteBar pieId="votePie2" v-if="tableData.length" :pieData="tableData">
+											</BaseVoteBar>
+										</div>
+										<BaseVoteTable :tableDatas="tableData" v-show="isOptionView && !isAreaVote"></BaseVoteTable>
+										<BaseVoteSsTable :tableDatas="studentsTable" v-show="!isOptionView && !isAreaVote" :isSecret="currentVote.secret">
+										</BaseVoteSsTable>
+									</vuescroll> -->
+								</div>
+							</div>
+						</div>
+					</Split>
 				</div>
-			</vuescroll>
+			</Split>
 		</div>
-
-		<!-- 完善试卷信息 -->
-		<!--<Modal v-model="addHwModal"
-               class-name="hw-modal"
-               :title="isEdit ? '修改作业' : '新增作业'"
-               footer-hide
-               width="600px">
-            <div class="hw-modal-box">
-                <vuescroll ref="hwModalScroll">
-                    <BaseHwForm @onAddSuccess="onAddSuccess" :editItem="editItem" :editable="editable" ref="editForm"></BaseHwForm>
-                </vuescroll>
-            </div>
-        </Modal>-->
 	</div>
 </template>
 <script>
 	import BaseHwForm from '@/components/homework/BaseHwForm'
-	import BaseHwTable from '@/components/homework/BaseHwTable'
+	import BaseVoteTable from '@/components/vote/BaseVoteTable'
+	import BaseVoteSsTable from '@/components/vote/BaseVoteSsTable'
+	import BaseVotePie from '@/components/vote/BaseVotePie'
+	import BaseVoteBar from '@/components/vote/BaseVoteBar'
 	export default {
 		components: {
 			BaseHwForm,
-			BaseHwTable
+			BaseVoteTable,
+			BaseVoteBar,
+			BaseVotePie,
+			BaseVoteSsTable
 		},
 		data() {
 			return {
+				split1: 0.2,
+				split2: 0.35,
+				tabIndex: 0,
+				hasNewAdd: false,
 				isLoading: false,
 				isLoadList: false,
+				isOptionView: false,
 				isEdit: false,
 				editable: false,
-				hwList: [],
+				voteList: [],
 				studentsList: [],
-				currentHw: {
-					status: 0
-				},
-				editItem: {},
-				activeHwIndex: 0,
+				studentsTable: [],
+				currentVote: {},
+				editItem: null,
+				activeVoteIndex: 0,
+				voteTableData: [],
+				tableData: [],
 				addHwModal: false,
+				isFromRecord: false,
+				areaId: sessionStorage.getItem('areaId'),
+				areaVoteTeachers: [],
+				areaRecord:[],
+				areaSchIndex:0,
+				areaSchList:[],
 			}
 		},
 		methods: {
-
-			/** 新增作业 */
+			// 校本课纲与个人课纲切换
+			handleTabClick(index) {
+				this.tabIndex = index
+				setTimeout(() => {
+					this.getVoteList(index === 0 ? 'school' : 'private')
+				}, 500)
+			},
+			/* 返回到活动记录页面 */
+			goBackRecord() {
+				this.$router.back(-1)
+			},
+			/** 新增投票 */
 			goToCreate() {
-				//this.$refs.editForm.handleReset('hwForm')
-				//this.$refs.editForm.$refs.uploadRef.clearUploadedList()
-				//this.$refs.editForm.isAdd = true
-				//this.$refs.editForm.defaultFileList = []
-				//this.$refs.hwForm.hwFormEdit = true
-				//this.isEdit = false
-				//this.editItem = null
-				//this.editable = true
-				//this.addHwModal = true
-				//this.backToTop('hwModalScroll')
-
-				let defaultHw = {
-					name: '预设作业名称',
-					target: [],
-					endTime: '',
-					publishModel: '0',
-					startTime: '',
-					description: '',
-					resource: [],
-					isReset: [],
-					other: []
+				let hasNoSaveVote = this.voteList.filter(i => !i.id).length
+				if (hasNoSaveVote) {
+					this.$Message.warning(this.$t('homework.isExistTip'));
+				} else {
+					let defaultVote = {
+						name: this.$t('homework.defaultName'),
+						code: this.$store.state.userInfo.TEAMModelId,
+						classes: [],
+						stuLists:[],
+						targets:[],
+						endTime: new Date(new Date().toLocaleDateString()).getTime() + 2 * 24 * 60 * 60 * 1000 - 1,
+						startTime:new Date().getTime(),
+						description: '',
+						progress: 'pending',
+						allowSupply:false,
+						typeLimit:false,
+						attachments:[],
+					}
+					this.voteList.unshift(defaultVote);
+					this.currentVote = defaultVote;
+					this.activeVoteIndex = 0;
+					this.editable = true
+					this.hasNewAdd = true
+					this.$refs.voteForm.voteFormEdit = true
+					this.$refs.voteForm.classTargets = []
+					this.$EventBus.$emit('onCreateVote')
 				}
-				this.studentsList = []
-				this.hwList.unshift(defaultHw);
-				this.currentHw = defaultHw;
-				this.editable = true
-				this.$refs.hwForm.hwFormEdit = true
 
+				this.$nextTick(() => {
+					this.$refs.voteFormBox.scrollIntoView();
+				})
 			},
-
-			/** 删除当前作业 */
-			onDeleteHw() {
-				this.$Modal.confirm({
-					title: '删除作业',
-					content: '<p>确认删除该作业?</p>',
-					okText: '确认',
-					cancelText: '取消',
-					onOk: () => {
-						this.isLoading = true
-
-						if (this.currentHw.id) {
-							this.$api.learnActivity.DeleteHomeWork({
-								id: this.currentHw.id,
-								pk: this.$store.state.userInfo.TEAMModelId
-							}).then(res => {
-								if (res.result.data) {
-									this.$Message.success('操作成功')
-									this.getHomeWorkList()
-								} else {
-									this.$Message.success('操作失败')
-								}
-								this.isLoading = false
-							})
-						} else {
-							this.hwList.splice(this.hwList.indexOf(this.currentHw), 1)
-							this.isLoading = false
-							this.$Message.success('操作成功')
-							if (this.hwList.length) this.onHwClick(this.hwList[0], 0)
-						}
-					}
+			/* 切换视图 */
+			changeTableView() {
+				this.isOptionView = !this.isOptionView
+				this.$nextTick(() => {
+					this.$refs.baseQnRef && this.$refs.baseQnRef.scrollIntoView()
 				})
 			},
-
-			/** 获取作业列表 */
-			getHomeWorkList() {
+			/** 获取投票列表 */
+			getVoteList(type) {
 				this.isLoadList = true
 				let params = {
-					code: this.$store.state.userInfo.TEAMModelId
+					code: this.getCurCode,
+					scope: this.getCurScope
 				}
-				this.$api.learnActivity.FindHomeWork(params).then(res => {
-					if (!res.error && res.homeWorkFindDtos) {
-						this.hwList = res.homeWorkFindDtos.sort((a, b) => {
-							return b.createTime - a.createTime
-						})
-						if (res.homeWorkFindDtos.length) this.onHwClick(res.homeWorkFindDtos[0], 0)
+				this.getVoteListByType(params).then(res => {
+					if (!res.error && res.votes) {
+						if (res.votes.length) {
+							let list = res.votes.reverse()
+							this.voteList = list
+							let queryId = this.$route.query.acId
+							if(queryId && list.filter(i => i.id === queryId).length === 0){
+								this.$Modal.confirm({
+									title: this.$t('survey.questionaire.confirmTitle'),
+									content: this.$t('survey.noFoundAc'),
+									cancelText: ' ',
+									onOk: () => {
+										this.goBackRecord()
+									},
+									onCancel: () => {}
+								});
+							}
+							let queryVote = queryId && list.filter(i => i.id === queryId).length ? list.filter(i =>
+								i.id === queryId)[0] : list[0]
+							let queryIndex = queryId ? list.indexOf(queryVote) : 0
+							this.isFromRecord = Boolean(queryId)
+							this.onVoteClick(queryVote, queryIndex)
+						} else {
+							this.voteList = []
+						}
 						this.isLoadList = false
 					} else {
-						this.$Message.error('获取数据失败')
+						this.$Message.error(this.$t('homework.getDataFailTip'))
 					}
+				}).catch(err => {
+					this.$Message.error(this.$t('homework.serverErrorTip'))
+					this.isLoadList = false
 				})
 			},
-
-			/**
-			 * 作业点击事件
-			 * @param item
-			 * @param index
-			 */
-			onHwClick(item, index) {
-				this.currentHw = item
-				this.activeHwIndex = index
-				this.studentsList = []
-				if (item.id) this.getHwStudents(item.id, item.target)
-				this.$refs.hwForm.hwFormEdit = false
-				//this.backToTop('hwDetailsScroll')
-			},
-
-
-			/**
-			 * 获取作业关联的学生清单
-			 * @param hwId 作业ID
-			 */
-			async getHwStudents(hwId, target) {
-				let records = await this.getHwRecord(hwId)
-				this.isLoading = true
-				//  先查找 作业发布对象关联的学生清单 然后再去判断学生的作答情况
-				this.$api.courseMgmt.getClassroomStudent({
-					classroomCode: target.map(i => i.classroomCode),
-					schoolCode: this.$store.state.userInfo.schoolCode
-				}).then(res => {
-					if (!res.error && res.result.data) {
-						let list = res.result.data
-						let infoList = res.result.extend.students
-						list.forEach(i => {
-							i.name = infoList.filter(j => j.studentId === i.code)[0].name
-							i.classroomName = target.filter(k => k.classroomCode === i.id)[0].classroomName
-						})
-						// 要根据作答情况 结合两张表 处理表格显示的数据 
-						if (records.length) {
-							list.forEach(i => {
-								for (let a = 0; a < records.length; a++) {
-									// 如果学生已提交 则添加提交信息 如果未提交则跳过
-									let item = records[a]
-									if (i.code === item.code) {
-										i.submissionBool = true
-										i.submissionTime = item.submitTime
-										i.teacherComments = item.tchCmt
-										i.studentComments = item.stuCmt
-										i.score = item.score
-										i.content = item.content
-										return false
-									} else {
-										i.submissionBool = false
-										i.submissionTime = null
-										i.teacherComments = null
-										i.studentComments = []
-										i.score = 0
-										i.content = []
-									}
-								}
-							})
+			/* 根据类型v来查询校级或者区级的投票活动数据 */
+			getVoteListByType(data) {
+				return new Promise((r, j) => {
+					this.$api.learnActivity.FindVote(data).then(res => {
+						if (!res.error) {
+							r(res)
+						} else {
+							j(res.error)
 						}
-						this.studentsList = list
-						this.isLoading = false
-					} else {
-						this.$Message.error('获取数据失败')
-					}
+					})
 				})
 			},
-
-			/**
-			 * 老师评分请求接口
-			 * @param params
-			 */
-			getHwRecord(hwId) {
+			/* 投票点击事件 */
+			async onVoteClick(item, index) {
+				console.log(item)
+				let fullItem = item.id ? await this.getVoteDetails(item) : item
+				console.log(fullItem)
+				this.currentVote = fullItem
+				this.activeVoteIndex = index
+				/* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
+				if (item.id && item.progress !== 'pending'){
+					// this.getVoteStudents(fullItem, fullItem.classes)
+				} 
+				this.$refs.voteForm && (this.$refs.voteForm.voteFormEdit = false)
+				this.$refs.voteFormScroll.scrollTo({
+						y: 0,
+					},
+					200,
+					"easeInQuad"
+				);
+				this.hasNewAdd = false
+				this.isOptionView = true
+			},
+			/* 获取投票活动的详细数据 */
+			getVoteDetails(voteItem) {
 				return new Promise((r, j) => {
-					this.$api.learnActivity.FindRecordByHwId({
-						id: hwId
+					this.$api.learnActivity.FindVoteById({
+						id: voteItem.id,
+						code: voteItem.code
 					}).then(res => {
-						if (!res.error && res.result.data) {
-							r(res.result.data)
-						} else {
-							j(500)
+						if (!res.error) {
+							if(res.status === 404){
+								this.$Message.error('未查询到当前活动!')
+								r(null)
+							}else{
+								r(res.vote)
+							}
 						}
+					}).catch(err => {
+						j(err)
 					})
 				})
 			},
-
-
-
-			/** 作业编辑事件 */
-			onEditHw() {
-				this.editItem = this.currentHw
-				this.isEdit = true
-				this.editable = true
-				this.$refs.hwForm.hwFormEdit = !this.$refs.hwForm.hwFormEdit
-				//this.addHwModal = true
-				//this.backToTop('hwModalScroll')
+			/* 获取正在进行中的投票活动的投票数据 */
+			async getVoteRecord(voteItem) {
+				return new Promise(async (r, j) => {
+					try {
+						if(!voteItem.recordUrl){
+							console.log('xxxxx')
+							r({})
+						}else{
+							let curItemRecord = await this.getBlobJsonFile(voteItem.scope, voteItem
+								.recordUrl)
+							r(curItemRecord)
+						}
+						
+					} catch (e) {
+						j(e)
+					}
+				})
 			},
-
-			/* 取消发布作业 */
-			onCancelHw() {
+			/* 根据已结束的RecordUrl来获取投票结果数据 */
+			getBlobJsonFile(scope, url) {
+				return new Promise(async (resolve, reject) => {
+					let blobHost = scope === 'private' ? JSON.parse(decodeURIComponent(localStorage
+						.user_profile, "utf-8")).blob_uri : JSON.parse(decodeURIComponent(localStorage
+						.school_profile, "utf-8")).blob_uri
+					// 根据试卷的Blob地址 去读取JSON文件
+					let sasString = scope === 'private' ? await this.$tools.getPrivateSas() : await this.$tools
+						.getSchoolSas()
+					try {
+						let itemJson = JSON.parse(await this.$tools.getFile(blobHost + url + sasString.sas))
+						resolve(itemJson)
+					} catch (e) {
+						reject(e)
+					}
+				})
+			},
+			/* 取消编辑投票(无ID状态) */
+			onCancelVote() {
+				this.voteList.splice(this.voteList.indexOf(this.currentVote), 1)
+				if (this.voteList.length > 0) {
+					this.onVoteClick(this.voteList[0], 0)
+				} else {
+					this.voteList = [];
+					this.currentVote = {}
+					this.activeVoteIndex = 0;
+				}
+			},
+			/** 删除当前投票 */
+			onDeleteHw() {
 				this.$Modal.confirm({
-					title: '取消发布',
-					content: '<p>确认取消发布该作业?</p>',
-					okText: '确认',
-					cancelText: '取消',
+					title: this.$t('homework.deleteVote'),
+					content: this.$t('homework.deleteConfirmTip'),
 					onOk: () => {
 						this.isLoading = true
-						this.$api.learnActivity.RevokeHomeWork(this.currentHw.id).then(res => {
-							if (res.result.data) {
-								this.isLoading = false
-								this.$Message.success('操作成功')
-								this.getHomeWorkList()
-							} else {
+						if (this.currentVote.id) {
+							this.$api.learnActivity.DeleteVote({
+								id: this.currentVote.id,
+								code: this.currentVote.code,
+								scope: this.getCurScope
+							}).then(res => {
+								if (!res.error && res.flag) {
+									console.log(this.voteList.indexOf(this.currentVote))
+									this.voteList.splice(this.voteList.reverse().indexOf(this
+										.currentVote), 1)
+									setTimeout(() => {
+										this.isLoading = false
+										this.$Message.success(this.$t('homework.deleteSuc'))
+										this.handleTabClick(this.$route.name === 'manageVote' ?
+											0 : 1)
+									}, 1000)
+
+									// this.isLoading = false
+									// this.$Message.success(this.$t('homework.deleteSuc'))
+									// if (this.voteList.length) this.onVoteClick(this.voteList[0], 0)
+								} else {
+									this.isLoading = false
+									this.$Message.error(this.$t('homework.deleteFail'))
+								}
+							}).catch(err => {
 								this.isLoading = false
-								this.$Message.success('操作失败')
-							}
-						})
+								this.$Message.error(this.$t('homework.deleteFail'))
+							})
+						} else {
+							this.voteList.splice(this.voteList.indexOf(this.currentVote), 1)
+							this.isLoading = false
+							this.$Message.success(this.$t('homework.deleteSuc'))
+							if (this.voteList.length) this.onVoteClick(this.voteList[0], 0)
+						}
 					}
 				})
 			},
-
-
-			/** 新增作业成功回调 */
+			/* 获取投票关联的学生清单 */
+			async getVoteStudents(voteItem) {
+				this.isLoading = true
+				try {
+					let records = await this.getVoteRecord(voteItem)
+					//  先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
+					console.log('当前投票的作答数据======', records)
+					this.$api.schoolSetting.getStusByClassId({
+						school_code: this.$store.state.userInfo.schoolCode,
+						ids: voteItem.classes.length ? voteItem.classes : voteItem.stuLists,
+					}).then(res => {
+						if (!res.error) {
+							let list = [] //学生清单 
+							let arr = [] //选项清单
+							res.list.forEach(classStus => {
+								classStus.class.stuInfos.forEach(i => {
+									list.push({
+										id: i.id,
+										name: i.name,
+										no: i.no || 0,
+										classroomName: classStus.class.name
+									})
+								})
+								classStus.class.tmdInfos.forEach(i => {
+									list.push({
+										id: i.id,
+										name: i.name,
+										no: i.no || 0,
+										classroomName: classStus.class.name
+									})
+								})
+							})
+							this.studentsTable = list
+							
+							// 要根据作答情况 结合两张表 处理表格显示的数据 
+							if (records.options && records.options.length) {
+								records.options = this._.orderBy(records.options,'code')
+								records.options.forEach((item, index) => {
+									arr.push({
+										option: item.code ? this.$t('homework.option') + (index +
+											1) : this.$t('homework.noVote'),
+										key: item.code || '',
+										result: new Array(item.count).fill('1')
+									})
+								})
+								this.studentsTable.forEach(i => {
+									let matchList = records.records.filter(j => j.userid === i.id)
+									i.option = matchList.length ? Object.keys(matchList[0].opt).join(
+										',') : null
+								})
+								this.tableData = arr
+								console.log(arr)
+								console.log(this.studentsTable)
+							} else {
+								// 如果是还没有投票作答数据 则默认显示0
+								// this.currentVote.forEach((item, index) => {
+								// 	arr.push({
+								// 		option: item.code ? this.$t('homework.option') + (index +
+								// 			1) : this.$t('homework.noVote'),
+								// 		key: item.code || '',
+								// 		result: 0
+								// 	})
+								// })
+								this.tableData = []
+							}
+						} else {
+							this.$Message.error(this.$t('homework.getDataFailTip'))
+						}
+					}).catch(err => {
+						this.$Message.error(this.$t('homework.getClassDataFailTip'))
+					}).finally(() => {
+						this.isLoading = false
+					})
+				} catch (e) {
+					this.isLoading = false
+				}
+			},
+			/* 提取富文本内容中的文本 */
+			getSimpleText(html) {
+				var r = /<(?!img|video|audio).*?>/g;
+				return html.replace(r, "");
+			},
+			/** 新增投票成功回调 */
 			onAddSuccess() {
-				this.getHomeWorkList()
+				//this.addHwModal = false
+				this.handleTabClick(this.$route.name === 'manageVote' ? 0 : 1)
+				this.hasNewAdd = false
 			},
-
-
-			/**
-			 * 滚动条返回顶部
-			 * @param refName
-			 */
-			backToTop(refName) {
-				this.$refs[refName].scrollTo({
-						y: 0
-					},
-					100, 'easeInQuad'
-				)
+			/* 获取当前教师的所有个人课程以及学校分配的课程 */
+			getMyCourse(){
+				// if(this.$store.state.user.userCourses.length) return
+				this.$api.courseMgmt.findAllByTeahcer({
+					code:this.$store.state.userInfo.TEAMModelId,
+					scope:'private',
+					schoolId:this.$store.state.userInfo.schoolCode,
+				}).then((res) => {
+					if(res.obj.length){
+						res.obj.forEach(i => {
+							i.classes.forEach(j => {
+								j.courseId = i.id
+								j.id = i.id + '/' + j.id
+							})
+						})
+						let myCourses = res.obj.map(j =>  {
+							return { 
+								id:j.id,
+								name:j.name,
+								scope:j.scope,
+								children:j.scope === 'private' ? j.classes : [
+									{
+										id:'class',
+										name:this.$t('stuAccount.adminClass'),
+										children:j.classes.filter(k => k.type === 'class')
+									},
+									{
+										id:'stuList',
+										name:this.$t('stuAccount.teachClass'),
+										children:j.classes.filter(k => k.type === 'stuList')
+									}
+								]
+							}
+						})
+						this.$store.commit('user/setUserCourses', myCourses)
+					}
+				}).catch((err) => {
+					console.log(err)
+				});
 			}
 		},
 		mounted() {
-			this.getHomeWorkList()
+			if (this.$route.query.acId) {
+				this.isFromRecord = true
+				this.split1 = 0
+				this.split2 = 0.3
+				this.$refs.leftSplit.$el.getElementsByClassName('ivu-split-trigger-con')[0].style.display = 'none'
+			}
+			this.getMyCourse()
+		},
+		computed: {
+			getCurCode() {
+				return this.$store.state.userInfo.TEAMModelId
+			},
+			getCurScope() {
+				return this.$route.name === 'manageHomeWork' ? 'private' : 'school'
+			},
+		},
+		watch: {
+			$route: {
+				handler: function(to, from) {
+					this.handleTabClick(this.$route.name === 'manageVote' ? 0 : 1)
+				},
+				immediate: true
+			}
 		}
 	}
 </script>
 <style lang="less" scoped>
-	@import "./ManageHomeWork.less";
+	@import "../vote/ManageVote.less";
 </style>
 <style>
-	.hw-modal .ivu-modal-content {
-		background: #454545;
+	.hw-container .dark-iview-split .ivu-split-trigger{
+		border-color: #dadada !important;
+		background:none;
 	}
-
-	.hw-modal .ivu-modal-body {
-		padding: 0;
+	.hw-modal {
+	  .ivu-modal-content {
+	    background: #454545;
+	  }
+	  .ivu-modal-body {
+	    padding: 0;
+	  }
+	  .ivu-modal-header {
+	    border-bottom: none;
+	  }
+	  .hw-modal-box {
+	    height: 600px;
+	    max-height: 600px;
+	    padding: 15px;
+	  }
 	}
-
 	.hw-modal .ivu-modal-header p,
-	.hw-modal .ivu-modal-header-inner {
-		color: #fff;
-		font-size: 18px;
-		font-weight: bold;
+		.hw-modal .ivu-modal-header-inner {
+	  color: #fff;
+	  font-size: 18px;
+	  font-weight: bold;
 	}
 
-	.hw-modal .ivu-modal-header {
-		border-bottom: none;
-	}
-
-	.hw-modal .hw-modal-box {
-		height: 600px;
-		max-height: 600px;
-		padding: 15px;
-	}
 </style>

+ 35 - 43
TEAMModelOS/ClientApp/src/view/train/Create.vue

@@ -7,65 +7,69 @@
                     <span class="step-icon-wrap">
                         <Icon type="ios-arrow-back" size="24" color="white" />
                     </span>
-                    <p style="margin-top:2px">上一步</p>
+                    <p style="margin-top:2px">
+                        {{$t('train.create.lastStep')}}
+                    </p>
                 </div>
                 <!-- 下一步 -->
                 <div v-show="step < 3" class="to-train-mgt next-step" @click="nextStep()">
                     <span class="step-icon-wrap">
                         <Icon type="ios-arrow-forward" size="24" color="white" />
                     </span>
-                    <p style="margin-top:2px">下一步</p>
+                    <p style="margin-top:2px">
+                        {{$t('train.create.nextStep')}}
+                    </p>
                 </div>
                 <Steps :current="step" class="step-wrap">
-                    <Step title="基础信息" @click.native="step = 0"></Step>
-                    <Step title="详情信息"></Step>
-                    <Step title="高级设置"></Step>
-                    <Step title="发布活动"></Step>
+                    <Step :title="$t('train.create.baseInfo')" @click.native="step = 0"></Step>
+                    <Step :title="$t('train.create.detailInfo')"></Step>
+                    <Step :title="$t('train.create.advancedTitle')"></Step>
+                    <Step :title="$t('train.create.publishTitle')"></Step>
                 </Steps>
                 <Form ref="baseInfo" :model="baseInfo" :rules="baseRule" :label-width="100" class="train-form" label-colon v-show="step == 0">
-                    <h1>基础信息</h1>
+                    <h1>{{$t('train.create.baseInfo')}}</h1>
                     <!-- <FormItem label="名称" prop="name">
                         <Input v-model="baseInfo.name" placeholder="活动名称"></Input>
                     </FormItem> -->
-                    <FormItem label="类型" prop="type" style="margin-top:80px">
+                    <FormItem :label="$t('train.create.typeLabel')" prop="type" style="margin-top:80px">
                         <Select v-model="baseInfo.type">
                             <Option v-for="item in typeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                         </Select>
                     </FormItem>
-                    <FormItem label="学时" prop="hour" style="margin-top:30px">
-                        <InputNumber :max="10" :min="1" style="width:100%" v-model="baseInfo.hour" placeholder="请输入学时"></InputNumber>
+                    <FormItem :label="$t('train.create.hour')" prop="hour" style="margin-top:30px">
+                        <InputNumber :max="10" :min="1" style="width:100%" v-model="baseInfo.hour" :placeholder="$t('train.create.hourHolder')"></InputNumber>
                     </FormItem>
-                    <FormItem label="对象" prop="target" style="margin-top:30px">
+                    <FormItem :label="$t('train.create.target')" prop="target" style="margin-top:30px">
                         <Select v-model="baseInfo.target" multiple>
                             <Option v-for="item in groupList" :value="item.id" :key="item.id">{{ item.name }}</Option>
                         </Select>
                     </FormItem>
                 </Form>
                 <Form ref="trainInfo" :model="trainInfo" :rules="trainRule" :label-width="100" class="train-form" label-colon v-show="step == 1">
-                    <h1>详细信息</h1>
-                    <FormItem label="上传封面">
+                    <h1>{{$t('train.create.detailInfo')}}</h1>
+                    <FormItem :label="$t('train.create.poster')">
                         <Upload :headers="updHeader" :on-error="handleUpdErr" type="drag" action="/blob/public-upload" :format="['jpg','png','jpeg']" :on-format-error="handleFormatError" :on-success="success">
                             <div style="padding: 10px 0">
                                 <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
-                                <p>1、格式支持:jpg、png、jpeg,大小不超过3M;</p>
-                                <p>2、图片最佳比例400 * 300;</p>
+                                <p>{{$t('train.create.posterTips1')}}</p>
+                                <p>{{$t('train.create.posterTips2')}}</p>
                             </div>
                         </Upload>
                     </FormItem>
-                    <FormItem label="主讲人" prop="presenter">
-                        <Input v-model="trainInfo.presenter" placeholder="请输入主讲人"></Input>
+                    <FormItem :label="$t('train.create.presenter')" prop="presenter">
+                        <Input v-model="trainInfo.presenter" :placeholder="$t('train.create.presenterHolder')"></Input>
                     </FormItem>
-                    <FormItem label="培训主题" prop="topic">
-                        <Input v-model="trainInfo.topic" placeholder="请输入培训主题"></Input>
+                    <FormItem :label="$t('train.create.topic')" prop="topic">
+                        <Input v-model="trainInfo.topic" :placeholder="$t('train.create.topicHolder')"></Input>
                     </FormItem>
-                    <FormItem label="培训时间" prop="time">
-                        <DatePicker :editable="false" @on-change="getTimeInfo" type="datetimerange" format="yyyy-MM-dd HH:mm" placeholder="请设置培训时间" style="width: 500px"></DatePicker>
+                    <FormItem :label="$t('train.create.address')" prop="time">
+                        <DatePicker :editable="false" @on-change="getTimeInfo" type="datetimerange" format="yyyy-MM-dd HH:mm" :placeholder="$t('train.create.addressHolder')" style="width: 500px"></DatePicker>
                     </FormItem>
-                    <FormItem label="培训地点" prop="address">
-                        <Input v-model="trainInfo.address" placeholder="请输入培训地点"></Input>
+                    <FormItem :label="$t('train.create.trainTime')" prop="address">
+                        <Input v-model="trainInfo.address" :placeholder="$t('train.create.timeHolder')"></Input>
                     </FormItem>
-                    <FormItem label="培训内容">
-                        <Input v-model="trainInfo.desc" type="textarea" placeholder="请输入活动描述" maxlength="200" show-word-limit :autosize="{minRows: 5, maxRows: 8}"></Input>
+                    <FormItem :label="培训内容">
+                        <Input v-model="trainInfo.desc" type="textarea" :placeholder="请输入活动描述" maxlength="200" show-word-limit :autosize="{minRows: 5, maxRows: 8}"></Input>
                     </FormItem>
                 </Form>
                 <Form ref="highInfo" :model="trainInfo" :rules="trainRule" :label-width="100" class="train-form" label-colon v-show="step == 2">
@@ -80,9 +84,9 @@
                         <Checkbox label="hw" class="check-item">
                             <span>布置作业</span>
                         </Checkbox>
-                        <!-- <Checkbox label="survey" class="check-item">
+                        <Checkbox label="survey" class="check-item">
                             <span>问卷反馈</span>
-                        </Checkbox> -->
+                        </Checkbox>
                         <Checkbox label="exam" class="check-item">
                             <span>评测反馈</span>
                         </Checkbox>
@@ -93,8 +97,8 @@
                                 <FormItem label="作业名称" prop="hwName">
                                     <Input v-model="trainInfo.hwName" placeholder="请输入作业名称"></Input>
                                 </FormItem>
-                                <FormItem label="作业内容" prop="hwDesc">
-                                    <Input v-model="trainInfo.hwDesc" type="textarea" placeholder="请输入活动描述" maxlength="200" show-word-limit :autosize="{minRows: 6, maxRows: 8}"></Input>
+                                <FormItem label="作业描述" prop="hwDesc">
+                                    <Input v-model="trainInfo.hwDesc" type="textarea" placeholder="请输入作业描述" maxlength="200" show-word-limit :autosize="{minRows: 6, maxRows: 8}"></Input>
                                 </FormItem>
                                 <FormItem label="截止时间" prop="hwTime">
                                     <DatePicker type="datetime" v-model="trainInfo.hwTime" placeholder="作业截止时间" format="yyyy-MM-dd HH:mm" style="width: 100%" @on-change="getHwTime"></DatePicker>
@@ -105,7 +109,7 @@
                                     <Input v-model="trainInfo.quName" placeholder="请输入问卷名称"></Input>
                                 </FormItem>
                                 <FormItem label="问卷描述" prop="quDesc">
-                                    <Input v-model="trainInfo.quDesc" type="textarea" placeholder="请输入活动描述" maxlength="200" show-word-limit :autosize="{minRows: 6, maxRows: 8}"></Input>
+                                    <Input v-model="trainInfo.quDesc" type="textarea" placeholder="请输入问卷描述" maxlength="200" show-word-limit :autosize="{minRows: 6, maxRows: 8}"></Input>
                                 </FormItem>
                                 <!-- 问卷题目区域 -->
                                 <FormItem label="问卷题目" prop="items">
@@ -196,7 +200,7 @@
                                                 </div>
                                             </div>
                                         </div>
-                                        <EmptyData v-show="!trainInfo.quItems" textContent="请添加问卷题目"></EmptyData>
+                                        <EmptyData v-show="!trainInfo.quItems" textContent="请添加评测题目"></EmptyData>
                                     </div>
                                     <Button type="info" @click="toAddQu">
                                         <Icon type="md-add" />
@@ -589,17 +593,6 @@ export default {
             if (this.trainInfo.setting.includes('hw')) {
                 this.beginSaveHw(workId)
             }
-
-            let t = []
-            this.teachers.forEach(item => {
-                if ((this.baseInfo.target.includes('默认分组') && !item.groupName) || this.baseInfo.target.includes(item.groupName)) {
-                    t.push({
-                        id: item.id,
-                        name: item.name,
-                        groupName: item.groupName
-                    })
-                }
-            })
             let params = {
                 name: this.trainInfo.topic,
                 school: this.$store.state.userInfo.schoolCode,
@@ -608,7 +601,6 @@ export default {
                 type: this.baseInfo.type,
                 targets: this.baseInfo.target,
                 tchLists: this.baseInfo.target,
-                teachers: t,
                 scope: 'school',
                 hour: this.baseInfo.hour,
                 startTime: this.trainInfo.startTime,

+ 1 - 0
TEAMModelOS/ClientApp/src/view/vote/ManageVote.less

@@ -14,6 +14,7 @@
     display: flex;
     flex-direction: column;
 	background-color: #fff;
+	font-family: 'ALI';
 	// font-family: 'NotoSerif', '微软正黑体', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Sans-serif;
 	
 	.hw-header{