Commit df576b3a authored by 张牧越's avatar 张牧越

bugfix

parent 2ef732a8
NODE_ENV = "development"
Mock: true
VUE_APP_API_URL = "http://192.168.0.228:8002"
VUE_APP_API_URL = "http:///yth.vnet.io"
NODE_ENV = "production"
Mock: false
VUE_APP_API_URL = ""
\ No newline at end of file
VUE_APP_API_URL = "http:///yth.vnet.io"
\ No newline at end of file
......@@ -16,13 +16,17 @@ export default {
},
methods: {
getXAccessToken() {
if (this.$route.query.premit_code) {
if (this.$route.query.permit_code) {
localStorage.setItem(
"PermitAuthorization",
this.$route.query.premit_code
this.$route.query.permit_code
);
}
if (this.$route.query.token_code != localStorage.getItem("token")) {
if (
this.$route.query.token_code != localStorage.getItem("token") &&
!this.$route.query.permit_code &&
!this.$route.query.api_type
) {
getXAccessToken(this.$route.query.token_code).then((res) => {
if (res.status == 200) {
localStorage.setItem("token", this.$route.query.token_code);
......@@ -33,7 +37,9 @@ export default {
}
});
} else {
this.$nextTick(() => {
this.signIn = true;
});
}
},
},
......
......@@ -730,47 +730,47 @@ export default {
if (item.type == 1) {
this.$router.push({
path: "/tower",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 2) {
this.$router.push({
path: "/supervisory",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 3) {
this.$router.push({
path: "/realname",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 4) {
this.$router.push({
path: "/safecap",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 8) {
this.$router.push({
path: "/earlywarning",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 9) {
this.$router.push({
path: "/noise",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 13) {
this.$router.push({
path: "/fallprotection",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 14) {
this.$router.push({
path: "/unloadingplatform",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
} else if (item.type == 15) {
this.$router.push({
path: "/elevator",
query: { token_code: localStorage.getItem("token") },
query: { ...this.$route.query },
});
}
},
......
import axios from 'axios'
import { Message } from 'element-ui';
const getLocationParams = (keyWords) => {
// 提取路由值(字符串)
let href = window.location.href;
// 从占位符开始截取路由(不包括占位符)
let query = href.substring(href.indexOf("?") + 1);
// 根据 & 切割字符串
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
// 根据指定的参数名去筛选参数值
if (pair[0] == keyWords) {
return pair[1];
}
}
return "";
};
const noLoadingrequest = axios.create({
withCredentials: false,
baseURL: getLocationParams("api_type") ? process.env.VUE_APP_API_URL : '',
})
noLoadingrequest.interceptors.request.use(
......
......@@ -5,6 +5,25 @@ import _ from 'lodash';
// loading框设置局部刷新,且所有请求完成后关闭loading框
let loadingInstance; //loading 实例
let needLoadingRequestCount = 0; //当前正在请求的数量
const getLocationParams = (keyWords) => {
// 提取路由值(字符串)
let href = window.location.href;
// 从占位符开始截取路由(不包括占位符)
let query = href.substring(href.indexOf("?") + 1);
// 根据 & 切割字符串
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
// 根据指定的参数名去筛选参数值
if (pair[0] == keyWords) {
return pair[1];
}
}
return "";
};
function showLoading() {
let main = document.querySelector('#app') //获取dom节点
if (main) {
......@@ -33,9 +52,9 @@ var hideLoading = _.debounce(() => {
loadingInstance = null;
}, 10);
const request = axios.create({
withCredentials: false,
baseURL: getLocationParams("api_type") ? process.env.VUE_APP_API_URL : '',
})
request.interceptors.request.use(
......
......@@ -18,7 +18,7 @@ module.exports = defineConfig({
}
}
},
publicPath: process.env.NODE_ENV == 'production' ? './' : '/',
publicPath: process.env.NODE_ENV == 'production' ? './' : '/', // 二级根目录需要修改
devServer: {
port: 3000,
proxy: {
......
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