This commit is contained in:
姚宇浩 2024-09-25 16:29:00 +08:00
commit d6f3aa5ed5
9 changed files with 383 additions and 90 deletions

15
package-lock.json generated
View File

@ -15,6 +15,7 @@
"echarts-gl": "^2.0.9",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.7.0",
"gdt-jsapi": "^1.9.51",
"sass": "^1.60.0",
"video.js": "^8.17.3",
"videojs-contrib-hls": "^5.15.0",
@ -110,6 +111,11 @@
"resolved": "https://registry.npmmirror.com/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz",
"integrity": "sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ=="
},
"node_modules/@remax/mini-types": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/@remax/mini-types/-/mini-types-0.1.0.tgz",
"integrity": "sha512-bVDcbUrp6p0PZwfS0xGVQS6k9f8B35BtZaYt/W/IGKh7VALYQ+tS2KcytLRmIJ/Vmohaw5ikIRN89I+frPdh4g=="
},
"node_modules/@types/lodash": {
"version": "4.17.1",
"resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.17.1.tgz",
@ -736,6 +742,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/gdt-jsapi": {
"version": "1.9.51",
"resolved": "https://registry.npmmirror.com/gdt-jsapi/-/gdt-jsapi-1.9.51.tgz",
"integrity": "sha512-VN1iIK7kJU2g2oxY/n8waCREhWxcVwR8qHAE1keVnUJHI6mTdgTelICzq++niRRCaLqUVWC1pYvftEVgk4sq8A==",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@remax/mini-types": "^0.1.0"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",

View File

@ -16,6 +16,7 @@
"echarts-gl": "^2.0.9",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.7.0",
"gdt-jsapi": "^1.9.51",
"sass": "^1.60.0",
"video.js": "^8.17.3",
"videojs-contrib-hls": "^5.15.0",

View File

@ -1,90 +1,95 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from "vue-router";
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 router = createRouter({
history: routerHistory,
routes: [
{
path: '/',
redirect: '/guide'
path: "/",
redirect: "/guide",
},
{
name: '引导页',
path: '/guide',
component: () => import('../view/guide.vue'),
name: "引导页",
path: "/guide",
component: () => import("../view/guide.vue"),
},
{
path: '/home',
component: () => import('../view/home.vue'),
path: "/home",
component: () => import("../view/home.vue"),
children: [
// {
// name: '登录',
// path: '/login/index',
// component: () => import('../view/login/LoginZZD.vue'),
// },
{
name: '首页',
path: '/home/index',
component: () => import('../view/sy.vue'),
name: "首页",
path: "/home/index",
component: () => import("../view/sy.vue"),
},
{
name: '养老',
path: '/home/yl',
component: () => import('../view/yl.vue'),
name: "养老",
path: "/home/yl",
component: () => import("../view/yl.vue"),
},
{
name: '卫生',
path: '/home/hygiene',
component: () => import('../view/hygiene.vue'),
name: "卫生",
path: "/home/hygiene",
component: () => import("../view/hygiene.vue"),
},
{
name: '教育',
path: '/home/education',
component: () => import('../view/education.vue'),
name: "教育",
path: "/home/education",
component: () => import("../view/education.vue"),
},
{
name: '就业补助',
path: '/home/work',
component: () => import('../view/work.vue'),
name: "就业补助",
path: "/home/work",
component: () => import("../view/work.vue"),
},
{
name: '智能分析',
path: '/home/analyze',
component: () => import('../view/analyze.vue'),
name: "智能分析",
path: "/home/analyze",
component: () => import("../view/analyze.vue"),
},
{
name: '首页地图',
path: '/home/index/map',
component: () => import('../view/sy_map.vue'),
name: "首页地图",
path: "/home/index/map",
component: () => import("../view/sy_map.vue"),
},
{
name: '首页表格',
path: '/home/index/table',
component: () => import('../view/sy_table.vue'),
name: "首页表格",
path: "/home/index/table",
component: () => import("../view/sy_table.vue"),
},
{
name: '首页表格详情',
path: '/home/index/table/details',
component: () => import('../view/sy_details.vue'),
name: "首页表格详情",
path: "/home/index/table/details",
component: () => import("../view/sy_details.vue"),
},
{
name: '人物图',
path: '/home/index/person',
component: () => import('../view/person/index.vue'),
name: "人物图",
path: "/home/index/person",
component: () => import("../view/person/index.vue"),
},
// {
// name: '地图编辑',
// path: '/home/index/mapEdit',
// component: () => import('../view/sy_map_fb.vue'),
// },
]
],
},
]
})
],
});
function getCookie(cname) {
var cn = cname
const cookies = document.cookie.split('; ');
var cn = cname;
const cookies = document.cookie.split("; ");
for (let i = 0; i < cookies.length; i++) {
const [name, value] = cookies[i].split('=');
const [name, value] = cookies[i].split("=");
if (name === cn) {
return value;
}
@ -100,26 +105,27 @@ function getCookie(cname) {
}
router.beforeEach((to, form, next) => {
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 {
// 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();
}
})
// 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 {
// // 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();
// }
next();
});
export default router
export default router;

