226 lines
8.3 KiB
Vue
226 lines
8.3 KiB
Vue
<template>
|
|
<div>
|
|
<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: 40px;">
|
|
<div style="border: 2px #eef1f2 solid;">
|
|
<div>
|
|
<div style="width: 100%;height: 20px;background-color: #1c84c6;"></div>
|
|
<div style="width:100%;white-space:normal; word-break:break-all;overflow:hidden;padding: 10px;height: 70px;font-weight: 600;font-size: 16px;">
|
|
{{ item.kcmc }}
|
|
</div>
|
|
</div>
|
|
<a-divider style="margin: 0px;color: #eef1f2;" />
|
|
<div style="padding: 20px;font-weight: 600;">
|
|
<a-row>
|
|
<a-col :span="16">
|
|
<div style="height: 30px;font-size: 16px;">{{ item.skjs }}</div>
|
|
<div style="height: 30px;font-size: 14px;">{{ item.kkdw }}</div>
|
|
</a-col>
|
|
<a-col :span="8" style="text-align: center;height: 70px;">
|
|
<div style="color: #1c84c6;font-size: 24px;font-weight: 600;">{{ item.xkrs }}</div>
|
|
<div style="font-size: 14px;">选课人数</div>
|
|
</a-col>
|
|
<a-col :span="24" style="margin-top:20px;">
|
|
<div>
|
|
第<span>{{ item.hh }}</span>节
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="24">
|
|
<div style="width:100%;text-align: center;">
|
|
—————线下上课地点—————
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="24">
|
|
<div style="height: 60px;">
|
|
{{ item.skdd }}
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="24" v-if="listType == 1 || listType == '1'">
|
|
<!-- <a-col :span="24" > -->
|
|
<a-row style="text-align: center;">
|
|
<a-col :span="12">
|
|
<a-button type="primary" class="yyyClass" @click="toLivePage(item)" :disabled="!item.jsbh || !item.zhjsId">听课</a-button>
|
|
</a-col>
|
|
<a-col :span="12">
|
|
<a-button type="primary" class="bcClass" @click="funpingjia(item)" >评价</a-button>
|
|
</a-col>
|
|
<!-- <a-col :span="8">
|
|
<a-button type="primary" class="bcClass" @click="handleBaocuo(item)">报错</a-button>
|
|
</a-col> -->
|
|
</a-row>
|
|
</a-col>
|
|
<!-- <a-col :span="24" style="text-align: center;"> -->
|
|
<a-col :span="24" v-else style="text-align: center;">
|
|
<div v-show="!isNow(item)">
|
|
<span v-if="props.type == 'zzsk'">
|
|
<!-- 正在上课的,就给个评价 -->
|
|
<a-button type="primary" class="bcClass" @click="funpingjia(item)" >评价</a-button>
|
|
</span>
|
|
<span v-else>
|
|
<a-button type="primary" class="yyyClass" disabled v-if="item.sfyy==1 && item.isdeleted==0">已预约</a-button>
|
|
<a-button type="primary" class="yyClass" @click="funYuyue(item)" v-if="item.sfyy==0 || (item.sfyy==1 && item.isdeleted==1)">预约</a-button>
|
|
</span>
|
|
</div>
|
|
<div v-show="isNow(item)">
|
|
<a-button type="primary" class="bcClass" @click="funpingjia(item)" >评价</a-button>
|
|
</div>
|
|
<!-- <a-col :span="24"> -->
|
|
<!-- <a-button type="primary" class="bcClass" @click="handleBaocuo(item)">报错</a-button> -->
|
|
</a-col>
|
|
</a-row>
|
|
</div>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<!-- 报错列表 -->
|
|
<KcErrorreportIndexModal ref="kcErrorreportIndexModal"></KcErrorreportIndexModal>
|
|
<addModalPage ref="tingKeZuJiAddModal"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref,watch,reactive,defineExpose } from 'vue';
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import KcErrorreportIndexModal from '/@/views/kc/kcErrorreport/components/KcErrorreportIndexModal.vue'
|
|
import { getUserId, addTingKeLog } from '/@/views/site/utils/index';
|
|
import addModalPage from '/@/views/site/tingKeZuJi/components/addModal.vue';
|
|
import { useRouter } from 'vue-router'
|
|
import dayjs from 'dayjs';
|
|
|
|
//用户相关
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
const userStore = useUserStore();
|
|
const kcErrorreportIndexModal = ref();
|
|
const tingKeZuJiAddModal = ref();
|
|
const route = useRouter();
|
|
|
|
|
|
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: '/ktgl/kcKetangbiao/getKclblist', params });
|
|
const props = defineProps({
|
|
queryParam:{ type:Object },
|
|
type: { type: String },
|
|
});
|
|
|
|
//监听条件变化
|
|
watch(() => props.queryParam, async (newRow, oldRow) => {
|
|
var newRowa = ref<any>({});
|
|
newRowa = newRow
|
|
listType = newRowa.type
|
|
},{ deep: true });
|
|
//查询数据
|
|
function rkbLoadData() {
|
|
var newRow = ref<any>({});
|
|
newRow = props.queryParam;
|
|
newRow.userid = getUserId();
|
|
newRow.pageSize = -1
|
|
console.log(`🚀 ~ file: kclbList.vue:109 ~ rkbLoadData ~ newRow:`, newRow)
|
|
if(newRow.hh!=","){
|
|
// listType.value = newRow.type
|
|
// console.log(`🚀 ~ file: kclbList.vue:111 ~ rkbLoadData ~ listType:`, listType)
|
|
list(newRow).then(res => {
|
|
listData.value = res.records;
|
|
console.log(`🚀 ~ file: kclbList.vue:113 ~ list ~ listData.value:`, listData.value)
|
|
emit('setTotal', res.records.length);
|
|
})
|
|
}
|
|
}
|
|
//预约事件
|
|
async function funYuyue(record){
|
|
var params = {ketangbiaoid:record.id,userid:getUserId(),username:userStore?.getUserInfo?.realname,skrq:record.skrq,hh:record.hh,zbpx:record.zbpx,link:'',isdeleted:0};
|
|
const isUpdate = ref<boolean>(false);
|
|
await saveOrUpdate(params, isUpdate.value).then((res) => {
|
|
if (res.success) {
|
|
createMessage.success("预约成功");
|
|
rkbLoadData();
|
|
//加载数据
|
|
} else {
|
|
createMessage.warning(res.message);
|
|
}
|
|
})
|
|
.finally(() => {
|
|
confirmLoading.value = false;
|
|
});
|
|
}
|
|
|
|
function isNow(item){
|
|
const jssj = dayjs(item.skrq + " " +item.jssj, 'YYYY-MM-DD hh:mm:ss');
|
|
|
|
|
|
const dqsj = dayjs(new Date());
|
|
|
|
|
|
if(jssj.unix() < dqsj.unix()){
|
|
console.log(`🚀 -------------------------------------------------🚀`);
|
|
console.log(`🚀 ~ file: kclbList.vue:149 ~ isNow ~ jssj:`, jssj,item,item.skrq,item.jssj,dayjs);
|
|
console.log(`🚀 -------------------------------------------------🚀`);
|
|
|
|
console.log(`🚀 -------------------------------------------------🚀`);
|
|
console.log(`🚀 ~ file: kclbList.vue:155 ~ isNow ~ dqsj:`, dqsj, jssj<dqsj);
|
|
console.log(`🚀 -------------------------------------------------🚀`);
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function funpingjia(record){
|
|
var item = {ketangbiaoid:record.id}
|
|
tingKeZuJiAddModal.value.view(item)
|
|
}
|
|
/**
|
|
* 报错事件
|
|
*/
|
|
function handleBaocuo(item) {
|
|
kcErrorreportIndexModal.value.disableSubmit = false;
|
|
kcErrorreportIndexModal.value.add(item);
|
|
}
|
|
|
|
function toLivePage(item){
|
|
// route.push({ path:'/site/liveRoom',query:{ id: item.jsbh } })
|
|
addTingKeLog(getUserId(),item.id);
|
|
let routeData = route.resolve({ path:'/site/liveRoom',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({
|
|
rkbLoadData
|
|
});
|
|
//提交报错信息
|
|
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>
|
|
.yyyClass{
|
|
background: #6cafda;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
|
|
}
|
|
.yyClass{
|
|
background-color: #1c84c6;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
|
|
}
|
|
.bcClass{
|
|
background-color: #1c84c6;font-weight: 600;border-radius: 5px;line-height: 23px;
|
|
}
|
|
</style>
|