feat:移动任务 选择面授

This commit is contained in:
宋文超
2022-11-16 09:43:21 +08:00
parent f21d7994dd
commit aa5ed4e7b6
7 changed files with 712 additions and 487 deletions

View File

@@ -10,7 +10,7 @@
>
<div class="drawerMain">
<div class="header">
<div class="headerTitle">{{edit?'编辑':'添加'}}直播</div>
<div class="headerTitle">{{ edit ? "编辑" : "添加" }}直播</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@@ -81,13 +81,18 @@
</div>
<div class="btnbox">
<a-input-number
:min="0"
:max="300"
:precision="0"
style=" width: 364px; height: 32px; border-radius: 8px;overflow: hidden; "
v-model:value="inputV2"
></a-input-number>
:min="0"
:max="300"
:precision="0"
style="
width: 364px;
height: 32px;
border-radius: 8px;
overflow: hidden;
"
v-model:value="inputV2"
></a-input-number>
<span style="margin-left: 5px">分钟</span>
</div>
</div>
@@ -102,19 +107,17 @@
<span style="margin-right: 3px">授课老师</span>
</div>
<div class="btnbox">
<a-select
v-model:value="value"
show-search
placeholder="Select a teacher"
style="width: 364px"
:options="options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
<a-select
v-model:value="value"
show-search
placeholder="Select a teacher"
style="width: 364px"
:options="options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
</div>
</div>
<div class="main_item2">
@@ -122,9 +125,6 @@
<span style="margin-right: 3px">直播封面</span>
</div>
<div class="textarea" style="overflow: hidden">
<a-upload
v-model:file-list="fileList"
name="avatar"
@@ -135,7 +135,12 @@
:before-upload="beforeUpload"
@change="handleChange"
>
<img v-if="imageUrl" :src="imageUrl" alt="avatar" style=width100pxheight:100px;/>
<img
v-if="imageUrl"
:src="imageUrl"
alt="avatar"
style="“width100pxheight:100px;”"
/>
<div v-else>
<loading-outlined v-if="loading"></loading-outlined>
<plus-outlined v-else></plus-outlined>
@@ -185,23 +190,26 @@
<span style="margin-right: 3px">评价</span>
</div>
<div class="btnbox">
<a-checkbox v-model:checked="checkedC1" @change = "checkRadio">需要评估</a-checkbox>
<a-checkbox v-model:checked="checkedC1" @change="checkRadio"
>需要评估</a-checkbox
>
</div>
</div>
<div class="main_item" style="margin-top: -25px," :style="{ display: checkedC1 ? 'block' : 'none' }">
<div
class="main_item"
style="margin-top: -25px"
:style="{ display: checkedC1 ? 'block' : 'none' }"
>
<div class="signbox"></div>
<div class="btnbox">
<a-select
v-model:value="value"
show-search
placeholder="选择评估"
style="width: 364px"
:options="options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
v-model:value="assessmentvalue"
show-search
placeholder="选择评估"
style="width: 364px"
:options="assessment"
@change="handleChangeAssessment"
></a-select>
</div>
</div>
<div class="main_item2">
@@ -219,7 +227,12 @@
:min="0"
:max="30"
:precision="0"
style="width: 88px; height: 32px; border-radius: 8px;overflow: hidden; "
style="
width: 88px;
height: 32px;
border-radius: 8px;
overflow: hidden;
"
v-model:value="inputV6"
></a-input-number>
<span style="color: #999999; margin-left: 8px">分钟</span>
@@ -230,7 +243,12 @@
:min="0"
:max="30"
:precision="0"
style="width: 88px;height: 32px;border-radius: 8px; overflow: hidden;"
style="
width: 88px;
height: 32px;
border-radius: 8px;
overflow: hidden;
"
v-model:value="inputV7"
></a-input-number>
<span style="color: #999999; margin-left: 8px">分钟</span>
@@ -246,7 +264,12 @@
:min="0"
:max="30"
:precision="0"
style=" width: 88px;height: 32px;border-radius: 8px; overflow: hidden; "
style="
width: 88px;
height: 32px;
border-radius: 8px;
overflow: hidden;
"
v-model:value="inputV8"
></a-input-number>
<span style="color: #999999; margin-left: 8px"
@@ -274,7 +297,9 @@
<span style="margin-right: 3px">其他设置</span>
</div>
<div class="btnbox">
<a-checkbox v-model:checked="checkedC2" @onclick = "checkedC2 = !checkedC2"
<a-checkbox
v-model:checked="checkedC2"
@onclick="checkedC2 = !checkedC2"
>学员请假后记为任务完成</a-checkbox
>
</div>
@@ -295,7 +320,7 @@ import * as api from "../../api/indexLiveBroadcast";
import * as apiTask from "../../api/indexTaskadd";
import { toDate } from "@/api/method";
import { RouterEditTask } from "@/api/indexTask";
import dayjs from 'dayjs';
import dayjs from "dayjs";
// import { useRouter } from "vue-router";
function getBase64(img, callback) {
const reader = new FileReader();
@@ -309,7 +334,6 @@ const options1 = ref([
},
]);
const rowSelection = ref({
checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => {
@@ -333,12 +357,13 @@ export default {
type: Boolean,
default: false,
},
EditLiveId: {
type: Number,
default: null,
},
edit: { // 是否为编辑
edit: {
// 是否为编辑
type: Boolean,
default: null,
},
@@ -354,11 +379,13 @@ export default {
type: Number,
default: 0,
},
isLevel: { // 是否是关卡页面触发
isLevel: {
// 是否是关卡页面触发
type: Boolean,
default: null,
},
projectTaskId: { // 要编辑的projectId
projectTaskId: {
// 要编辑的projectId
type: Number,
default: null,
},
@@ -369,8 +396,7 @@ export default {
isactive: {
type: Number,
default: null,
}
},
},
setup(props, ctx) {
// const router = useRouter();
@@ -396,11 +422,13 @@ export default {
checkedC1: false,
checkedC2: false,
playback: false,
assessmentId:"0",
assessmentId: null,
obj: {}, //要传的obj数据
assessment: [], //评估信息
assessmentvalue: null,
});
const closeDrawer = () => {
ctx.emit("update:addliveVisible", false);
ctx.emit("update:addliveVisible", false);
ctx.emit("update:edit", false);
console.log(props, "props");
state.radioV1 = "";
@@ -419,37 +447,59 @@ export default {
state.imageUrl = "";
};
const afterVisibleChange = (bool) => {
console.log("props.edit===================", props.edit,bool);
if(props.edit){
console.log("props.edit===================", props.edit, bool);
if (props.edit) {
queryLive();
}
api
.queryAssessmentDetailList({
assessmentName: "",
pageNo: 1,
pageSize: 200,
releaseStatus: "",
searchEndTime: "",
searchStartTime: "",
})
.then((res) => {
console.log(res.data.data.rows, "获取全部评估信息");
res.data.data.rows.forEach((item) => {
let obj = item;
obj.value = item.assessmentId;
obj.label = item.assessmentName;
state.assessment.push(obj);
});
console.log("eeee", state.assessment);
});
};
const queryLive = () => {
let d =props.EditLiveId;
console.log("直播查询=======",d);
let d = props.EditLiveId;
console.log("直播查询=======", d);
api
.getLiveBroadcastInfor({liveId:d}).then((res) => {
// console.log(dayjs(res.data.data.submitStartTime).format("YYYY-MM-DD"));
state.inputV1 = res.data.data.liveName;
state.time = [dayjs(res.data.data.liveStartTime, "YYYY-MM-DD"), dayjs(res.data.data.liveEndTime, "YYYY-MM-DD")]
state.inputV2= res.data.data.liveDuration;
state.inputV3= res.data.data. liveTeacherId;
//state.fileList= res.data.data
state.inputV4= res.data.data.liveLink;
state.inputV5= res.data.data.livePlaybackLink;
state.inputV6= res.data.data.beforeSignIn;
state.inputV7= res.data.data.afterSignIn;
state.inputV8= res.data.data.signOutTime;
state.textV1= res.data.data.liveExplain;
state.radioV1= res.data.data.standardSettings
//state.= res.data.data
console.log("查询成功=====inputv1",state.inputV1);
}).catch(() => {
message.error(`查询失败`)
})
.getLiveBroadcastInfor({ liveId: d })
.then((res) => {
// console.log(dayjs(res.data.data.submitStartTime).format("YYYY-MM-DD"));
state.inputV1 = res.data.data.liveName;
state.time = [
dayjs(res.data.data.liveStartTime, "YYYY-MM-DD"),
dayjs(res.data.data.liveEndTime, "YYYY-MM-DD"),
];
state.inputV2 = res.data.data.liveDuration;
state.inputV3 = res.data.data.liveTeacherId;
//state.fileList= res.data.data
state.inputV4 = res.data.data.liveLink;
state.inputV5 = res.data.data.livePlaybackLink;
state.inputV6 = res.data.data.beforeSignIn;
state.inputV7 = res.data.data.afterSignIn;
state.inputV8 = res.data.data.signOutTime;
state.textV1 = res.data.data.liveExplain;
state.radioV1 = res.data.data.standardSettings;
//state.= res.data.data
state.assessmentId = res.data.data.assessmentId;
console.log("查询成功=====inputv1", state.inputV1);
})
.catch(() => {
message.error(`查询失败`);
});
};
const cloradio1 = (value) => {
@@ -458,7 +508,7 @@ export default {
state.radioV1 = "";
}
};
const handleChange = (info) => {
if (info.file.status === "uploading") {
state.loading = true;
@@ -496,48 +546,46 @@ export default {
return isJpgOrPng && isLt2M;
};
const updateTask =(res)=>{
if(props.isLevel){
RouterEditTask({
chapterId: props.isactive,
courseId: res.data.data.liveId,
duration: res.data.data.duration,
name: res.data.data.liveName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 6,
})
.then((res) => {
console.log(res, 11111);
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err, 1111);
});
}else{
apiTask
.addTask({
courseId: res.data.data.liveId,
duration: res.data.data.duration,
name: res.data.data.liveName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId,
type: 6,
})
.then((res) => {
console.log("调用项目添加接口后", res.data);
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err);
});
}
}
const updateTask = (res) => {
if (props.isLevel) {
RouterEditTask({
chapterId: props.isactive,
courseId: res.data.data.liveId,
duration: res.data.data.duration,
name: res.data.data.liveName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 6,
})
.then((res) => {
console.log(res, 11111);
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err, 1111);
});
} else {
apiTask
.addTask({
courseId: res.data.data.liveId,
duration: res.data.data.duration,
name: res.data.data.liveName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId,
type: 6,
})
.then((res) => {
console.log("调用项目添加接口后", res.data);
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err);
});
}
};
//创建直播
const updateLiveBroadcast = () => {
if (!state.inputV1) {
@@ -556,8 +604,8 @@ export default {
if (!regular.test(state.inputV2)) {
message.destroy();
return message.warning("直播时长需大于0");
}
}
let startTime = toDate(
new Date(state.time[0].$d).getTime() / 1000,
"Y-M-D"
@@ -566,89 +614,85 @@ export default {
new Date(state.time[1].$d).getTime() / 1000,
"Y-M-D"
);
state.obj = {
afterSignIn: state.inputV6,
beforeSignIn: state.inputV7,
assessmentId: 0,
assessmentId: state.assessmentId == null ? 0 : state.assessmentId,
// liveCover: state.fileList,//直播封面
liveDuration: state.inputV2,
liveEndTime: endTime,
liveStartTime: startTime,
liveExplain: state.textV1,
liveFlag: "",
liveId: props.edit?props.EditLiveId:0,
liveId: props.edit ? props.EditLiveId : 0,
liveLink: state.inputV4,
liveName: state.inputV1,
livePlayback:state.playback ? "true":"false",
livePlaybackLink: state.playback?state.inputV5:"",
livePlayback: state.playback ? "true" : "false",
livePlaybackLink: state.playback ? state.inputV5 : "",
liveTeacherId: state.inputV3,
otherSettings:0, //1或0
otherSettings: 0, //1或0
signOutTime: state.inputV8,
standardSettings: state.radioV1, //1或2
};
console.log("zhibo-==========",props.EditLiveId);
if(props.edit){
console.log("zhibo-==========", props.EditLiveId);
if (props.edit) {
api
.updateLiveBroadcastMessage(state.obj)
.then((res) => {
console.log("直播编辑成功", res.data.data);
message.success("提交成功");
updateTask(res);
closeDrawer();
})
.catch((err) => {
console.log(err, 2222);
});
}else{
.updateLiveBroadcastMessage(state.obj)
.then((res) => {
console.log("直播编辑成功", res.data.data);
message.success("提交成功");
updateTask(res);
closeDrawer();
})
.catch((err) => {
console.log(err, 2222);
});
} else {
api
.createLiveBroadcast(state.obj)
.then((res) => {
console.log("调用添加直播接口后", res.data.data);
// console.log(state, 2222);
message.success("提交成功");
updateTask(res);
closeDrawer();
})
.catch((err) => {
console.log(err, 2222);
});
.createLiveBroadcast(state.obj)
.then((res) => {
console.log("调用添加直播接口后", res.data.data);
// console.log(state, 2222);
message.success("提交成功");
updateTask(res);
closeDrawer();
})
.catch((err) => {
console.log(err, 2222);
});
}
};
const options = ref([{
value: 'jack',
label: 'Jack',
}, {
value: 'lucy',
label: 'Lucy',
}, {
value: 'tom',
label: 'Tom',
}]);
const handleChange2 = value => {
const options = ref([]);
const handleChange2 = (value) => {
console.log(`selected ${value}`);
};
const handleBlur = () => {
console.log('blur');
console.log("blur");
};
const handleFocus = () => {
console.log('focus');
console.log("focus");
};
const checkRadio = () =>{
if(state.checkedC1){
state.discussSettings = "true"
}else{
const checkRadio = () => {
if (state.checkedC1) {
state.discussSettings = "true";
} else {
state.discussSettings = "false";
}
console.log("state.checkedC1=====",state.discussSettings,state.discussSettings=="true");
}
console.log(
"state.checkedC1=====",
state.discussSettings,
state.discussSettings == "true"
);
};
const filterOption = (input, option) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
const handleChangeAssessment = (value, option) => {
console.log("选择了", value, option);
state.assessmentId = option.assessmentId;
};
return {
...toRefs(state),
afterVisibleChange,
@@ -666,6 +710,7 @@ export default {
handleChange2,
options,
checkRadio,
handleChangeAssessment,
};
},
};