View File

@ -1,6 +1,8 @@
import axios from "axios";
import { ElMessage } from "element-plus";
import tools from "@/utils/tools";
import dd from "gdt-jsapi";
import router from "../router";
// axios.defaults.baseURL = '/api'
axios.defaults.timeout = 120000;
@ -31,9 +33,13 @@ axios.interceptors.response.use(
// console.log(error.response,"响应拦截器失败")
ElMessage.error("请重新登录!");
// window.location.href = '/#/login?returnURL=' + window.location.href
window.location.href =
"http://220.191.238.50:996/api/login?returnURL=" +
window.location.href;
// window.location.href =
// "http://220.191.238.50:996/api/login?returnURL=" +
// window.location.href;
router.replace({
path: '/guide'
});
} else if (error.response.status == 404) {
ElMessage.error("Status:404正在请求不存在的服务器记录");
} else if (error.response.status == 500) {

View File

@ -61,6 +61,8 @@
<script setup>
import { ref, onMounted, onUnmounted, reactive } from "vue";
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 tab2 from "@/assets/guide/tab2.png";
import tab3 from "@/assets/guide/tab3.png";
@ -69,7 +71,6 @@ import tab5 from "@/assets/guide/tab5.png";
import tab6 from "@/assets/guide/tab6.png";
import tab7 from "@/assets/guide/tab7.png";
import tab8 from "@/assets/guide/tab8.png";
import png1 from "@/assets/guide/Dp/1.png";
import png2 from "@/assets/guide/Dp/2.png";
import png3 from "@/assets/guide/Dp/3.png";
@ -80,7 +81,6 @@ import png7 from "@/assets/guide/Dp/7.png";
import png8 from "@/assets/guide/Dp/8.png";
import { ElMessage } from "element-plus";
import tools from "@/utils/tools";
const router = useRouter();
const routers = useRoute();
@ -123,6 +123,80 @@ const stopDrag = () => {
document.removeEventListener("mousemove", doDrag); //
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");
var token = '6b0e380b4a8f46baae4923f83faf670d';
// 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(() => {
//
@ -137,16 +211,17 @@ const reset_font = () => {
"scale(" + width / 1920 + "," + height / 1080 + ")";
};
onMounted(() => {
let token = tools.data.get("token");
login();
// let token = tools.data.get("token");
// console.log(token, "token");
if (token == null) {
ElMessage.error({
message: "请重新登录!",
offset: 100,
});
window.location.href =
"http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
}
// if (token == null) {
// ElMessage.error({
// message: "!",
// offset: 100,
// });
// window.location.href =
// "http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
// }
reset_font();
reset_font();
});
@ -161,16 +236,16 @@ const tabData = reactive({
PageUrl: "/home/index/table",
tabList: [
{
name: "总体概况",
name: "全局概览",
img: tab1,
},
{
name: "要素一张图",
name: "要素",
img: tab7,
},
{
name: "评估模型",
name: "评估体系",
img: tab8,
},
// {

175
src/view/login/LoginZZD.vue Normal file
View File

@ -0,0 +1,175 @@
<template>
<div
class="zzd-container"
v-loading="loading"
:element-loading-text="isShowBind ? '绑定中...' : '登录中...'"
>
<div class="zzd-bind" v-if="isShowBind">
<h3>浙政钉绑定</h3>
<el-form
:model="form"
ref="formRef"
:rules="formRules"
label-width="60px"
label-position="left"
>
<el-form-item prop="user" label="账号">
<el-input
v-model="form.user"
placeholder="请输入账号"
prefix-icon="el-icon-user"
>
</el-input>
</el-form-item>
<el-form-item prop="password" label="密码">
<el-input
v-model="form.password"
prefix-icon="el-icon-lock"
show-password
type="password"
placeholder="请输入密码"
>
</el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="zzdBind">绑定</el-button>
</div>
</div>
</template>
<script>
import dd from "gdt-jsapi";
import tools from "@/utils/tools";
import http from "@/utils/request.js";
import { encrypt } from "@/utils";
export default {
data() {
return {
loading: false,
form: {},
formRules: {
user: [{ required: true, message: "请输入账号", trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
},
isShowBind: false,
tenantUserId: "",
};
},
methods: {
//
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);
dd.getAuthCode()
.then((res) => {
let auth__code = env == "pc" ? res.auth_code : res.code;
console.log(res, 555, auth__code);
http
.post(`/api/sign_in/one_click_login?authCode=${auth__code}`)
.then((response) => {
if (response.code == 200) {
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");
}
} else {
//
this.loading = false;
}
});
})
.catch((err) => {});
},
//
zzdBind() {
this.$refs.formRef.validate((valid, fields) => {
if (valid) {
this.loading = true;
http
.post(`/api/sso/dg/bind`, {
user: encrypt(this.form.user),
password: encrypt(this.form.password),
tenantUserId: this.tenantUserId,
})
.then((res) => {
if (res.code == 200) {
var user = {
token: res.data.token,
name: res.data.name,
id: res.data.id,
};
tools.data.set("user", user);
this.$message.success("绑定成功");
this.$router.replace("/home");
}
this.loading = false;
});
} else {
console.log("error submit!", fields);
}
});
},
},
mounted() {
this.login();
},
};
</script>
<style lang="scss" scoped>
.zzd-container {
width: 100%;
height: 100%;
background: url("@/assets/home/group.png") no-repeat 0 0 / cover;
position: relative;
min-height: 700px;
.zzd-bind {
width: 400px;
height: 340px;
box-sizing: border-box;
position: absolute;
background-color: #fff;
border-radius: 20px;
left: 50%;
top: 45%;
transform: translate(-50%, -50%);
padding: 0 30px;
h3 {
font-size: 22px;
text-align: center;
margin: 30px 0;
}
.el-form-item {
margin-bottom: 30px;
}
:deep(.el-button) {
display: block;
width: 100%;
margin: 0 auto;
}
}
}
</style>

View File

@ -1831,8 +1831,8 @@ const autoScroll = () => {
}
};
onBeforeMount(async () => {
document.cookie='lytoken=6b0e380b4a8f46baae4923f83faf670d'
tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
// document.cookie='lytoken=6b0e380b4a8f46baae4923f83faf670d'
// tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
getData();
getfw();
setTimeout(() => {

View File

@ -3229,11 +3229,13 @@ const createCustomOverlay = (polygon, indexx) => {
function createLabelDOM() {
var content = document.createElement("div");
content.style.display = "flex";
content.style.justifyContent= "end";
content.style.flexDirection = "column";
content.style.alignItems = "center";
content.style.justifyContent = "end";
content.style.height = "40px";
content.style.width = "140px";
content.style.width = "140px";
content.style.zIndex = BMapGL.Overlay.getZIndex(this.point.lat);
var div = document.createElement("div");

View File

@ -7,7 +7,7 @@
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.21.3.tgz"
integrity sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==
"@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5":
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5":
version "7.25.4"
resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.25.4.tgz"
integrity sha512-DSgLeL/FNcpXuzav5wfYvHCGvynXkJbn3Zvc3823AEe9nPwW9IK4UoCSS5yGymmQzN0pCPvivtgS6/8U2kkm1w==
@ -159,6 +159,11 @@
resolved "https://registry.npmmirror.com/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz"
integrity sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==
"@remax/mini-types@^0.1.0":
version "0.1.0"
resolved "https://registry.npmmirror.com/@remax/mini-types/-/mini-types-0.1.0.tgz"
integrity sha512-bVDcbUrp6p0PZwfS0xGVQS6k9f8B35BtZaYt/W/IGKh7VALYQ+tS2KcytLRmIJ/Vmohaw5ikIRN89I+frPdh4g==
"@types/lodash-es@^4.17.6":
version "4.17.12"
resolved "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.12.tgz"
@ -599,6 +604,14 @@ function-bind@^1.1.1:
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
gdt-jsapi@^1.9.51:
version "1.9.51"
resolved "https://registry.npmmirror.com/gdt-jsapi/-/gdt-jsapi-1.9.51.tgz"
integrity sha512-VN1iIK7kJU2g2oxY/n8waCREhWxcVwR8qHAE1keVnUJHI6mTdgTelICzq++niRRCaLqUVWC1pYvftEVgk4sq8A==
dependencies:
"@babel/runtime" "^7.10.2"
"@remax/mini-types" "^0.1.0"
glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz"