feat:直播和面授添加教师的下拉列表,修改模板id,修改发布公告

This commit is contained in:
王熙东
2022-11-25 18:27:08 +08:00
parent 7fa58e7869
commit 3184508078
11 changed files with 253 additions and 134 deletions

View File

@@ -107,17 +107,18 @@
<span style="margin-right: 3px">授课老师</span>
</div>
<div class="btnbox">
<a-select
v-model:value="value"
<a-auto-complete
v-model:value="memberValue"
show-search
:not-found-content="fetching ? undefined : null"
placeholder="Select a teacher"
style="width: 364px"
:options="options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
@popupScroll="templateScroll"
@search="handleSearch"
></a-auto-complete>
</div>
</div>
<div class="main_item2">
@@ -320,7 +321,9 @@ import * as api from "../../api/indexLiveBroadcast";
import * as apiTask from "../../api/indexTaskadd";
import { toDate } from "@/api/method";
import { RouterEditTask } from "@/api/indexTask";
import {getMemberInfo} from "@/api/index1"
import dayjs from "dayjs";
import { debounce } from 'lodash-es';
// import { useRouter } from "vue-router";
function getBase64(img, callback) {
const reader = new FileReader();
@@ -379,10 +382,14 @@ export default {
},
setup(props, ctx) {
// const router = useRouter();
const options = ref([]);
const state = reactive({
currentPage: 1,
tableDataTotal: 100,
pageSize: 10,
fetching: false,
totalPages:0,
memberValue:null,// 授课老师关键词
inputV1: "", //*直播名称
time: "", //*直播时间
inputV2: "", //*直播时长
@@ -647,16 +654,63 @@ export default {
});
}
};
const templateScroll = (e) => {
console.log("滚动", e,);
const { target } = e;
const scrllHeight = target.scrollHeight - target.scrollTop;
const clientHeight = target.clientHeight;
// console.log("scrllHeight", scrllHeight, clientHeight);
if (scrllHeight === 0 && clientHeight === 0) {
state.currentPage = 1;
} else if (scrllHeight - clientHeight == 0) {
// 下拉到底部时
if (state.currentPage < state.totalPages) {
// 如果滑到底部,则加载下一页
state.currentPage++;
// queryMember();
}
}
};
// 获取员工
const queryMember = () => {
if(!state.memberValue) return;
let obj = {
"keyWord": state.memberValue,
"id":0,
"org":0,
"pageNo": state.currentPage,
"pageSize": state.pageSize,
}
getMemberInfo(obj).then(res => {
let data = res.data.data.rows
state.totalPages = res.data.data.total
for(let i in data) {
options.value.push({
value:data[i].id,
label:data[i].realName
})
}
}).catch(err => {
message.error('获取员工失败'+err)
})
}
const handleSearch = debounce(memberValue => {
console.log('fetching user', memberValue);
options.value = [];
state.fetching = true;
state.currentPage = 1;
state.memberValue = memberValue;
queryMember();
state.fetching = false;
},300);
const options = ref([]);
const handleChange2 = (value) => {
console.log(`selected ${value}`);
};
const handleBlur = () => {
console.log("blur");
state.inputV3 = value;
};
const handleFocus = () => {
console.log("focus");
queryMember();
};
const checkRadio = () => {
if (state.checkedC1) {
@@ -665,9 +719,6 @@ export default {
state.discussSettings = "false";
}
};
const filterOption = (input, option) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
const handleChangeAssessment = (option) => {
state.assessmentId = option.assessmentId;
};
@@ -679,13 +730,14 @@ export default {
handleChange,
beforeUpload,
updateLiveBroadcast,
filterOption,
handleBlur,
handleFocus,
handleChange2,
options,
checkRadio,
handleChangeAssessment,
queryMember,
templateScroll,
handleSearch,
};
},
};