Merge branch 'master' of http://git.luyuan.tk/luyuan/beelink into zj

This commit is contained in:
asd 2020-10-30 15:49:12 +08:00
commit 636cb8acbf
8 changed files with 139 additions and 13 deletions

View File

@ -25,6 +25,8 @@ export default defineComponent({
store.commit("login", true)
store.dispatch("setUserInfo");
}else{
console.log('ip')
store.dispatch("getip");
router.push("/")
}
return{

View File

@ -166,6 +166,11 @@ interface Liveaddrule{
export async function liveadd(data: any) {
const res = await post<Liveaddrule>('live',data);
console.log(res)
if(res.code==0){
message.success(res.msg)
}else{
message.error(res.msg)
}
}
/**
@ -196,7 +201,7 @@ export async function setvideo(data?: any) {
console.log(data,11110)
const res=await put<Liveaddrule>('video/'+data.id,data)
if(res.code==0){
message.success("修改成功")
message.success(res.msg)
}else{
message.error(res.msg)
}
@ -967,4 +972,35 @@ export async function livestart(id: string) {
}else{
message.error(res.msg)
}
}
export async function livestop(id: string, roomid: string) {
const res = await put("live/" + id, {status : 2})
if(res.code == 0){
message.success(res.msg)
}else{
message.error(res.msg)
}
const luzhi = await get('StopMCUMixTranscode', {roomid});
console.log(luzhi)
}
export async function luzhi(roomid: string){
const res = await get('StartMCUMixTranscode', {roomid});
console.log(res)
}
export async function getaddr() {
const res = await get<any>('ip');
const gj = res.data.address.split("|")[0];
if(gj == "CN"){
return ["zh", "中文", '人民币¥'];
}else {
return ['en', 'English', '美元$']
}
}
// export async function StopMCUMixTranscode(roomid: number) {
// const res = await get('StopMCUMixTranscode', {roomid});
// console.log(res)
// }

View File

@ -15,7 +15,7 @@
</div>
<div class="takehour" v-if="i.status == 1 && livestatus == 2">
{{lan.$t('canjiashichang')}}
<div>30min</div>
<div>{{i.length}}min</div>
</div>
<div
class="cancel"

View File

@ -115,8 +115,10 @@
}
</style>
<script lang="ts">
import { setToken } from '@/api/base';
import router from '@/router';
import store from '@/store';
import { saveValue } from '@/utils/common';
import { useI18n } from '@/utils/i18n';
import { computed, defineComponent, ref } from 'vue';
import { useRoute } from 'vue-router';
@ -200,6 +202,8 @@ export default defineComponent({
function logout(): void{
store.commit("login", false)
saveValue("token", "");
setToken();
router.replace("/");
}

View File

@ -1,4 +1,5 @@
import { userinfo } from '@/api';
import { getaddr, userinfo } from '@/api';
import { isProxy } from 'vue';
import { createStore } from 'vuex'
export default createStore({
@ -57,6 +58,14 @@ export default createStore({
},
login(state, islogin: boolean){
state.islogin = islogin;
},
setLanguage(state, data){
const split = new Date().toString().split(" ");
const timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1];
state.userinfo.language = data[1] // English 中文
state.userinfo.languageValue = data[0] // 'en' 'zh'
state.userinfo.zoneStr = timeZoneFormatted;
state.userinfo.currency = data[2];
}
},
actions: {
@ -64,7 +73,14 @@ export default createStore({
const user = await userinfo();
if(user != '未登录'){
commit('setUserInfo', user);
} else {
const info = await getaddr();
commit("setLanguage", info)
}
},
async getip({ commit }){
const info = await getaddr();
commit("setLanguage", info)
}
},
modules: {

View File

@ -119,6 +119,7 @@
type="number"
/>
<span class="unit">{{ lan.$t("fenzhong") }}</span>
<div style="color: red;font-size: 0.12rem;line-height: 1.3;">*最短30min, 最长120min</div>
</a-form-item>
<a-form-item
:label="lan.$t('zhiborenshu')"
@ -130,6 +131,8 @@
:placeholder="lan.$t('shuruzhiborenshu')"
type="number"
/>
<div style="color: red;font-size: 0.12rem;line-height: 1.3;">*最少1人, 最多4人</div>
</a-form-item>
<a-form-item :label="lan.$t('zhibojianjie')" class="brief">
<a-textarea
@ -349,8 +352,15 @@ export default defineComponent({
message.error(lan.$t('zhibojianjieweikong'));
return;
} else {
if (lives.value.status == 0) {
if(subdata.livetime < 30 || subdata.livetime > 120){
message.error("直播时长最短30min, 最长120min");
return ;
}
if(subdata.livenumber > 4 || subdata.livenumber < 1){
message.error("直播人数最少1人, 最多4人");
return ;
}
if (!lives.value.status) {
// subdata.fileid=picinfo.
if (id != undefined && id) {
/**

View File

@ -194,7 +194,7 @@ import { defineComponent, onMounted, ref } from "vue";
import LivePlaying from "@/components/LivePlaying.vue";
import LiveingWatcher from "@/components/LiveingWatcher.vue";
import TRTC from "trtc-js-sdk"
import { getliveinfo, usersig } from '@/api';
import { getliveinfo, livestop, luzhi, usersig } from '@/api';
import { useRoute } from 'vue-router';
import store from '@/store';
import { message } from 'ant-design-vue';
@ -340,12 +340,15 @@ export default defineComponent({
remoteStream.play('s-' + remoteStream.userId_);
});
client
.join({ roomId: 12 })
.join({ roomId: roominfo.value.roomid})
.catch((error: string) => {
console.error('进房失败 ' + error);
})
.then(() => {
console.log('进房成功');
// if(typeof id == "string"){
luzhi(roominfo.value.roomid)
// }
fun()
});
}
@ -376,7 +379,9 @@ export default defineComponent({
client.leave().then(() => {
// leaving room success
visible.value = false;
if(typeof id == "string"){
livestop(id, roominfo.value.roomid)
}
}).catch((error: string) => {
message.error(lan.$t('guanbishibai')+':' + error);
});

View File

@ -39,14 +39,14 @@
</div>
<div class="body">
<div class="row" v-for="item in 24" :key="item">
<div class="day date">
<div class="day date" :style="{'background-color': item - 1 == xs ? '#0DBBA4' : '', 'color': item - 1 == xs ? '#fff' : ''}">
{{ item > 10 ? item - 1 : "0" + (item - 1) }}:00-{{
item > 9 ? item : "0" + item
}}:00
</div>
<div v-for="i in 7" :key="i" >
<div class="day">
<div :class="zhuangtai(week.date[i -1].list[item - 1].zhuangtai)" v-if="week.date[i -1].list[item - 1].title != ''">
<div :class="zhuangtai(week.date[i -1].list[item - 1].zhuangtai)" v-if="week.date[i -1].list[item - 1].title != ''" :style="{'top': (week.date[i -1].list[item - 1].start / 60 * 0.63) + 'rem', 'min-height': (week.date[i -1].list[item - 1].num / 60 * 0.63) + 'rem' }">
<div class="one-line-hide" style="max-width: 1.5rem">
{{week.date[i -1].list[item - 1].title}}
</div>
@ -55,6 +55,13 @@
</div>
</div>
</div>
<div class="lien" :style="{'top': top + 'rem'}">
<div class="heng">
<div class="dian"></div>
<div class="xian"></div>
</div>
<div class="times">{{times}}</div>
</div>
</div>
</div>
</div>
@ -64,6 +71,7 @@
display: flex;
flex-direction: column;
align-items: center;
.head {
width: 1320px;
height: 57px;
@ -144,6 +152,8 @@
}
.body {
width: 100%;
overflow: hidden;
position: relative;
.row {
background-color: #fff;
height: 63px;
@ -165,8 +175,9 @@
display: flex;
flex-direction: column;
color: #111;
position: relative;
> div {
position: absolute;
min-height: 100%;
width: 100%;
border-radius: 6px;
@ -202,6 +213,32 @@
border: unset;
}
}
.lien{
width: 100%;
position: absolute;
top: 0;
left: 128px;
.heng{
display: flex;
align-items: center;
}
.dian{
width: 6px;
height: 6px;
flex-shrink: 0;
background-color: #FFFA18;
border-radius: 50%;
}
.xian{
width: 100%;
height: 2px;
background: linear-gradient(90deg, #FFFA18, #D0EB3D, #87E062, #42DE9D, #00DAC2);
}
}
.times{
font-size: 11px;
color: #FFFA18;
}
}
}
}
@ -212,6 +249,7 @@ import { getDay, gethour, getminute, gettime, getweek } from "@/utils/date";
import store from '@/store';
import { getdatelist, userinfo } from '@/api';
import router from '@/router';
import dayjs from 'dayjs';
export default defineComponent({
props: {},
@ -244,6 +282,18 @@ export default defineComponent({
getdates(userid);
const top = ref(0);
const times = ref('');
const xs = ref(0);
setInterval(()=>{
const now = dayjs();
const xiaoshi = now.month()
const fenzhong = now.minute()
top.value = (xiaoshi + (fenzhong / 60)) * 0.63;
times.value = (xiaoshi > 10 ? xiaoshi : '0' + xiaoshi) + ":" + (fenzhong > 10 ? fenzhong : '0' + fenzhong);
xs.value = xiaoshi;
}, 2000)
watch(zhou, (value) => {
week.value = getweek(value);
console.log(week.value);
@ -269,7 +319,10 @@ export default defineComponent({
zhou,
week,
navto,
zhuangtai
zhuangtai,
top,
times,
xs
};
},
});