
42 changed files with 720 additions and 509 deletions
@ -1,7 +1,6 @@ |
|||||
package com.genersoft.iot.vmp.vmanager.service; |
package com.genersoft.iot.vmp.service; |
||||
|
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; |
|
||||
import com.github.pagehelper.PageInfo; |
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
import java.util.List; |
import java.util.List; |
@ -1,4 +1,4 @@ |
|||||
package com.genersoft.iot.vmp.vmanager.service; |
package com.genersoft.iot.vmp.service; |
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
import com.alibaba.fastjson.JSONObject; |
||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
@ -1,4 +1,4 @@ |
|||||
package com.genersoft.iot.vmp.vmanager.service; |
package com.genersoft.iot.vmp.service; |
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
import com.alibaba.fastjson.JSONObject; |
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
@ -0,0 +1,36 @@ |
|||||
|
package com.genersoft.iot.vmp.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface IStreamPushService { |
||||
|
|
||||
|
List<StreamPushItem> handleJSON(String json); |
||||
|
|
||||
|
/** |
||||
|
* 将应用名和流ID加入国标关联 |
||||
|
* @param stream |
||||
|
* @return |
||||
|
*/ |
||||
|
boolean saveToGB(GbStream stream); |
||||
|
|
||||
|
/** |
||||
|
* 将应用名和流ID移出国标关联 |
||||
|
* @param stream |
||||
|
* @return |
||||
|
*/ |
||||
|
boolean removeFromGB(GbStream stream); |
||||
|
|
||||
|
/** |
||||
|
* 获取 |
||||
|
* @param page |
||||
|
* @param count |
||||
|
* @return |
||||
|
*/ |
||||
|
PageInfo<StreamPushItem> getPushList(Integer page, Integer count); |
||||
|
} |
@ -0,0 +1,89 @@ |
|||||
|
package com.genersoft.iot.vmp.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.alibaba.fastjson.TypeReference; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
||||
|
import com.genersoft.iot.vmp.service.IStreamPushService; |
||||
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
||||
|
import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class StreamPushServiceImpl implements IStreamPushService { |
||||
|
|
||||
|
@Autowired |
||||
|
private GbStreamMapper gbStreamMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private StreamPushMapper streamPushMapper; |
||||
|
|
||||
|
@Override |
||||
|
public List<StreamPushItem> handleJSON(String jsonData) { |
||||
|
if (jsonData == null) return null; |
||||
|
|
||||
|
Map<String, StreamPushItem> result = new HashMap<>(); |
||||
|
|
||||
|
List<MediaItem> mediaItems = JSON.parseObject(jsonData, new TypeReference<List<MediaItem>>() {}); |
||||
|
for (MediaItem item : mediaItems) { |
||||
|
|
||||
|
// 不保存国标推理以及拉流代理的流
|
||||
|
if (item.getOriginType() == 3 || item.getOriginType() == 4 || item.getOriginType() == 5) { |
||||
|
continue; |
||||
|
} |
||||
|
String key = item.getApp() + "_" + item.getStream(); |
||||
|
StreamPushItem streamPushItem = result.get(key); |
||||
|
if (streamPushItem == null) { |
||||
|
streamPushItem = new StreamPushItem(); |
||||
|
streamPushItem.setApp(item.getApp()); |
||||
|
streamPushItem.setStream(item.getStream()); |
||||
|
streamPushItem.setAliveSecond(item.getAliveSecond()); |
||||
|
streamPushItem.setCreateStamp(item.getCreateStamp()); |
||||
|
streamPushItem.setOriginSock(item.getOriginSock()); |
||||
|
streamPushItem.setTotalReaderCount(item.getTotalReaderCount()); |
||||
|
streamPushItem.setOriginType(item.getOriginType()); |
||||
|
streamPushItem.setOriginTypeStr(item.getOriginTypeStr()); |
||||
|
streamPushItem.setOriginUrl(item.getOriginUrl()); |
||||
|
streamPushItem.setCreateStamp(item.getCreateStamp()); |
||||
|
streamPushItem.setAliveSecond(item.getAliveSecond()); |
||||
|
streamPushItem.setStatus(true); |
||||
|
streamPushItem.setVhost(item.getVhost()); |
||||
|
result.put(key, streamPushItem); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return new ArrayList<>(result.values()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<StreamPushItem> getPushList(Integer page, Integer count) { |
||||
|
PageHelper.startPage(page, count); |
||||
|
List<StreamPushItem> all = streamPushMapper.selectAll(); |
||||
|
return new PageInfo<>(all); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean saveToGB(GbStream stream) { |
||||
|
stream.setStreamType("push"); |
||||
|
stream.setStatus(true); |
||||
|
int add = gbStreamMapper.add(stream); |
||||
|
return add > 0; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean removeFromGB(GbStream stream) { |
||||
|
int del = gbStreamMapper.del(stream.getApp(), stream.getStream()); |
||||
|
return del > 0; |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.genersoft.iot.vmp.storager.dao; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
@Repository |
||||
|
public interface StreamPushMapper { |
||||
|
|
||||
|
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
||||
|
"createStamp, aliveSecond) VALUES" + |
||||
|
"('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + |
||||
|
"'${createStamp}', '${aliveSecond}' )") |
||||
|
int add(StreamPushItem streamPushItem); |
||||
|
|
||||
|
@Update("UPDATE stream_push " + |
||||
|
"SET app=#{app}," + |
||||
|
"stream=#{stream}," + |
||||
|
"totalReaderCount=#{totalReaderCount}, " + |
||||
|
"originType=#{originType}," + |
||||
|
"originTypeStr=#{originTypeStr}, " + |
||||
|
"createStamp=#{createStamp}, " + |
||||
|
"aliveSecond=#{aliveSecond} " + |
||||
|
"WHERE app=#{app} AND stream=#{stream}") |
||||
|
int update(StreamPushItem streamPushItem); |
||||
|
|
||||
|
@Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") |
||||
|
int del(String app, String stream); |
||||
|
|
||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream") |
||||
|
List<StreamPushItem> selectAll(); |
||||
|
|
||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=${enable}") |
||||
|
List<StreamPushItem> selectForEnable(boolean enable); |
||||
|
|
||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream}") |
||||
|
StreamPushItem selectOne(String app, String stream); |
||||
|
|
||||
|
@Insert("<script>" + |
||||
|
"INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
||||
|
"createStamp, aliveSecond) " + |
||||
|
"VALUES <foreach collection='streamPushItems' item='item' index='index' >" + |
||||
|
"( '${item.app}', '${item.stream}', '${item.totalReaderCount}', '${item.originType}', " + |
||||
|
"'${item.originTypeStr}','${item.createStamp}', '${item.aliveSecond}' )" + |
||||
|
" </foreach>" + |
||||
|
"</script>") |
||||
|
void addAll(List<StreamPushItem> streamPushItems); |
||||
|
|
||||
|
@Delete("DELETE FROM stream_push") |
||||
|
void clear(); |
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package com.genersoft.iot.vmp.vmanager.streamPush; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
||||
|
import com.genersoft.iot.vmp.service.IStreamPushService; |
||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
||||
|
import com.genersoft.iot.vmp.vmanager.media.MediaController; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
@Controller |
||||
|
@CrossOrigin |
||||
|
@RequestMapping(value = "/api/push") |
||||
|
public class StreamPushController { |
||||
|
|
||||
|
private final static Logger logger = LoggerFactory.getLogger(StreamPushController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private IStreamPushService streamPushService; |
||||
|
|
||||
|
@RequestMapping(value = "/list") |
||||
|
@ResponseBody |
||||
|
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, |
||||
|
@RequestParam(required = false)Integer count, |
||||
|
@RequestParam(required = false)String q, |
||||
|
@RequestParam(required = false)Boolean online ){ |
||||
|
|
||||
|
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page - 1, page - 1 + count); |
||||
|
return pushList; |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "/saveToGB") |
||||
|
@ResponseBody |
||||
|
public Object saveToGB(@RequestBody GbStream stream){ |
||||
|
if (streamPushService.saveToGB(stream)){ |
||||
|
return "success"; |
||||
|
}else { |
||||
|
return "fail"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "/removeFormGB") |
||||
|
@ResponseBody |
||||
|
public Object removeFormGB(@RequestBody GbStream stream){ |
||||
|
if (streamPushService.removeFromGB(stream)){ |
||||
|
return "success"; |
||||
|
}else { |
||||
|
return "fail"; |
||||
|
} |
||||
|
} |
||||
|
} |
Binary file not shown.
@ -1,283 +0,0 @@ |
|||||
<template> |
|
||||
<div id="pLatformStreamList"> |
|
||||
<el-container> |
|
||||
<el-header> |
|
||||
<uiHeader></uiHeader> |
|
||||
</el-header> |
|
||||
<el-main> |
|
||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;"> |
|
||||
<span style="font-size: 1rem; font-weight: bold;">直播级联列表</span> |
|
||||
</div> |
|
||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> |
|
||||
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStreamProxy">添加代理</el-button> |
|
||||
</div> |
|
||||
<devicePlayer ref="devicePlayer"></devicePlayer> |
|
||||
<el-table :data="streamProxyList" border style="width: 100%" :height="winHeight"> |
|
||||
<el-table-column prop="app" label="应用名" align="center" show-overflow-tooltip/> |
|
||||
<el-table-column prop="stream" label="流ID" align="center" show-overflow-tooltip/> |
|
||||
<el-table-column prop="gbId" label="国标平台" align="center" show-overflow-tooltip/> |
|
||||
|
|
||||
<el-table-column label="转HLS" width="120" align="center"> |
|
||||
<template slot-scope="scope"> |
|
||||
<div slot="reference" class="name-wrapper"> |
|
||||
<el-tag size="medium" v-if="scope.row.enable_hls">已启用</el-tag> |
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_hls">未启用</el-tag> |
|
||||
</div> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column label="MP4录制" width="120" align="center"> |
|
||||
<template slot-scope="scope"> |
|
||||
<div slot="reference" class="name-wrapper"> |
|
||||
<el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag> |
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_mp4">未启用</el-tag> |
|
||||
</div> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column label="启用" width="120" align="center"> |
|
||||
<template slot-scope="scope"> |
|
||||
<div slot="reference" class="name-wrapper"> |
|
||||
<el-tag size="medium" v-if="scope.row.enable">已启用</el-tag> |
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.enable">未启用</el-tag> |
|
||||
</div> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
|
|
||||
<el-table-column label="操作" width="360" align="center" fixed="right"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-button-group> |
|
||||
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.enable" @click="play(scope.row)">播放</el-button> |
|
||||
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button> |
|
||||
<el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button> |
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button> |
|
||||
<!-- <el-button size="mini" icon="el-icon-position" type="primary" >加入国标</el-button> --> |
|
||||
</el-button-group> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
</el-table> |
|
||||
<el-pagination |
|
||||
style="float: right" |
|
||||
@size-change="handleSizeChange" |
|
||||
@current-change="currentChange" |
|
||||
:current-page="currentPage" |
|
||||
:page-size="count" |
|
||||
:page-sizes="[15, 25, 35, 50]" |
|
||||
layout="total, sizes, prev, pager, next" |
|
||||
:total="total"> |
|
||||
</el-pagination> |
|
||||
<streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit> |
|
||||
</el-main> |
|
||||
</el-container> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import streamProxyEdit from './dialog/StreamProxyEdit.vue' |
|
||||
import devicePlayer from './dialog/devicePlayer.vue' |
|
||||
import uiHeader from './UiHeader.vue' |
|
||||
export default { |
|
||||
name: 'pLatformStreamList', |
|
||||
components: { |
|
||||
devicePlayer, |
|
||||
streamProxyEdit, |
|
||||
uiHeader |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
streamProxyList: [], |
|
||||
currentPusher: {}, //当前操作设备对象 |
|
||||
updateLooper: 0, //数据刷新轮训标志 |
|
||||
currentDeviceChannelsLenth:0, |
|
||||
winHeight: window.innerHeight - 200, |
|
||||
currentPage:1, |
|
||||
count:15, |
|
||||
total:0, |
|
||||
getListLoading: false |
|
||||
}; |
|
||||
}, |
|
||||
computed: { |
|
||||
}, |
|
||||
mounted() { |
|
||||
this.initData(); |
|
||||
// this.updateLooper = setInterval(this.initData, 10000); |
|
||||
}, |
|
||||
destroyed() { |
|
||||
this.$destroy('videojs'); |
|
||||
clearTimeout(this.updateLooper); |
|
||||
}, |
|
||||
methods: { |
|
||||
initData: function() { |
|
||||
this.getStreamProxyList(); |
|
||||
}, |
|
||||
currentChange: function(val){ |
|
||||
this.currentPage = val; |
|
||||
this.getStreamProxyList(); |
|
||||
}, |
|
||||
handleSizeChange: function(val){ |
|
||||
this.count = val; |
|
||||
this.getStreamProxyList(); |
|
||||
}, |
|
||||
getStreamProxyList: function() { |
|
||||
let that = this; |
|
||||
this.getListLoading = true; |
|
||||
this.$axios.get(`/api/proxy/list`,{ |
|
||||
params: { |
|
||||
page: that.currentPage, |
|
||||
count: that.count |
|
||||
} |
|
||||
} ) |
|
||||
.then(function (res) { |
|
||||
console.log(res); |
|
||||
console.log(res.data.list); |
|
||||
that.total = res.data.total; |
|
||||
that.streamProxyList = res.data.list; |
|
||||
that.getListLoading = false; |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
console.log(error); |
|
||||
that.getListLoading = false; |
|
||||
}); |
|
||||
}, |
|
||||
addStreamProxy: function(){ |
|
||||
this.$refs.streamProxyEdit.openDialog(null, this.initData) |
|
||||
}, |
|
||||
saveStreamProxy: function(){ |
|
||||
}, |
|
||||
play: function(row){ |
|
||||
let that = this; |
|
||||
this.getListLoading = true; |
|
||||
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{ |
|
||||
params: { |
|
||||
app: row.app, |
|
||||
stream: row.stream |
|
||||
} |
|
||||
}) |
|
||||
.then(function (res) { |
|
||||
that.getListLoading = false; |
|
||||
that.$refs.devicePlayer.openDialog("streamPlay", null, null, { |
|
||||
streamInfo: res.data, |
|
||||
hasAudio: true |
|
||||
}); |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
console.log(error); |
|
||||
that.getListLoading = false; |
|
||||
}); |
|
||||
|
|
||||
}, |
|
||||
deleteStreamProxy: function(row){ |
|
||||
console.log(1111) |
|
||||
let that = this; |
|
||||
this.getListLoading = true; |
|
||||
this.$axios.get(`/api/proxy/del`,{ |
|
||||
params: { |
|
||||
app: row.app, |
|
||||
stream: row.stream |
|
||||
} |
|
||||
}) |
|
||||
.then(function (res) { |
|
||||
that.getListLoading = false; |
|
||||
that.initData() |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
console.log(error); |
|
||||
that.getListLoading = false; |
|
||||
}); |
|
||||
}, |
|
||||
start: function(row){ |
|
||||
let that = this; |
|
||||
this.getListLoading = true; |
|
||||
this.$axios.get(`/api/proxy/start`,{ |
|
||||
params: { |
|
||||
app: row.app, |
|
||||
stream: row.stream |
|
||||
} |
|
||||
}) |
|
||||
.then(function (res) { |
|
||||
that.getListLoading = false; |
|
||||
that.initData() |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
console.log(error); |
|
||||
that.getListLoading = false; |
|
||||
}); |
|
||||
}, |
|
||||
stop: function(row){ |
|
||||
let that = this; |
|
||||
this.getListLoading = true; |
|
||||
this.$axios.get(`/api/proxy/stop`,{ |
|
||||
params: { |
|
||||
app: row.app, |
|
||||
stream: row.stream |
|
||||
} |
|
||||
}) |
|
||||
.then(function (res) { |
|
||||
that.getListLoading = false; |
|
||||
that.initData() |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
console.log(error); |
|
||||
that.getListLoading = false; |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
}; |
|
||||
</script> |
|
||||
|
|
||||
<style> |
|
||||
.videoList { |
|
||||
display: flex; |
|
||||
flex-wrap: wrap; |
|
||||
align-content: flex-start; |
|
||||
} |
|
||||
|
|
||||
.video-item { |
|
||||
position: relative; |
|
||||
width: 15rem; |
|
||||
height: 10rem; |
|
||||
margin-right: 1rem; |
|
||||
background-color: #000000; |
|
||||
} |
|
||||
|
|
||||
.video-item-img { |
|
||||
position: absolute; |
|
||||
top: 0; |
|
||||
bottom: 0; |
|
||||
left: 0; |
|
||||
right: 0; |
|
||||
margin: auto; |
|
||||
width: 100%; |
|
||||
height: 100%; |
|
||||
} |
|
||||
|
|
||||
.video-item-img:after { |
|
||||
content: ""; |
|
||||
display: inline-block; |
|
||||
position: absolute; |
|
||||
z-index: 2; |
|
||||
top: 0; |
|
||||
bottom: 0; |
|
||||
left: 0; |
|
||||
right: 0; |
|
||||
margin: auto; |
|
||||
width: 3rem; |
|
||||
height: 3rem; |
|
||||
background-image: url("../assets/loading.png"); |
|
||||
background-size: cover; |
|
||||
background-color: #000000; |
|
||||
} |
|
||||
|
|
||||
.video-item-title { |
|
||||
position: absolute; |
|
||||
bottom: 0; |
|
||||
color: #000000; |
|
||||
background-color: #ffffff; |
|
||||
line-height: 1.5rem; |
|
||||
padding: 0.3rem; |
|
||||
width: 14.4rem; |
|
||||
} |
|
||||
.cpoy-btn { |
|
||||
cursor: pointer; |
|
||||
margin-right: 10px; |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,138 @@ |
|||||
|
<template> |
||||
|
<div id="addStreamProxy" v-loading="isLoging"> |
||||
|
<el-dialog |
||||
|
title=" 加入" |
||||
|
width="40%" |
||||
|
top="2rem" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="showDialog" |
||||
|
:destroy-on-close="true" |
||||
|
@close="close()" |
||||
|
> |
||||
|
<div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
||||
|
<el-form ref="streamProxy" :rules="rules" :model="proxyParam" label-width="140px"> |
||||
|
<el-form-item label="名称" prop="name"> |
||||
|
<el-input v-model="proxyParam.name" clearable></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="流应用名" prop="app"> |
||||
|
<el-input v-model="proxyParam.app" clearable :disabled="true"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="流ID" prop="stream"> |
||||
|
<el-input v-model="proxyParam.stream" clearable :disabled="true"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="国标编码" prop="gbId"> |
||||
|
<el-input v-model="proxyParam.gbId" placeholder="设置国标编码可推送到国标" clearable></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<div style="float: right;"> |
||||
|
<el-button type="primary" @click="onSubmit">保存</el-button> |
||||
|
<el-button @click="close">取消</el-button> |
||||
|
</div> |
||||
|
|
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "streamProxyEdit", |
||||
|
props: {}, |
||||
|
computed: {}, |
||||
|
created() {}, |
||||
|
data() { |
||||
|
// var deviceGBIdRules = async (rule, value, callback) => { |
||||
|
// console.log(value); |
||||
|
// if (value === "") { |
||||
|
// callback(new Error("请输入设备国标编号")); |
||||
|
// } else { |
||||
|
// var exit = await this.deviceGBIdExit(value); |
||||
|
// console.log(exit); |
||||
|
// console.log(exit == "true"); |
||||
|
// console.log(exit === "true"); |
||||
|
// if (exit) { |
||||
|
// callback(new Error("设备国标编号已存在")); |
||||
|
// } else { |
||||
|
// callback(); |
||||
|
// } |
||||
|
// } |
||||
|
// }; |
||||
|
return { |
||||
|
listChangeCallback: null, |
||||
|
showDialog: false, |
||||
|
isLoging: false, |
||||
|
proxyParam: { |
||||
|
name: null, |
||||
|
app: null, |
||||
|
stream: null, |
||||
|
gbId: null, |
||||
|
}, |
||||
|
|
||||
|
rules: { |
||||
|
name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
||||
|
app: [{ required: true, message: "请输入应用名", trigger: "blur" }], |
||||
|
stream: [{ required: true, message: "请输入流ID", trigger: "blur" }], |
||||
|
gbId: [{ required: true, message: "请输入国标编码", trigger: "blur" }], |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
openDialog: function (proxyParam, callback) { |
||||
|
this.showDialog = true; |
||||
|
this.listChangeCallback = callback; |
||||
|
if (proxyParam != null) { |
||||
|
this.proxyParam = proxyParam; |
||||
|
} |
||||
|
}, |
||||
|
onSubmit: function () { |
||||
|
console.log("onSubmit"); |
||||
|
var that = this; |
||||
|
that.$axios |
||||
|
.post(`/api/push/saveToGB`, that.proxyParam) |
||||
|
.then(function (res) { |
||||
|
console.log(res); |
||||
|
console.log(res.data == "success"); |
||||
|
if (res.data == "success") { |
||||
|
that.$message({ |
||||
|
showClose: true, |
||||
|
message: "保存成功", |
||||
|
type: "success", |
||||
|
}); |
||||
|
that.showDialog = false; |
||||
|
if (that.listChangeCallback != null) { |
||||
|
that.listChangeCallback(); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
}, |
||||
|
close: function () { |
||||
|
console.log("关闭加入GB"); |
||||
|
this.showDialog = false; |
||||
|
this.$refs.streamProxy.resetFields(); |
||||
|
}, |
||||
|
deviceGBIdExit: async function (deviceGbId) { |
||||
|
var result = false; |
||||
|
var that = this; |
||||
|
await that.$axios |
||||
|
.post(`/api/platforms/exit/${deviceGbId}`) |
||||
|
.then(function (res) { |
||||
|
result = res.data; |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
return result; |
||||
|
}, |
||||
|
checkExpires: function() { |
||||
|
if (this.platform.enable && this.platform.expires == "0") { |
||||
|
this.platform.expires = "300"; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
Loading…
Reference in new issue