import{_ as h,ac as w,u as v,p as y,o as C,aD as I,q as S,c as i,b as c,d as n,e as k,g as p,w as N,f as s,t as R,h as D,aE as F}from"./index-BDh_pN-M.js";import{C as P}from"./index-Dga3nmmr.js";import{d as T}from"./updating-x5avpz8W.js";import{i as b}from"./info-Bq3qLitc.js";import"./index-Bg8xNGen.js";import{s as x,b as M}from"./index-QU4odbju.js";import"./index-BNvz5O81.js";const E={class:"install-wrapper"},V={class:"install-inner"},q={class:"circle-inner"},B=["src"],A={key:0,class:"mt20"},U={key:1,class:"mt20"},W={class:"bottom-message"},$=["src"],z={__name:"under-install",setup(j){var u;const d=w(),l=v(),_=(u=d.query)==null?void 0:u.appName;let t=y({consoleCurrentRate:0,installProgress:50,timer:null,installStatus:"installing"});const g={"0%":"#46A2FF","100%":"#12F3FF"},f=async r=>{var e,o;try{const a=await F({task_id:r});if(a.code===200){const m=Number((e=a.data)==null?void 0:e.progress)||0;t.installProgress=m,t.consoleCurrentRate=m,t.installStatus=(o=a.data)==null?void 0:o.status,t.installStatus==="completed"?(clearInterval(t.timer),setTimeout(()=>{l.push({name:"applicationManage"})},2e3)):t.installStatus==="failed"&&(x({message:"安装失败！",type:"warning",duration:2e3}),setTimeout(()=>{l.push({name:"applicationManage"})},2e3))}else throw new Error(`进度查询失败：${a.msg||"接口返回异常"}`)}catch(a){console.error("查询安装进度失败：",a),clearInterval(t.timer),M({message:"安装进度查询失败，请刷新重试",duration:3e3}),setTimeout(()=>{l.push({name:"applicationManage"})},3e3)}};return C(async()=>{try{const{code:r,data:e}=await I({app_name:_});if(r===200){let o=e==null?void 0:e.task_id;t.timer=setInterval(()=>f(o),2e3)}else throw new Error(`安装接口调用失败：${msg||"接口返回异常"}`)}catch(r){console.log(r),l.push({name:"applicationManage"})}}),S(()=>{clearInterval(t.timer),t.timer=null}),(r,e)=>{const o=P;return c(),i("div",E,[n("div",V,[k(o,{"current-rate":s(t).consoleCurrentRate,"onUpdate:currentRate":e[0]||(e[0]=a=>s(t).consoleCurrentRate=a),rate:s(t).installProgress,speed:100,size:"8.125rem",color:g},{default:N(()=>[n("div",q,[n("img",{src:s(T),alt:""},null,8,B)])]),_:1},8,["current-rate","rate"]),s(t).installStatus==="installing"||s(t).installStatus==="pulling"?(c(),i("div",A," DWdeply安装中（"+R(s(t).installProgress)+"%） ",1)):p("",!0),s(t).installStatus==="completed"?(c(),i("div",U," DWdeply安装成功 ")):p("",!0)]),n("div",W,[n("img",{src:s(b),alt:""},null,8,$),e[1]||(e[1]=D(" 未了避免中断，请勿关闭或刷新页面 "))])])}}},X=h(z,[["__scopeId","data-v-21a1b315"]]);export{X as default};
