Xiaoshu-C6gAo9qc.js 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import{u as C,r as d,p as N,o as r,h as m,w as U,d as $,F as R,i as p,k as h,al as f,P as t,ac as T}from"./index-CMAU1KqT.js";import{u as j}from"./Header.vue_vue_type_style_index_0_scoped_2e420fdc_lang-BleInYeL.js";import{u as q}from"./use-current-user-DimmbF7E.js";/* empty css */import O from"./ContentContainer-BN_ZqRt9.js";import"./login-D4wd0S7c.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const K={__name:"Xiaoshu",props:{},setup(_){const g=C(),b=j(),{bus:u}=f,x=_,s=d(!1),c=d([]),v=t("XIAOSHU_URL"),k=t("WEBSOCKET_BASE_URL"),y=t("API_BASE_URL"),S=t("ASSETS_BASE_URL"),w={padding:0};function E(){const e={"system:menu:conversation":"/chat/qa","system:conversation:qa":"/chat/qa","system:conversation:hisroty":"/chat/history","system:conversation:board":"/chat/board","system:menu:intelligent":"/intelligent","system:menu:knowledge":"/knowledge"};let o="";for(let n in e)if(T(n)){o=e[n];break}return o}return N(()=>{const e=q(),o=e.token,l={userName:e.username,token:o},L=JSON.stringify(l),i=E(),A=`
  2. window.WEBSOCKET_BASE_URL = '${k}';
  3. window.API_BASE_URL = '${y}';
  4. window.ASSETS_BASE_URL = '${S}';
  5. localStorage.setItem('xintongxiaoshu', '${L}');
  6. const observer = new MutationObserver((mutationsList) => {
  7. mutationsList.forEach((mutation) => {
  8. if (mutation.type === "childList") {
  9. // console.log("A child node has been added or removed.");
  10. // console.log(mutation);
  11. if(mutation.addedNodes.length > 0){
  12. // console.log('新节点被添加', mutation.addedNodes);
  13. // console.log(mutation);
  14. const addedNodes = mutation.addedNodes;
  15. addedNodes.forEach((item, index) => {
  16. const klass_name = item.className;
  17. if(klass_name === 'arco-trigger-popup arco-trigger-position-rt arco-popover'){
  18. // popover
  19. // 可能是用户名,账号
  20. const box = item.querySelector('.xiaoshu-aside-left-menus-pop-container');
  21. const div = document.createElement('div');
  22. div.setAttribute('class', 'xiaoshu-aside-left-menus-logout-btn');
  23. const span = document.createElement('span');
  24. span.innerText = '退出登录'
  25. div.appendChild(span);
  26. box.appendChild(div);
  27. div.addEventListener('click', () => {
  28. window.$wujie?.bus.$emit("xiaoshuAsideLogout");
  29. });
  30. }
  31. });
  32. }
  33. if(mutation.removedNodes.length > 0){
  34. // console.log('节点被移除', mutation.removedNodes);
  35. // console.log(mutation);
  36. }
  37. } else if (mutation.type === "attributes") {
  38. // console.log('属性被修改了');
  39. }else{
  40. // console.log('其他');
  41. }
  42. });
  43. });
  44. observer.observe(document.body, {childList: true, subtree: true})
  45. `;let a="";i?a=`
  46. const box = document.querySelector('.xiaoshu-aside-left-menus-container');
  47. if(box){
  48. const btn = document.createElement('div');
  49. box.appendChild(btn);
  50. btn.innerHTML = '<span class="xiaoshu-aside-left-back-btn">返回</span>';
  51. btn.addEventListener('click', () => {
  52. window.$wujie?.bus.$emit("xiaoshuAsideBack");
  53. });
  54. }
  55. `:a="console.log('cant back');";const B=`
  56. .xiaoshu-aside-left-back-btn{
  57. width: 100%;
  58. height: 40px;
  59. line-height: 40px;
  60. text-align: center;
  61. background-color: #165dff;
  62. color: #fff;
  63. display: inline-block;
  64. cursor: pointer;
  65. }
  66. .xiaoshu-aside-left-menus-pop-container {}
  67. .xiaoshu-aside-left-menus-actions-container{
  68. display: none;
  69. }
  70. .user-popover.xiaoshu-aside-left-menus-pop-container>div.item{
  71. display: none;
  72. }
  73. .user-popover.xiaoshu-aside-left-menus-pop-container>header{
  74. padding-bottom: 0;
  75. border-bottom: none;
  76. }
  77. .xiaoshu-aside-left-menus-logout-btn{
  78. cursor: pointer;
  79. text-align: center;
  80. margin-top: 10px;
  81. }
  82. `;u.$on("xiaoshuAsideBack",function(){i&&g.push(i)}),u.$on("xiaoshuAsideLogout",function(){b()}),c.value=[{jsBeforeLoaders:[{content:A}]},{jsAfterLoaders:[{content:a}]},{cssAfterLoaders:[{content:B}]}],s.value=!0}),(e,o)=>(r(),m(O,{containerStyle:w},{default:U(()=>[s.value?p("",!0):(r(),$(R,{key:0},[],64)),s.value?(r(),m(h(f),{key:1,width:"100%",height:"100%",name:"xiaoshu",url:h(v),sync:!1,props:x,plugins:c.value},null,8,["url","props","plugins"])):p("",!0)]),_:1}))}};export{K as default};