Commit 846f145c authored by 黄奎's avatar 黄奎

页面修改

parent 0b280102
......@@ -60,6 +60,42 @@ export function UploadSelfFile(path, file, callback, configObj) {
}
}
/**
* 上传到当前站点
*/
export function UploadLocalSystem(configObj,fileObj,successCall)
{
var uploadLoadding = Loading;
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
let url = process.env.API + "/Upload/UploadFile";
let formData = new FormData()
if(configObj)
{
formData.append("params",configObj);
}
formData.append('myfile', fileObj)
let xhr = new XMLHttpRequest()
xhr.onload = function () {
uploadLoadding.hide();
var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode == 1 && successCall) {
var uploadResult = {
Code: 1,
FileName: fileObj.name,
FileUrl: process.env.API + jsonObj.FilePath,
VideoCoverImg: process.env.API + jsonObj.VideoCoverImg,
}
if (successCall) {
successCall(uploadResult);
}
}
}
xhr.open('post', url, true)
xhr.send(formData)
}
/**
* 上传文件到本地文件系统
*/
......
......@@ -213,3 +213,25 @@ export function querySaleplatList() {
data: {}
})
}
/**
* 新增修改课程作业
*/
export function SaveCourseJobInfo(data) {
return request({
url: "/Course/SetCourseJob",
method: 'post',
data
})
}
/**
* 获取课程作业分页列表
*/
export function queryCourseJobPageList(data) {
return request({
url: "/Course/GetCourseJobPageList",
method: 'post',
data
})
}
<template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.CourseId==0?'新增作业信息':'修改作业信息'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.JobName" ref="JobName"
class="col-6 q-pr-lg q-pb-lg" label="作业名称" :rules="[val => !!val || '请填写作业名称']" />
</div>
<div class="row wrap">
<span>
作业类型
<q-radio v-model="objOption.JobType" :val="0" label="题目型作业" />
<q-radio v-model="objOption.JobType" :val="1" label="答题卡作业" />
</span>
</div>
<div class="row wrap">
<span>
评分机制
<q-radio v-model="objOption.ScoreType" :val="1" label="百分制(平均分配每道题的分值)" />
<q-radio v-model="objOption.ScoreType" :val="2" label="百分制(平均分配每道题的分值)" />
</span>
</div>
<div class="row wrap">
<span>
题型设置
<q-radio v-model="objOption.TopicType" :val="1" label="按题型归类" />
<q-radio v-model="objOption.TopicType" :val="2" label="不按题型归类" />
</span>
</div>
<el-upload class="avatar-uploader" action="" :show-file-list="false" :http-request="UploadAttachment">
<div class="app-upload" flex="main:center cross:center" style="width: 100px; height: 100px;">
<i class="el-icon-upload"></i>
</div>
</el-upload>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
@click="saveCourse" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
queryCourseCategoryTree,
saveCourseInfo,
queryCourseInfo,
querySaleplatList,
} from '../../api/course/index'
import {
getTeacherDropDownList,
} from '../../api/school/index'
import {
UploadSelfFile,
UploadLocalSystem
} from '../../api/common/common'
import selectTree from '../common/select-tree'
import extEditor from '../common/ext-editor'
export default {
components: {
selectTree,
extEditor,
},
props: {
saveObj: {
type: Object,
default: null
},
CourseId: {
type: String,
default: ""
}
},
data() {
return {
persistent: true,
objOption: {
JobId: 0, //作业编号
CourseId: 0, //课程编号
JobName: "", //作业名称
JobType: 0, //作业类型(0-题目型作业,1-答题卡作业)
ScoreType: 1, //评分机制(1-百分制,2-自定义)
TopicType: 1, //题型设置(1-按题型归类,2-不按题型归类)
},
optionTitle: "",
defaultArray: [],
ladderPriceList: [], //阶梯定价数组
saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
TeacherList: [], //关联教师下拉数据
SaleplatList: [], //销售端口
choosePlat: [], //选择的平台
chooseTeacher: [], //选择老师
}
},
created() {
console.log("this.saveObj", this.saveObj);
this.GetTeacherList();
this.getSaleplat();
},
mounted() {
this.getCategorytree();
this.initObj()
},
methods: {
UploadAttachment(files) {
var fileParams = {
Excel: 1,
Analysis: 1,
CourseId: this.CourseId
}
UploadLocalSystem(JSON.stringify(fileParams), files.file, res => {
console.log("res", res);
})
},
//获取教师下拉
GetTeacherList() {
getTeacherDropDownList({}).then(res => {
if (res.Code == 1) {
this.TeacherList = res.Data;
var obj = {
TeacherName: '请选择',
TId: 0
}
this.TeacherList.unshift(obj);
}
})
},
//获取销售端口列表
getSaleplat() {
querySaleplatList().then(res => {
this.SaleplatList = res.Data;
})
},
//获取编辑器值
getEditValue(obj) {
this.objOption.CourseIntro = obj;
},
getChild(obj) {
if (obj == "") {
this.objOption.CateId = 0;
} else {
this.objOption.CateId = obj;
}
},
uploadFile(files) {
UploadSelfFile('course', files[0], res => {
if (res.Code == 1) {
this.objOption.CoverImg = res.FileUrl;
}
})
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {}
queryCourseCategoryTree(qMsg).then(res => {
this.TreeCategoryList = res.Data;
})
},
//新增阶梯定价
addStepPrice() {
var obj = {
ClassStepPriceId: 0,
PersionNum: 2,
PersionPrice: 0
}
if (this.ladderPriceList && this.ladderPriceList.length > 0) {
var _index = this.ladderPriceList.length - 1;
obj.PersionNum = parseInt(this.ladderPriceList[_index].PersionNum) + 1;
}
this.ladderPriceList.push(obj);
},
//删除阶梯定价
delStepPrice(index) {
this.ladderPriceList.splice(index, 1);
},
//初始化表单
initObj() {
this.defaultArray = [];
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
}).then(res => {
this.objOption.CourseId = res.Data.CourseId;
this.objOption.CoverImg = res.Data.CoverImg;
this.objOption.CourseName = res.Data.CourseName;
this.objOption.CourseIntro = res.Data.CourseIntro;
this.objOption.CateId = res.Data.CateId;
this.objOption.School_Id = res.Data.School_Id;
this.objOption.Teacher_Ids = res.Data.Teacher_Ids;
this.objOption.CourseFeature = res.Data.CourseFeature;
this.objOption.OriginalPrice = res.Data.OriginalPrice;
this.objOption.SellPrice = res.Data.SellPrice;
this.objOption.IsOpenStepPrice = res.Data.IsOpenStepPrice;
this.objOption.IsRenew = res.Data.IsRenew;
this.objOption.RenewOgPrice = res.Data.RenewOgPrice;
this.objOption.RenewSlPrice = res.Data.RenewSlPrice;
this.objOption.Saleplat = res.Data.Saleplat;
this.objOption.IsKCourse = res.Data.IsKCourse;
if (res.Data.StepPriceList && res.Data.StepPriceList.length > 0) {
this.ladderPriceList = res.Data.StepPriceList;
}
if (res.Data.TeacherIdList && res.Data.TeacherIdList.length > 0) {
this.chooseTeacher = res.Data.TeacherIdList;
}
if (res.Data.SalePlatList && res.Data.SalePlatList.length > 0) {
this.choosePlat = res.Data.SalePlatList;
}
this.defaultArray.push(res.Data.CateId);
})
this.optionTitle = "修改课程信息"
} else {
this.optionTitle = "新增课程"
this.objOption.CourseId = 0;
this.objOption.CoverImg = "";
this.objOption.CourseName = "";
this.objOption.CourseIntro = "";
this.objOption.CateId = 0;
this.objOption.School_Id = 0;
this.objOption.Teacher_Ids = "";
this.objOption.CourseFeature = "";
this.objOption.OriginalPrice = 0;
this.objOption.SellPrice = 0;
this.objOption.IsOpenStepPrice = 0;
this.objOption.IsRenew = 0;
this.objOption.RenewOgPrice = 0;
this.objOption.RenewSlPrice = 0;
this.objOption.Saleplat = "";
this.objOption.IsKCourse = 0;
}
},
//关闭弹窗
closeCourseForm() {
this.$emit('close')
this.persistent = false
},
//保存菜单
saveCourse() {
this.saveCourseLoading = true;
var Teacher_Ids = "";
if (this.chooseTeacher && this.chooseTeacher.length > 0) {
this.chooseTeacher.forEach(item => {
Teacher_Ids += "," + item;
})
}
if (Teacher_Ids != '') {
Teacher_Ids = Teacher_Ids.substring(1);
}
var salePlat = "";
if (this.choosePlat && this.choosePlat.length > 0) {
this.choosePlat.forEach(item => {
salePlat += "," + item;
});
}
if (salePlat != '') {
salePlat = salePlat.substring(1);
}
this.objOption.StepPriceList = this.ladderPriceList;
this.objOption.Teacher_Ids = Teacher_Ids;
this.objOption.Saleplat = salePlat;
saveCourseInfo(this.objOption).then(res => {
this.saveCourseLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveCourseLoading = false
})
}
},
}
</script>
......@@ -37,14 +37,14 @@
</div>
<br />
<!--单选题-->
<single v-if="questionObj.Key=='single'" :questionData="AnswerList" @getChild="getChildData"></single>
<single v-if="questionObj.Key=='single'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></single>
<!--多选题-->
<multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"></multiple>
<multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></multiple>
<!--填空题-->
<fill-in v-if="questionObj.Key=='fill-in'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></fill-in>
<!--判断题-->
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"></judge>
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></judge>
<!--简答题、名词解释、论述题、计算题、口语题、其它-->
<short-answer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other'
......@@ -231,7 +231,7 @@
//获取子组件内容
getChildData(obj) {
if (obj) {
this.objOption.Answer = JSON.stringify(obj);
this.objOption.QuestionContent = JSON.stringify(obj);
}
},
//题型点击
......@@ -283,8 +283,8 @@
this.objOption.IsMutex = res.Data.IsMutex;
this.questionObj.Key = res.Data.QuestionTypeKey;
this.questionObj.QId = res.Data.QuestionTypeId;
if (res.Data.AnswerObj) {
this.AnswerList = res.Data.AnswerObj;
if (res.Data.QuestionContentObj) {
this.AnswerList = res.Data.QuestionContentObj;
} else {
this.onItemClick(this.questionObj);
}
......
......@@ -52,6 +52,7 @@
})
}
item.IsAnswer = true;
this.setOption.Answer=item.Name;
},
},
mounted() {
......
......@@ -35,6 +35,9 @@
props: {
questionData: {
type: Array,
},
setOption: {
type: Object,
}
},
components: {
......@@ -91,6 +94,18 @@
},
//返回数据到父组件
returnDataToParent() {
if (this.data && this.data.length > 0) {
var answer = "";
this.data.forEach(item => {
if (item.IsAnswer) {
answer += "," + item.Name;
}
})
if (answer != "") {
answer = answer.substring(1);
}
this.setOption.Answer = answer;
}
this.$emit('getChild', this.data);
},
},
......
......@@ -35,6 +35,9 @@
props: {
questionData: {
type: Array,
},
setOption: {
type: Object,
}
},
components: {
......@@ -100,6 +103,7 @@
})
}
item.IsAnswer = true;
this.setOption.Answer=item.Name;
},
},
mounted() {
......
......@@ -206,7 +206,7 @@
$route: {
handler: function (route) {
var newPath = route.path.split("?")[0].toLowerCase();
this.IsShowLeft=false;
this.IsShowLeft = false;
switch (newPath) {
case "/course/chapter":
this.IsShowLeft = true;
......@@ -220,6 +220,9 @@
case "/course/courseinfo":
this.IsShowLeft = true;
break;
case "/course/coursejob":
this.IsShowLeft = true;
break;
}
this.currentPath = route.path
},
......
......@@ -4,51 +4,36 @@
<div class="col row wrap q-mr-lg q-col-gutter-md">
</div>
<div class="page-option">
<q-btn-dropdown outline color="dark" label="添加教案">
<q-list>
<q-item clickable v-close-popup>
<q-item-section>
<q-item-label @click="EditTeachPlan(null)">编辑章节</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="编辑章节" @click="EditChapter(null)" />
</div>
</div>
<div class="page-content">
<div class="q-table-container q-table-dense">
<!-- <q-sortable-tree :nodes="data"
node-key="id"
label-key="name"
no-connectors
:default-expand-all="true"/> -->
<div class="q-table-middle scroll">
<table class="q-table">
<thead>
<tr class style="text-align: left;">
<th>目录</th>
<th>开发状态</th>
<th>进度</th>
</tr>
</thead>
<tbody>
<tr v-for="(item ,index) in (data)" :key="index"
v-bind:class="[(item.ChapterId != selectedRowID.ChapterId) ? 'my-label':'text-green bg-light-green-11','']">
<td data-th="Name" @click="toggle(item, index)">
<span class="q-tree-link q-tree-label" v-bind:style="setPadding(item)">
<q-icon style="cursor: pointer;" :name="iconName(item)" color="secondary"></q-icon>
{{item.ChapterName}}
</span>
</td>
<td width="20%" data-th="Account">{{item.niif_account}} </td>
<td width="10%" data-th="Actions">
<q-btn dense flat color="blue" icon="add_circle"></q-btn>
</td>
</tr>
</tbody>
</table>
</div>
<el-table :data="data" style="width: 100%;margin-bottom: 20px;" row-key="ChapterId" border default-expand-all
:tree-props="{children: 'ChildList'}">
<el-table-column prop="ChapterName" label="目录">
<template slot-scope="scope">
<span>{{scope.row.ChapterNo}} {{scope.row.ChapterName}}</span>
</template>
</el-table-column>
<el-table-column prop="OpenStatus" label="开发状态" width="200">
<template slot-scope="scope" v-if="scope.row.OpenStatus==1||scope.row.OpenStatus==2">
<span>开放</span>
</template>
</el-table-column>
<el-table-column prop="Progress" label="进度" width="200">
<template slot-scope="scope">
<q-linear-progress stripe size="10px" :value="scope.row.Progress/100.0" />
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<a>编辑</a>
&nbsp;
<a>设置</a>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
......@@ -62,25 +47,16 @@
export default {
meta: {
title: "教案管理"
title: "章节管理"
},
components: {
},
computed: {
arrayTreeObj() {
let vm = this;
var newObj = [];
vm.recursive(vm.table, newObj, 0, vm.itemId, vm.isExpanded);
return newObj;
}
},
watch: {
selectedIDRow: function (val) {
if (this.selectedRowID != null) {
this.$set(this.selectedRowID, "id", val);
}
}
},
data() {
return {
......@@ -105,66 +81,9 @@
this.getchaperTree();
},
methods: {
recursive(obj, newObj, level, itemId, isExpend) {
let vm = this;
obj.forEach(function (o) {
if (o.ChildList && o.ChildList.length != 0) {
o.level = level;
o.leaf = false;
newObj.push(o);
if (o.ChapterId == itemId) {
o.expend = isExpend;
}
if (o.expend == true) {
vm.recursive(o.ChildList, newObj, o.level + 1, itemId, isExpend);
}
} else {
o.level = level;
o.leaf = true;
newObj.push(o);
return false;
}
});
},
iconName(item) {
if (item.expend == true) {
return "remove_circle_outline";
}
if (item.ChildList && item.ChildList.length > 0) {
return "control_point";
}
return "done";
},
toggle(item, index) {
let vm = this;
vm.itemId = item.id;
item.leaf = false;
//show sub items after click on + (more)
if (
item.leaf == false &&
item.expend == undefined &&
item.ChildList != undefined
) {
if (item.ChildList.length != 0) {
vm.recursive(item.ChildList, [], item.level + 1, item.id, true);
}
}
//新增修改章节
EditChapter(obj) {
if (item.expend == true && item.ChildList != undefined) {
var __subindex = 0;
item.ChildList.forEach(function (o) {
o.expend = undefined;
});
vm.$set(item, "expend", undefined);
vm.$set(item, "leaf", false);
vm.itemId = null;
}
},
setPadding(item) {
return `padding-left: ${item.level * 30}px;`;
},
//获取菜单分页列表
getchaperTree() {
......
......@@ -91,13 +91,16 @@
<li :class="{'checkedLi':commonIndex==3}" @click="gotoPage('chapter',3)">
<i class="iconfont icon-icon_zhangjielianxi"></i>章节
</li>
<li :class="{'checkedLi':commonIndex==4}" @click="gotoPage('coursejob',4)">
<i class="iconfont icon-icon_zhangjielianxi"></i>作业
</li>
</ul>
</div>
</q-list>
</div>
</div>
<div class="col" style="background: #f2f4f7;">
<q-scroll-area class="fit" :thumb-style="thumbStyle" :bar-style="barStyle" visible style="">
<q-scroll-area class="fit" :thumb-style="thumbStyle" :bar-style="barStyle" visible>
<router-view style="margin:20px" />
</q-scroll-area>
</div>
......@@ -133,7 +136,26 @@
}
},
watch: {
$route: {
handler: function (route) {
var newPath = route.path.split("?")[0].toLowerCase();
switch (newPath) {
case "/course/chapter":
this.commonIndex = 3;
break;
case "/course/question":
this.commonIndex = 1;
break;
case "/course/teachplan":
this.commonIndex = 2;
break;
case "/course/courseinfo":
this.commonIndex = 1;
break;
}
},
immediate: true
}
},
computed: {
......
<style>
.page-content p {
margin: 16px 0 0 0 !important;
}
</style>
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @change="getCourseJobList" clearable standout="bg-primary text-white" v-model="msg.JobName"
label="作业名称" @clear="getCourseJobList" maxlength="20" />
</div>
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="data" :columns="columns" row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">作业列表</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增作业" @click="EditQuestion(null)" />
</div>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditQuestion(props.row)" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="删除"
@click="setQuestionStatus(props.row)"></q-btn>
</q-td>
</template>
</q-table>
<job-form v-if="isShowCourseJobForm" :CourseId="msg.CourseId" :seting-obj="courseJobObj" @close="closeQuestion"
@success="refreshQuestion">
</job-form>
</div>
</div>
</template>
<script>
import {
queryCourseJobPageList
} from '../../api/course/index';
import jobForm from '../../components/course/job-form';
export default {
meta: {
title: "作业管理"
},
components: {
jobForm
},
data() {
return {
columns: [{
name: 'JobName',
label: '作业名称',
field: 'JobName',
align: 'left'
},
{
name: 'CreateByName',
label: '创建者',
field: 'CreateByName',
align: 'left'
},
{
name: 'CreateTimeStr',
label: '创建时间',
field: 'CreateTimeStr',
align: 'left'
},
{
name: 'optioned',
label: '操作',
field: 'JobId'
}
],
data: [],
loading: false,
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
CourseId: 0,
JobName: "", //作业名称
},
pageCount: 0,
isShowCourseJobForm: false,
courseJobObj: null,
}
},
created() {
if (this.$route.query) {
this.msg.CourseId = this.$route.query.CourseId
}
},
mounted() {
this.getCourseJobList();
},
methods: {
//删除问题
setQuestionStatus(item) {
this.$q.dialog({
title: "删除问题",
message: "你正在进行删除问题行为,一旦执行无法找回,是否确认执行?",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
deleteQuestion({
QuestionId: item.QuestionId
}).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '删除成功!',
position: 'top'
})
this.getCourseJobList();
} else {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
})
}
});
});
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getCourseJobList()
},
//获取问题分页列表
getCourseJobList() {
this.loading = true;
queryCourseJobPageList(this.msg).then(res => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}).catch(() => {
this.loading = false
})
},
//刷新页面
refreshQuestion() {
this.isShowCourseJobForm = false;
this.getCourseJobList();
},
//新增修改问题
EditQuestion(obj) {
if (obj) {
this.courseJobObj = obj
} else {
this.courseJobObj = null
}
this.isShowCourseJobForm = true
},
//关闭弹窗
closeQuestion() {
this.isShowCourseJobForm = false;
this.courseJobObj = null;
},
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass');
</style>
......@@ -449,6 +449,11 @@ const routes = [{
component: () =>
import("pages/course/question.vue")
},
{
path: "/course/coursejob", //作业管理
component: () =>
import("pages/course/coursejob.vue")
},
]
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment