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)=>{ axios.interceptors.response.use((response)=>{
console.log(response) // console.log(response)
if(response.data.code == 1001){ if(response.data.code == 1001){
router.push("/") router.push("/")
} }

View File

@ -1,6 +1,6 @@
import router from '@/router'; import router from '@/router';
import store from '@/store'; 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 { saveValue } from '@/utils/common';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { del, get, post, put, setToken } from './base' 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); const res = await get<Array<LiveList>>('live',data);
// console.log(res); console.log(res);
return res.data 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) const res=await post<Liveaddrule>('video',data)
if(res.code==0){ if(res.code==0){
message.success("发布成功") 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>{ export async function putmember(data: unknown): Promise<Liveaddrule>{
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, data) ) 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 class="more">查看详情</div>
</div> </div>
<div class="info"> <div class="info">
<div class="item"> <div class="item" v-for="(i, j) in list" :key="j">
<div style="display:flex"> <div style="display: flex">
<img src="" alt="" /> <img :src="i.img" alt="" />
<div class="stuinfo"> <div class="stuinfo">
<div>andy</div> <div>{{ i.name }}</div>
<div class="lessonname">英语 A1</div> <div class="lessonname">{{ i.interest }}</div>
</div> </div>
</div> </div>
<div class="takehour" v-if="i.status == 1 && livestatus == 2">
<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>30min</div> <div>30min</div>
</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>
<div class="item"> <div class="item">
<div style="display:flex"> <div style="display:flex">
@ -56,9 +63,7 @@
参加时长 参加时长
<div>30min</div> <div>30min</div>
</div> </div>
</div> </div> -->
</div> </div>
</div> </div>
</template> </template>
@ -105,7 +110,7 @@
margin: auto 0; margin: auto 0;
text-align: center; text-align: center;
} }
> div>img { > div > img {
width: 57px; width: 57px;
height: 57px; height: 57px;
border-radius: 50%; border-radius: 50%;
@ -113,18 +118,20 @@
} }
} }
} }
.refuse{ .refuse {
color: #D22C2E; color: #d22c2e;
margin:auto 0; margin: auto 0;
width: 57px;
text-align: center;
} }
.cancel{ .cancel {
margin:auto 0; margin: auto 0;
width: 57px; width: 57px;
height: 23px; height: 23px;
border: 1px solid #09AE99; border: 1px solid #09ae99;
line-height: 23px; line-height: 23px;
text-align: center; text-align: center;
color: #09AE99; color: #09ae99;
border-radius: 3px; border-radius: 3px;
} }
.button { .button {
@ -152,12 +159,33 @@
} }
</style> </style>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { cancellive } from '@/api';
import { defineComponent, ref, watch } from "vue";
export default defineComponent({ 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> </script>

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@ interface GetDate{
yue: number; yue: number;
day: number; day: number;
zhou: number; zhou: number;
start: string;
end: string;
} }
export function getdate(yue?: number): GetDate{ export function getdate(yue?: number): GetDate{
@ -27,7 +29,8 @@ export function getdate(yue?: number): GetDate{
now = now.date(0); now = now.date(0);
const month = now.date(); // 当前月有几天 const month = now.date(); // 当前月有几天
const year = now.year() const year = now.year()
const start = year + "-" + yue + '-01';
const end = year + "-" + yue + '-' + month;
console.log(day,week,month) console.log(day,week,month)
let i = 0; let i = 0;
let w = 0; let w = 0;
@ -55,7 +58,7 @@ export function getdate(yue?: number): GetDate{
} }
console.log(date) 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-form-item label="母语" class="form-item">
<a-input class="shuru" placeholder="请输入您的母语" /> <a-input class="shuru" placeholder="请输入您的母语" />
</a-form-item> </a-form-item>
<a-form-item label="课语言" class="form-item"> <a-form-item label="授" class="form-item">
<a-select class="getcode" placeholder="请选择您的课语言"> <a-select class="getcode" placeholder="请选择您的授">
<a-select-option value="Zhejiang"> <a-select-option value="Zhejiang">
中国+0086 中国+0086
</a-select-option> </a-select-option>

View File

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

View File

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

View File

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

View File

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

View File

@ -2,13 +2,12 @@
<div class="livedetail"> <div class="livedetail">
<div class="info"> <div class="info">
<div class="liveplay"> <div class="liveplay">
<liveplay></liveplay> <liveplay :info="liveinfo"></liveplay>
</div> </div>
<LiveCount></LiveCount> <LiveCount :info="liveinfo.studentlist" :livestatus="liveinfo.livestatus" :zid="liveinfo.liveid"></LiveCount>
</div> </div>
<VideoReview class="review"></VideoReview> <VideoReview class="review" v-if="liveinfo.livestatus == 2"></VideoReview>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -18,12 +17,11 @@
.info { .info {
width: 1321px; width: 1321px;
display: flex; display: flex;
justify-content:center; justify-content: center;
.liveplay { .liveplay {
background: white; background: white;
border-radius: 18px; border-radius: 18px;
margin-right: 29px; margin-right: 29px;
} }
} }
.review { .review {
@ -32,11 +30,12 @@
} }
</style> </style>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent, ref } from "vue";
import liveplay from "@/components/LivePlay.vue" import liveplay from "@/components/LivePlay.vue";
import LiveCount from "@/components/LiveCount.vue"; import LiveCount from "@/components/LiveCount.vue";
import VideoReview from "@/components/VideoReview.vue"; import VideoReview from "@/components/VideoReview.vue";
import { useRoute } from 'vue-router'; import { useRoute } from "vue-router";
import { getliveinfo } from "@/api";
export default defineComponent({ export default defineComponent({
components: { components: {
LiveCount, LiveCount,
@ -45,6 +44,17 @@ export default defineComponent({
}, },
setup() { setup() {
console.log(useRoute().query.id); 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> </script>

View File

@ -57,7 +57,6 @@
<img src="" alt="" /> <img src="" alt="" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
@ -156,7 +155,7 @@
height: 630px; height: 630px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.othersitem{ .othersitem {
position: relative; position: relative;
width: 100%; width: 100%;
height: 132px; height: 132px;
@ -177,7 +176,7 @@
border-radius: 18px; border-radius: 18px;
background: #0f0; background: #0f0;
} }
.name{ .name {
position: absolute; position: absolute;
top: 9px; top: 9px;
left: 28px; left: 28px;
@ -185,7 +184,6 @@
color: #fff; color: #fff;
} }
} }
} }
} }
</style> </style>

View File

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