@ohuoy/easymap 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.js CHANGED
@@ -5,6 +5,17 @@ import mapboxgl from './lib/mapbox-gl/dist/mapbox-gl.js';
5
5
  import * as ant7 from './lib/@antv/l7';
6
6
  import * as Three from 'three'
7
7
  import {TrackballControls} from 'three/addons/controls/TrackballControls.js'
8
+ import {OrbitControls} from 'three/addons/controls/OrbitControls.js'
9
+ import {EffectComposer} from 'three/examples/jsm/postprocessing/EffectComposer.js';
10
+ import {RenderPass} from 'three/examples/jsm/postprocessing/RenderPass.js';
11
+ import {ShaderPass} from 'three/examples/jsm/postprocessing/ShaderPass.js';
12
+ import {OutlinePass} from 'three/examples/jsm/postprocessing/OutlinePass.js';
13
+ import {FXAAShader} from 'three/examples/jsm/shaders/FXAAShader.js';
14
+ import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass'
15
+
16
+ import {
17
+ GammaCorrectionShader
18
+ } from 'three/examples/jsm/shaders/GammaCorrectionShader.js';
8
19
  window.EasyMap = EasyMap
9
20
  window.EmComponents = EmComponents
10
21
  window.EmUtils = EmUtils
@@ -18,7 +29,15 @@ export {
18
29
  EmComponents,
19
30
  EmUtils,
20
31
  mapboxgl,
32
+ OrbitControls,
33
+ UnrealBloomPass,
21
34
  ant7,
22
35
  Three,
23
- TrackballControls
36
+ TrackballControls,
37
+ EffectComposer,
38
+ RenderPass,
39
+ ShaderPass,
40
+ OutlinePass,
41
+ FXAAShader,
42
+ GammaCorrectionShader
24
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohuoy/easymap",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "self map easy use",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ export default class GisReverse {
2
+
3
+ }
@@ -0,0 +1,28 @@
1
+ export const VERSION = '/api/'+ 'v1'
2
+ export const UPLOADMINIOURL = import.meta.env.VITE_MINIO_URL
3
+ export const UPLOADMINIOURLSERVER = import.meta.env.VITE_MINIO_SERVER_URL
4
+ export const LOGINURL =VERSION+ '/auth'
5
+ export const UPLOADANDDOWNLOADURL = VERSION+'/attachment'
6
+ export const SITEURL = VERSION+'/site'
7
+ export const LIDARURL = VERSION+'/lidar'
8
+ export const USERURL = VERSION+'/user'
9
+ export const ROLEURL = VERSION+'/role'
10
+ export const PERMISSIONSURL =ROLEURL+'/permission'
11
+ export const DICURL = VERSION + '/dictionary'
12
+ export const GEOURL = VERSION + '/redisGeo'
13
+ export const MONITORPOINTURL = VERSION + '/monitorpoint'
14
+ export const SYS = VERSION + '/sys'
15
+ export const EXTERNALURL = VERSION + '/external'
16
+ export const MESSAGEURL = VERSION+'/notice'
17
+ export const NOTICECONFIGURL = MESSAGEURL+'/reciver/configuration'
18
+ export const LOGURL = VERSION+'/sys/log'
19
+ export const COMPANYURL = VERSION+'/company'
20
+ export const GIS = VERSION + '/gis'
21
+ export const REPORTURL = VERSION + '/report'
22
+ export const DAILYREPORTURL = REPORTURL + '/daily'
23
+ export const CASEURL = VERSION + '/case'
24
+ export const STATISTICSURL = VERSION + '/statistics'
25
+ export const MARKERURL = VERSION + '/markinfo'
26
+ export const MARKERTYPE = VERSION + '/marktype'
27
+ export const MARKERRECORDS = VERSION + 'markRecords'
28
+ export const EXTERNALMONITORPOINT = 'http://47.114.183.34:10207'
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @description: 请求结果集
3
+ */
4
+ export enum ResultEnum {
5
+ SUCCESS = 200,
6
+ ERROR = -1,
7
+ TIMEOUT = 10042,
8
+ TYPE = 'success',
9
+ }
10
+
11
+ /**
12
+ * @description: 请求方法
13
+ */
14
+ export enum RequestEnum {
15
+ GET = 'GET',
16
+ POST = 'POST',
17
+ PATCH = 'PATCH',
18
+ PUT = 'PUT',
19
+ DELETE = 'DELETE',
20
+ }
21
+
22
+ /**
23
+ * @description: 常用的contentTyp类型
24
+ */
25
+ export enum ContentTypeEnum {
26
+ // json
27
+ JSON = 'application/json;charset=UTF-8',
28
+ // json
29
+ TEXT = 'text/plain;charset=UTF-8',
30
+ // form-data 一般配合qs
31
+ FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
32
+ // form-data 上传
33
+ FORM_DATA = 'multipart/form-data;charset=UTF-8',
34
+ }
@@ -0,0 +1,205 @@
1
+ import axios, { CanceledError } from 'axios';
2
+ import { isString } from 'lodash-es';
3
+ import type { AxiosRequestConfig, AxiosResponse } from 'axios';
4
+ import { ResultEnum } from './enums/httpEnum';
5
+ import Qs from 'qs'
6
+ import { getUniqueCode} from '@/utils/helper'
7
+
8
+ export interface RequestOptions extends AxiosRequestConfig {
9
+ /** 是否直接将数据从响应中提取出,例如直接返回 res.data,而忽略 res.code 等信息 */
10
+ isReturnResult?: boolean;
11
+ /** 请求成功是提示信息 */
12
+ successMsg?: string;
13
+ /** 请求失败是提示信息 */
14
+ errorMsg?: string;
15
+ /** 成功时,是否显示后端返回的成功信息 */
16
+ showSuccessMsg?: boolean;
17
+ /** 失败时,是否显示后端返回的失败信息 */
18
+ showErrorMsg?: boolean;
19
+ requestType?: 'json' | 'form';
20
+ }
21
+
22
+ const UNKNOWN_ERROR = '未知错误,请重试';
23
+
24
+
25
+ let tokenStore;
26
+
27
+ /** 真实请求的路径前缀 */
28
+ export const baseApiUrl = import.meta.env.VITE_BASE_API_URL;
29
+ /** mock请求路径前缀 */
30
+ // const baseMockUrl = import.meta.env.VITE_MOCK_API;
31
+ const controller = new AbortController();
32
+ const service = axios.create({
33
+ baseURL: baseApiUrl,
34
+ timeout: 1000 * 60 *3,
35
+ signal: controller.signal,
36
+ headers:{
37
+ clientId:await getUniqueCode(),
38
+ 'Accept-Language':'zh-',
39
+ 'clientType':"Web_Client"
40
+ }
41
+ });
42
+ service.interceptors.request.use(
43
+ async (config) => {
44
+ if (config.loading) {
45
+ config.loading.value = true
46
+ }
47
+ if (config.headers && !config.noAuth) {
48
+ if(!tokenStore){
49
+ tokenStore= useTokenStore()
50
+ }
51
+ const token = await tokenStore.getTokenString();
52
+ // 请求头token信息,请根据实际情况进行修改
53
+ config.headers['Authorization'] = `Bearer ${token}`;
54
+ }
55
+ return config;
56
+ },
57
+ (error) => {
58
+ Promise.reject(error);
59
+ },
60
+ );
61
+
62
+
63
+ service.interceptors.response.use(
64
+ (response: AxiosResponse<BaseResponse>) => {
65
+ const res = response.data;
66
+ if (response.config.loading) {
67
+ response.config.loading.value = false
68
+ }
69
+ // if the custom code is not 200, it is judged as an error.
70
+ if (response.status !== ResultEnum.SUCCESS) {
71
+ if(204 == response.status){
72
+ return response;
73
+ }
74
+ console.error(res.title || "请求错误");
75
+ // Illegal token
76
+ if ([401, 403,400].includes(res.statusCode)) {
77
+
78
+ // to re-login
79
+ localStorage.clear();
80
+ setTimeout(() => {
81
+ console.error(res.title || "认证错误");
82
+ }, 400);
83
+ window.location.reload();
84
+
85
+ }
86
+
87
+ // throw other
88
+ const error = new Error(res.statusText || UNKNOWN_ERROR) as Error & { code: any };
89
+ error.code = res.code;
90
+ return Promise.reject(error);
91
+ } else {
92
+ return response;
93
+ }
94
+ },
95
+ (error) => {
96
+ if(!error.response){
97
+ debugger
98
+ console.error("系统错误");
99
+ localStorage.clear();
100
+ return
101
+ }
102
+ if (error.config.loading) {
103
+ error.config.loading.value = false
104
+ }
105
+ if (error.code === 'ERR_NETWORK' || [401, 403,400].includes(error.response.data.statusCode)) {
106
+ console.error(error.response.data.title || "认证错误");
107
+ // to re-login
108
+ localStorage.clear();
109
+ setTimeout(() => {
110
+ window.location.reload();
111
+ }, 2000);
112
+ }
113
+ else{
114
+ console.error(error.response?.data?.title);
115
+ }
116
+ return Promise.reject(error);
117
+ },
118
+ );
119
+
120
+ type BaseResponse<T = any> = Omit<API.ResOp, 'data'> & {
121
+ data: T;
122
+ };
123
+
124
+ export function request<T = any>(
125
+ url: string,
126
+ config: { isReturnResult: false } & RequestOptions,
127
+ ): Promise<BaseResponse<T>>;
128
+ export function request<T = any>(
129
+ url: string,
130
+ config: RequestOptions,
131
+ ): Promise<BaseResponse<T>['data']>;
132
+ export function request<T = any>(
133
+ config: { isReturnResult: false } & RequestOptions,
134
+ ): Promise<BaseResponse<T>>;
135
+ export function request<T = any>(config: RequestOptions): Promise<BaseResponse<T>['data']>;
136
+
137
+ /**
138
+ *
139
+ * @param url - request url
140
+ * @param config - AxiosRequestConfig
141
+ */
142
+ export async function request(_url: string | RequestOptions, _config: RequestOptions = {}) {
143
+ const url = isString(_url) ? _url : _url.url;
144
+ const config = isString(_url) ? _config : _url;
145
+ try {
146
+ // 兼容 from data 文件上传的情况
147
+ const { requestType , noAuth, isReturnResult = true, ...rest } = config;
148
+ const response = (await service.request({
149
+ url,
150
+ noAuth,
151
+ ...rest,
152
+ headers: {
153
+ ...rest.headers,
154
+ ...(requestType === 'form' ? { 'Content-Type': 'multipart/form-data' } : {}),
155
+ },
156
+ paramsSerializer: function (par) {
157
+ return Qs.stringify(par, {arrayFormat: 'repeat'})
158
+ },
159
+ })) as AxiosResponse<BaseResponse>;
160
+ const { data } = response;
161
+ // 页面代码需要获取 code,data,message 等信息时,需要将 isReturnResult 设置为 false
162
+ return data;
163
+ } catch (error: any) {
164
+ return Promise.reject(error);
165
+ }
166
+ }
167
+
168
+
169
+ // /**
170
+ // *
171
+ // * @param url - request url
172
+ // * @param config - AxiosRequestConfig
173
+ // */
174
+ // export async function requestAll(requestList:[]) {
175
+ // let requestEnList= requestList.map(a=>{
176
+ // let url = isString(_url) ? _url : _url.url;
177
+ // let config = isString(_url) ? _config : _url;
178
+ // const { requestType , noAuth, isReturnResult = true, ...rest } = config;
179
+ // return (service.request({
180
+ // url,
181
+ // noAuth,
182
+ // ...rest,
183
+ // headers: {
184
+ // ...rest.headers,
185
+ // ...(requestType === 'form' ? { 'Content-Type': 'multipart/form-data' } : {}),
186
+ // },
187
+ // paramsSerializer: function (par) {
188
+ // return Qs.stringify(par, {arrayFormat: 'repeat'})
189
+ // },
190
+ // })) as AxiosResponse<BaseResponse>;
191
+ // })
192
+ // try {
193
+ // axios.all(requestEnList).then(axios.spread(()=>{
194
+
195
+ // }))
196
+ // // 兼容 from data 文件上传的情况
197
+ // const { requestType , noAuth, isReturnResult = true, ...rest } = config;
198
+ // const response =
199
+ // const { data } = response;
200
+ // // 页面代码需要获取 code,data,message 等信息时,需要将 isReturnResult 设置为 false
201
+ // return data;
202
+ // } catch (error: any) {
203
+ // return Promise.reject(error);
204
+ // }
205
+ // }
@@ -0,0 +1 @@
1
+ export const