99AI/public/chat/assets/index-54c5e012.js
2024-07-31 14:12:56 +08:00

4 lines
2.1 KiB
JavaScript

import{x as m,y as _,a as h,_ as g,B as w,C as p}from"./index-a70ad6b3.js";import{d as v,e as r,r as y,f as L,w as C,U as P,a3 as x,S as b}from"./vue-cf46d111.js";import{_ as A}from"./_plugin-vue_export-helper-c27b6911.js";import"./naive-ui-074da7ca.js";import"./vueuse-motion-d8fe070a.js";const S={class:"iframe-container"},B=v({__name:"index",setup(R){const n=m();_();const o=h(),i=r(()=>o.isLogin);r(()=>{var t;return Number((t=o.globalConfig)==null?void 0:t.wechatSilentLoginStatus)===1});const s=y(null);async function u(){const a=new URLSearchParams(window.location.search).getAll("code");if(!(a.length>0?a[a.length-1]:null)){const c=window.location.href.split("#")[0],l=await p({url:c});l.success&&(window.location.href=l.data)}}async function d(){const a=new URLSearchParams(window.location.search).getAll("code"),e=a.length>0?a[a.length-1]:null;if(e){const c=await w({code:e});c.success&&(o.setToken(c.data),await o.getUserInfo(),o.setLoginDialog(!1),n.replace("/chat"))}}async function f(){window.navigator.userAgent.toLowerCase().includes("micromessenger")&&await u()}return L(async()=>{var a;if(i.value){n.replace("/chat");return}let t=r(()=>{var e;return((e=o.globalConfig)==null?void 0:e.homeHtml)||""});if(t=r(()=>{var e;return`
${((e=o.globalConfig)==null?void 0:e.homeHtml)||""}
`}),s.value){const e=s.value.contentDocument||((a=s.value.contentWindow)==null?void 0:a.document);e&&(e.open(),e.write(t.value),e.close())}g(()=>import("./chat-2c477ae5.js"),["./chat-2c477ae5.js","./useBasicLayout-8e07f8d7.js","./vue-cf46d111.js","./index-a70ad6b3.js","./naive-ui-074da7ca.js","./vueuse-motion-d8fe070a.js","./index-429097f0.css","./index-97198a55.js","./index-08cceacb.js","./menu-1a8ade33.js","./_plugin-vue_export-helper-c27b6911.js","./index-c94da121.js","./index.vue_vue_type_script_setup_true_lang-1cfab100.js","./chat-61246561.css"],import.meta.url),window.addEventListener("message",async e=>{e.data==="goToChat"&&(await d(),n.replace("/chat"))}),await f()}),C(i,t=>{t&&n.replace("/chat")}),(t,a)=>(b(),P("div",S,[x("iframe",{ref_key:"iframe",ref:s,class:"iframe",frameborder:"0"},null,512)]))}});const T=A(B,[["__scopeId","data-v-9b565240"]]);export{T as default};