DBSD_ZJPT/jeecgboot-vue3/src/views/bl/kcKetangbiao/wdyy.vue

230 lines
8.0 KiB
Vue

<template>
<a-row style="margin-top:20px;">
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 4 }">
<a-form-item label="" style="padding: 10px;">
<a-date-picker :showTime="false" valueFormat="YYYY-MM-DD" :placeholder="'请选择结束时间'" style="width:100%;" v-model:value="queryParam.ywTime"></a-date-picker>
</a-form-item>
</a-col>
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 4 }">
<a-form-item label="" style="padding: 10px;">
<JDictSelectTag placeholder="课程性质" v-model:value="queryParam.kcxz" dictCode="kcxz" />
</a-form-item>
</a-col>
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 4 }">
<a-form-item label="" style="padding: 10px;">
<a-select placeholder="请选择教学楼" v-model:value="queryParam.jzwh">
<a-select-option :value="undefined">全部</a-select-option>
<a-select-option :value="`0106`">逸夫教学楼</a-select-option>
<a-select-option :value="`0295`">净月综合教学楼</a-select-option>
<a-select-option :value="`0108`">惟真楼</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 5 }">
<a-form-item label="" style="padding: 10px;">
<a-input placeholder="请输入课程或教师名称" v-model:value="queryParam.ywmc" ></a-input>
</a-form-item>
</a-col>
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 5 }">
<a-form-item label="" style="padding: 10px;">
<a-button type="primary" @click="loadData(1)">查询</a-button>
</a-form-item>
</a-col>
</a-row>
<a-row class="rowGutter" :gutter="[16, 16]">
<a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 6 }" v-for="(item, index) in listData" :key="index" style="margin-bottom: 0;">
<itemPage :data="item" @to-live-page="toLivePage" @funpingjia="funpingjia" @ok="handleSuccess"></itemPage>
</a-col>
<a-col :span="25" style="line-height: 50px;">
<div v-show="1 == pageNo && current > 0 && total > 4">
<div style="text-align: center;"><a @click="funMore">更多...</a></div>
</div>
<div v-show="current==0">
<div style="text-align: center;"><a @click="funMore">暂无课堂</a></div>
</div>
<div v-show="1 < pageNo && pageNo < current">
<div style="text-align: center;"><a @click="funMore">更多...</a></div>
<div style="text-align: right;margin-top: -51px;"><a @click="funShouqi">收起</a></div>
</div>
<!-- <div v-show="current == pageNo">
<div style="text-align: center;"><a @click="funShouqi">收起</a></div>
</div> -->
</a-col>
</a-row>
<viewPageModal ref="viewPageModalPage"></viewPageModal>
</template>
<script lang="ts" setup>
import { ref,watch,reactive,defineExpose,onMounted, createVNode,h } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { addTingKeLog, getUserId } from '/@/views/site/utils/index';
import itemPage from './itemPage.vue';
import { useRouter } from 'vue-router'
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { Modal } from 'ant-design-vue';
import { CloseOutlined } from '@ant-design/icons-vue';
import viewPageModal from '/@/views/bl/kcKetangbiao/video/videojs/viewPageModal.vue'
import {getSysConfig } from '/@/views/site/utils/index';
//用户相关
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const route = useRouter();
const viewPageModalPage = ref();
const pageNo = ref<number>(1);
const current = ref<number>(0);
const total = ref<number>(0);
const emit = defineEmits(['setTotal']);
const { createMessage } = useMessage();
const confirmLoading = ref<boolean>(false);
let listData = ref<any>([]);
let listType = ref<any>(String);
const list = (params) => defHttp.get({ url: '/kcKetangbiao/kcKetangbiao/getYylist', params });
const jclist = (queryParam) => defHttp.get({ url: '/kcJieci/kcJieci/getIndexJcList', params:queryParam });
const listTkjlApi = (params) => defHttp.get({ url: '/kcTingke/kcTingke/findTingKeZuJiBytingketimeAndUserId', params });
const queryParam = ref<any>({});
//进入就加载
onMounted(() => {
jclist(queryParam.value).then(res=>{
var list = res
queryParam.value.ywTime = list[0].kssj
// queryParam.value.jieci = list[1].jieci
loadData(1)
})
});
function handleSuccess(){
loadData(1)
}
//查询数据
function loadData(num?) {
if(num == 1){
pageNo.value = 1
listData.value = [];
}
queryParam.value.pageSize = '4'
queryParam.value.pageNo = pageNo
queryParam.value.sfyzhjs = '1'
// queryParam.value.hh = queryParam.value.jieci+","+queryParam.value.jieci.split("、").join(',')
if(queryParam.value.jieci){
queryParam.value.hh = queryParam.value.jieci+","+queryParam.value.jieci.split("、").join(',')
}
queryParam.value.skrq = queryParam.value.ywTime
queryParam.value.userid = getUserId()
queryParam.value.skxs = 1
queryParam.value.type = 1
queryParam.value.sftkb = 1
queryParam.value.sfyy = 1
console.log(`🚀 ~ file: index.vue:112 ~ rkbLoadData ~ newRow:`, queryParam)
if(queryParam.value.hh!=","){
list(queryParam.value).then(res => {
// console.log(`🚀 ~ file: index.vue:104 ~ list ~ res:`, res)
listData.value.push(...res.records)
current.value = res.pages
total.value = res.total
console.log(`🚀 ---------------------------------------------🚀`);
console.log(`🚀 ~ file: rkb.vue:132 ~ list ~ total:`, total.value);
console.log(`🚀 ---------------------------------------------🚀`);
// listData.value = res.records;
// console.log(`🚀 ~ file: kclbList.vue:113 ~ list ~ listData.value:`, listData.value)
})
}
}
function funpingjia(record){
var item = {ketangbiaoid:record.id}
let userid = getUserId();
listTkjlApi({ userid: userid, ketangbiaoid:item.ketangbiaoid}).then(res => {
var list = res
console.log(`🚀 ~ file: list.vue:106 ~ listTkjlApi ~ list:`, list)
if(list.length>0){
var score = list[0].score
if(score){
Modal.error({
icon: createVNode({}),
content: h('div', {style:'height:200px;text-align:center;'}, [
h('icon', {style:'font-size:80px;font-weight:600;color:red;'}, createVNode(CloseOutlined)),
h('p',{style:'font-size:22px;font-weight:600;color:black;'}, '已经对此课程进行评价,不可重复评价!'),
]),
okText: 'OK',
width:'500px',
});
}else{
}
}else{
}
});
}
/**
* 公开课收起
*/
function funShouqi(){
listData.value = []
pageNo.value = 1
loadData()
}
/**
* 加载更多公开课
*/
function funMore(){
console.log(`🚀 ~ file: index.vue:83 ~ funMore ~ current>pageNo:`, current,pageNo)
if(current.value > pageNo.value){
pageNo.value ++;
loadData()
}else{
createMessage.error("没有更多数据了!");
}
}
/**
* 听课按钮
* @param item
*/
function toLivePage(item){
viewPageModalPage.value.disableSubmit = true
viewPageModalPage.value.edit(item);
// //添加听课日志
// addTingKeLog(getUserId(),item.id);
// let routeData = route.resolve({ path:'/video/index',query:{ id: item.jsbh, ktId: item.id } });
// window.open(routeData.href, '_blank');
};
enum Api {
list = '/kcYuyue/kcYuyue/list',
save='/kcYuyue/kcYuyue/add',
edit='/kcYuyue/kcYuyue/edit',
deleteOne = '/kcYuyue/kcYuyue/delete',
deleteBatch = '/kcYuyue/kcYuyue/deleteBatch',
importExcel = '/kcYuyue/kcYuyue/importExcel',
exportXls = '/kcYuyue/kcYuyue/exportXls',
}
defineExpose({
loadData
});
//提交报错信息
const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
console.log(`🚀 ~ file: kclbList.vue:107 ~ saveOrUpdate ~ url:`, url)
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}
</script>
<style lang="less" scoped>
</style>