12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //动态获取url
- //const URL = getUrl();
- //console.log('动态获取URL' + URL)
- // function getUrl(){
- // return window.location.protocol+'//'+window.location.host
- // }
- //本地调试url
- const URL = "https://iot.usky.cn/";
- // const URL = "http://172.16.120.213:8080/";
- // const URL = "http://127.0.0.1:8080/";
- //这里登陆用户名、密码 写活?
- const LOGIN_NAME = "admin";
- const LOGIN_PASSWORD = "e10adc3949ba59abbe56e057f20f883e";
- const STATISTICS = "YtIoT/iot/alarm/view/getWjDataStatisticsList"; //数据统计查询
- //const STATISTICS = "data/statistics.json"; //数据统计查询
- const DEVICE_LIST = "YtIoT/iot/alarm/view/getWjDeviceList"; //设备列表查询
- //const DEVICE_LIST = "../data/deviceList.json";//设备列表查询
- const DEVICE_INFO_LIST = "YtIoT/iot/alarm/view/getWjDeviceInfoList" //设备详情查询
- const ALARM_LIST = "YtIoT/iot/alarm/view/getWjAlarmList"; //告警列表查询
- //const ALARM_LIST = "../data/alarmList.json";//告警列表查询
- const ALARM_HANDLE = "YtIoT/iot/alarm/view/updateWjAlarm";
- function ajaxRequest(path, method, data, success, error, type = 1) {
- let url = URL + path;
- let loginUser = {
- "V_LOGINNAME": LOGIN_NAME,
- "V_PASSWORD": LOGIN_PASSWORD,
- }
- if (type == 1) {
- data.queryJson = JSON.stringify(loginUser);
- } else {
- let paramJson = {};
- for (key in loginUser) {
- paramJson[key] = loginUser[key];
- }
- for (key in data) {
- paramJson[key] = data[key];
- }
- data = {}
- data.queryJson = JSON.stringify(paramJson);
- }
- $.ajax({
- async: false, //同步
- data: data,
- url: url,
- type: method, //请求方式 post get delete put
- dataType: "json",
- beforeSend: function(XMLHttpRequest) {
- // $("#loading").html("<img src='images/loading.gif' />")
- // handlePreloader();
- // $(".loadingdata").append('<div class="preloader"></div>');
- },
- success: success,
- error: error
- });
- }
|