Merge pull request 'xbx' (#49) from xbx into master

Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/49
This commit is contained in:
luyuan 2020-10-16 14:33:13 +08:00
commit 7808cac24d
16 changed files with 646 additions and 452 deletions

View File

@ -11,7 +11,7 @@ export interface Get {
}
axios.interceptors.response.use((response)=>{
console.log(response)
// console.log(response)
if(response.data.code == 1001){
router.push("/")
}

View File

@ -1,6 +1,6 @@
import router from '@/router';
import store from '@/store';
import { LiveList, LoginData, UserInfo, VideoInfo } from '@/types';
import { LiveList, LivelistInfo, LoginData, UserInfo, VideoInfo } from '@/types';
import { saveValue } from '@/utils/common';
import { message } from 'ant-design-vue';
import { del, get, post, put, setToken } from './base'
@ -136,10 +136,10 @@ export async function getvideolist(): Promise<VideoList[]> {
export async function getlivelist(data?:any):Promise<LiveList[]> {
export async function getlivelist(data?:any):Promise<LivelistInfo> {
const res = await get<Array<LiveList>>('live',data);
// console.log(res);
return res.data
console.log(res);
return res;
}
/**
@ -177,10 +177,19 @@ export async function liveadd(data:any) {
/**
*
*/
export async function videoadd(data:any) {
export async function videoadd( form: any,data: any) {
const res=await post<Liveaddrule>('video',data)
if(res.code==0){
message.success("发布成功")
form.value = {
title: "",
img: "",
fileid: "",
fileurl: "",
fileduration: "",
desc: "",
video:[""],
}
}
}
@ -417,3 +426,69 @@ export async function getlanguages(): Promise<Language[]>{
export async function putmember(data: unknown): Promise<Liveaddrule>{
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, data) )
}
/**
*
*
*/
interface LiveInfo {
liveid: number;
title: string;
img: string;
fileid: string;
fileurl: string;
fileduration: string;
vodid: string;
vodurl: string;
vodduration: string;
dateline: string;
livetime: number;
livenumber: number;
status: number;
desc: string;
deleted_at: null;
created_at: string;
updated_at: string;
}
interface StudentList {
memberid: number;
name: string;
img: string;
}
export async function getliveinfo(id: number){
const liveinfo = (await get<LiveInfo>(`live/${id}`)).data;
const studentlist = (await get<StudentList[]>("studentLive",{id})).data;
return {...liveinfo,studentlist}
}
/**
*
*/
export async function getdatelist(start: string, end: string) {
return (await get("teacherCalendar")).data
}
/**
*
*/
export async function cancellive(id: number, status: number){
const res = await post("cancelLive",{id, status})
if(res.code == 0){
message.success(res.msg);
return true;
}else{
message.error(res.msg);
return false;
}
}

View File

@ -5,43 +5,50 @@
<div class="more">查看详情</div>
</div>
<div class="info">
<div class="item">
<div class="item" v-for="(i, j) in list" :key="j">
<div style="display: flex">
<img src="" alt="" />
<img :src="i.img" alt="" />
<div class="stuinfo">
<div>andy</div>
<div class="lessonname">英语 A1</div>
<div>{{ i.name }}</div>
<div class="lessonname">{{ i.interest }}</div>
</div>
</div>
<div class="cancel">取消直播</div>
</div>
<div class="item">
<div style="display:flex">
<img src="" alt="" />
<div class="stuinfo">
<div>andy</div>
<div class="lessonname">英语 A1</div>
</div>
</div>
<div class="refuse">已拒绝</div>
</div>
<div class="item">
<div style="display:flex">
<img src="" alt="" />
<div class="stuinfo">
<div>andy</div>
<div class="lessonname">英语 A1</div>
</div>
</div>
<div class="takehour">
<div class="takehour" v-if="i.status == 1 && livestatus == 2">
参加时长
<div>30min</div>
</div>
<div
class="cancel"
v-if="i.status == 2 || (livestatus == 0 && i.status == 1)"
@click="quxiao(j)"
>
取消直播
</div>
<div class="refuse" v-if="i.status == 3">已拒绝</div>
</div>
<!-- <div class="item">
<div style="display:flex">
<img src="" alt="" />
<div class="stuinfo">
<div>andy</div>
<div class="lessonname">英语 A1</div>
</div>
</div>
</div>
<div class="item">
<div style="display:flex">
<img src="" alt="" />
<div class="stuinfo">
<div>andy</div>
<div class="lessonname">英语 A1</div>
</div>
</div>
</div>
<div class="item">
<div style="display:flex">
@ -56,9 +63,7 @@
参加时长
<div>30min</div>
</div>
</div>
</div> -->
</div>
</div>
</template>
@ -114,17 +119,19 @@
}
}
.refuse {
color: #D22C2E;
color: #d22c2e;
margin: auto 0;
width: 57px;
text-align: center;
}
.cancel {
margin: auto 0;
width: 57px;
height: 23px;
border: 1px solid #09AE99;
border: 1px solid #09ae99;
line-height: 23px;
text-align: center;
color: #09AE99;
color: #09ae99;
border-radius: 3px;
}
.button {
@ -152,12 +159,33 @@
}
</style>
<script lang="ts">
import { defineComponent } from "vue";
import { cancellive } from '@/api';
import { defineComponent, ref, watch } from "vue";
export default defineComponent({
setup(){
props: {
info: Array,
livestatus: Number,
},
setup(props) {
return{}
let list = ref<any>(props.info);
watch(()=> props.info,()=>{
// console.log(props.info)
list.value = props.info
})
async function quxiao(index: number){
console.log(index, list.value[index])
const res = await cancellive(list.value[index].memberid, 3);
if(res){
list.value[index].status = 3
}
}
return {
list,
quxiao
};
},
});
</script>

View File

@ -47,7 +47,6 @@
.cover{
width: 100%;
height: 127px;
background-color: #0f0;
}
.play{
position: absolute;

View File

@ -1,6 +1,6 @@
<template>
<div class="video">
<video src=""></video>
<video :controls="true" :src="info.livestatus == 0 ? info.fileurl : info.vodurl"></video>
<div class="liveinfo">
<div class="left">
<div>
@ -9,11 +9,11 @@
</div>
<div>
<img src="@/static/images/livewatch.png" alt="" class="icon">
<span>2020-09-11 18:30</span>
<span>{{info.dateline}}</span>
</div>
<div>
<img src="@/static/images/livetimetake.png" alt="" class="icon">
<span>30min</span>
<span>{{info.livetime}}min</span>
</div>
<div>
<img src="@/static/images/shoucang.png" alt="" class="icon">
@ -31,7 +31,6 @@
width: 976px;
height: 563px;
border-radius: 18px;
background-color: #0f0;
overflow: hidden;
> video {
width: 100%;
@ -78,11 +77,18 @@
}
</style>
<script lang="ts">
import { defineComponent } from "vue";
import { defineComponent, ref } from "vue";
export default defineComponent({
setup() {
props:{
info: Object
},
setup(props) {
console.log(1);
// const liveinfo = ref(props.liveinfo)
return {
// liveinfo
}
},
});
</script>

View File

@ -91,7 +91,7 @@
</a-menu>
</template>
</a-dropdown>
<div class="item" style="border-right: none;">
<div class="item" style="border-right: none;" @click="navto('/regime/date')">
<img src="@/static/images/rili.png" alt="" class="icon">
<div class="name">日历</div>
</div>
@ -219,10 +219,15 @@ export default defineComponent({
return store.state.userinfo;
})
function navto(index: number){
function navto(index: number | string){
if(typeof index == "number"){
router.push({
path: nav[index].route
})
}else{
router.push(index)
}
}
return {
nav,

View File

@ -10,6 +10,7 @@ declare module 'axios' {
code: number;
msg: string;
data: T;
total: number;
[keys: string]: any;
}
}
@ -88,3 +89,10 @@ export interface LiveList {
starttime: string;
begin: number;
}
export interface LivelistInfo {
data: LiveList[];
code: number;
msg: string;
total: number;
}

View File

@ -11,6 +11,8 @@ interface GetDate{
yue: number;
day: number;
zhou: number;
start: string;
end: string;
}
export function getdate(yue?: number): GetDate{
@ -27,7 +29,8 @@ export function getdate(yue?: number): GetDate{
now = now.date(0);
const month = now.date(); // 当前月有几天
const year = now.year()
const start = year + "-" + yue + '-01';
const end = year + "-" + yue + '-' + month;
console.log(day,week,month)
let i = 0;
let w = 0;
@ -55,7 +58,7 @@ export function getdate(yue?: number): GetDate{
}
console.log(date)
return {date, year, yue, day, zhou};
return {date, year, yue, day, zhou, start, end};
}

View File

@ -84,8 +84,8 @@
<a-form-item label="母语" class="form-item">
<a-input class="shuru" placeholder="请输入您的母语" />
</a-form-item>
<a-form-item label="课语言" class="form-item">
<a-select class="getcode" placeholder="请选择您的课语言">
<a-form-item label="授" class="form-item">
<a-select class="getcode" placeholder="请选择您的授">
<a-select-option value="Zhejiang">
中国+0086
</a-select-option>

View File

@ -32,7 +32,7 @@
<a-input size="small" v-model:value="userinfo.live" placeholder="请输入居住地" />
</div>
<div class="input-box teach-lang">
<div class="label">课语言</div>
<div class="label"></div>
<a-select
v-model:value="userinfo.tlanguage"
style="width: 171px"

View File

@ -233,7 +233,7 @@ export default defineComponent({
const onSubmit = async (e: FromSend) => {
e.preventDefault();
console.log(toRaw(form.value), 111);
// videoadd(toRaw(form));
videoadd(form, toRaw(form.value));
};
return {

View File

@ -41,7 +41,7 @@
:width="80"
v-else
/>
<video style="display: none" :src="videofile"></video>
<!-- <video style="display: none" :src="videofile"></video> -->
</div>
<div
class="upload-image upload"

View File

@ -2,35 +2,69 @@
<div class="video">
<div class="nav">
<div class="tabs">
<div :class="tabindex == 1 ? 'on' : ''" @click="tabchange(1)">全部直播</div>
<div :class="tabindex == 2 ? 'on' : ''" @click="tabchange(2)">未开始</div>
<div :class="tabindex == 3 ? 'on' : ''" @click="tabchange(3)">已结束</div>
<div :class="tabindex == 1 ? 'on' : ''" @click="tabchange(1)">
全部直播
</div>
<div :class="tabindex == 0 ? 'on' : ''" @click="tabchange(0)">
未开始
</div>
<div :class="tabindex == 2 ? 'on' : ''" @click="tabchange(2)">
已结束
</div>
</div>
<div class="sel">
<img src="@/static/images/sousuo.png" alt="" class="icon" />
<input type="text" />
<input placeholder="请输入想要搜索的直播标题" type="text" @keyup.enter="sel()" v-model="input" />
</div>
</div>
<div class="list" v-if="tabindex == 1">
<LiveItem :type="2" v-for="(i,j) in livelist" :key="j" :img="i.img" :title="i.title" :score="i.score" :date="i.starttime" :takehour="i.vodduration" :livenum="i.livenumber" :status="i.livestatus" :zid="i.liveid"></LiveItem>
<LiveItem
:type="2"
v-for="(i, j) in livelist.data"
:key="j"
:img="i.img"
:title="i.title"
:score="i.score"
:date="i.starttime"
:takehour="i.vodduration"
:livenum="i.livenumber"
:status="i.livestatus"
:zid="i.liveid"
></LiveItem>
</div>
<div class="list" v-if="tabindex==2">
<LiveItem :type="3"></LiveItem>
<LiveItem></LiveItem>
<LiveItem></LiveItem>
<LiveItem></LiveItem>
<LiveItem></LiveItem>
<LiveItem></LiveItem>
<div class="list" v-if="tabindex == 0">
<LiveItem
:type="2"
v-for="(i, j) in livelist.data"
:key="j"
:img="i.img"
:title="i.title"
:score="i.score"
:date="i.starttime"
:takehour="i.vodduration"
:livenum="i.livenumber"
:status="i.livestatus"
:zid="i.liveid"
></LiveItem>
</div>
<div class="list" v-if="tabindex==3">
<LiveItem :type="2"></LiveItem>
<LiveItem :type="2"></LiveItem>
<LiveItem :type="2"></LiveItem>
<LiveItem :type="2"></LiveItem>
<div class="list" v-if="tabindex == 2">
<LiveItem
:type="2"
v-for="(i, j) in livelist.data"
:key="j"
:img="i.img"
:title="i.title"
:score="i.score"
:date="i.starttime"
:takehour="i.vodduration"
:livenum="i.livenumber"
:status="i.livestatus"
:zid="i.liveid"
></LiveItem>
</div>
<div class="pages">
<a-pagination v-model:current="page" :total="500" :showLessItems="true" />
<a-pagination v-model:current="page" :total="livelist.total" :showLessItems="true" />
</div>
</div>
</template>
@ -137,8 +171,8 @@
<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
import LiveItem from "@/components/LiveItem.vue";
import { getlivelist } from '@/api';
import { LiveList } from '@/types';
import { getlivelist } from "@/api";
import { LivelistInfo } from "@/types";
export default defineComponent({
components: {
LiveItem,
@ -146,18 +180,37 @@ export default defineComponent({
setup() {
const page = ref(1);
const tabindex = ref(1);
const livelist=ref<LiveList[]>()
const livelist = ref<LivelistInfo>({
code: 0,
total: 0,
msg: "",
data: []
});
const input = ref("")
onMounted(async () => {
livelist.value = await getlivelist();
})
});
function tabchange(e: number): void {
tabindex.value=e
tabindex.value = e;
livelist.value = {data:[], code: 0, msg: "",total: 0};
tab();
}
async function sel(){
console.log(input.value);
livelist.value = await getlivelist({title: input.value});
}
async function tab(){
input.value = '';
livelist.value = await getlivelist({ status: tabindex.value});
}
return {
page,
tabindex,
tabchange,
livelist
livelist,
input,
sel
};
},
});

View File

@ -2,13 +2,12 @@
<div class="livedetail">
<div class="info">
<div class="liveplay">
<liveplay></liveplay>
<liveplay :info="liveinfo"></liveplay>
</div>
<LiveCount></LiveCount>
<LiveCount :info="liveinfo.studentlist" :livestatus="liveinfo.livestatus" :zid="liveinfo.liveid"></LiveCount>
</div>
<VideoReview class="review"></VideoReview>
<VideoReview class="review" v-if="liveinfo.livestatus == 2"></VideoReview>
</div>
</template>
<style lang="scss" scoped>
@ -23,7 +22,6 @@
background: white;
border-radius: 18px;
margin-right: 29px;
}
}
.review {
@ -32,11 +30,12 @@
}
</style>
<script lang="ts">
import { defineComponent } from "vue";
import liveplay from "@/components/LivePlay.vue"
import { defineComponent, ref } from "vue";
import liveplay from "@/components/LivePlay.vue";
import LiveCount from "@/components/LiveCount.vue";
import VideoReview from "@/components/VideoReview.vue";
import { useRoute } from 'vue-router';
import { useRoute } from "vue-router";
import { getliveinfo } from "@/api";
export default defineComponent({
components: {
LiveCount,
@ -45,6 +44,17 @@ export default defineComponent({
},
setup() {
console.log(useRoute().query.id);
const id = useRoute().query.id;
let liveinfo = ref<any>({})
if (typeof id == "string") {
getliveinfo(parseInt(id)).then((res) => {
liveinfo.value = res;
console.log(res)
});
}
return {
liveinfo
}
},
});
</script>

View File

@ -57,7 +57,6 @@
<img src="" alt="" />
</div>
</div>
</div>
</div>
</template>
@ -185,7 +184,6 @@
color: #fff;
}
}
}
}
</style>

View File

@ -188,6 +188,7 @@
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { getdate } from "@/utils/date"
import { getdatelist } from '@/api';
export default defineComponent({
props:{
@ -202,11 +203,19 @@ export default defineComponent({
function xia(){
yue.value = yue.value + 1;
month.value = getdate(yue.value)
getdates()
}
function shang(){
yue.value = yue.value - 1;
month.value = getdate(yue.value)
getdates()
}
async function getdates(){
getdatelist(month.value.start, month.value.end).then((res)=>{
console.log(res)
})
}
getdates()
return {
month,
xia,