This commit is contained in:
parent
2cd8209171
commit
496057ae5c
|
@ -1,6 +1,7 @@
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
import { createRouter, createWebHashHistory } from "vue-router";
|
||||||
import http from "@/utils/request.js";
|
import http from "@/utils/request.js";
|
||||||
import tools from '@/utils/tools'
|
import tools from "@/utils/tools";
|
||||||
|
import { namespaceContextKey } from "element-plus";
|
||||||
|
|
||||||
const routerHistory = createWebHashHistory();
|
const routerHistory = createWebHashHistory();
|
||||||
|
|
||||||
|
@ -8,83 +9,88 @@ const router = createRouter({
|
||||||
history: routerHistory,
|
history: routerHistory,
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: "/",
|
||||||
redirect: '/guide'
|
redirect: "/guide",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '引导页',
|
name: "引导页",
|
||||||
path: '/guide',
|
path: "/guide",
|
||||||
component: () => import('../view/guide.vue'),
|
component: () => import("../view/guide.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/home',
|
path: "/home",
|
||||||
component: () => import('../view/home.vue'),
|
component: () => import("../view/home.vue"),
|
||||||
children: [
|
children: [
|
||||||
|
// {
|
||||||
|
// name: '登录',
|
||||||
|
// path: '/login/index',
|
||||||
|
// component: () => import('../view/login/LoginZZD.vue'),
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
name: '首页',
|
name: "首页",
|
||||||
path: '/home/index',
|
path: "/home/index",
|
||||||
component: () => import('../view/sy.vue'),
|
component: () => import("../view/sy.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '养老',
|
name: "养老",
|
||||||
path: '/home/yl',
|
path: "/home/yl",
|
||||||
component: () => import('../view/yl.vue'),
|
component: () => import("../view/yl.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '卫生',
|
name: "卫生",
|
||||||
path: '/home/hygiene',
|
path: "/home/hygiene",
|
||||||
component: () => import('../view/hygiene.vue'),
|
component: () => import("../view/hygiene.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '教育',
|
name: "教育",
|
||||||
path: '/home/education',
|
path: "/home/education",
|
||||||
component: () => import('../view/education.vue'),
|
component: () => import("../view/education.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '就业补助',
|
name: "就业补助",
|
||||||
path: '/home/work',
|
path: "/home/work",
|
||||||
component: () => import('../view/work.vue'),
|
component: () => import("../view/work.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '智能分析',
|
name: "智能分析",
|
||||||
path: '/home/analyze',
|
path: "/home/analyze",
|
||||||
component: () => import('../view/analyze.vue'),
|
component: () => import("../view/analyze.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '首页地图',
|
name: "首页地图",
|
||||||
path: '/home/index/map',
|
path: "/home/index/map",
|
||||||
component: () => import('../view/sy_map.vue'),
|
component: () => import("../view/sy_map.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '首页表格',
|
name: "首页表格",
|
||||||
path: '/home/index/table',
|
path: "/home/index/table",
|
||||||
component: () => import('../view/sy_table.vue'),
|
component: () => import("../view/sy_table.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '首页表格详情',
|
name: "首页表格详情",
|
||||||
path: '/home/index/table/details',
|
path: "/home/index/table/details",
|
||||||
component: () => import('../view/sy_details.vue'),
|
component: () => import("../view/sy_details.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '人物图',
|
name: "人物图",
|
||||||
path: '/home/index/person',
|
path: "/home/index/person",
|
||||||
component: () => import('../view/person/index.vue'),
|
component: () => import("../view/person/index.vue"),
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// name: '地图编辑',
|
// name: '地图编辑',
|
||||||
// path: '/home/index/mapEdit',
|
// path: '/home/index/mapEdit',
|
||||||
// component: () => import('../view/sy_map_fb.vue'),
|
// component: () => import('../view/sy_map_fb.vue'),
|
||||||
// },
|
// },
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
})
|
});
|
||||||
|
|
||||||
function getCookie(cname) {
|
function getCookie(cname) {
|
||||||
var cn = cname
|
var cn = cname;
|
||||||
const cookies = document.cookie.split('; ');
|
const cookies = document.cookie.split("; ");
|
||||||
for (let i = 0; i < cookies.length; i++) {
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
const [name, value] = cookies[i].split('=');
|
const [name, value] = cookies[i].split("=");
|
||||||
if (name === cn) {
|
if (name === cn) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -100,26 +106,35 @@ function getCookie(cname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
router.beforeEach((to, form, next) => {
|
router.beforeEach((to, form, next) => {
|
||||||
var token = getCookie('lytoken')
|
// var token = getCookie('lytoken')
|
||||||
// console.log('token', token)
|
// // console.log('token', token)
|
||||||
if (token == '') {
|
// if (token == '') {
|
||||||
window.location.href =
|
// window.location.href =
|
||||||
'http://220.191.238.50:996/api/login?returnURL=' +
|
// 'http://220.191.238.50:996/api/login?returnURL=' +
|
||||||
window.location.href
|
// window.location.href
|
||||||
|
// } else {
|
||||||
|
// // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => {
|
||||||
|
// // if (res.code == '500') {
|
||||||
|
// // window.location.href =
|
||||||
|
// // 'http://220.191.238.50:996/api/login?returnURL=' +
|
||||||
|
// // window.location.href
|
||||||
|
// // } else {
|
||||||
|
// // tools.data.set('token',token)
|
||||||
|
// next();
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
// tools.data.set('token', token)
|
||||||
|
// next();
|
||||||
|
// }
|
||||||
|
let type = tools.data.get("type");
|
||||||
|
if (type) {
|
||||||
|
console.log(1111);
|
||||||
|
|
||||||
|
next();
|
||||||
} else {
|
} else {
|
||||||
// http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => {
|
window.location.href = "http://localhost:8080/#/guide";
|
||||||
// if (res.code == '500') {
|
|
||||||
// window.location.href =
|
|
||||||
// 'http://220.191.238.50:996/api/login?returnURL=' +
|
|
||||||
// window.location.href
|
|
||||||
// } else {
|
|
||||||
// tools.data.set('token',token)
|
|
||||||
// next();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
tools.data.set('token', token)
|
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
export default router
|
export default router;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import tools from "@/utils/tools";
|
import tools from "@/utils/tools";
|
||||||
|
|
||||||
|
import dd from "gdt-jsapi";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
// axios.defaults.baseURL = '/api'
|
// axios.defaults.baseURL = '/api'
|
||||||
axios.defaults.timeout = 120000;
|
axios.defaults.timeout = 120000;
|
||||||
|
|
|
@ -61,6 +61,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, reactive } from "vue";
|
import { ref, onMounted, onUnmounted, reactive } from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
|
import http from "@/utils/request.js";
|
||||||
|
import dd from "gdt-jsapi";
|
||||||
|
|
||||||
import tab1 from "@/assets/guide/tab1.png";
|
import tab1 from "@/assets/guide/tab1.png";
|
||||||
import tab2 from "@/assets/guide/tab2.png";
|
import tab2 from "@/assets/guide/tab2.png";
|
||||||
import tab3 from "@/assets/guide/tab3.png";
|
import tab3 from "@/assets/guide/tab3.png";
|
||||||
|
@ -123,6 +126,79 @@ const stopDrag = () => {
|
||||||
document.removeEventListener("mousemove", doDrag); // 销毁监听器
|
document.removeEventListener("mousemove", doDrag); // 销毁监听器
|
||||||
document.removeEventListener("mouseup", stopDrag);
|
document.removeEventListener("mouseup", stopDrag);
|
||||||
};
|
};
|
||||||
|
const getCookie = (cname) => {
|
||||||
|
var cn = cname;
|
||||||
|
const cookies = document.cookie.split("; ");
|
||||||
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
|
const [name, value] = cookies[i].split("=");
|
||||||
|
if (name === cn) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
// 登录
|
||||||
|
const login = () => {
|
||||||
|
// this.loading = true;
|
||||||
|
// let ua = navigator.userAgent.toLowerCase();
|
||||||
|
// let env = "pc";
|
||||||
|
// const isMobile =
|
||||||
|
// /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/i.test(
|
||||||
|
// ua
|
||||||
|
// );
|
||||||
|
// env = isMobile ? "move" : "pc";
|
||||||
|
// console.log(ua, env, 333);
|
||||||
|
console.log(111, dd.getAuthCode);
|
||||||
|
dd.getAuthCode()
|
||||||
|
.then((res) => {
|
||||||
|
// let auth__code = env == "pc" ? res.auth_code : res.code;
|
||||||
|
// console.log( 555,res, auth__code);
|
||||||
|
http
|
||||||
|
.post(`/api/sign_in/one_click_login?authCode=${res.auth_code}`)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
console.log(1111, response);
|
||||||
|
tools.data.set("token", response.data.token);
|
||||||
|
// this.loading = false;
|
||||||
|
// // 登录成功
|
||||||
|
// if (!response.data.is_bind) {
|
||||||
|
// this.isShowBind = true;
|
||||||
|
// this.tenantUserId = response.data.tenant_user_id;
|
||||||
|
// } else {
|
||||||
|
// var user = {
|
||||||
|
// token: response.data.token,
|
||||||
|
// name: response.data.name,
|
||||||
|
// id: response.data.id,
|
||||||
|
// };
|
||||||
|
// tools.data.set("user", user);
|
||||||
|
// this.$message.success("登录成功");
|
||||||
|
// this.$router.replace("/home");
|
||||||
|
// }
|
||||||
|
tools.data.set("type", 1);
|
||||||
|
} else {
|
||||||
|
// 前往绑定
|
||||||
|
this.loading = false;
|
||||||
|
ElMessage.error({
|
||||||
|
message: "请重新登录!",
|
||||||
|
offset: 100,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
var token = getCookie("lytoken");
|
||||||
|
// console.log('token', token)
|
||||||
|
if (!token) {
|
||||||
|
window.location.href =
|
||||||
|
"http://220.191.238.50:996/api/login?returnURL=" +
|
||||||
|
window.location.href;
|
||||||
|
} else {
|
||||||
|
tools.data.set("token", token);
|
||||||
|
tools.data.set("type", 2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 清理事件监听器
|
// 清理事件监听器
|
||||||
|
@ -137,16 +213,17 @@ const reset_font = () => {
|
||||||
"scale(" + width / 1920 + "," + height / 1080 + ")";
|
"scale(" + width / 1920 + "," + height / 1080 + ")";
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let token = tools.data.get("token");
|
login();
|
||||||
|
// let token = tools.data.get("token");
|
||||||
// console.log(token, "token");
|
// console.log(token, "token");
|
||||||
if (token == null) {
|
// if (token == null) {
|
||||||
ElMessage.error({
|
// ElMessage.error({
|
||||||
message: "请重新登录!",
|
// message: "请重新登录!",
|
||||||
offset: 100,
|
// offset: 100,
|
||||||
});
|
// });
|
||||||
window.location.href =
|
// window.location.href =
|
||||||
"http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
|
// "http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
|
||||||
}
|
// }
|
||||||
reset_font();
|
reset_font();
|
||||||
reset_font();
|
reset_font();
|
||||||
});
|
});
|
||||||
|
@ -161,16 +238,16 @@ const tabData = reactive({
|
||||||
PageUrl: "/home/index/table",
|
PageUrl: "/home/index/table",
|
||||||
tabList: [
|
tabList: [
|
||||||
{
|
{
|
||||||
name: "总体概况",
|
name: "全局概览",
|
||||||
img: tab1,
|
img: tab1,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "要素一张图",
|
name: "要素图谱",
|
||||||
img: tab7,
|
img: tab7,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "评估模型",
|
name: "评估体系",
|
||||||
img: tab8,
|
img: tab8,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
|
@ -199,7 +276,7 @@ const tabData = reactive({
|
||||||
img: png3,
|
img: png3,
|
||||||
url: "/home/index",
|
url: "/home/index",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
img: png2,
|
img: png2,
|
||||||
url: "/home/index/map",
|
url: "/home/index/map",
|
||||||
|
|
Loading…
Reference in New Issue