优化跨域配置,支持同域的前后端分离部署

This commit is contained in:
648540858
2023-03-05 09:53:26 +08:00
parent a5d9afeb60
commit a7c3cf5316
71 changed files with 173 additions and 191 deletions

View File

@@ -335,7 +335,7 @@ export default {
var that = this;
await that.$axios({
method: 'get',
url:`./api/platform/exit/${deviceGbId}`
url:`/api/platform/exit/${deviceGbId}`
}).then(function (res) {
result = res.data;
}).catch(function (error) {

View File

@@ -195,7 +195,7 @@ export default {
let that = this;
this.$axios({
method: 'get',
url:`./api/platform/query/10000/1`
url:`/api/platform/query/10000/1`
}).then(function (res) {
that.platformList = res.data.data.list;
}).catch(function (error) {
@@ -212,7 +212,7 @@ export default {
if (that.proxyParam.mediaServerId !== "auto"){
that.$axios({
method: 'get',
url:`./api/proxy/ffmpeg_cmd/list`,
url:`/api/proxy/ffmpeg_cmd/list`,
params: {
mediaServerId: that.proxyParam.mediaServerId
}
@@ -230,7 +230,7 @@ export default {
this.noneReaderHandler();
this.$axios({
method: 'post',
url:`./api/proxy/save`,
url:`/api/proxy/save`,
data: this.proxyParam
}).then((res)=> {
this.dialogLoading = false;
@@ -261,7 +261,7 @@ export default {
var that = this;
await that.$axios({
method: 'get',
url:`./api/platform/exit/${deviceGbId}`
url:`/api/platform/exit/${deviceGbId}`
}).then(function (res) {
result = res.data;
}).catch(function (error) {

View File

@@ -55,7 +55,7 @@ export default {
getProgress(){
this.$axios({
method: 'get',
url:`./api/device/query/${this.deviceId}/sync_status/`,
url:`/api/device/query/${this.deviceId}/sync_status/`,
}).then((res) => {
if (res.data.code === 0) {
if (!this.syncFlag) {

View File

@@ -100,7 +100,7 @@ export default {
onSubmit: function () {
this.$axios({
method: 'post',
url: "./api/user/add",
url: "/api/user/add",
params: {
username: this.username,
password: this.password,
@@ -139,7 +139,7 @@ export default {
this.$axios({
method: 'get',
url: "./api/role/all"
url: "/api/role/all"
}).then((res) => {
this.loading = true;
if (res.data.code === 0) {

View File

@@ -116,7 +116,7 @@ export default {
console.log(this.form);
this.$axios({
method:"post",
url:`./api/platform/catalog/${!this.isEdit? "add":"edit"}`,
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
data: this.form
}).then((res)=> {
if (res.data.code === 0) {

View File

@@ -90,7 +90,7 @@ export default {
onSubmit: function () {
this.$axios({
method: 'post',
url:"./api/user/changePassword",
url:"/api/user/changePassword",
params: {
oldPassword: crypto.createHash('md5').update(this.oldPassword, "utf8").digest('hex'),
password: this.newPassword

View File

@@ -85,7 +85,7 @@ export default {
onSubmit: function () {
this.$axios({
method: 'post',
url:"./api/user/changePasswordForAdmin",
url:"/api/user/changePasswordForAdmin",
params: {
password: this.newPassword,
userId: this.form.id,

View File

@@ -65,7 +65,7 @@ export default {
onSubmit: function () {
this.$axios({
method: 'post',
url:"./api/user/changePushKey",
url:"/api/user/changePushKey",
params: {
pushKey: this.newPushKey,
userId: this.form.id,

View File

@@ -44,7 +44,7 @@ export default {
let that = this;
this.$axios({
method: 'get',
url: './api/play/start/' + deviceId + '/' + channelId
url: '/api/play/start/' + deviceId + '/' + channelId
}).then(function (res) {
that.isLoging = false;
if (res.data.code === 0) {

View File

@@ -98,7 +98,7 @@ export default {
this.$axios({
method:"post",
url:"./api/platform/update_channel_for_gb",
url:"/api/platform/update_channel_for_gb",
data:{
platformId: that.platformId,
channelReduces: that.chooseData

View File

@@ -82,7 +82,7 @@ export default {
let that = this;
this.$axios({
method:"get",
url:`./api/platform/catalog`,
url:`/api/platform/catalog`,
params: {
platformId: that.platformId,
parentId: parentId
@@ -134,7 +134,7 @@ export default {
removeCatalog: function (id, node){
this.$axios({
method:"delete",
url:`./api/platform/catalog/del`,
url:`/api/platform/catalog/del`,
params: {
id: id,
platformId: this.platformId,
@@ -156,7 +156,7 @@ export default {
setDefaultCatalog: function (id){
this.$axios({
method:"post",
url:`./api/platform/catalog/default/update`,
url:`/api/platform/catalog/default/update`,
params: {
platformId: this.platformId,
catalogId: id,
@@ -201,7 +201,7 @@ export default {
onClick: () => {
this.$axios({
method:"delete",
url:"./api/platform/catalog/relation/del",
url:"/api/platform/catalog/relation/del",
data: data
}).then((res)=>{
console.log("移除成功")

View File

@@ -121,7 +121,7 @@ export default {
this.getCatalogFromUser((catalogId)=> {
this.$axios({
method:"post",
url:"./api/platform/update_channel_for_gb",
url:"/api/platform/update_channel_for_gb",
data:{
platformId: this.platformId,
all: all,
@@ -149,7 +149,7 @@ export default {
this.$axios({
method:"delete",
url:"./api/platform/del_channel_for_gb",
url:"/api/platform/del_channel_for_gb",
data:{
platformId: this.platformId,
all: all,
@@ -248,7 +248,7 @@ export default {
this.$axios({
method:"get",
url:`./api/platform/channel_list`,
url:`/api/platform/channel_list`,
params: {
page: that.currentPage,
count: that.count,
@@ -290,7 +290,7 @@ export default {
}).then(() => {
this.$axios({
method:"delete",
url:"./api/platform/del_channel_for_gb",
url:"/api/platform/del_channel_for_gb",
data:{
platformId: this.platformId,
channelReduces: this.multipleSelection
@@ -310,7 +310,7 @@ export default {
this.$axios({
method: "post",
url: "./api/platform/update_channel_for_gb",
url: "/api/platform/update_channel_for_gb",
data: {
platformId: this.platformId,
channelReduces: this.multipleSelection,

View File

@@ -134,7 +134,7 @@ export default {
this.getCatalogFromUser((catalogId)=>{
this.$axios({
method:"post",
url:"./api/gbStream/add",
url:"/api/gbStream/add",
data:{
platformId: this.platformId,
catalogId: catalogId,
@@ -163,7 +163,7 @@ export default {
this.$axios({
method:"delete",
url:"./api/gbStream/del",
url:"/api/gbStream/del",
data:{
platformId: this.platformId,
all: all,
@@ -186,7 +186,7 @@ export default {
this.$axios({
method: 'get',
url:`./api/gbStream/list`,
url:`/api/gbStream/list`,
params: {
page: that.currentPage,
count: that.count,
@@ -222,7 +222,7 @@ export default {
}).then(() => {
this.$axios({
method:"delete",
url:"./api/gbStream/del",
url:"/api/gbStream/del",
data:{
platformId: this.platformId,
gbStreams: this.multipleSelection,
@@ -242,7 +242,7 @@ export default {
this.getCatalogFromUser((catalogId)=>{
this.$axios({
method:"post",
url:"./api/gbStream/add",
url:"/api/gbStream/add",
data:{
platformId: this.platformId,
catalogId: catalogId,

View File

@@ -131,7 +131,7 @@ export default {
this.form.mobilePositionSubmissionInterval = this.form.mobilePositionSubmissionInterval||0
this.$axios({
method: 'post',
url:`./api/device/query/device/${this.isEdit?'update':'add'}/`,
url:`/api/device/query/device/${this.isEdit?'update':'add'}/`,
params: this.form
}).then((res) => {
console.log(res.data)

View File

@@ -320,7 +320,7 @@ export default {
if (tab.name === "codec") {
this.$axios({
method: 'get',
url: './zlm/' +this.mediaServerId+ '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtsp&app='+ this.app +'&stream='+ this.streamId
url: '/zlm/' +this.mediaServerId+ '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtsp&app='+ this.app +'&stream='+ this.streamId
}).then(function (res) {
that.tracksLoading = false;
if (res.data.code == 0 && res.data.tracks) {
@@ -397,7 +397,7 @@ export default {
this.$refs[this.activePlayer].pause()
that.$axios({
method: 'post',
url: './api/play/convert/' + that.streamId
url: '/api/play/convert/' + that.streamId
}).then(function (res) {
if (res.data.code === 0) {
that.convertKey = res.data.key;
@@ -434,7 +434,7 @@ export default {
that.$refs.videoPlayer.pause()
this.$axios({
method: 'post',
url: './api/play/convertStop/' + this.convertKey
url: '/api/play/convertStop/' + this.convertKey
}).then(function (res) {
if (res.data.code == 0) {
console.log(res.data.msg)
@@ -494,7 +494,7 @@ export default {
let that = this;
this.$axios({
method: 'post',
url: './api/ptz/control/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&horizonSpeed=' + this.controSpeed + '&verticalSpeed=' + this.controSpeed + '&zoomSpeed=' + this.controSpeed
url: '/api/ptz/control/' + this.deviceId + '/' + this.channelId + '?command=' + command + '&horizonSpeed=' + this.controSpeed + '&verticalSpeed=' + this.controSpeed + '&zoomSpeed=' + this.controSpeed
}).then(function (res) {});
},
//////////////////////播放器事件处理//////////////////////////
@@ -506,7 +506,7 @@ export default {
let that = this;
this.$axios({
method: 'post',
url: './api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=0&parameter2=' + presetPos + '&combindCode2=0'
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=0&parameter2=' + presetPos + '&combindCode2=0'
}).then(function (res) {});
},
setSpeedOrTime: function (cmdCode, groupNum, parameter) {
@@ -516,7 +516,7 @@ export default {
console.log('前端控制0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter2.toString(16) + ' 0x' + combindCode2.toString(16));
this.$axios({
method: 'post',
url: './api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter2 + '&combindCode2=' + combindCode2
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter2 + '&combindCode2=' + combindCode2
}).then(function (res) {});
},
setCommand: function (cmdCode, groupNum, parameter) {
@@ -524,7 +524,7 @@ export default {
console.log('前端控制0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter.toString(16) + ' 0x0');
this.$axios({
method: 'post',
url: './api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter + '&combindCode2=0'
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter + '&combindCode2=0'
}).then(function (res) {});
},
copyUrl: function (dropdownItem){

View File

@@ -89,7 +89,7 @@ export default {
let that = this;
this.$axios({
method:"get",
url:`./api/platform/catalog`,
url:`/api/platform/catalog`,
params: {
platformId: that.platformId,
parentId: parentId
@@ -111,7 +111,7 @@ export default {
if (node.level === 0) {
this.$axios({
method:"get",
url:`./api/platform/info/` + this.platformId,
url:`/api/platform/info/` + this.platformId,
})
.then((res)=> {
if (res.data.code === 0) {

View File

@@ -60,7 +60,7 @@ export default {
console.log(this.form);
this.$axios({
method:"post",
url:`./api/platform/catalog/${!this.isEdit? "add":"edit"}`,
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
data: this.form
})
.then((res)=> {

View File

@@ -81,7 +81,7 @@ export default {
console.log(this.form);
this.$axios({
method: 'get',
url:`./api/onvif/rtsp`,
url:`/api/onvif/rtsp`,
params: {
hostname: this.form.hostName,
timeout: 3000,

View File

@@ -138,7 +138,7 @@ export default {
showDialog: false,
isLoging: false,
onSubmit_text: "立即创建",
saveUrl: "./api/platform/save",
saveUrl: "/api/platform/save",
platform: {
id: null,
@@ -192,7 +192,7 @@ export default {
this.saveUrl = "/api/platform/add";
this.$axios({
method: 'get',
url:`./api/platform/server_config`
url:`/api/platform/server_config`
}).then(function (res) {
console.log(res);
if (res.data.code === 0) {
@@ -315,7 +315,7 @@ export default {
var that = this;
await that.$axios({
method: 'get',
url:`./api/platform/exit/${deviceGbId}`})
url:`/api/platform/exit/${deviceGbId}`})
.then(function (res) {
if (res.data.code === 0) {
result = res.data.data;

View File

@@ -109,7 +109,7 @@ export default {
if (this.edit) {
this.$axios({
method:"post",
url:`./api/push/save_to_gb`,
url:`/api/push/save_to_gb`,
data: this.proxyParam
}).then( (res) => {
if (res.data.code === 0) {
@@ -129,7 +129,7 @@ export default {
}else {
this.$axios({
method:"post",
url:`./api/push/add`,
url:`/api/push/add`,
data: this.proxyParam
}).then( (res) => {
if (res.data.code === 0) {
@@ -159,7 +159,7 @@ export default {
var that = this;
await that.$axios({
method:"get",
url:`./api/platform/exit/${deviceGbId}`
url:`/api/platform/exit/${deviceGbId}`
}).then(function (res) {
result = res.data;
}).catch(function (error) {

View File

@@ -72,7 +72,7 @@ export default {
onSubmit: function () {
console.log("onSubmit");
this.isLoging = true;
let url = `./api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`;
let url = `/api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`;
if (this.channel.channelId) {
url+="&channelId=${this.channel.channelId}"
}

View File

@@ -71,7 +71,7 @@ export default {
getProgress: function (callback){
this.$axios({
method: 'get',
url: `./api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}`
url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}`
}).then((res)=> {
console.log(res)
if (res.data.code === 0) {
@@ -124,7 +124,7 @@ export default {
stopDownloadRecord: function (callback) {
this.$axios({
method: 'get',
url: './api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.stream
url: '/api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.stream
}).then((res)=> {
if (callback) callback(res)
});
@@ -132,7 +132,7 @@ export default {
getFileDownload: function (){
this.$axios({
method: 'get',
url:`./record_proxy/${this.mediaServerId}/api/record/file/download/task/add`,
url:`/record_proxy/${this.mediaServerId}/api/record/file/download/task/add`,
params: {
app: this.app,
stream: this.stream,
@@ -164,7 +164,7 @@ export default {
getProgressForFile: function (callback){
this.$axios({
method: 'get',
url:`./record_proxy/${this.mediaServerId}/api/record/file/download/task/list`,
url:`/record_proxy/${this.mediaServerId}/api/record/file/download/task/list`,
params: {
app: this.app,
stream: this.stream,