"use strict";(self["webpackChunkX_PHP_Admin"]=self["webpackChunkX_PHP_Admin"]||[]).push([[951],{1951:function(e,a,i){i.r(a),i.d(a,{default:function(){return A}});var t=i(6252),s=i(3577);const l=e=>((0,t.dD)("data-v-383af292"),e=e(),(0,t.Cn)(),e),o={class:"x-update"},r={key:0,class:"login-box"},n={class:"face"},d=["src"],u={key:1,style:{"text-transform":"capitalize"}},p={class:"info"},c={class:"name",style:{"text-transform":"capitalize"}},m={class:"title"},g=l((()=>(0,t._)("i",{class:"el-icon-mobile-phone"},null,-1))),h=l((()=>(0,t._)("i",{class:"wk wk-icon-email-outline"},null,-1))),w={key:1,class:"login-box"},f=l((()=>(0,t._)("div",{class:"face"},"登录",-1))),k={class:"info"},v={class:"login-box-title"},_=l((()=>(0,t._)("p",null,"更新前需要先登录云平台账号",-1))),y={class:"last-time"},b={key:2,class:""},D={key:0,class:"version"},U=l((()=>(0,t._)("p",{class:"text"},"您当前是最新版本",-1))),V={key:1,class:"version"},x=l((()=>(0,t._)("p",{class:"text"},"有新的版本可升级",-1))),C={class:"update-wrap"},$=["value"],W={class:"el-dialog__title"},z={class:"description"},H=["href"],L={class:"form-item"},F={class:"form-item password"};function q(e,a,i,l,q,P){const R=(0,t.up)("x-page-header"),N=(0,t.up)("el-alert"),T=(0,t.up)("el-button"),A=(0,t.up)("el-table-column"),Q=(0,t.up)("el-table"),X=(0,t.up)("el-input"),B=(0,t.up)("el-form-item"),I=(0,t.up)("el-form"),M=(0,t.up)("el-dialog"),O=(0,t.Q2)("loading"),Y=(0,t.Q2)("time");return(0,t.wg)(),(0,t.iD)(t.HY,null,[(0,t.Wm)(R,{title:"系统更新",description:"你可以随时检查使用系统是否是最新版本,并进行一键升级",icon:"el-icon-setting"}),(0,t._)("div",o,[(0,t.Wm)(N,{title:"当前为更新系统核心架构; 更新前,您需要备份您的数据,防止数据丢失。",type:"warning",style:{padding:"10px 0"}}),(0,t.Wm)(N,{title:"相关应用请单独更新, 框架更新可能导致部分应用报错。",type:"error",style:{padding:"10px 0"}}),q.userData.uid?((0,t.wg)(),(0,t.iD)("div",r,[(0,t._)("div",n,[q.userData.avatar?((0,t.wg)(),(0,t.iD)("img",{key:0,src:q.userData.avatar,alt:""},null,8,d)):((0,t.wg)(),(0,t.iD)("span",u,(0,s.zw)(q.userData.username),1))]),(0,t._)("div",p,[(0,t._)("span",c,(0,s.zw)(q.userData.username),1),(0,t._)("span",m,"授权 "+(0,s.zw)(q.name),1),(0,t._)("p",null,(0,s.zw)(q.authorizationtime),1),(0,t._)("p",null,[g,(0,t.Uk)(" "+(0,s.zw)(q.userData.mobile),1)]),(0,t._)("p",null,[h,(0,t.Uk)(" "+(0,s.zw)(q.userData.email),1)])]),(0,t._)("div",null,[(0,t.Wm)(T,{type:"info",plain:"",onClick:a[0]||(a[0]=e=>q.dialogVisible=!0)},{default:(0,t.w5)((()=>[(0,t.Uk)("更换绑定")])),_:1})])])):((0,t.wg)(),(0,t.iD)("div",w,[f,(0,t._)("div",k,[(0,t._)("div",v,[(0,t._)("span",{onClick:a[1]||(a[1]=e=>q.dialogVisible=!0)},"请点击登"),_])]),(0,t.Wm)(T,{type:"primary",plain:"",onClick:a[2]||(a[2]=e=>q.dialogVisible=!0)},{default:(0,t.w5)((()=>[(0,t.Uk)("登录")])),_:1})])),(0,t.wy)(((0,t.wg)(),(0,t.iD)("div",y,[(0,t.Wm)(T,{disabled:q.isClick,type:"primary",plain:"",onClick:P.checkHandle},{default:(0,t.w5)((()=>[(0,t.Uk)("检查更新")])),_:1},8,["disabled","onClick"])])),[[O,q.checkLoading]]),q.isCheckUpdate?((0,t.wg)(),(0,t.iD)("div",b,[q.isNewest?((0,t.wg)(),(0,t.iD)("div",D,[U,(0,t.Uk)(" 当前版本:"+(0,s.zw)(q.version)+" ("+(0,s.zw)(q.release)+") ",1)])):(0,t.wy)(((0,t.wg)(),(0,t.iD)("div",V,[x,(0,t.Uk)(" 当前版本:"+(0,s.zw)(q.version)+" ("+(0,s.zw)(q.release)+") ",1),(0,t._)("div",C,[(0,t.Wm)(Q,{data:q.upgradelist,border:"",style:{width:"100%"}},{default:(0,t.w5)((()=>[(0,t.Wm)(A,{label:"版本",width:"170"},{default:(0,t.w5)((e=>[(0,t._)("span",null,(0,s.zw)(e.row.version)+" ("+(0,s.zw)(e.row.release)+")",1)])),_:1}),(0,t.Wm)(A,{label:"更新内容"},{default:(0,t.w5)((e=>[(0,t._)("input",{style:{cursor:"pointer"},class:"el-input__inner",type:"text",readonly:"",value:e.row.message},null,8,$)])),_:1}),(0,t.Wm)(A,{label:"发布时间",width:"170"},{default:(0,t.w5)((e=>[(0,t.wy)((0,t._)("span",null,null,512),[[Y,e.row.timestamp]])])),_:1}),(0,t.Wm)(A,{label:"操作",align:"center",width:"140",fixed:"right"},{default:(0,t.w5)((e=>[(0,t.Wm)(T,{type:q.isCanUpdate?"default":"info",onClick:a=>P.updateHandle(e.row)},{default:(0,t.w5)((()=>[(0,t.Uk)("更新到此版本")])),_:2},1032,["type","onClick"])])),_:1})])),_:1},8,["data"])])])),[[O,q.updateLoading]])])):(0,t.kq)("",!0),(0,t.Wm)(M,{modelValue:q.dialogVisible,"onUpdate:modelValue":a[6]||(a[6]=e=>q.dialogVisible=e),class:"xlogin",title:"",width:"500px"},{header:(0,t.w5)((({})=>[(0,t._)("div",W,[(0,t.Uk)(" 登录云平台账号 "),(0,t._)("p",z,[(0,t.Uk)("您可以登录云平台账号来进行一键升级,如没有请"),(0,t._)("a",{target:"_blank",href:q.cloudregister},"注册",8,H)])])])),default:(0,t.w5)((()=>[(0,t.Wm)(I,{ref:"loginRef",model:q.loginForm,rules:q.loginRules,"label-width":"80px","label-position":"top",class:"login-form"},{default:(0,t.w5)((()=>[(0,t._)("div",L,[(0,t.Wm)(B,{prop:"account"},{default:(0,t.w5)((()=>[(0,t.Uk)(" 账号 "),(0,t.Wm)(X,{modelValue:q.loginForm.account,"onUpdate:modelValue":a[3]||(a[3]=e=>q.loginForm.account=e),autocomplete:"off",placeholder:"请输入您的云平台账号"},null,8,["modelValue"])])),_:1})]),(0,t._)("div",F,[(0,t.Wm)(B,{prop:"password"},{default:(0,t.w5)((()=>[(0,t.Uk)(" 密码 "),(0,t.Wm)(X,{modelValue:q.loginForm.password,"onUpdate:modelValue":a[4]||(a[4]=e=>q.loginForm.password=e),autocomplete:"off",type:"password",placeholder:"请输入您的云平台账号的密码"},null,8,["modelValue"])])),_:1})]),(0,t.Wm)(T,{type:"primary",onClick:a[5]||(a[5]=e=>P.loginHandle("loginRef"))},{default:(0,t.w5)((()=>[(0,t.Uk)("确认登录")])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["modelValue"])])],64)}var P=i(9737),R={name:"Update",components:{},data(){return{isClick:!1,isCanUpdate:!0,dialogVisible:!1,loginForm:{account:"",password:""},loginRules:{account:[{required:!0,message:"请输入云平台账号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]},userData:{uid:0},name:null,authorizationtime:null,cloudregister:null,isCheckUpdate:!1,isNewest:!1,checkLoading:!1,version:"",release:"",serverVersion:{},upgradelist:[],updateLoading:!1,progress:0}},created(){this.loaddata()},methods:{loaddata(){this.loading=!0,this.$http.get("admin/upgrade/get").then((e=>{if(this.loading=!1,200==e.code)return this.userData=e.data.user,this.cloudregister=e.data.cloudregister,this.name=e.data.name,void(this.authorizationtime=e.data.authorizationtime);this.$alert(e.message,"提示",{type:"error"})}))},loginHandle(e){this.$refs[e].validate((e=>{if(!e)return!1;this.$http.post("admin/upgrade/login",this.loginForm).then((e=>{if(200==e.code)return this.dialogVisible=!1,this.$message.success(e.message||"操作成功"),this.userData=e.data,!0;this.$alert(e.message,"提示",{type:"error"})}))}))},logoutHandle(){P.T.confirm("退出后无法在线升级系统框架和下载应用.","正在退出云账号",{type:"error",closeOnClickModal:!1,confirmButtonText:"确认退出"}).then((()=>{this.$http.post("admin/upgrade/quit",{}).then((e=>{if(200==e.code)return this.userData={uid:0},this.loginForm.account="",this.loginForm.password="",this.$message.success(e.message||"操作成功"),!0;this.$alert(e.message,"提示",{type:"error"})}))})).catch((()=>{}))},async checkHandle(){this.checkLoading=!0;var{code:e,data:a,message:i}=await this.$http.post("admin/upgrade/check",{});return this.checkLoading=!1,200==e?(this.isNewest=!a.upgrade,this.version=a.version,this.release=a.release,this.serverVersion=a.serverVersion,this.upgradelist=a.upgradelist,this.isCheckUpdate=!0,this.isClick=!0,!0):205==e?(this.$message.info(i||"请先登录云平台"),void(this.dialogVisible=!0)):void this.$alert(i||"操作失败","提示",{type:"error"})},async updateHandle(e){if(!this.userData.uid)return this.$message.info("请先登录云平台"),void(this.dialogVisible=!0);this.updateLoading={visible:!0,text:"获取更新信息中"};var a=await this.$http.post("admin/upgrade/update",{version:e.version,release:e.release,xphphash:e.xphphash});if(200!=a.code){if(205==a.code)return this.$message.info(a.message||"请先登录云平台"),void(this.dialogVisible=!0);this.updateLoading=!1,this.$alert(a.message||"操作失败","提示",{type:"error"})}else{this.updateLoading={visible:!0,text:a.message||"文件下载成功"},this.$message.success(a.message||"文件下载成功");var i=this;setTimeout((async()=>{var e=await i.$http.post("admin/upgrade/install",{token:a.data.token});if(200==e.code)return i.updateLoading=!1,i.$message.success(e.message||"更新成功"),void i.checkHandle();this.updateLoading=!1,this.$alert(e.message||"操作失败","提示",{type:"error"})}),1e3)}}}},N=i(3744);const T=(0,N.Z)(R,[["render",q],["__scopeId","data-v-383af292"]]);var A=T}}]);