import{_ as h,a as w,u as v,q as y,o as C,aD as I,s as S,c as i,d as c,e as n,f as k,h as d,w as N,g as s,t as R,j as D,aE as F}from"./index-BV0H45HW.js";import{C as P}from"./index-Dvq70EEv.js";import{d as T}from"./updating-x5avpz8W.js";import{i as x}from"./info-Bq3qLitc.js";import"./index-BtHEBb5f.js";import{s as M,b as E}from"./index-BbxsW7ll.js";import"./index-DPrftX7L.js";const V={class:"install-wrapper"},b={class:"install-inner"},q={class:"circle-inner"},B=["src"],A={key:0,class:"mt20"},U={key:1,class:"mt20"},W={class:"bottom-message"},$=["src"],j={__name:"under-install",setup(z){var u;const p=w(),l=v(),_=(u=p.query)==null?void 0:u.appName;let t=y({consoleCurrentRate:0,installProgress:0,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"&&(M({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),E({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",V,[n("div",b,[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)):d("",!0),s(t).installStatus==="completed"?(c(),i("div",U," DWdeply安装成功 ")):d("",!0)]),n("div",W,[n("img",{src:s(x),alt:""},null,8,$),e[1]||(e[1]=D(" 未了避免中断，请勿关闭或刷新页面 "))])])}}},X=h(j,[["__scopeId","data-v-81d2e70c"]]);export{X as default};
