Commit 43ea53e8 authored by 方建宇's avatar 方建宇

警告接口、热用户数据接口、AI无人站接口

parent 22f69d70
...@@ -6,22 +6,22 @@ import store from "@/store/index.js"; ...@@ -6,22 +6,22 @@ import store from "@/store/index.js";
export function handleGetAIToken() { export function handleGetAIToken() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const AIToken = localStorage.getItem('AIToken'); const AIToken = localStorage.getItem('AIToken');
if (AIToken) { // if (AIToken) {
// 有存储token判断token有没有过期 // // 有存储token判断token有没有过期
// 检验token是否过期 // // 检验token是否过期
checkToken(AIToken).then(res => { // checkToken(AIToken).then(res => {
if (res.data === false) { // if (res.data === false) {
localStorage.removeItem('AIToken'); // localStorage.removeItem('AIToken');
// token过期 // // token过期
getToken().then(resolve).catch(reject); // getToken().then(resolve).catch(reject);
} else { // } else {
resolve(); // resolve();
} // }
}).catch(reject); // }).catch(reject);
} else { // } else {
// 没有token的话获取存储token // // 没有token的话获取存储token
getToken().then(resolve).catch(reject); // getToken().then(resolve).catch(reject);
} // }
}); });
} }
...@@ -31,17 +31,17 @@ function getToken() { ...@@ -31,17 +31,17 @@ function getToken() {
const userId = userInfo.userId; const userId = userInfo.userId;
const params = { username: userName }; const params = { username: userName };
// 通过userName获取uuid // 通过userName获取uuid
return getAuthUUID(params).then(res => { // return getAuthUUID(params).then(res => {
const uuid = res.data; // const uuid = res.data;
const params = { // const params = {
userId: userId, // userId: userId,
username: userName, // username: userName,
uuid: uuid, // uuid: uuid,
}; // };
// 通过userId,username,uuid获取token // 通过userId,username,uuid获取token
return createToken(params).then(res => { // return createToken(params).then(r-es => {
const token = res.data; // const token = res.data;
localStorage.setItem('AIToken', token); // localStorage.setItem('AIToken', token);
}); // });
}); // });
} }
...@@ -490,17 +490,20 @@ async function getName() { ...@@ -490,17 +490,20 @@ async function getName() {
//根据参数获得数据 //根据参数获得数据
async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) { async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
loading.value = true loading.value = true
await http.post(dataUrl, { name: name, startTime: start, endTime: end, start: startPage, count: pagesCount, sort: sort }).then((result) => { // await http.post(dataUrl, { name: name, startTime: start, endTime: end, start: startPage, count: pagesCount, sort: sort }).then((result) => {
if (result.status === 0) { // if (result.status === 0) {
//处理返回数据 //处理返回数据
tableInfo.hisData = result.data.dataInfoList; // tableInfo.hisData = result.data.dataInfoList;
total.value = result.data.rowCount; // total.value = result.data.rowCount;
// setshowData();
tableInfo.hisData = tigerTigerHeatUserHis.dataInfoList;
total.value = tigerTigerHeatUserHis.rowCount;
setshowData(); setshowData();
} else { // } else {
tableInfo.tableData.length = 0; // tableInfo.tableData.length = 0;
total.value=0; // total.value=0;
} // }
}) // })
loading.value = false loading.value = false
} }
......
...@@ -864,80 +864,80 @@ export default defineComponent({ ...@@ -864,80 +864,80 @@ export default defineComponent({
RoleId: roleIds.value, RoleId: roleIds.value,
}; };
} }
//警告接口
function alarm() { // function alarm() {
http // http
.post("/api/alarm/GetAlarmMsg", AlarmInfo.value, false) // .post("/api/alarm/GetAlarmMsg", AlarmInfo.value, false)
.then((result) => { // .then((result) => {
if (result.success && result.data.lenth === 0 && sta.value === 0) { // if (result.success && result.data.lenth === 0 && sta.value === 0) {
sta.value = 1; // sta.value = 1;
title.value = result.data[0].title; // title.value = result.data[0].title;
msg.value = result.data[0].msg; // msg.value = result.data[0].msg;
id.value = result.data[0].id; // id.value = result.data[0].id;
ElNotification({ // ElNotification({
title: title.value, // title: title.value,
dangerouslyUseHTMLString: true, // dangerouslyUseHTMLString: true,
message: msg.value.replace("\n", "<br />"), // message: msg.value.replace("\n", "<br />"),
position: "bottom-right", // position: "bottom-right",
type: "error", // type: "error",
duration: 0, // duration: 0,
onClick() { // onClick() {
activeTable.value = "/Video"; // activeTable.value = "/Video";
localStorage.setItem("activeTab", "/Video"); // localStorage.setItem("activeTab", "/Video");
//路由跳转 // //路由跳转
this.$router.push({ // this.$router.push({
//如果要是用 name 传参 就直接 携带一个 query 对象中包含参数 // //如果要是用 name 传参 就直接 携带一个 query 对象中包含参数
path: "/Video", // path: "/Video",
query: { // query: {
id: id.value, // id: id.value,
}, // },
}); // });
}, // },
onClose() { // onClose() {
sta.value = 0; // sta.value = 0;
}, // },
}); // });
} // }
}); // });
} // }
function countalarm() { // function countalarm() {
http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => { // http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => {
if (result.success && result.data.lenth === 0 && consta.value === 0) { // if (result.success && result.data.lenth === 0 && consta.value === 0) {
consta.value = 1; // consta.value = 1;
counttitle.value = result.data[1].title; // counttitle.value = result.data[1].title;
countmsg.value = result.data[1].msg; // countmsg.value = result.data[1].msg;
countid.value = result.data[1].id; // countid.value = result.data[1].id;
ElNotification({ // ElNotification({
title: counttitle.value, // title: counttitle.value,
dangerouslyUseHTMLString: true, // dangerouslyUseHTMLString: true,
message: countmsg.value.replace("\n", "<br />"), // message: countmsg.value.replace("\n", "<br />"),
position: "bottom-right", // position: "bottom-right",
type: "error", // type: "error",
duration: 0, // duration: 0,
onClick() { // onClick() {
activeTable.value = "/Video"; // activeTable.value = "/Video";
localStorage.setItem("activeTab", "/Video"); // localStorage.setItem("activeTab", "/Video");
//路由跳转 // //路由跳转
this.$router.push({ // this.$router.push({
//如果要是用 name 传参 就直接 携带一个 query 对象中包含参数 // //如果要是用 name 传参 就直接 携带一个 query 对象中包含参数
path: "/Video", // path: "/Video",
query: { // query: {
id: countid.value, // id: countid.value,
}, // },
}); // });
}, // },
onClose() { // onClose() {
consta.value = 0; // consta.value = 0;
}, // },
}); // });
} // }
}); // });
} // }
setInterval(() => { // setInterval(() => {
getinfo(); // getinfo();
alarm(); // alarm();
countalarm(); // countalarm();
}, 60 * 1000); // 每分钟执行一次 // }, 60 * 1000); // 每分钟执行一次
//个人资料弹出框 //个人资料弹出框
const funsel = ref(true); const funsel = ref(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment