From c93d4b3af5739f786cfdf20b16b28ec60403f709 Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期二, 25 六月 2024 19:53:54 +0800 Subject: [PATCH] 前端对接 seb实体库,rag基本服务 --- src/assets/js/map/modelLayer.js | 90 ++++++++++++++++++++++++++++++-------------- 1 files changed, 61 insertions(+), 29 deletions(-) diff --git a/src/assets/js/map/modelLayer.js b/src/assets/js/map/modelLayer.js index dfd6536..f7063ab 100644 --- a/src/assets/js/map/modelLayer.js +++ b/src/assets/js/map/modelLayer.js @@ -1,7 +1,10 @@ import { getPublickey, getSecurityLogin, - getListCanview + getListCanview, + getmapConfig, + getQueryEentity, + getSettingPublickey } from "../../../api/modelBase.js"; import JSEncrypt from "jsencrypt"; import store from "../../../store/index.js"; @@ -14,35 +17,43 @@ modelBase: null, dbid: null, geom: null, - // 鑾峰彇Publickey + layers: null, + publickey: null, init() { this.modelBase = config.modelBase; - getPublickey().then((response) => { - const password = this.modelBase.password; - const userId = this.modelBase.userId; - const publickey = response.data; - const encrypt = new JSEncrypt(); - encrypt.setPublicKey(publickey); - let encrypted = encrypt.encrypt(password.substring(0, 50)) + ""; - let submit = { - userid: userId, - password: encrypted - }; - this.setLoginsubmit(submit); + this.getSettingPublicKey(); + const token = getToken(); + console.log("token", token); + if (token) { + this.getModelLayerList(); + } else { + getPublickey().then((response) => { + const password = this.modelBase.password; + const userId = this.modelBase.userId; + const publickey = response.data; + const encrypt = new JSEncrypt(); + encrypt.setPublicKey(publickey); + let encrypted = encrypt.encrypt(password.substring(0, 50)) + ""; + let submit = { + userid: userId, + password: encrypted + }; + this.setLoginsubmit(submit); + }); + } + }, + getSettingPublicKey() { + getSettingPublickey().then((response) => { + this.publickey = response.data; }); }, // 鑾峰彇Token setLoginsubmit(res) { - // const token = getToken(); - // if (token) { getSecurityLogin(res).then((response) => { const val = response.data.token; setToken(val); this.getModelLayerList(); }); - // } else { - // this.getModelLayerList( ); - // } }, // 鑾峰彇鍒楄〃 getModelLayerList() { @@ -56,19 +67,40 @@ }); if (obj.length > 0) { this.dbid = obj[0].dbid; + this.getmapConfig(); } }); - this.setLayerQuery(); + }, + getmapConfig() { + getmapConfig({ + dbid: this.dbid, + token: getToken() + }).then((response) => { + if (response.code != 200) return; + const layers = response.data.layers; + this.layers = layers; + for (var i in layers) { + if (layers[i].name == "寤虹瓚") { + const url = layers[i].lod_url["3d"][""]; + + mapServer.addServer({ + sourceType: "Tileset", + url: url, + id: layers[i].id + }); + } + } + }); }, setLayerQuery() { const token = getToken(); this.geom = mapConfig.setPointToCrical(120.27, 14.79, null); - const obj = { - type: "FeatureCollection", - totalFeatures: 1086, - features: [this.geom] - }; + // const obj = { + // type: "FeatureCollection", + // totalFeatures: 1086, + // features: [this.geom] + // }; // earthCtrl.factory.createFeatureLayer({ // sourceType: "geojson", // url: obj, @@ -168,11 +200,11 @@ // a.push([ // "${id} == '1_b092c0c26de646b984801e29fba37f82'", - '${id} == 1_b092c0c26de646b984801e29fba37f82', - 'color("purple", 0.5)' + "${id} == 1_b092c0c26de646b984801e29fba37f82", + 'color("purple", 0.5)' ]); a.push(["true", "color('#E8F1F2', 0.5)"]); - console.log( tileset); + console.log(tileset); tileset.style = new Cesium.Cesium3DTileStyle({ // color: "vec4(1.0,1.0,1.0, 1.0)", // 绾㈣壊 color: { @@ -180,7 +212,7 @@ [ // "${id} == '1_b092c0c26de646b984801e29fba37f82'", '${targettype} == "鍐涗簨鐩爣"', - 'color("purple", 0.5)' + 'color("purple", 0.5)' ] ] } -- Gitblit v1.9.3