提交 77e5eaa7 authored 作者: 苏帅's avatar 苏帅

fix(创新示范分保大屏)请求接口逻辑修改

上级 c17c9d19
......@@ -23,7 +23,6 @@ const axios = Axios.create({
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
config.headers['Authorization'] = 'Bearer ' + localStorage.getItem("cxsf_echarts_token")
// 在发送请求之前做些什么
return config;
}, function (error) {
......
......@@ -164,10 +164,12 @@ export default defineComponent({
},
created() {
// 获取token
this.getXypjToken()
const url = window.location.href;
const str = url.split('?token=')[1] || '';
const token = str.split(this.$route.href)[0];
this.token = token;
sessionStorage.setItem("cxsf_echarts_token",token)
console.log(this.years, 'years');
this.years.map((item, index) => {
if (index == this.curYearIndex) {
......@@ -229,6 +231,17 @@ export default defineComponent({
window.open(qyxypj, "_blank");
}
},
getXypjToken(){
// const loginForm = this.loginForm;
axios({
url:window.baseURL.qyxypj + "/login/external",
method:"POST",
headers: { 'Authorization': 'Bearer ' + this.token }
}).then(res => {
const { token } = res.data;
localStorage.setItem("xypjToken",token)
})
},
// getCycleData() {
// const activeData = this.years.filter(item => item.value == this.curDataType)[0];
// let url = window.baseURL.devUrl || "";
......
......@@ -129,7 +129,8 @@ import { DataCenterRouter } from "@/route/dataCenter";
import Mock from "./cradMock";
import { mapState } from "vuex";
import { bigscreen } from './index.ts'
import { bigscreen,login } from './index.ts'
import axios from "axios";
const BIGSCREEN = {
'全省军民融合创新示范绩效评价情况': Performance,
'创新示范区县(市、区)排名': InvestmentProgress,
......@@ -161,9 +162,6 @@ export default defineComponent({
return Mock[this.curDataType].list2x;
},
},
created() {
this.getBigScreen()
},
data() {
return {
dataCenterRouter: DataCenterRouter,
......@@ -179,10 +177,17 @@ export default defineComponent({
tableData: []
};
},
created(){
this.getBigScreen()
},
methods: {
getBigScreen() {
bigscreen().then(res => {
this.tableData = res.data
axios({
url:window.baseURL.devUrl + "/fb/bigscreen",
method:"GET",
headers: { 'Authorization': 'Bearer ' + sessionStorage.getItem("cxsf_echarts_token") }
}).then(res => {
this.tableData = res.data.data
})
},
// getModule(label){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论