Merge branch 'third' into preview

This commit is contained in:
daihh
2022-12-28 16:50:45 +08:00
4 changed files with 205 additions and 73 deletions

View File

@@ -0,0 +1,42 @@
/**我的授课记录*/
import ajax from '@/api/boe/boeApiAjax.js'
import axios from 'axios'
import { getToken } from '@/utils/token'
const baseURL = process.env.VUE_APP_BOE_BASE_API;
/**
* 导出授课记录
*
* @param {Object} kid
*/
const courseRecordExport = function(data) {
return axios.request({
baseURL,
url: '/b1/system/teacher/teacher-course-export',
method: 'post',
data:data,
headers:{'Content-Type':'application/json;charset=utf-8'},
responseType: 'blob'
})
// return ajax.postJson('/b1/system/teacher/teacher-course-export',data);
}
/**
* 授课记录列表
*
* @param {Object} kid
*/
const courseRecordList = function(data) {
return ajax.postJson('/b1/system/teacher/teacher-course-list',data);
}
export default {
courseRecordExport,
courseRecordList
}

View File

@@ -156,6 +156,29 @@ export function formatDate(date){
}
export function formatDateByFmt(date,fmt) {
if(/(y+)/.test(fmt)){
fmt = fmt.replace(RegExp.$1,(date.getFullYear()+'').substr(4-RegExp.$1.length));
}
let o = {
'M+':date.getMonth() + 1,
'd+':date.getDate(),
'h+':date.getHours(),
'm+':date.getMinutes(),
's+':date.getSeconds()
};
// 遍历这个对象
for(let k in o){
if(new RegExp(`(${k})`).test(fmt)){
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1,(RegExp.$1.length===1)?str:('00'+str).substr(str.length));
}
}
return fmt;
}
/**
* 把日期格式化为显示时间yyyy-MM-dd
* @param {Object} date

View File

@@ -1,104 +1,165 @@
<template>
<div style="padding: 12px 32px 10px 12px;">
<div style="display: flex;justify-content: flex-start;">
<div style="margin-left:10px"><el-input placeholder="名称关键字" clearable></el-input></div>
<div style="padding-left: 10px;"><el-button type="primary" icon="el-icon-search">搜索</el-button></div>
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" type="primary" >重置</el-button></div>
<div><el-input v-model="keyword" placeholder="输入课程名称搜索" clearable></el-input></div>
<div style="padding-left: 10px;"><el-button @click="recordList()" type="primary" icon="el-icon-search">搜索</el-button></div>
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" @click="keyword = ''" type="primary" >重置</el-button></div>
<div style="padding: 0px 5px;"><el-button type="primary" @click="exportFile()" icon="el-icon-search" size="small" round>导出</el-button></div>
</div>
<div class="Export">
<div style="padding-left: 10px;"><el-button type="primary" icon="el-icon-search" size="small" round>导出</el-button></div>
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" type="primary" size="small" round>导出学员信息</el-button></div>
<!-- <div style="padding-left: 10px;"><el-button type="primary" @click="exportFile()" icon="el-icon-search" size="small" round>导出</el-button></div> -->
<!-- <div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" type="primary" size="small" round>导出学员信息</el-button></div> -->
</div>
<div style="margin-top:20px;">
<el-table :data="pageData" border stripe>
<el-table-column
label="课程时间"
prop="time"
<el-table-column
label="课程时间"
prop="courseTime"
width="200px">
</el-table-column>
<el-table-column
label="课程名称"
prop="courseName"
<el-table-column
label="课程名称"
prop="courseName"
width="200px">
</el-table-column>
<el-table-column
label="开课场地"
prop="sysType"
<el-table-column
label="开课场地"
prop="address"
width="240px">
</el-table-column>
<el-table-column
label="所属课程"
prop="status"
<el-table-column
label="所属课程"
prop="parentCourse"
width="120px">
</el-table-column>
<el-table-column
label="所属项目"
prop="courseUser"
<el-table-column
label="所属项目"
prop="parentProject"
></el-table-column>
<el-table-column
label="所属路径"
prop="auditTime"
width="200px"
<el-table-column
label="所属路径"
prop="parentRoute"
width="200px"
></el-table-column>
<el-table-column
label="学习总人数"
prop="auditRemark"
<el-table-column
label="学习总人数"
prop="studentNumber"
width="100px"
></el-table-column>
<el-table-column
label="时长(分钟)"
width="100px"
prop="studynum"
></el-table-column>
<el-table-column
label="评分"
<el-table-column
label="时长(分钟)"
width="100px"
prop="pf"
prop="period"
></el-table-column>
<el-table-column
label="评分"
width="100px"
prop="score"
></el-table-column>
<el-table-column
label="操作"
<!-- <el-table-column
label="操作"
align="center"
width="110px"
width="150px"
prop="cz"
fixed="right"
></el-table-column>
>
<template v-slot="scope">
<el-button type="primary" size="small">导出学员信息</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
<div style="text-align: center; margin-top:57px">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageInfo.page"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageInfo.total"
></el-pagination>
</div>
</div>
</template>
<script>
import apiCourse from '../../api/boe/courseRecord.js';
import { mapGetters } from 'vuex';
export default {
data(){
return {
pageData:[{
time:'2022-10-30 13:00:00',
courseName:'时间管理',
sysType:'核心能力大楼培训',
status:'管理者课程',
courseUser:'管理者进阶-腾飞班K1',
auditTime:'产品经理路径管理',
auditRemark:'35',
studynum:'120',
pf:'4.5',
cz:'导出学员信息'
},
{
time:'2022-10-30 13:00:00',
courseName:'时间管理',
sysType:'核心能力大楼培训',
status:'管理者课程',
courseUser:'管理者进阶-腾飞班K1',
auditTime:'产品经理路径管理',
auditRemark:'35',
studynum:'120',
pf:'4.5',
cz:'导出学员信息'
}
]
pageData:[],
keyword:'',
pageInfo:{},
}
}
},
mounted() {
this.recordList(1);
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
exportFile(){
let req = {
teacherId: this.userInfo.sysId
// teacherId:"70F80F4E-34BA-10AB-894A-8FA812B19637"
}
apiCourse.courseRecordExport(req).then(res=>{
const link = document.createElement('a');// 创建a标签
let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); // 设置文件类型
link.style.display = "none";
link.href = URL.createObjectURL(blob); // 创建URL
link.setAttribute("download", "授课记录.xls");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
},
recordList(pageIndex){
let req = {
//     teacherId:"70F80F4E-34BA-10AB-894A-8FA812B19637",
teacherId: this.userInfo.sysId,
keyword:this.keyword,
    page:pageIndex,
    pageSize:10
}
apiCourse.courseRecordList(req).then(res=>{
if(res.status == 200) {
this.pageData = res.result.list;
this.pageInfo = res.result.pageInfo;
} else {
this.$message({
type: 'error',
message: res.message
});
}
})
},
// 每页显示的条数事件
handleSizeChange(val){
this.pageInfo.pageSize = val;
this.recordList(1);
},
// 显示制定页的数据
handleCurrentChange(val){
this.pageInfo.pageIndex = val;
this.recordList(this.pageInfo.pageIndex);
},
},
}
</script>
@@ -107,4 +168,4 @@ export default {
display: flex;
padding-top: 10px;
}
</style>
</style>

View File

@@ -101,7 +101,7 @@
<div class="couresstartTime">
<div v-if="cinfo.type == 30">
<span v-if="startTime">授课时间{{ cinfo.startTime }}</span>
<span v-if="cinfo.startTime">授课时间{{ cinfo.startTime }}</span>
</div>
</div>
@@ -321,7 +321,7 @@ import scene from "@/api/modules/scene.js";
import apiUserGroup from "@/api/modules/usergroup.js";
import interactBar from "@/components/Portal/interactBar.vue";
import courseImage from "@/components/Course/courseImage.vue";
import { courseType, getType, toScore,formatDate,formatUserNumber } from "@/utils/tools.js";
import { courseType, getType, toScore,formatDate,formatUserNumber,formatDateByFmt } from "@/utils/tools.js";
import { deepClone, param } from "../../../utils";
import apiSearchterm from "@/api/modules/searchterm.js";
import apiPlace from "@/api/phase2/place.js"
@@ -564,7 +564,7 @@ export default {
row.checked=false;
})
item.checked=true;
this.searchData();
},
handleOptionClick(item,list){
@@ -806,6 +806,11 @@ export default {
}
},
async search() {
//测试时间格式化
// let s=1650973801;
// var d = new Date(1650973801*1000);
// console.log(formatDateByFmt(d,'yyyy-MM-dd hh:mm'),'data');
let that = this;
if (this.keyword) {
apiSearchterm.save({ keyword: this.course.keyword, type: 1 });
@@ -857,9 +862,10 @@ export default {
res.result.list.forEach(item => {
// item.startTime
if(item.startTime != '') {
let time = item.startTime.split('-');
item.startTime = `${time[0]}${time[1]}${time[2]}`
}
item.startTime=formatDateByFmt(new Date(item.startTime*1000),'yyyy-MM-dd hh:mm')
//let time = item.startTime.split('-');
//item.startTime = `${time[0]}年${time[1]}月${time[2]}日`
}
//教师转化
if(item.teacher){
let dotIdx=item.teacher.indexOf(',');