From 1c32be451c2756f35b75667d8af3241ceacdb34b Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期四, 29 四月 2021 17:30:07 +0800 Subject: [PATCH] 添加系统设置界面,未完成 --- web_src/src/components/dialog/StreamProxyEdit.vue | 85 ++++++++++++++++++++++++------------------ 1 files changed, 48 insertions(+), 37 deletions(-) diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue index a2b3c9e..1c0d3b9 100644 --- a/web_src/src/components/dialog/StreamProxyEdit.vue +++ b/web_src/src/components/dialog/StreamProxyEdit.vue @@ -10,7 +10,7 @@ @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 ref="streamProxy" :rules="rules" :model="proxyParam" label-width="140px" > <el-form-item label="绫诲瀷" prop="type"> <el-select v-model="proxyParam.type" @@ -21,7 +21,10 @@ <el-option label="FFmpeg" value="ffmpeg"></el-option> </el-select> </el-form-item> - <el-form-item label="搴旂敤鍚�" prop="app"> + <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></el-input> </el-form-item> <el-form-item label="娴両D" prop="stream"> @@ -38,6 +41,9 @@ </el-form-item> <el-form-item label="FFmpeg鍛戒护妯℃澘" prop="ffmpeg_cmd_key" v-if="proxyParam.type=='ffmpeg'"> <el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></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 label="鎷夋祦鏂瑰紡" prop="rtp_type" v-if="proxyParam.type=='default'"> <el-select @@ -56,14 +62,14 @@ <el-checkbox label="杞琀LS" v-model="proxyParam.enable_hls" ></el-checkbox> <el-checkbox label="MP4褰曞埗" v-model="proxyParam.enable_mp4" ></el-checkbox> </div> - + </el-form-item> <el-form-item> <div style="float: right;"> - <el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> + <el-button type="primary" @click="onSubmit" :loading="dialogLoading" >{{onSubmit_text}}</el-button> <el-button @click="close">鍙栨秷</el-button> </div> - + </el-form-item> </el-form> </div> @@ -98,22 +104,26 @@ listChangeCallback: null, showDialog: false, isLoging: false, + dialogLoading: false, onSubmit_text: "绔嬪嵆鍒涘缓", proxyParam: { + name: null, type: "default", app: null, stream: null, - url: "rtmp://58.200.131.2:1935/livetv/hunantv", + url: "rtmp://58.200.131.2/livetv/cctv5hd", src_url: null, timeout_ms: null, ffmpeg_cmd_key: null, + gbId: null, rtp_type: null, enable: true, enable_hls: true, enable_mp4: false, }, - + rules: { + name: [{ required: true, message: "璇疯緭鍏ュ悕绉�", trigger: "blur" }], app: [{ required: true, message: "璇疯緭鍏ュ簲鐢ㄥ悕", trigger: "blur" }], stream: [{ required: true, message: "璇疯緭鍏ユ祦ID", trigger: "blur" }], url: [{ required: true, message: "璇疯緭鍏ヨ浠g悊鐨勬祦", trigger: "blur" }], @@ -129,51 +139,52 @@ this.listChangeCallback = callback; if (proxyParam != null) { this.proxyParam = proxyParam; - this.onSubmit_text = "淇濆瓨"; - } else { - this.onSubmit_text = "绔嬪嵆鍒涘缓"; } }, onSubmit: function () { console.log("onSubmit"); + this.dialogLoading = true; var that = this; - that.$axios - .post(`/api/proxy/save`, 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(); - } + that.$axios({ + method: 'post', + url:`/api/proxy/save`, + data: that.proxyParam + }).then(function (res) { + that.dialogLoading = false; + if (typeof (res.data.code) != "undefined" && res.data.code === 0) { + that.$message({ + showClose: true, + message: res.data.msg, + type: "success", + }); + that.showDialog = false; + if (that.listChangeCallback != null) { + that.listChangeCallback(); + that.dialogLoading = false; } - }) - .catch(function (error) { - console.log(error); - }); + } + }).catch(function (error) { + console.log(error); + this.dialogLoading = false; + }); }, close: function () { console.log("鍏抽棴娣诲姞瑙嗛骞冲彴"); this.showDialog = false; + this.dialogLoading = 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); - }); + await that.$axios({ + method: 'post', + url:`/api/platform/exit/${deviceGbId}` + }).then(function (res) { + result = res.data; + }).catch(function (error) { + console.log(error); + }); return result; }, checkExpires: function() { -- Gitblit v1.8.0