|
|
@@ -0,0 +1,129 @@
|
|
|
+import{W as R,f as l,u as $,p as m,o as r,y as j,c as T,m as p,P as q,V as f}from"./vue-vendor-DFp1TAzT.js";import{aR as g,z as t,aS as O}from"./index-DtVIg-6U.js";import I from"./ContentContainer-CYRCh3sf.js";import{u as M}from"./use-logout-qkoDjT8Y.js";import{u as P}from"./use-current-user-B84CZlY_.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./login-D2AOe682.js";const J={__name:"Xiaoshu",props:{},setup(h){const _=R(),b=M(),{bus:c}=g,x=h,s=l(!1),u=l([]),y=t("XIAOSHU_URL"),v=t("WEBSOCKET_BASE_URL"),k=t("API_BASE_URL"),S=t("ASSETS_BASE_URL"),w={padding:0};function L(){const e={"system:conversation:board":"/chat/board","system:conversation:hisroty":"/chat/history","system:menu:intelligent":"/intelligent","system:menu:knowledge":"/knowledge","system:menu:model":"/model","system:menu:permission":"/permission","system:menu:conversation":"/chat/qa","system:conversation:qa":"/chat/qa","system:group":"/permission/group","system:dept":"/permission/org","system:role":"/permission/role","system:user":"/permission/account","system:menu":"/permission/resource"};let o="";for(let n in e)if(O(n)){o=e[n];break}return o}return $(()=>{const e=P(),o=e.token,d={userName:e.username,token:o},E=JSON.stringify(d),i=L(),A=`
|
|
|
+ window.WEBSOCKET_BASE_URL = '${v}';
|
|
|
+ window.API_BASE_URL = '${k}';
|
|
|
+ window.ASSETS_BASE_URL = '${S}';
|
|
|
+
|
|
|
+ localStorage.setItem('xintongxiaoshu', '${E}');
|
|
|
+
|
|
|
+ const observer = new MutationObserver((mutationsList) => {
|
|
|
+ mutationsList.forEach((mutation) => {
|
|
|
+ if (mutation.type === "childList") {
|
|
|
+ // console.log("A child node has been added or removed.");
|
|
|
+ // console.log(mutation);
|
|
|
+
|
|
|
+ if(mutation.addedNodes.length > 0){
|
|
|
+ // console.log('新节点被添加', mutation.addedNodes);
|
|
|
+ // console.log(mutation);
|
|
|
+
|
|
|
+ const addedNodes = mutation.addedNodes;
|
|
|
+ addedNodes.forEach((item, index) => {
|
|
|
+ const klass_name = item.className;
|
|
|
+ if(klass_name === 'arco-trigger-popup arco-trigger-position-rt arco-popover'){
|
|
|
+ // popover
|
|
|
+ // 可能是用户名,账号
|
|
|
+ const box = item.querySelector('.xiaoshu-aside-left-menus-pop-container');
|
|
|
+
|
|
|
+ const div = document.createElement('div');
|
|
|
+ div.setAttribute('class', 'xiaoshu-aside-left-menus-logout-btn');
|
|
|
+ const span = document.createElement('span');
|
|
|
+ span.innerText = '退出登录'
|
|
|
+ div.appendChild(span);
|
|
|
+ box.appendChild(div);
|
|
|
+ div.addEventListener('click', () => {
|
|
|
+ window.$wujie?.bus.$emit("xiaoshuAsideLogout");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if(mutation.removedNodes.length > 0){
|
|
|
+ // console.log('节点被移除', mutation.removedNodes);
|
|
|
+ // console.log(mutation);
|
|
|
+ }
|
|
|
+ } else if (mutation.type === "attributes") {
|
|
|
+ // console.log('属性被修改了');
|
|
|
+ }else{
|
|
|
+ // console.log('其他');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ observer.observe(document.body, {childList: true, subtree: true})
|
|
|
+ `;let a="";i?a=`
|
|
|
+ const box = document.querySelector('.xiaoshu-aside-left-menus-container');
|
|
|
+
|
|
|
+ if(box){
|
|
|
+ const btn = document.createElement('div');
|
|
|
+ box.appendChild(btn);
|
|
|
+
|
|
|
+ btn.innerHTML = '<span class="xiaoshu-aside-left-back-btn">返回</span>';
|
|
|
+
|
|
|
+ btn.addEventListener('click', () => {
|
|
|
+ window.$wujie?.bus.$emit("xiaoshuAsideBack");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ `:a="console.log('cant back');";const B=`
|
|
|
+ .xiaoshu-aside-left-back-btn{
|
|
|
+ width: 100%;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #165dff;
|
|
|
+ color: #fff;
|
|
|
+ display: inline-block;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .xiaoshu-aside-left-menus-pop-container {}
|
|
|
+ .xiaoshu-aside-left-menus-actions-container{
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .user-popover.xiaoshu-aside-left-menus-pop-container>div.item{
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .user-popover.xiaoshu-aside-left-menus-pop-container>header{
|
|
|
+ padding-bottom: 0;
|
|
|
+ border-bottom: none;
|
|
|
+ }
|
|
|
+ .xiaoshu-aside-left-menus-logout-btn{
|
|
|
+ cursor: pointer;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ `,C=`
|
|
|
+ .xiaoshu-loading-container {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(205, 230, 248, 0.5);
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ z-index: 9999;
|
|
|
+ }
|
|
|
+
|
|
|
+ .xiaoshu-loading-spinner {
|
|
|
+ border: 4px solid #f3f3f3;
|
|
|
+ border-top: 4px solid #3498db;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ animation: spin 2s linear infinite;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes spin {
|
|
|
+ 0% { transform: rotate(0deg); }
|
|
|
+ 100% { transform: rotate(360deg); }
|
|
|
+ }
|
|
|
+`,N=`
|
|
|
+ // 显示 loading 层
|
|
|
+ document.body.insertAdjacentHTML('afterbegin', '<div class="xiaoshu-loading-container"><div class="xiaoshu-loading-spinner"></div></div>');
|
|
|
+`,U=`
|
|
|
+ // 页面加载完成后,移除 loading 层
|
|
|
+ window.addEventListener('load', function() {
|
|
|
+ const loadingContainer = document.querySelector('.xiaoshu-loading-container');
|
|
|
+ if (loadingContainer) {
|
|
|
+ loadingContainer.style.display = 'none';
|
|
|
+ }
|
|
|
+ });`;c.$on("xiaoshuAsideBack",function(){i&&_.push(i)}),c.$on("xiaoshuAsideLogout",function(){b()}),u.value=[{jsBeforeLoaders:[{content:A},{content:N}]},{jsAfterLoaders:[{content:a},{content:U}]},{cssAfterLoaders:[{content:B},{content:C}]}],s.value=!0}),(e,o)=>(r(),m(I,{containerStyle:w},{default:j(()=>[s.value?p("",!0):(r(),T(q,{key:0},[],64)),s.value?(r(),m(f(g),{key:1,width:"100%",height:"100%",name:"xiaoshu",url:f(y),sync:!1,props:x,plugins:u.value},null,8,["url","props","plugins"])):p("",!0)]),_:1}))}};export{J as default};
|