anxiao_web/pages/hikVideo/js/index.js

50 lines
1.4 KiB
JavaScript

import { stationurl,brigade} from "../../../public/js/url.js";
import { showLeftPage } from "./leftPage.js";
import { showRightPage } from "./rightPage.js";
var layuiObj={};
var hkIpcList=[];
layui.use(['carousel','table','form','laydate','slider','element'],function() {
layuiObj["layer"] = layui.layer;
layuiObj["carousel"] = layui.carousel;
layuiObj["layuitable"] = layui.table;
layuiObj["rate"] = layui.rate;
layuiObj["layuiForm"] = layui.form;
layuiObj["laydate"] =layui.laydate;
layuiObj["slider"] =layui.slider;
layuiObj["element"] =layui.element;
var session=getParams("session");
var title=decodeURI(decodeURI(getParams("title")));
$(".setTitle").html(title)
axios.defaults.headers.common['Authorization'] = session;
initApi();
})
function getParams(key) {
var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
};
async function initApi(){
var data={
"brigade":brigade
}
var hikurl="http://www.lonsungsh.com:8082/firectrl/hik/device/getlist";
axios({
method:'post',
url:hikurl,
data:data
}).then(res=>{
var code=res["data"]["code"];
if(code==0){
hkIpcList=res["data"]["data"]
}
showLeftPage();
showRightPage();
})
}
export {layuiObj,hkIpcList}