Commit fec5857d authored by xcc's avatar xcc

token修改

parent 05d13dd0
......@@ -88,17 +88,20 @@
// lable:"工位111",
// active:false
// },
]
}),
created(){
this.getSite();
this.login();
//清除interval定时器
if(window.IntervalRefreshToken){
clearInterval(window.IntervalRefreshToken)
}
window.IntervalRefreshToken=setInterval(()=>{
this.refreshToken();
},6*60*60*1000)
},
methods: {
// 上一个
......@@ -113,7 +116,7 @@
this.numMark=this.numMark-1
})
}
},
// 下一个
nextClick(){
......@@ -146,11 +149,42 @@
},15000)
}
},
login(){
const data = {
clientType: 'CLIENT',
username: 'ulocClient',
password: "QcoY2JE0yxDvOadKWeDHKmTXm2LFl1zEcBu0mzMy8UHnHCB5LRMJFG9oY3zfUii0ACIN6uSaHyltCyYk5v1SUs505dtWkq0P/+XRE/Lq6xGrcfAHjWjySU3cLhvjZw3lUB4KtuvJY8UaOrx4+v9+FFQ6CUr2Zh+oz2m4bljoZdE="
};
fetch('http://127.0.0.1:8180/stage-api/auth/login',
{method: 'POST',body: JSON.stringify(data)})
.then(response => response.json())
.then(data => {
// token
localStorage.setItem("_token",data.data.access_token)
this.getSite();
})
.catch(error => console.error('Error:', error));
},
refreshToken(){
/*const data = {
clientType: 'CLIENT',
username: 'ulocClient',
password: "QcoY2JE0yxDvOadKWeDHKmTXm2LFl1zEcBu0mzMy8UHnHCB5LRMJFG9oY3zfUii0ACIN6uSaHyltCyYk5v1SUs505dtWkq0P/+XRE/Lq6xGrcfAHjWjySU3cLhvjZw3lUB4KtuvJY8UaOrx4+v9+FFQ6CUr2Zh+oz2m4bljoZdE="
};*/
fetch('http://127.0.0.1:8180/stage-api/auth/refresh',
{method: 'POST'})
.then(response => response.json())
.then(data => {
// token
localStorage.setItem("_token",data.data.access_token)
})
.catch(error => console.error('Error:', error));
},
getSite(){
fetch('http://127.0.0.1:8180/stage-api/base/site/selectListSite',
{method: 'GET', headers: {'Authorization': 'Bearer_8aa1151b-dcff-47d7-8d6a-4bec3cb2041d'}})
{method: 'GET', headers: {'Authorization': 'Bearer_'+localStorage.getItem("_token")}})
.then(response => response.json())
.then(data => {
this.gongweiList=data.data.map((o)=> Object.assign({},o,{active:false,lable:o.siteName}));
......@@ -336,7 +370,7 @@
this.showDilog=false;
this.$nextTick(()=>{
that.requestFullscreenFunc()
setTimeout(()=>{
// 显示第一个 ifream
......@@ -348,7 +382,7 @@
},
// 全屏 函数
requestFullscreenFunc(){
// 全屏
var docElm = document.body;
......
......@@ -146,7 +146,6 @@
function EchartsB5(){
var myChart = echarts.init(document.getElementById('echart_b5'));
var siteId="333333";
var token="b7de53ef-bcf8-494f-aaf4-2e890298e507";
var data1=['8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00','24:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00']; // x轴
var data2=[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]; // 柱状图数据
var data4=[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]; // 折线
......@@ -155,7 +154,7 @@ function EchartsB5(){
url: 'http://127.0.0.1:8180/stage-api/order/orderSn/siteHourReport/'+siteId,
type: 'GET',
headers: {
'Authorization': 'Bearer_' + token
'Authorization': 'Bearer_'+localStorage.getItem("_token")
},
success: function(response) {
console.log(response);
......
......@@ -160,7 +160,7 @@
var tps = document.getElementById("tps-text").innerHTML;
if(tps) {
fetch('http://127.0.0.1:8180/stage-api/order/ulocScreen/selectSiteBySiteId?tmBasSiteId=' + tmBasSiteId + '&sn=' + tps + '&type=' + type,
{method: 'GET', headers: {'Authorization': 'Bearer_8aa1151b-dcff-47d7-8d6a-4bec3cb2041d'}})
{method: 'GET', headers: {'Authorization': 'Bearer_'+localStorage.getItem("_token")}})
.then(response => response.json())
.then(data => {
$("#image").attr("src", data.data);
......
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