mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 13:56:45 +08:00
feat:添加直播接口对接
This commit is contained in:
13
src/api/indexLiveBroadcast.js
Normal file
13
src/api/indexLiveBroadcast.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import http from "./config";
|
||||
|
||||
//根据直播Id获取直播信息 query参数
|
||||
export const getLiveBroadcastInfor = (obj) => http.get('/liveBroadcast', { params: obj })
|
||||
|
||||
//创建直播接口
|
||||
export const createLiveBroadcast = (obj) => http.post('/liveBroadcast/createLiveBroadcast', obj)
|
||||
|
||||
//直播信息删除接口
|
||||
export const deleteLiveBroadcast = (obj) => http.post('/liveBroadcast/deleteLiveBroadcast', obj)
|
||||
|
||||
//直播信息修改接口
|
||||
export const updateLiveBroadcastMessage = (obj) => http.post('/liveBroadcast/updateLiveBroadcastMessage', obj)
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- 直播抽屉 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
:visible="addliveVisible"
|
||||
@@ -63,6 +64,8 @@
|
||||
<div class="btnbox">
|
||||
<a-range-picker
|
||||
style="width: 424px"
|
||||
v-model:value="time"
|
||||
format="YYYY-MM-DD HH:MM"
|
||||
:placeholder="[' 开始时间', ' 结束时间']"
|
||||
/>
|
||||
</div>
|
||||
@@ -114,7 +117,7 @@
|
||||
list-type="picture-card"
|
||||
class="avatar-uploader"
|
||||
:show-upload-list="false"
|
||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
||||
action="/api/file/upload"
|
||||
:before-upload="beforeUpload"
|
||||
@change="handleChange"
|
||||
>
|
||||
@@ -195,18 +198,32 @@
|
||||
<div class="timerbox">
|
||||
<span>开始前:</span>
|
||||
<a-input-number
|
||||
:min="0" :max="30" :precision="0"
|
||||
style="width: 88px; height: 32px;border-radius: 8px;overflow: hidden;"
|
||||
:v-model:value="inputV6"
|
||||
:min="0"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
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>
|
||||
</div>
|
||||
<div class="timerbox">
|
||||
<span>开始后:</span>
|
||||
<a-input-number
|
||||
:min="0" :max="30" :precision="0"
|
||||
style="width: 88px; height: 32px;border-radius: 8px;overflow: hidden;"
|
||||
:v-model:value="inputV7"
|
||||
:min="0"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
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>
|
||||
</div>
|
||||
@@ -218,9 +235,16 @@
|
||||
<div class="timerbox">
|
||||
<span>结束前:</span>
|
||||
<a-input-number
|
||||
:min="0" :max="30" :precision="0"
|
||||
style="width: 88px; height: 32px;border-radius: 8px;overflow: hidden;"
|
||||
:v-model:value="inputV8"
|
||||
:min="0"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
style="
|
||||
width: 88px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
"
|
||||
v-model:value="inputV8"
|
||||
></a-input-number>
|
||||
<span style="color: #999999; margin-left: 8px"
|
||||
>分钟(提前签退则记为早退)</span
|
||||
@@ -235,8 +259,8 @@
|
||||
</div>
|
||||
<div class="btnbox">
|
||||
<a-radio-group v-model:value="radioV1">
|
||||
<a-radio v-model:checked="checked" :value="1" @click="cloradio1">仅签到</a-radio>
|
||||
<a-radio v-model:checked="checked" :value="2" @click="cloradio1"
|
||||
<a-radio :value="1" @click="cloradio1">仅签到</a-radio>
|
||||
<a-radio :value="2" @click="cloradio1"
|
||||
>签到、签退全部完成</a-radio
|
||||
>
|
||||
</a-radio-group>
|
||||
@@ -256,63 +280,65 @@
|
||||
</div>
|
||||
<div class="main_btns">
|
||||
<button class="btn1">取消</button>
|
||||
<button class="btn2">确定</button>
|
||||
<button class="btn2" @click="createLiveBroadcast">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import * as api from "../../api/indexLiveBroadcast";
|
||||
const options1 = ref([
|
||||
{
|
||||
value: "value1",
|
||||
label: "请选择状态",
|
||||
},
|
||||
]);
|
||||
const columns1 = [
|
||||
{
|
||||
title: "课程编号",
|
||||
width: "20%",
|
||||
dataIndex: "num",
|
||||
key: "num",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
width: "20%",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "内容分类",
|
||||
width: "13%",
|
||||
dataIndex: "content",
|
||||
key: "content",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "授课教师",
|
||||
width: "13%",
|
||||
dataIndex: "teacher",
|
||||
key: "teacher",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "创建人",
|
||||
width: "13%",
|
||||
dataIndex: "creator",
|
||||
key: "creator",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "完成时间",
|
||||
width: "20%",
|
||||
dataIndex: "time",
|
||||
key: "time",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
// const columns1 = [
|
||||
// {
|
||||
// title: "课程编号",
|
||||
// width: "20%",
|
||||
// dataIndex: "num",
|
||||
// key: "num",
|
||||
// align: "center",
|
||||
// },
|
||||
// {
|
||||
// title: "名称",
|
||||
// width: "20%",
|
||||
// dataIndex: "name",
|
||||
// key: "name",
|
||||
// align: "center",
|
||||
// },
|
||||
// {
|
||||
// title: "内容分类",
|
||||
// width: "13%",
|
||||
// dataIndex: "content",
|
||||
// key: "content",
|
||||
// align: "center",
|
||||
// },
|
||||
// {
|
||||
// title: "授课教师",
|
||||
// width: "13%",
|
||||
// dataIndex: "teacher",
|
||||
// key: "teacher",
|
||||
// align: "center",
|
||||
// },
|
||||
// {
|
||||
// title: "创建人",
|
||||
// width: "13%",
|
||||
// dataIndex: "creator",
|
||||
// key: "creator",
|
||||
// align: "center",
|
||||
// },
|
||||
// {
|
||||
// title: "完成时间",
|
||||
// width: "20%",
|
||||
// dataIndex: "time",
|
||||
// key: "time",
|
||||
// align: "center",
|
||||
// },
|
||||
// ];
|
||||
const rowSelection = ref({
|
||||
checkStrictly: false,
|
||||
onChange: (selectedRowKeys, selectedRows) => {
|
||||
@@ -427,19 +453,21 @@ export default {
|
||||
currentPage: 1,
|
||||
tableDataTotal: 100,
|
||||
pageSize: 10,
|
||||
inputV1: "",
|
||||
inputV2: "",
|
||||
inputV3: "",
|
||||
inputV4: "",
|
||||
inputV5: "",
|
||||
inputV6: "",
|
||||
inputV7: "",
|
||||
inputV8: "",
|
||||
inputV1: "", //*直播名称
|
||||
time: "", //*直播时间
|
||||
inputV2: "", //*直播时长
|
||||
inputV3: "", //*授课老师
|
||||
fileList: [], //直播封面
|
||||
inputV4: "", //直播链接
|
||||
inputV5: "", //回放链接
|
||||
inputV6: "", //活动开始前多少分钟结束签到
|
||||
inputV7: "", //活动开始后多少分钟结束签到
|
||||
inputV8: "", //结束前多少分钟开始签退
|
||||
textV1: "",
|
||||
radioV1: "",
|
||||
radioV1: "", //标准设置的单选
|
||||
switchC1: "",
|
||||
checkedC1: "",
|
||||
checkedC2: "",
|
||||
checkedC2: true,
|
||||
playback: false,
|
||||
});
|
||||
const closeDrawer = () => {
|
||||
@@ -454,19 +482,72 @@ export default {
|
||||
state.playback = !state.playback;
|
||||
};
|
||||
const cloradio1 = (value) => {
|
||||
if (value != "") {
|
||||
console.log(value.target._value); //点击的选项
|
||||
if (state.radioV1 === value.target._value) {
|
||||
state.radioV1 = "";
|
||||
}
|
||||
};
|
||||
|
||||
//创建直播
|
||||
const createLiveBroadcast = () => {
|
||||
if (!state.inputV1) return message.info("请输入直播名称");
|
||||
if (!state.time) return message.info("请输入直播时间");
|
||||
if (!state.inputV2) return message.info("请输入直播时长");
|
||||
const regular = /^[+]{0,1}(\d+)$/;
|
||||
if (!regular.test(state.inputV2)) {
|
||||
return message.info("直播时长需大于0");
|
||||
}
|
||||
|
||||
// if (!state.inputV3) return message.info("请输入授课老师");
|
||||
let check = state.checkedC2 * 1;
|
||||
let startTime = state.time[0].$d;
|
||||
let endTime = state.time[1].$d;
|
||||
console.log(startTime); //时间需要处理
|
||||
console.log(endTime);
|
||||
let obj = {
|
||||
afterSignIn: state.inputV6,
|
||||
beforeSignIn: state.inputV7,
|
||||
createTime: "",
|
||||
createUser: 0,
|
||||
// liveCover: state.fileList,//直播封面
|
||||
liveDuration: state.inputV2,
|
||||
// liveEndTime: endTime,
|
||||
// liveStartTime: startTime,
|
||||
liveExplain: state.textV1,
|
||||
liveFlag: "",
|
||||
liveId: 0,
|
||||
liveLink: state.inputV4,
|
||||
liveName: state.inputV1,
|
||||
livePlayback: "",
|
||||
livePlaybackLink: state.inputV5,
|
||||
liveTag: "",
|
||||
liveTeacherId: 0,
|
||||
otherSettings: check, //1或0
|
||||
signOutTime: state.inputV8,
|
||||
standardSettings: state.radioV1, //1或2
|
||||
updateTime: "",
|
||||
updateUser: 0,
|
||||
};
|
||||
api
|
||||
.createLiveBroadcast(obj)
|
||||
.then((res) => {
|
||||
console.log(res.data.data, 1111);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err, 2222);
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
closeDrawer,
|
||||
PlayBack,
|
||||
options1,
|
||||
columns1,
|
||||
// columns1,
|
||||
rowSelection,
|
||||
cloradio1,
|
||||
createLiveBroadcast,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
centered="true"
|
||||
:footer="null"
|
||||
:closable="clos"
|
||||
wrapClassName="AddLevel"
|
||||
wrapClassName="AddLevell"
|
||||
>
|
||||
<div class="header">
|
||||
<div class="headmain">
|
||||
@@ -1176,7 +1176,7 @@ export default {
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.AddLevel {
|
||||
.AddLevell {
|
||||
.ant-modal {
|
||||
width: 624px !important;
|
||||
height: 388px !important;
|
||||
@@ -1507,7 +1507,7 @@ export default {
|
||||
}
|
||||
.active {
|
||||
opacity: 1;
|
||||
transition:all .5s;
|
||||
transition: all 0.5s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user