hrp-ui-base 1.3.6 → 1.3.7
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/dist/components.cjs +1 -1
- package/dist/components.es.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +2 -2
- package/dist/string-utils-BH3jGZDF.cjs +1 -0
- package/dist/{string-utils-DPWu4Qfh.js → string-utils-DjRg4NCR.js} +86 -95
- package/dist/{transform-data-DDmK9TEL.cjs → transform-data-CkMSs3ZE.cjs} +1 -1
- package/dist/{transform-data-jyYW8phC.js → transform-data-_KBQqEax.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.es.js +2 -2
- package/package.json +1 -1
- package/packages/approval-process/package.json +1 -1
- package/src/utils/crypto.ts +12 -12
- package/dist/string-utils-DKz4mfHd.cjs +0 -1
package/src/utils/crypto.ts
CHANGED
|
@@ -79,19 +79,19 @@ export const getPMSFinalToken = function (token: string) {
|
|
|
79
79
|
|
|
80
80
|
// 获取最终的token
|
|
81
81
|
export const getFinalToken = function () {
|
|
82
|
-
// 从 URL中获取 projectId
|
|
83
|
-
const hash = window.location.hash;
|
|
84
|
-
const pathname = window.location.pathname;
|
|
85
|
-
const projectIdMatch = hash.match(/\/project\/([^\/\?]+)/);
|
|
86
|
-
const projectId = projectIdMatch ? projectIdMatch[1] : null;
|
|
82
|
+
// // 从 URL中获取 projectId
|
|
83
|
+
// const hash = window.location.hash;
|
|
84
|
+
// const pathname = window.location.pathname;
|
|
85
|
+
// const projectIdMatch = hash.match(/\/project\/([^\/\?]+)/);
|
|
86
|
+
// const projectId = projectIdMatch ? projectIdMatch[1] : null;
|
|
87
87
|
|
|
88
|
-
// 如果有 projectId,优先使用项目专属 token
|
|
89
|
-
if (projectId && pathname.includes("/pms/")) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
88
|
+
// // 如果有 projectId,优先使用项目专属 token
|
|
89
|
+
// if (projectId && pathname.includes("/pms/")) {
|
|
90
|
+
// const projectToken = localStorage.getItem(`TOKEN-${projectId}`);
|
|
91
|
+
// if (projectToken) {
|
|
92
|
+
// return getPMSFinalToken(projectToken);
|
|
93
|
+
// }
|
|
94
|
+
// }
|
|
95
95
|
|
|
96
96
|
// 否则使用通用 TOKEN
|
|
97
97
|
return getFinalHrpToken();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var R=(t,o,e)=>o in t?D(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var g=(t,o,e)=>R(t,typeof o!="symbol"?o+"":o,e);const y=require("dingtalk-jsapi"),u=require("element-plus"),v=require("axios"),A=require("qs"),j=require("lodash"),w=require("vant"),J=require("sm-crypto"),L=t=>{if(y.env.platform!=="notInDingTalk")window.open(t+"/?ddtab=true","_blank");else if(window.oaTool&&window.oaTool.isOA){window.oaTool.openNewWindow(t);return}else window.open(t,"_blank")},M=t=>encodeURIComponent(t),K=t=>(t.indexOf("?")>-1&&(t.indexOf("/?")>-1?t=t.split("/?")[0]:t=t.split("?")[0]),t[t.length-1]==="/"&&(t=t.substring(0,t.length-1)),t),W=t=>{if(!(!t||typeof t!="string"))if(y.env.platform!=="notInDingTalk")y.biz.navigation.setTitle({title:t}),document.title=t;else if(window.oaTool&&window.oaTool.isOA){window.oaTool.setTitle(t);return}else document.title=t};function F(t){try{return new URL(t),t}catch{}const o=window.location.origin,e=window.location.pathname;t.startsWith("./")?t=t.substring(2):t.startsWith("/")&&(t=t.substring(1));const n=e.endsWith("/")?e:e.substring(0,e.lastIndexOf("/")+1);return o+n+t}const q=async t=>{let o="";try{o=(sessionStorage.getItem("userConfig")?JSON.parse(sessionStorage.getItem("userConfig")):null).fileUploadType}catch(n){console.log(n)}try{await navigator.clipboard.writeText(F(t.url)),console.log("URL 已复制到剪贴板:",F(t.url)),u.ElMessage.success("文件下载链接已写入剪切板,如遇系统无法下载,自行复制到浏览器打开链接即可下载!")}catch(n){console.error("无法写入剪贴板:",n)}let e=document.createElement("a");e.style="display: none",e.download=t.fileName,e.href=t.url,e.target="_blank",document.body.appendChild(e),e.click(),document.body.removeChild(e)},b=()=>{const t=navigator.userAgent.toLowerCase();return["android","iphone","ipad","ipod","harmonyos","openharmony","huawei","honor","symbianos","windows phone","mobile","webos","blackberry","opera mini","opera mobi","iemobile","wpdesktop"].some(n=>t.includes(n))},$=()=>!b();let m=null;const B=t=>{m=t},x=()=>{var t,o,e;return((o=(t=m==null?void 0:m.currentRoute)==null?void 0:t.value)==null?void 0:o.fullPath)||((e=window.location.hash)==null?void 0:e.replace(/^#/,""))||window.location.pathname+window.location.search},H=j.debounce(()=>{alert("登录失效,请重新登录")},1e3,{leading:!0,trailing:!1});function T(t){const o=localStorage.getItem("TenantHost");localStorage.setItem("preRoute",x()),localStorage.setItem("toRouter",window.location.search),localStorage.getItem("toRouter");let e=localStorage.getItem("currentRouterInfo");if(localStorage.setItem("toRouterObject",e),y.env.platform!=="notInDingTalk")window.location.href=window.location.origin+window.location.pathname+"login/index.html?host="+o;else if(window.oaTool&&window.oaTool.isOA){const n=window.location.origin+(window.location.pathname.endsWith("/")?window.location.pathname:window.location.pathname+"/");let i=x();sessionStorage.setItem("preRoute",i),window.localStorage.removeItem("TOKEN"),window.location.href=`${n}oa-login/index.html?url=${i}`}else if(t&&t===1)window.sessionStorage.clear(),window.localStorage.clear(),window.location.href=window.location.origin+window.location.pathname+"login/index.html";else{localStorage.setItem("toRouter",window.location.search);let n=x();sessionStorage.setItem("preRoute",n),window.localStorage.removeItem("TOKEN"),window.localStorage.removeItem("clientId"),H();const i=window.location.origin+(window.location.pathname.endsWith("/")?window.location.pathname:window.location.pathname+"/");setTimeout(()=>{window.location.href=`${i}login/index.html?host=${o}`},100)}}const P=(t,o)=>J.sm4.encrypt(t,V(o));function V(t){const o=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?o.push(n):n<2048?o.push(192|n>>6,128|n&63):n<55296||n>=57344?o.push(224|n>>12,128|n>>6&63,128|n&63):(e++,n=65536+((n&1023)<<10|t.charCodeAt(e)&1023),o.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}for(let e=0;e<o.length;e++){let n=o[e];n>127&&(o[e]=n-256)}return o}const Z=function(){let t=localStorage.getItem("TOKEN")+"IhfN5d11Zk1ZC%Po"+Date.now();return P(t,"*XeL#J@znVJ#sdSv")},_=function(){return localStorage.getItem("TOKEN")},X=function(t){let o=t+"IhfN5d11Zk1ZC%Po"+Date.now();return P(o,"*XeL#J@znVJ#sdSv")},a=function(){const t=window.location.hash,o=window.location.pathname,e=t.match(/\/project\/([^\/\?]+)/),n=e?e[1]:null;if(n&&o.includes("/pms/")){const i=localStorage.getItem(`TOKEN-${n}`);if(i)return X(i)}return Z()},U=window.location.origin+window.location.pathname+"api",r=v.create({timeout:18e5,baseURL:U});r.interceptors.request.use(t=>t);r.interceptors.response.use(t=>(b()?t.data.code==501||t.data.code==510?t.data.msg?w.showNotify({type:"danger",message:t.data.msg}):w.showNotify({type:"danger",message:"发生未知错误!"}):t.data.code==500?w.showNotify({type:"danger",message:"服务发生错误!"}):t.data.code==201?w.showNotify({type:"success",message:t.data.msg}):t.data.code===401&&T():t.data.code==501||t.data.code==510?t.data.msg?u.ElMessage({type:"error",dangerouslyUseHTMLString:!0,message:`<span style="word-break: break-all">${t.data.msg}</span>`,duration:5e3}):u.ElMessage.error("发生未知错误!"):t.data.code==500?u.ElMessageBox.alert(t.data.msg?t.data.msg:"服务发生错误","错误提示",{confirmButtonText:"确定",callback:()=>{}}):t.data.code==201?u.ElMessage({type:"success",dangerouslyUseHTMLString:!0,message:`<span style="word-break: break-all">${t.data.msg}</span>`,duration:5e3}):t.data.code===401&&T(),t.data),async t=>(t.response.status===401?T():b()?w.showNotify({type:"danger",message:"网络请求失败"}):u.ElMessage.error("网络请求失败"),Promise.reject(t.response)));class z{static get(o,e){return e&&(e=e||""),r({method:"get",url:o,params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static post(o,e){return e&&(e=e||""),r({method:"post",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a(),"Authorization-origin-Token":localStorage.getItem("TOKEN")}})}static postJson(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a(),"Authorization-origin-Token":localStorage.getItem("TOKEN"),...n}})}static uploadOSS(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:e,headers:{"Content-Type":"multipart/form-data","Authorization-Token":a(),...n}})}static uploadOSSResident(o,e,n){return e&&(e=e||""),r({method:"post",url:o,data:e,headers:{"Content-Type":"multipart/form-data","Authorization-Token":_(),...n}})}static exportFile(o,e){return e&&(e=e||""),r({method:"post",responseType:"arraybuffer",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static put(o,e){return e&&(e=e||""),r({method:"put",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static putJson(o,e){return e&&(e=e||""),r({method:"put",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static putFile(o,e,n){return e&&(e=e||""),r({method:"put",url:o,data:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a(),...n}})}static deleted(o,e){return e&&(e=e||""),r({method:"delete",url:o,data:A.stringify(e),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static deletedjson(o,e){return e&&(e=e||""),r({method:"delete",url:o,data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadGet(o,e){return e&&(e=e||""),r({method:"get",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static downloadPost(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static download(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadPostJson(o,e){return e&&(e=e||""),r({method:"post",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadPut(o,e){return e&&(e=e||""),r({method:"put",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static downloadPutJson(o,e){return e&&(e=e||""),r({method:"put",url:o,responseType:"blob",data:JSON.stringify(e),headers:{"Content-Type":"application/json;charset=utf-8","Authorization-Token":a()}})}static downloadFile(o,e){return e&&(e=e||{}),r({method:"post",url:o,responseType:"blob",params:e,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Authorization-Token":a()}})}static uploadBase64(o,e,n){let i=new FormData;return i.append("file",e.file),i.append("modulesId",e.modulesId),r({method:"post",url:o,data:i,headers:{"Content-Type":"multipart/form-data","Authorization-Token":a(),...n}})}static postFormData(o,e,n){let i=new FormData;return e.files&&Array.isArray(e.files)&&e.files.forEach(c=>{i.append("files",c)}),e.submitWorkOrderParam&&i.append("submitWorkOrderParam",new Blob([JSON.stringify(e.submitWorkOrderParam)],{type:"application/json;charset=utf-8"})),r({method:"post",url:o,data:i,headers:{"Authorization-Token":a(),"Content-Type":"multipart/form-data",...n}})}}g(z,"baseUrl",U);class G{constructor(){g(this,"havePermission",!1);g(this,"funPointIdList",[])}}const Q=(t,o)=>{const e=o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),n=new RegExp(e,"gi");return t.replace(n,c=>`<span style="color:var(--theme-normal-normal)">${c}</span>`)},Y=t=>t.split("?")[0].substring(t.lastIndexOf(".")+1).toLowerCase(),ee=(t,o,e=0)=>{let n="";if(e>0)for(let i=0;i<e;i++)n+=".";return t.length>o?t.slice(0,o-e)+n:t};function te(t){let o=new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"),e=new Array("","拾","佰","仟"),n=new Array("","万","亿","兆"),i=new Array("角","分","毫","厘"),c="元",E=1e15,p="",h="",s="",S=["",""],f,I,d,k,N,C,O;if(t==null)return"";if(t>=E)return"超出最大处理数字";if(t==0)return s=o[0]+c,s;if(t.toString().indexOf(".")==-1?(p=t.toString(),h="",c="元整"):(S=t.toString().split("."),p=S[0],h=S[1].substr(0,2)),parseInt(p,10)>0){f=0,I=p.length;for(let l=0;l<I;l++)d=p.substr(l,1),k=I-l-1,N=k/4,C=k%4,d=="0"?f++:(f>0&&(s+=o[0]),f=0,s+=o[parseInt(d)]+e[C]),C==0&&f<4&&(s+=n[N]);s+=c}if(h!=""){O=h.length;for(let l=0;l<O;l++)d=h.substr(l,1),d!="0"&&(s+=o[Number(d)]+i[l])}return s==""&&(s+=o[0]+c),s}function oe(t){const o=parseFloat(t.toString());if(isNaN(o))return t;const e=o.toString();return(e.split(".")[1]||"").length>11?o.toFixed(11):e}function ne(t){const o=parseFloat(t.toString());return isNaN(o)?0:Number(Math.round(o*100)/100)}exports.FunPointVo=G;exports.HttpUtil=z;exports.IsPc=$;exports.IsPhone=b;exports.ddWindowOpen=L;exports.digitUppercase=te;exports.downloadFile=q;exports.exitLogin=T;exports.formatDecimal=oe;exports.formatTwoDecimal=ne;exports.getEllipsis=ee;exports.getFileType=Y;exports.getProcessAppIdUrl=K;exports.highlightText=Q;exports.openEncodeUrl=M;exports.setDingDingTitle=W;exports.setExitLoginRouter=B;
|