import{d as e,a5 as a,o as t,I as l,r as s,x as n,c as o,w as u,L as i,u as c,i as r,h as d,j as f,k as v,O as p,B as m,a as g,b as _,C as h,e as b,U as w,f as x,t as k,a8 as y,D as C,E as I,l as N,H as S,_ as F}from"./index-CY26MUkV.js";const U=F(e({__name:"version",setup(e){const{styles:F}=a();t(()=>{G(),O()}),l();const U=s(0),z=s(3),A=s(""),B=s(""),M=s(""),V=s(!1),D=s(!1),E=()=>{J(1)},G=()=>{if("undefined"!=typeof plus)return A.value=plus.runtime.version,!0;A.value=""},O=()=>{n("/api/services/app/ApkManagement/GetNewVersion",{}).then(e=>{if(e.success){B.value=e.result||"";let a=((e,a)=>{const t=e.split(".").map(Number),l=a.split(".").map(Number),s=Math.max(t.length,l.length);for(let n=0;n<s;n++){const e=t[n]||0,a=l[n]||0;if(e>a)return 1;if(e<a)return-1}return 0})(A.value,B.value);1===a?z.value=1:-1===a?z.value=2:0===a&&(z.value=3)}})},P=()=>{J(2),1===z.value?M.value="检测到需退回版本，建议您立即更新以获取最新功能和优化体验。":2===z.value?M.value="检测到新版本，建议您立即更新以获取最新功能和优化体验。":M.value="当前已是最新版本，无需更新。",V.value=!0},T=()=>{if(1===z.value||2===z.value){n("/api/services/app/ApkManagement/GetNewVersionFileNamePath",{}).then(e=>{if(e.success){let a=e.result||"";j(a)}})}V.value=!1},j=e=>{if("undefined"==typeof plus)return!1;I({title:"正在下载更新包..."}),D.value=!0;const a=N.get("remoteUrl")+"/File/QueryFileContentView?value="+e+`&tenantId=${N.get("TenantId")}`,t=plus.downloader.createDownload(a,{filename:"_doc/update_app.apk",method:"GET",timeout:30},(e,a)=>{S(),D.value=!1,200===a?(console.log("✅ 下载完成，本地路径:",e.filename),plus.runtime.install(e.filename,{},()=>{console.log("✅ 安装成功"),plus.nativeUI.alert("新版本已安装成功，请重新打开App")},e=>{console.error("❌ 安装失败:",JSON.stringify(e)),plus.nativeUI.alert("安装失败："+JSON.stringify(e))})):(console.error("❌ 下载失败，状态码:",a),plus.nativeUI.alert("下载失败，请检查网络或权限"))});t.addEventListener("statechanged",e=>{switch(e.state){case 1:console.log("开始下载...");break;case 2:console.log("连接到服务器...");break;case 3:if(e.totalSize>0){const a=(e.downloadedSize/e.totalSize*100).toFixed(2);console.log(`下载进度: ${a}%`)}break;case 4:console.log("下载完成")}}),t.start()},J=(e=0)=>{U.value=e,setTimeout(()=>{U.value=0},200)};return(e,a)=>{const t=d(v("up-navbar"),f),l=b,s=w,n=r,I=d(v("up-icon"),p),N=d(v("up-modal"),m);return g(),o(n,{class:"page-container",style:i({...c(F)})},{default:u(()=>[_(t,{autoBack:!0}),_(n,{class:"version-container",mode:"widthFix"},{default:u(()=>[_(l,{src:"/static/image/logo.svg",class:"logo"}),_(n,{class:"text-container"},{default:u(()=>[_(s,{class:"text-info",style:{"font-size":"25px","font-weight":"600"}},{default:u(()=>[x("WMS PDA")]),_:1}),_(s,{class:"text-info"},{default:u(()=>[x("Version "+k(A.value),1)]),_:1})]),_:1})]),_:1}),_(n,{class:"btn-container"},{default:u(()=>[_(n,{class:y(["btn-class",[1===U.value?"animate":""]]),onClick:E},{default:u(()=>[_(s,{class:"btn-text"},{default:u(()=>[x("功能介绍")]),_:1}),_(I,{name:"arrow-right",class:"btn-icon"})]),_:1},8,["class"]),_(n,{class:y(["btn-class last",[2===U.value?"animate":""]]),onClick:P},{default:u(()=>[_(s,{class:"btn-text"},{default:u(()=>[x("检查版本更新")]),_:1}),_(I,{name:"arrow-right",class:"btn-icon"})]),_:1},8,["class"])]),_:1}),_(n,{class:"info-container"},{default:u(()=>[_(n,null,{default:u(()=>[x("热线：400-878-3812")]),_:1}),_(n,null,{default:u(()=>[x("电话：0512-67865115")]),_:1}),_(n,null,{default:u(()=>[x("邮箱：luling@valueics.com")]),_:1}),_(n,null,{default:u(()=>[x("Copyright © 2025 苏州智合诚信息科技有限公司 备案号：苏ICP备20014693号-1")]),_:1})]),_:1}),h(_(n,{class:"bg-loading"},null,512),[[C,D.value]]),_(N,{show:V.value,title:"版本更新",content:M.value,showCancelButton:3!==z.value,onConfirm:T,onCancel:a[0]||(a[0]=e=>V.value=!1)},null,8,["show","content","showCancelButton"])]),_:1},8,["style"])}}}),[["__scopeId","data-v-bf9073e7"]]);export{U as default};
