yxuse 3.0.81 → 3.0.82
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/lib/api.es.js +2 -2
- package/lib/index.cjs12.js +1 -1
- package/lib/index.cjs2.js +1 -1
- package/lib/index.es12.js +30 -23
- package/lib/index.es12.js.gz +0 -0
- package/lib/index.es2.js +8 -9
- package/lib/index.es4.js +1 -1
- package/lib/index.es5.js +1 -1
- package/lib/index.es5.js.gz +0 -0
- package/lib/index.es6.js +1 -1
- package/lib/index.es6.js.gz +0 -0
- package/lib/index.es7.js +1 -1
- package/lib/index.es8.js +1 -1
- package/lib/utils.cjs.js +1 -1
- package/lib/utils.es.js +3 -4
- package/package.json +1 -1
- package/types/api/auth/index.d.ts +3 -2
- package/types/utils/http/index.d.ts +9 -2
- package/types/utils/index.d.ts +0 -1
package/lib/api.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l } from "./index.es12.js";
|
|
2
2
|
import { i } from "./index.es14.js";
|
|
3
3
|
import { g, d, c, b } from "./index.es4.js";
|
|
4
4
|
export {
|
|
5
5
|
i as assets,
|
|
6
|
-
|
|
6
|
+
l as auth,
|
|
7
7
|
g as getCommentUntreatedCount,
|
|
8
8
|
d as getUserSelectAnteList,
|
|
9
9
|
c as getUserSelectSatelliteList,
|
package/lib/index.cjs12.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);const s=require("./vendor-axios.cjs.js"),r=require("element-plus");require("element-plus/es/components/notification/style/index"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/notification/style/css"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/loading/style/css");const o={ttc:{LOGIN_URL:`${window.location.origin}/ttc/cloud/#/login`,HOME_URL:`${window.location.origin}/ttc/cloud/#/cloud`,INTEGRATED_BASE_URL:"/gateway/integrated-management/api/v1"}},n=(e="ttc")=>{p({token:""})},a=(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).token:null},i=async({userName:e,password:t},s="ttc")=>{const o=d("loginApiUrl"),{data:n}=await
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);const s=require("./vendor-axios.cjs.js"),r=require("element-plus");require("element-plus/es/components/notification/style/index"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/notification/style/css"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/loading/style/css");const o={ttc:{LOGIN_URL:`${window.location.origin}/ttc/cloud/#/login`,HOME_URL:`${window.location.origin}/ttc/cloud/#/cloud`,INTEGRATED_BASE_URL:"/gateway/integrated-management/api/v1"}},n=(e="ttc")=>{p({token:""})},a=(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).token:null},i=async({userName:e,password:t},s="ttc")=>{const o=d("loginApiUrl"),{data:n}=await N.post(o,{userName:e,password:t});n.tokenValue&&r.ElMessage.success("登录成功"),p({token:n.tokenValue,userInfo:n})},l=()=>{if(S()){n();if(location.pathname.includes(u()))return;location.replace(u())}else{const e=window.prompt("当前系统处于开发环境,当前登录过期,请输入登录账号","");if(null!==e){const t=window.prompt("请输入登录密码","");null!==t&&""!=t||window.prompt("请输入登录密码",""),i({userName:e,password:t})}}},c=()=>{window.location.replace(g())},u=()=>d("loginUrl"),g=()=>d("homeUrl"),p=(e,t="ttc")=>{const s=localStorage.getItem(`${t}GlobalState`)??"{}",r={...JSON.parse(s),...e};localStorage.setItem(`${t}GlobalState`,JSON.stringify(r))},m=(e,t)=>{const s=localStorage.getItem("ttcGlobalState")??"{}",r={...JSON.parse(s),[e]:t};localStorage.setItem("ttcGlobalState",JSON.stringify(r))},d=(e,t="ttc")=>JSON.parse(localStorage.getItem(`${t}GlobalState`)??"{}")[e]??"",S=()=>"production"===d("environment"),h=e=>{if(!e)return!1;const t=sessionStorage.getItem("ttcUserBtnList")??"[]";return JSON.parse(t).includes(e)};let E=null;const R=async()=>{if(E)return E;const{data:e}=await N.get(d("userConfigApiUrl"),{},{headers:{noLoading:!0}});return E=e,e},f=Object.freeze(Object.defineProperty({__proto__:null,autoLogin:i,changeSystemConfig:m,getHomeUrl:g,getLoginUrl:u,getSystemConfig:d,getToken:a,getUserConfig:R,getUserInfo:(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).userInfo:null},getUserIsHaveBtnPower:h,getUserPermissions:async(e,t=!0,s)=>{if(!a()&&t)return l();try{const{data:t}=await((e="ttc")=>N.get(`${o[e].INTEGRATED_BASE_URL}/account/auth/route/list`))(s),r=t.filter((t=>t.routeTag.startsWith(e))),n=r.filter((e=>"VIEW"===e.routeType)),a=r.filter((e=>"BTN"===e.routeType));return sessionStorage.setItem("ttcUserBtnList",JSON.stringify(a.map((e=>e.routeTag)))),{userMenuList:n,userBtnList:a}}catch(r){}},getUserRouteList:async()=>{if(!a())return[];return await((e="ttc")=>N.get(`${o[e].INTEGRATED_BASE_URL}/account/home/menu`))()},getUserRouter:(e,t)=>{let s=[];return e.forEach((e=>{const r=`/src/views${e.routeView}/index.vue`;if(t[r]){const o=(null==e?void 0:e.reservedRouteInfo)&&JSON.parse((null==e?void 0:e.reservedRouteInfo)??"{}"),n={path:e.routeView,name:e.routeView.split("/")[1],meta:{title:e.routeName,icon:null==o?void 0:o.routeIcon},component:t[r]};s.push(n)}})),s},isProduction:S,jumpToHome:c,jumpToLogin:l,removeToken:n,setSystemConfig:p,setSystemInfo:(e,t)=>{const s=`${e}GlobalState`;localStorage.setItem(s,JSON.stringify(t))},setUserInfo:(e,t)=>{const s=`${e}GlobalState`,r=localStorage.getItem(s)??"{}",o={...JSON.parse(r),userInfo:t};localStorage.setItem(s,JSON.stringify(o))}},Symbol.toStringTag,{value:"Module"}));let I;const v={lock:!0,text:"loading...",fullscreen:!0,background:"rgba(0, 0, 0, 0.6)"};let M=0;const w=()=>{0===M&&(I=r.ElLoading.service(v)),M++},y=()=>{M<=0||(M--,0===M&&I.close())};var U=(e=>(e[e.SUCCESS=200]="SUCCESS",e[e.ERROR=500]="ERROR",e[e.OVERDUE=401]="OVERDUE",e[e.TIMEOUT=3e4]="TIMEOUT",e))(U||{});const b=(e,t)=>{switch(e){case 400:r.ElMessage.error(t||"请求失败!请您稍后重试");break;case 401:r.ElMessage.error(t||"登录失效!请您重新登录"),location.href.includes(u())||l();break;case 403:r.ElMessage.error(t||"当前账号无权限访问!");break;case 404:r.ElMessage.error("你所访问的资源不存在");break;case 405:r.ElMessage.error(t||"请求方式错误!请您稍后重试");break;case 408:r.ElMessage.error(t||"请求超时!请您稍后重试");break;case 500:r.ElMessage.error(t||"服务异常!");break;case 502:r.ElMessage.error(t||"网关错误!");break;case 503:r.ElMessage.error(t||"服务不可用");break;case 504:r.ElMessage.error(t||"网关超时!");break;default:r.ElMessage.error(t||"请求失败!请您稍后重试!")}};d("isTranslateApi");const N=new class{constructor(e){t(this,"service"),t(this,"customResMap"),t(this,"customResquestInterceptors"),t(this,"customResponseInterceptors"),this.service=s.axios.create(e),this.setupInterceptors(),this.customResMap={}}setupInterceptors(){this.service.interceptors.request.use((e=>{var t;return(null==(t=e.headers)?void 0:t.noLoading)||w(),e.headers.token=a(),(null==e?void 0:e.customResHandler)&&(null==e?void 0:e.url)&&(this.customResMap[null==e?void 0:e.url]=e.customResHandler),this.customResquestInterceptors&&this.customResquestInterceptors(e),e}),(e=>Promise.reject(e))),this.service.interceptors.response.use((async e=>{const{config:t}=e;let s=e.data;this.customResponseInterceptors&&this.customResponseInterceptors(s);const r=e.status;return y(),t.url&&this.customResMap[t.url]?this.customResMap[t.url](s):(r==U.OVERDUE||s.code===U.OVERDUE?this.handleOverdueResponse(s):s.code!==U.SUCCESS&&this.handleErrorResponse(s),s)}),(e=>{y();const t=e.response,{config:s}=e;return this.customResponseInterceptors&&this.customResponseInterceptors(t),(null==s?void 0:s.url)&&this.customResMap[s.url]&&this.customResMap[s.url](e.response),e.message.includes("timeout")?r.ElMessage.error("请求超时!请稍后重试"):e.message.includes("Network Error")&&r.ElMessage.error("网络错误!请稍后重试"),t&&b(t.status,this.getResMessage(t.data)),window.navigator.onLine||r.ElNotification({title:"提示",message:"当前网络似乎开小差了",type:"warning",duration:5e3}),Promise.reject(e)}))}getResMessage(e){return(null==e?void 0:e.resultMsg)??(null==e?void 0:e.message)??(null==e?void 0:e.msg)??null}handleOverdueResponse(e){return r.ElNotification({title:"登录过期提醒",message:this.getResMessage(e)||"当前登录失效",type:"warning",duration:5e3}),l(),Promise.reject(e)}handleErrorResponse(e){return this.getResMessage(e)?r.ElMessage.error(this.getResMessage(e)):b(e.status),Promise.reject(e)}get(e,t,s={}){return this.service.get(e,{params:t,...s})}post(e,t,s={}){return this.service.post(e,t,s)}put(e,t,s={}){return this.service.put(e,t,s)}delete(e,t,s={}){return this.service.delete(e,{params:t,...s})}interceptorsRequestCallback(e){this.customResquestInterceptors=e}interceptorsResponseCallback(e){this.customResponseInterceptors=e}}({timeout:3e4,withCredentials:!0});exports.BC_LANG_NAME="LANG",exports.BC_THEME_NAME="THEME",exports.URL=o,exports.changeSystemConfig=m,exports.checkStatus=b,exports.getSystemConfig=d,exports.getToken=a,exports.getUserConfig=R,exports.getUserIsHaveBtnPower=h,exports.hideFullScreenLoading=y,exports.http=N,exports.index=f,exports.jumpToHome=c,exports.setSystemConfig=p,exports.showFullScreenLoading=w;
|
package/lib/index.cjs2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);const s=require("./index.cjs12.js"),i=require("./index.cjs13.js");require("element-plus"),require("element-plus/es/components/message/style/index");const n=require("./vendor-mqtt.cjs.js");async function o(e,t,i,n={}){const{headers:o={},responseType:r="json",signal:a,noAuth:h=!1}=n,c="GET"===t?`${e}${function(e){if(!e)return"";const t=new URLSearchParams;return Object.entries(e).forEach((([e,s])=>{null!=s&&t.append(e,String(s))})),`?${t.toString()}`}(i)}`:`${e}`,l=s.getToken();n.noLoading||s.showFullScreenLoading();const u=await fetch(c,{method:t,headers:{"Content-Type":"application/json",...l&&!h?{token:l}:"",...o},body:"GET"!==t&&i?JSON.stringify(i):void 0,signal:a});if(s.hideFullScreenLoading(),!u.ok){let e="";try{const t=await u.json();(null==t?void 0:t.resultMsg)&&(e=t.resultMsg)}catch(m){}throw s.checkStatus(u.status,e),new Error(e)}switch(r){case"text":return u.text();case"blob":return u.blob();default:return u.json()}}const r={get:(e,t,s)=>o(e,"GET",t,s),post:(e,t,s)=>o(e,"POST",t,s),put:(e,t,s)=>o(e,"PUT",t,s),delete:(e,t,s)=>o(e,"DELETE",t,s)},a={mqttVersion:5,clean:!0,connectTimeout:4e3,keepAlive:60,clientId:"mqttjs_"+Date.now(),qos:1},h=new Map;class c{constructor(e,s){t(this,"client"),this.client=null,this.subscribe=this.subscribe,this.unsubscribe=this.unsubscribe,this.publish=this.publish,this.destroyed=this.destroyed,this.createClient(e,{...a,...s})}createClient(e,t){this.client=n.mqtt_minExports.connect(e,t),this.client.on("connect",this.onConnect),this.client.on("reconnect",this.onReconnect),this.client.on("error",this.onError),this.client.on("message",this.onMessage)}publish(e,t){this.client.publish(e,t,{qos:a.qos},(e=>{}))}subscribe(e,t){this.client.subscribe(e,(s=>{if(s)throw new Error(s);h.set(e,t)}))}unsubscribe(e){this.client.unsubscribe(e,{},(e=>{}))}onConnect(e){}onReconnect(e){}onError(e){}onMessage(e,t){const s=t.toString();h.get(e)(JSON.parse(s))}destroyed(){this.client.end&&this.client.end()}}class l{constructor(e,s){t(this,"url"),t(this,"protocols"),t(this,"webSocketState"),t(this,"isCustomClose"),t(this,"reconnectTime"),t(this,"heartBeatTime"),t(this,"waitBeatTime"),t(this,"callback"),t(this,"HEART_KEY"),t(this,"HEART_VALUE"),t(this,"ws"),t(this,"isReconnectionLoading"),t(this,"timeId"),t(this,"eventCenter"),t(this,"errorStack"),t(this,"heartMessage"),t(this,"msgDataPreHandler"),this.url=e.url,this.protocols=s,this.webSocketState=!1,this.isCustomClose=!0,this.reconnectTime=e.reconnectTime,this.heartBeatTime=e.heartBeatTime,this.waitBeatTime=e.waitBeatTime,this.callback=e.callback,e.msgDataPreHandler&&(this.msgDataPreHandler=e.msgDataPreHandler),this.onmessage=this.onmessage,this.heartMessage=e.heartMessage,this.HEART_KEY=e.HEART_KEY,this.HEART_VALUE=e.HEART_VALUE,this.ws=null,this.isReconnectionLoading=!1,this.createWs()}createWs(){"WebSocket"in window&&(this.ws=null,this.ws=new WebSocket(this.url,this.protocols),this.onopen(),this.onerror(),this.onclose(),this.onmessage())}onopen(){this.ws.onopen=()=>{this.webSocketState=!0,this.startHeartBeat(this.heartBeatTime)}}startHeartBeat(e){setTimeout((()=>{this.heartMessage&&(this.heartMessage.data=(new Date).getTime()+""),this.send(this.heartMessage?this.heartMessage:this.HEART_KEY),this.waitingServer()}),e)}waitingServer(){this.webSocketState=!1,setTimeout((()=>{if(this.webSocketState)this.startHeartBeat(this.heartBeatTime);else try{this.close(),this.ws&&this.start()}catch(e){}}),this.waitBeatTime)}onerror(){this.ws&&(this.ws.onerror=e=>{this.isCustomClose=!1,this.isReconnectionLoading=!1})}onclose(){this.ws&&(this.ws.onclose=()=>{this.isCustomClose||this.ws&&(this.reconnection(),this.isReconnectionLoading=!1)})}async onmessage(){this.ws&&(this.ws.onmessage=async e=>{try{let t=e.data;if(this.msgDataPreHandler&&await this.msgDataPreHandler(t),t===this.HEART_VALUE)return void(this.webSocketState=!0);const s=JSON.parse(t);this.callback(s)}catch(t){this.callback(e.data)}})}reconnection(){this.isReconnectionLoading||(this.isReconnectionLoading=!0,clearTimeout(this.timeId),this.timeId=null,this.timeId=setTimeout((()=>{this.createWs()}),this.reconnectTime))}send(e){this.webSocketState&&this.ws&&this.ws.send(e)}close(){var e;this.isCustomClose=!0,this.isReconnectionLoading=!1,this.ws&&this.ws.close&&(null==(e=this.ws)||e.close())}start(){this.isCustomClose=!1,this.reconnection()}subscribe(e,t){this.eventCenter.on(e,t)}unsubscribe(e,t){this.eventCenter.off(e,t)}destroy(){clearTimeout(this.timeId),this.close(),this.ws=null,this.errorStack=null,this.eventCenter=null,this.webSocketState=!1}}const u=Object.freeze(Object.defineProperty({__proto__:null,MQ:c,WS:l,areColorsSimilar:i.areColorsSimilar,copyText:i.copyText,enumToArray:i.enumToArray,getCownDownTime:i.getCownDownTime,getSelectOptions:i.getSelectOptions,http:s.http,
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);const s=require("./index.cjs12.js"),i=require("./index.cjs13.js");require("element-plus"),require("element-plus/es/components/message/style/index");const n=require("./vendor-mqtt.cjs.js");async function o(e,t,i,n={}){const{headers:o={},responseType:r="json",signal:a,noAuth:h=!1}=n,c="GET"===t?`${e}${function(e){if(!e)return"";const t=new URLSearchParams;return Object.entries(e).forEach((([e,s])=>{null!=s&&t.append(e,String(s))})),`?${t.toString()}`}(i)}`:`${e}`,l=s.getToken();n.noLoading||s.showFullScreenLoading();const u=await fetch(c,{method:t,headers:{"Content-Type":"application/json",...l&&!h?{token:l}:"",...o},body:"GET"!==t&&i?JSON.stringify(i):void 0,signal:a});if(s.hideFullScreenLoading(),!u.ok){let e="";try{const t=await u.json();(null==t?void 0:t.resultMsg)&&(e=t.resultMsg)}catch(m){}throw s.checkStatus(u.status,e),new Error(e)}switch(r){case"text":return u.text();case"blob":return u.blob();default:return u.json()}}const r={get:(e,t,s)=>o(e,"GET",t,s),post:(e,t,s)=>o(e,"POST",t,s),put:(e,t,s)=>o(e,"PUT",t,s),delete:(e,t,s)=>o(e,"DELETE",t,s)},a={mqttVersion:5,clean:!0,connectTimeout:4e3,keepAlive:60,clientId:"mqttjs_"+Date.now(),qos:1},h=new Map;class c{constructor(e,s){t(this,"client"),this.client=null,this.subscribe=this.subscribe,this.unsubscribe=this.unsubscribe,this.publish=this.publish,this.destroyed=this.destroyed,this.createClient(e,{...a,...s})}createClient(e,t){this.client=n.mqtt_minExports.connect(e,t),this.client.on("connect",this.onConnect),this.client.on("reconnect",this.onReconnect),this.client.on("error",this.onError),this.client.on("message",this.onMessage)}publish(e,t){this.client.publish(e,t,{qos:a.qos},(e=>{}))}subscribe(e,t){this.client.subscribe(e,(s=>{if(s)throw new Error(s);h.set(e,t)}))}unsubscribe(e){this.client.unsubscribe(e,{},(e=>{}))}onConnect(e){}onReconnect(e){}onError(e){}onMessage(e,t){const s=t.toString();h.get(e)(JSON.parse(s))}destroyed(){this.client.end&&this.client.end()}}class l{constructor(e,s){t(this,"url"),t(this,"protocols"),t(this,"webSocketState"),t(this,"isCustomClose"),t(this,"reconnectTime"),t(this,"heartBeatTime"),t(this,"waitBeatTime"),t(this,"callback"),t(this,"HEART_KEY"),t(this,"HEART_VALUE"),t(this,"ws"),t(this,"isReconnectionLoading"),t(this,"timeId"),t(this,"eventCenter"),t(this,"errorStack"),t(this,"heartMessage"),t(this,"msgDataPreHandler"),this.url=e.url,this.protocols=s,this.webSocketState=!1,this.isCustomClose=!0,this.reconnectTime=e.reconnectTime,this.heartBeatTime=e.heartBeatTime,this.waitBeatTime=e.waitBeatTime,this.callback=e.callback,e.msgDataPreHandler&&(this.msgDataPreHandler=e.msgDataPreHandler),this.onmessage=this.onmessage,this.heartMessage=e.heartMessage,this.HEART_KEY=e.HEART_KEY,this.HEART_VALUE=e.HEART_VALUE,this.ws=null,this.isReconnectionLoading=!1,this.createWs()}createWs(){"WebSocket"in window&&(this.ws=null,this.ws=new WebSocket(this.url,this.protocols),this.onopen(),this.onerror(),this.onclose(),this.onmessage())}onopen(){this.ws.onopen=()=>{this.webSocketState=!0,this.startHeartBeat(this.heartBeatTime)}}startHeartBeat(e){setTimeout((()=>{this.heartMessage&&(this.heartMessage.data=(new Date).getTime()+""),this.send(this.heartMessage?this.heartMessage:this.HEART_KEY),this.waitingServer()}),e)}waitingServer(){this.webSocketState=!1,setTimeout((()=>{if(this.webSocketState)this.startHeartBeat(this.heartBeatTime);else try{this.close(),this.ws&&this.start()}catch(e){}}),this.waitBeatTime)}onerror(){this.ws&&(this.ws.onerror=e=>{this.isCustomClose=!1,this.isReconnectionLoading=!1})}onclose(){this.ws&&(this.ws.onclose=()=>{this.isCustomClose||this.ws&&(this.reconnection(),this.isReconnectionLoading=!1)})}async onmessage(){this.ws&&(this.ws.onmessage=async e=>{try{let t=e.data;if(this.msgDataPreHandler&&await this.msgDataPreHandler(t),t===this.HEART_VALUE)return void(this.webSocketState=!0);const s=JSON.parse(t);this.callback(s)}catch(t){this.callback(e.data)}})}reconnection(){this.isReconnectionLoading||(this.isReconnectionLoading=!0,clearTimeout(this.timeId),this.timeId=null,this.timeId=setTimeout((()=>{this.createWs()}),this.reconnectTime))}send(e){this.webSocketState&&this.ws&&this.ws.send(e)}close(){var e;this.isCustomClose=!0,this.isReconnectionLoading=!1,this.ws&&this.ws.close&&(null==(e=this.ws)||e.close())}start(){this.isCustomClose=!1,this.reconnection()}subscribe(e,t){this.eventCenter.on(e,t)}unsubscribe(e,t){this.eventCenter.off(e,t)}destroy(){clearTimeout(this.timeId),this.close(),this.ws=null,this.errorStack=null,this.eventCenter=null,this.webSocketState=!1}}const u=Object.freeze(Object.defineProperty({__proto__:null,MQ:c,WS:l,areColorsSimilar:i.areColorsSimilar,copyText:i.copyText,enumToArray:i.enumToArray,getCownDownTime:i.getCownDownTime,getSelectOptions:i.getSelectOptions,http:s.http,isColorEqual:i.isColorEqual,isDarkColor:i.isDarkColor,notifyMessageToSystems:i.notifyMessageToSystems,receiveMessage:i.receiveMessage,useConfirm:i.useConfirm,yxFecth:r,yxMessage:i.yxMessage,yxSubscribe:i.yxSubscribe},Symbol.toStringTag,{value:"Module"}));exports.MQ=c,exports.Ws=l,exports.utils2=u,exports.yxFecth=r;
|
package/lib/index.es12.js
CHANGED
|
@@ -28,6 +28,10 @@ const getHomeMenuList = (systemName = "ttc") => {
|
|
|
28
28
|
const removeToken = (systemName = "ttc") => {
|
|
29
29
|
setSystemConfig({ token: "" });
|
|
30
30
|
};
|
|
31
|
+
const setSystemInfo = (key, data) => {
|
|
32
|
+
const GlobalStateKey = `${key}GlobalState`;
|
|
33
|
+
localStorage.setItem(GlobalStateKey, JSON.stringify(data));
|
|
34
|
+
};
|
|
31
35
|
const setUserInfo = (key, userInfo) => {
|
|
32
36
|
const GlobalStateKey = `${key}GlobalState`;
|
|
33
37
|
const GlobalState = localStorage.getItem(GlobalStateKey) ?? "{}";
|
|
@@ -86,10 +90,10 @@ const getLoginUrl = () => {
|
|
|
86
90
|
const getHomeUrl = () => {
|
|
87
91
|
return getSystemConfig("homeUrl");
|
|
88
92
|
};
|
|
89
|
-
const setSystemConfig = (config2) => {
|
|
90
|
-
const GlobalState = localStorage.getItem(
|
|
93
|
+
const setSystemConfig = (config2, systemName = "ttc") => {
|
|
94
|
+
const GlobalState = localStorage.getItem(`${systemName}GlobalState`) ?? "{}";
|
|
91
95
|
const newGlobalState = { ...JSON.parse(GlobalState), ...config2 };
|
|
92
|
-
localStorage.setItem(
|
|
96
|
+
localStorage.setItem(`${systemName}GlobalState`, JSON.stringify(newGlobalState));
|
|
93
97
|
};
|
|
94
98
|
const changeSystemConfig = (key, value) => {
|
|
95
99
|
const GlobalState = localStorage.getItem("ttcGlobalState") ?? "{}";
|
|
@@ -169,6 +173,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
169
173
|
jumpToLogin,
|
|
170
174
|
removeToken,
|
|
171
175
|
setSystemConfig,
|
|
176
|
+
setSystemInfo,
|
|
172
177
|
setUserInfo
|
|
173
178
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
174
179
|
let loadingInstance;
|
|
@@ -251,14 +256,6 @@ const checkStatus = (status, msg) => {
|
|
|
251
256
|
ElMessage.error(msg || "请求失败!请您稍后重试!");
|
|
252
257
|
}
|
|
253
258
|
};
|
|
254
|
-
const config$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
255
|
-
__proto__: null,
|
|
256
|
-
ResultEnum,
|
|
257
|
-
checkStatus,
|
|
258
|
-
config,
|
|
259
|
-
hideFullScreenLoading,
|
|
260
|
-
showFullScreenLoading
|
|
261
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
262
259
|
getSystemConfig("isTranslateApi");
|
|
263
260
|
class YxHttp {
|
|
264
261
|
constructor(config2) {
|
|
@@ -266,7 +263,9 @@ class YxHttp {
|
|
|
266
263
|
/** 自定义响应处理map */
|
|
267
264
|
__publicField(this, "customResMap");
|
|
268
265
|
/**自定义请求拦截器逻辑 */
|
|
269
|
-
__publicField(this, "
|
|
266
|
+
__publicField(this, "customResquestInterceptors");
|
|
267
|
+
/**自定义响应拦截器逻辑 */
|
|
268
|
+
__publicField(this, "customResponseInterceptors");
|
|
270
269
|
this.service = axios.create(config2);
|
|
271
270
|
this.setupInterceptors();
|
|
272
271
|
this.customResMap = {};
|
|
@@ -282,7 +281,7 @@ class YxHttp {
|
|
|
282
281
|
if ((config2 == null ? void 0 : config2.customResHandler) && (config2 == null ? void 0 : config2.url)) {
|
|
283
282
|
this.customResMap[config2 == null ? void 0 : config2.url] = config2.customResHandler;
|
|
284
283
|
}
|
|
285
|
-
this.
|
|
284
|
+
this.customResquestInterceptors && this.customResquestInterceptors(config2);
|
|
286
285
|
return config2;
|
|
287
286
|
},
|
|
288
287
|
(error) => {
|
|
@@ -293,6 +292,7 @@ class YxHttp {
|
|
|
293
292
|
async (response) => {
|
|
294
293
|
const { config: config2 } = response;
|
|
295
294
|
let data = response.data;
|
|
295
|
+
this.customResponseInterceptors && this.customResponseInterceptors(data);
|
|
296
296
|
const code = response.status;
|
|
297
297
|
hideFullScreenLoading();
|
|
298
298
|
if (config2.url && this.customResMap[config2.url]) {
|
|
@@ -309,6 +309,7 @@ class YxHttp {
|
|
|
309
309
|
hideFullScreenLoading();
|
|
310
310
|
const response = error.response;
|
|
311
311
|
const { config: config2 } = error;
|
|
312
|
+
this.customResponseInterceptors && this.customResponseInterceptors(response);
|
|
312
313
|
if ((config2 == null ? void 0 : config2.url) && this.customResMap[config2.url]) {
|
|
313
314
|
this.customResMap[config2.url](error.response);
|
|
314
315
|
}
|
|
@@ -395,8 +396,15 @@ class YxHttp {
|
|
|
395
396
|
* 请求拦截器的回调
|
|
396
397
|
* @param callback
|
|
397
398
|
*/
|
|
398
|
-
|
|
399
|
-
this.
|
|
399
|
+
interceptorsRequestCallback(callback) {
|
|
400
|
+
this.customResquestInterceptors = callback;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* 全局响应拦截器回调
|
|
404
|
+
* @param callback
|
|
405
|
+
*/
|
|
406
|
+
interceptorsResponseCallback(callback) {
|
|
407
|
+
this.customResponseInterceptors = callback;
|
|
400
408
|
}
|
|
401
409
|
}
|
|
402
410
|
const http = new YxHttp(config);
|
|
@@ -404,17 +412,16 @@ export {
|
|
|
404
412
|
BC_LANG_NAME as B,
|
|
405
413
|
URL as U,
|
|
406
414
|
http as a,
|
|
407
|
-
|
|
415
|
+
getUserConfig as b,
|
|
408
416
|
checkStatus as c,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
417
|
+
getUserIsHaveBtnPower as d,
|
|
418
|
+
changeSystemConfig as e,
|
|
419
|
+
getSystemConfig as f,
|
|
412
420
|
getToken as g,
|
|
413
421
|
hideFullScreenLoading as h,
|
|
414
|
-
|
|
422
|
+
BC_THEME_NAME as i,
|
|
415
423
|
jumpToHome as j,
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
index as m,
|
|
424
|
+
setSystemConfig as k,
|
|
425
|
+
index as l,
|
|
419
426
|
showFullScreenLoading as s
|
|
420
427
|
};
|
package/lib/index.es12.js.gz
CHANGED
|
Binary file
|
package/lib/index.es2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { g as getToken, s as showFullScreenLoading, h as hideFullScreenLoading, c as checkStatus, a as http
|
|
4
|
+
import { g as getToken, s as showFullScreenLoading, h as hideFullScreenLoading, c as checkStatus, a as http } from "./index.es12.js";
|
|
5
5
|
import { a as areColorsSimilar, c as copyText, e as enumToArray, g as getCownDownTime, b as getSelectOptions, i as isColorEqual, d as isDarkColor, n as notifyMessageToSystems, r as receiveMessage, u as useConfirm, y as yxMessage, f as yxSubscribe } from "./index.es13.js";
|
|
6
6
|
import "element-plus";
|
|
7
7
|
import "element-plus/es/components/message/style/index";
|
|
@@ -16,11 +16,11 @@ function buildQuery(params) {
|
|
|
16
16
|
});
|
|
17
17
|
return `?${query.toString()}`;
|
|
18
18
|
}
|
|
19
|
-
async function baseRequest(url, method, data,
|
|
20
|
-
const { headers = {}, responseType = "json", signal, noAuth = false } =
|
|
19
|
+
async function baseRequest(url, method, data, config = {}) {
|
|
20
|
+
const { headers = {}, responseType = "json", signal, noAuth = false } = config;
|
|
21
21
|
const fullUrl = method === "GET" ? `${url}${buildQuery(data)}` : `${url}`;
|
|
22
22
|
const token = getToken();
|
|
23
|
-
if (!
|
|
23
|
+
if (!config.noLoading) {
|
|
24
24
|
showFullScreenLoading();
|
|
25
25
|
}
|
|
26
26
|
const res = await fetch(fullUrl, {
|
|
@@ -56,10 +56,10 @@ async function baseRequest(url, method, data, config2 = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
const yxFecth = {
|
|
59
|
-
get: (url, params,
|
|
60
|
-
post: (url, data,
|
|
61
|
-
put: (url, data,
|
|
62
|
-
delete: (url, data,
|
|
59
|
+
get: (url, params, config) => baseRequest(url, "GET", params, config),
|
|
60
|
+
post: (url, data, config) => baseRequest(url, "POST", data, config),
|
|
61
|
+
put: (url, data, config) => baseRequest(url, "PUT", data, config),
|
|
62
|
+
delete: (url, data, config) => baseRequest(url, "DELETE", data, config)
|
|
63
63
|
};
|
|
64
64
|
const clientOptions = {
|
|
65
65
|
mqttVersion: 5,
|
|
@@ -297,7 +297,6 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
297
297
|
getCownDownTime,
|
|
298
298
|
getSelectOptions,
|
|
299
299
|
http,
|
|
300
|
-
httpConf: config,
|
|
301
300
|
isColorEqual,
|
|
302
301
|
isDarkColor,
|
|
303
302
|
notifyMessageToSystems,
|
package/lib/index.es4.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as http, U as URL,
|
|
1
|
+
import { a as http, U as URL, l as index$1 } from "./index.es12.js";
|
|
2
2
|
import { i as index } from "./index.es14.js";
|
|
3
3
|
const getUserSelectSatelliteList = async (systemName = "ttc") => {
|
|
4
4
|
const data = await http.get(`${URL[systemName].INTEGRATED_BASE_URL}/basic/data/satellite/select`);
|
package/lib/index.es5.js
CHANGED
|
@@ -15,7 +15,7 @@ import "./vendor-file-saver.es.js";
|
|
|
15
15
|
import "xlsx-js-style";
|
|
16
16
|
import { S as Sortable } from "./vendor-sortablejs.es.js";
|
|
17
17
|
import "element-plus";
|
|
18
|
-
import {
|
|
18
|
+
import { e as changeSystemConfig, f as getSystemConfig, a as http, B as BC_LANG_NAME, i as BC_THEME_NAME, k as setSystemConfig } from "./index.es12.js";
|
|
19
19
|
import { f as yxSubscribe, i as isColorEqual } from "./index.es13.js";
|
|
20
20
|
import "element-plus/es/components/message/style/index";
|
|
21
21
|
import "element-plus/es/components/loading/style/index";
|
package/lib/index.es5.js.gz
CHANGED
|
Binary file
|
package/lib/index.es6.js
CHANGED
|
@@ -5,7 +5,7 @@ import "xlsx-js-style";
|
|
|
5
5
|
import { S as Sortable } from "./vendor-sortablejs.es.js";
|
|
6
6
|
import { _ as _export_sfc, T as Toolbar, Y as YxTablePro } from "./index.es5.js";
|
|
7
7
|
import { genFileId } from "element-plus";
|
|
8
|
-
import { j as jumpToHome,
|
|
8
|
+
import { j as jumpToHome, b as getUserConfig } from "./index.es12.js";
|
|
9
9
|
import "element-plus/es/components/message/style/index";
|
|
10
10
|
import { u as uploadResourceApi } from "./index.es14.js";
|
|
11
11
|
const _hoisted_1$4 = { class: "dialog-footer flex justify-end" };
|
package/lib/index.es6.js.gz
CHANGED
|
Binary file
|
package/lib/index.es7.js
CHANGED
package/lib/index.es8.js
CHANGED
package/lib/utils.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs12.js"),s=require("./index.cjs13.js"),o=require("./index.cjs2.js");exports.http=e.http,exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs12.js"),s=require("./index.cjs13.js"),o=require("./index.cjs2.js");exports.http=e.http,exports.areColorsSimilar=s.areColorsSimilar,exports.copyText=s.copyText,exports.enumToArray=s.enumToArray,exports.getCownDownTime=s.getCownDownTime,exports.getSelectOptions=s.getSelectOptions,exports.isColorEqual=s.isColorEqual,exports.isDarkColor=s.isDarkColor,exports.notifyMessageToSystems=s.notifyMessageToSystems,exports.receiveMessage=s.receiveMessage,exports.useConfirm=s.useConfirm,exports.yxMessage=s.yxMessage,exports.yxSubscribe=s.yxSubscribe,exports.MQ=o.MQ,exports.WS=o.Ws,exports.yxFecth=o.yxFecth;
|
package/lib/utils.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a
|
|
2
|
-
import { a as a2, c, e, g, b
|
|
1
|
+
import { a } from "./index.es12.js";
|
|
2
|
+
import { a as a2, c, e, g, b, i, d, n, r, u, y, f } from "./index.es13.js";
|
|
3
3
|
import { M, W, y as y2 } from "./index.es2.js";
|
|
4
4
|
export {
|
|
5
5
|
M as MQ,
|
|
@@ -8,9 +8,8 @@ export {
|
|
|
8
8
|
c as copyText,
|
|
9
9
|
e as enumToArray,
|
|
10
10
|
g as getCownDownTime,
|
|
11
|
-
|
|
11
|
+
b as getSelectOptions,
|
|
12
12
|
a as http,
|
|
13
|
-
b as httpConf,
|
|
14
13
|
i as isColorEqual,
|
|
15
14
|
d as isDarkColor,
|
|
16
15
|
n as notifyMessageToSystems,
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**@description 移除token */
|
|
2
2
|
export declare const removeToken: (systemName?: string) => void;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const setSystemInfo: (key: string, data: any) => void;
|
|
4
|
+
export declare const setUserInfo: (key: string, userInfo: any) => void;
|
|
4
5
|
/**@description 获取token */
|
|
5
6
|
export declare const getToken: (systemName?: string) => any;
|
|
6
7
|
interface LoginParams {
|
|
@@ -20,7 +21,7 @@ export declare const getLoginUrl: () => any;
|
|
|
20
21
|
/**获取当前部署的系统前缀 */
|
|
21
22
|
export declare const getHomeUrl: () => any;
|
|
22
23
|
/**设置系统配置信息 */
|
|
23
|
-
export declare const setSystemConfig: (config: any) => void;
|
|
24
|
+
export declare const setSystemConfig: (config: any, systemName?: string) => void;
|
|
24
25
|
/**修改某个系统配置 */
|
|
25
26
|
export declare const changeSystemConfig: (key: string, value: any) => void;
|
|
26
27
|
/**获取系统配置信息 */
|
|
@@ -11,7 +11,9 @@ declare class YxHttp {
|
|
|
11
11
|
[key: string]: Function;
|
|
12
12
|
};
|
|
13
13
|
/**自定义请求拦截器逻辑 */
|
|
14
|
-
|
|
14
|
+
customResquestInterceptors?: any;
|
|
15
|
+
/**自定义响应拦截器逻辑 */
|
|
16
|
+
customResponseInterceptors?: Function;
|
|
15
17
|
constructor(config: CustomAxiosRequestConfig);
|
|
16
18
|
private setupInterceptors;
|
|
17
19
|
private getResMessage;
|
|
@@ -51,7 +53,12 @@ declare class YxHttp {
|
|
|
51
53
|
* 请求拦截器的回调
|
|
52
54
|
* @param callback
|
|
53
55
|
*/
|
|
54
|
-
|
|
56
|
+
interceptorsRequestCallback(callback: Function): void;
|
|
57
|
+
/**
|
|
58
|
+
* 全局响应拦截器回调
|
|
59
|
+
* @param callback
|
|
60
|
+
*/
|
|
61
|
+
interceptorsResponseCallback(callback: Function): void;
|
|
55
62
|
}
|
|
56
63
|
declare const _default: YxHttp;
|
|
57
64
|
export default _default;
|
package/types/utils/index.d.ts
CHANGED