合并分支且修改跳转后台问题
This commit is contained in:
commit
d0df4b9330
16
src/App.vue
16
src/App.vue
@ -56,14 +56,14 @@ onMounted(() => {
|
||||
// window.sessionStorage["login"] = true;
|
||||
// };
|
||||
// 监听 beforeunload 事件
|
||||
window.addEventListener("beforeunload", function () {
|
||||
if (window.performance.navigation.type === window.performance.navigation.TYPE_RELOAD) {
|
||||
// 如果是刷新页面操作,不清除 token
|
||||
return;
|
||||
}
|
||||
globalStore.setToken("");
|
||||
globalStore.setUserInfo("");
|
||||
});
|
||||
// window.addEventListener("beforeunload", function () {
|
||||
// if (window.performance.navigation.type === window.performance.navigation.TYPE_RELOAD) {
|
||||
// // 如果是刷新页面操作,不清除 token
|
||||
// return;
|
||||
// }
|
||||
// // globalStore.setToken("");
|
||||
// // globalStore.setUserInfo("");
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
export const projectTypeEnum = [
|
||||
{ id: 1, name: "房建" },
|
||||
{ id: 2, name: "市政" },
|
||||
|
||||
@ -36,8 +36,6 @@ const router = createRouter({
|
||||
* */
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const globalStore = GlobalStore();
|
||||
console.log("路由拦截 beforeEach:", to);
|
||||
console.log("路由拦截 to.path:", to.path);
|
||||
// 解决首次跳转失败
|
||||
let freeToken = window.location.href.indexOf("token") != -1;
|
||||
if (freeToken) {
|
||||
@ -57,7 +55,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
console.log("判断是访问登陆页,有:", from.fullPath);
|
||||
console.log("判断是访问登陆页,globalStore.token有:", globalStore.token);
|
||||
|
||||
if (globalStore.token) return next(from.fullPath);
|
||||
if (globalStore.token && from.fullPath !='/') return next(from.fullPath);
|
||||
// resetRouter();//重置路由
|
||||
return next();
|
||||
}
|
||||
|
||||
@ -8,6 +8,11 @@ import { HOME_URL } from "@/enums/Home/index";
|
||||
* staticRouter(静态路由)
|
||||
*/
|
||||
export const staticRouter: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
// redirect: HOME_URL[0]
|
||||
redirect: LOGIN_URL
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "login",
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<div><span>建筑面积:</span> {{ projectData.projectAcreage || "" }} ㎡</div>
|
||||
<div><span>开工日期:</span> {{ projectData.startWorkDate || "" }}</div>
|
||||
<div><span>项目编号:</span> {{ projectData.projectNumber || "" }}</div>
|
||||
<div><span>工程类别:</span> {{ projectData.projectType ? projectTypeEnum[projectData.projectType - 1].name : "" }}</div>
|
||||
<div><span>工程类别:</span> {{ projectData.projectType ? projectTypeEnumList[projectData.projectType - 1].name : "" }}</div>
|
||||
</div>
|
||||
<!-- <div class="projectInfo">
|
||||
<div><span>建设地点:</span> 南平市建阳区</div>
|
||||
@ -28,7 +28,7 @@
|
||||
import Card from "@/components/card.vue";
|
||||
import { GlobalStore } from "@/stores";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { projectTypeEnum } from "@/enums/project/projectTypeEnum";
|
||||
import { getStageOption } from "@/api/modules/projectOverview";
|
||||
// ts
|
||||
type Props = {
|
||||
projectData?: any; // 传入项目信息
|
||||
@ -41,7 +41,26 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
const projectData = ref({} as any);
|
||||
|
||||
const projectLocal = ref("" as any);
|
||||
|
||||
const store = GlobalStore();
|
||||
const projectTypeEnumList:any = ref([]); //工程类别
|
||||
// 工程类别字典数据
|
||||
const projectTypeEnum = async () => {
|
||||
const res: any = await getStageOption({ dictionaryEncoding: "project_type", projectSn: store.sn });
|
||||
if (res.result.length > 0) {
|
||||
let newArray = res.result.map((item: any) => {
|
||||
return {
|
||||
name: item.name,
|
||||
id: Number(item.data)
|
||||
};
|
||||
});
|
||||
projectTypeEnumList.value = newArray
|
||||
} else {
|
||||
projectTypeEnumList.value = []
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
projectTypeEnum();
|
||||
})
|
||||
watch(
|
||||
() => props.projectData,
|
||||
newVal => {
|
||||
|
||||
@ -28,6 +28,14 @@ import { GlobalStore } from "@/stores";
|
||||
const store = GlobalStore();
|
||||
|
||||
const weatherList = ref([]);
|
||||
//获取项目信息
|
||||
const projectTimeInfo = ref({} as any);
|
||||
const getProjectInfo = async () => {
|
||||
const res: any = await getTaskTimeDetail({ projectSn: store.sn });
|
||||
console.log("获取项目信息", res);
|
||||
projectTimeInfo.value = res.result;
|
||||
loadWeather();
|
||||
};
|
||||
//获取天气
|
||||
const loadWeather = async () => {
|
||||
const res = await getWeatherDataApi({ cityid: "", areaId: projectTimeInfo.value.areaCode});
|
||||
@ -44,14 +52,6 @@ const loadWeather = async () => {
|
||||
weatherList.value.push(element);
|
||||
});
|
||||
};
|
||||
//获取项目信息
|
||||
const projectTimeInfo = ref({} as any);
|
||||
const getProjectInfo = async () => {
|
||||
const res: any = await getTaskTimeDetail({ projectSn: store.sn });
|
||||
console.log("获取项目信息", res);
|
||||
projectTimeInfo.value = res.result;
|
||||
loadWeather();
|
||||
};
|
||||
onMounted(() => {
|
||||
getProjectInfo();
|
||||
});
|
||||
|
||||
@ -556,12 +556,16 @@ function loginOut() {
|
||||
function jumpBgd() {
|
||||
// 标准版——跳转演示平台项目后台
|
||||
if (COMPANY == "") {
|
||||
window.location.replace("http://jxj.zhgdyun.com:100/#/projectIndex");
|
||||
window.location.replace("http://jxj.zhgdyun.com:100/#/login?token=" + store.token);
|
||||
}else if(COMPANY === "as"){
|
||||
window.location.replace("http://182.90.224.237:15551/#/projectIndex");
|
||||
window.location.replace("http://182.90.224.237:15551/#/projectIndex" + store.token);
|
||||
}else if(COMPANY === "agjt"){
|
||||
window.location.replace("http://angang.xingzong.tech:9809" + store.token);
|
||||
} else {
|
||||
// 新项目通用(百色服务器)
|
||||
window.location.replace("http://101.43.164.214:11111/#/projectIndex");
|
||||
window.location.replace("http://101.43.164.214:11111/#/login?token=" + store.token);
|
||||
// window.location.replace("http://192.168.34.138:8080/#/login?token=" + store.token);
|
||||
// window.open("http://192.168.34.138:8080/#/login?token=" + store.token);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user