Skip to content

Commit

Permalink
Optimize: add type
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyCreeper committed Oct 10, 2023
1 parent bfbf71e commit 6cbe218
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/assets/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ body {
}
}

.l-select {
@apply l-input;
}

a {
@apply transition-all duration-500 text-blue-500 hover:text-blue-300;
}
Expand Down
55 changes: 33 additions & 22 deletions src/components/MoviePush.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,31 @@ let newMovieInfo = ref<BaseMovieInfo>({
headers: {}
});
enum AddType {
NORMAL = 0,
LIVE = 1,
RTMP_SOURCE = 2
}
const addType = ref(AddType.NORMAL);
const selectAddType = () => {
console.log(addType.value);
switch (addType.value) {
case AddType.NORMAL:
newMovieInfo.value.live = newMovieInfo.value.proxy = newMovieInfo.value.rtmpSource = false;
break;
case AddType.LIVE:
newMovieInfo.value.live = true;
newMovieInfo.value.proxy = newMovieInfo.value.rtmpSource = false;
break;
case AddType.RTMP_SOURCE:
newMovieInfo.value.proxy = false;
newMovieInfo.value.live = newMovieInfo.value.rtmpSource = true;
}
};
// 把视频链接添加到列表
const { execute: reqPushMovieApi } = pushMovieApi();
const pushMovie = async (dir: string) => {
Expand Down Expand Up @@ -70,7 +95,14 @@ onMounted(() => {});

<template>
<div class="card max-sm:rounded-none">
<div class="card-title">添加影片</div>
<div class="card-title">
添加影片
<select @change="selectAddType" v-model="addType" class="bg-transparent p-0 text-base">
<option :value="0">普通视频</option>
<option :value="1">直播流</option>
<option :value="2">创建直播</option>
</select>
</div>
<div class="card-body flex justify-around flex-wrap">
<input
type="text"
Expand All @@ -85,27 +117,6 @@ onMounted(() => {});
class="l-input-slate mt-1.5 w-full"
v-model="newMovieInfo.name"
/>

<div class="mt-4 mb-0 flex flex-wrap justify-around w-full">
<div>
<input type="checkbox" v-model="newMovieInfo.live" />
<label>&nbsp;这是一条直播流</label>
</div>

<div>
<input
type="checkbox"
v-model="newMovieInfo.rtmpSource"
@click="newMovieInfo.live ? true : (newMovieInfo.live = true)"
/>
<label>&nbsp;我想创建直播</label>
</div>

<!-- <div>
<input type="checkbox" v-model="newMovieInfo.proxy" />
<label>&nbsp;isProxy</label>
</div> -->
</div>
</div>
<div class="card-footer flex-wrap pt-3" style="justify-content: space-around">
<button class="btn" @click="pushMovie('front')">添加到列表最<b>前</b>面</button>
Expand Down

0 comments on commit 6cbe218

Please sign in to comment.