adminInfo-3zuCwxMX.js 6.4 KB

1
  1. import{d as J,o as Q,a2 as W,a as X,r as P,K as r,aq as Y,e as p,f as U,j as o,L as d,N as Z,u as t,i as s,y as b,C as ee,t as c,ac as y,ae as F,m as k,F as ae,B as oe,am as ne}from"./vue-A59npLRR.js";import{c as V,a as te,b as z,P as le,o as ie,a5 as de,a0 as re,_ as me}from"./index-EwE51S_X.js";import{b as v}from"./validate-_EUdkMt3.js";import{U as se}from"./userProfile-ncSGlwdV.js";import{u as ue}from"./userMounted-UUYQdIa5.js";import"./echarts-cxb9vJr1.js";import"./wechat_mp-zANTKHXk.js";import"./oauth-flw5HISP.js";const S="/admin/routine.AdminInfo/",C=new Map([["index",S+"index"],["edit",S+"edit"],["log","/admin/auth.AdminLog/index"]]);function fe(){return V({url:C.get("index"),method:"get"})}function pe(g={}){return V({url:C.get("log"),method:"get",params:g})}function K(g){return V({url:C.get("edit"),method:"post",data:g},{showSuccessMessage:!0})}const ce={class:"default-main"},ge={class:"admin-info"},_e={class:"image-slot"},Ie={class:"admin-info-base"},be={class:"admin-nickname"},ve={class:"admin-other"},he={class:"admin-info-form"},we=J({name:"routine/adminInfo",__name:"adminInfo",setup(g){Q(async()=>{const l=await ue();if(l.type!="break"&&l.type=="reload")return window.location.href=l.url});const{t:n}=W(),_=X(),I=te(),e=P({adminInfo:{},formKey:z(),buttonLoading:!1,log:[],logFilter:{limit:12},logCurrentPage:1,logPageSize:12,logTotal:100,logLoading:!0});fe().then(l=>{e.adminInfo=l.data.info,e.formKey=z(),e.logFilter.search=[{field:"admin_id",val:l.data.info.id,operator:"eq"}],h()});const h=()=>{pe(e.logFilter).then(l=>{e.log=l.data.list,e.logTotal=l.data.total,e.logLoading=!1}).catch(()=>{e.logLoading=!1})},B=l=>{e.logPageSize=l,e.logFilter.limit=l,h()},D=l=>{e.logCurrentPage=l,e.logFilter.page=l,h()},M=P({nickname:[v({name:"required",title:n("routine.adminInfo.User nickname")})],email:[v({name:"email",title:n("routine.adminInfo.e-mail address")})],mobile:[v({name:"mobile",message:n("Please enter the correct field",{field:n("routine.adminInfo.phone number")})})],password:[v({name:"password"})]}),N=l=>{let a=new FormData;a.append("file",l.raw),re(a).then(u=>{u.code==1&&K({id:e.adminInfo.id,avatar:u.data.file.url}).then(()=>{I.dataFill({...I.$state,avatar:u.data.file.full_url}),e.adminInfo.avatar=u.data.file.full_url})})},w=()=>{_.value&&_.value.validate(l=>{if(l){let a={...e.adminInfo};delete a.last_login_time,delete a.username,delete a.avatar,e.buttonLoading=!0,K(a).then(()=>{I.dataFill({...I.$state,nickname:e.adminInfo.nickname}),e.buttonLoading=!1}).catch(()=>{e.buttonLoading=!1})}})};return(l,a)=>{const u=r("Icon"),$=r("el-image"),A=r("el-upload"),f=r("el-input"),m=r("el-form-item"),x=r("el-button"),T=r("el-form"),L=r("el-col"),j=r("el-timeline-item"),R=r("el-timeline"),q=r("el-pagination"),E=r("el-card"),O=r("el-row"),G=Y("loading");return p(),U("div",ce,[o(O,{gutter:30},{default:d(()=>[o(L,{class:"lg-mb-20",xs:24,sm:24,md:24,lg:10},{default:d(()=>[s("div",ge,[t(Z)(e.adminInfo)?ee("",!0):(p(),b(A,{key:0,class:"avatar-uploader",action:"","show-file-list":!1,onChange:N,"auto-upload":!1,accept:"image/gif, image/jpg, image/jpeg, image/bmp, image/png, image/webp"},{default:d(()=>[o($,{src:t(le)(e.adminInfo.avatar),class:"avatar"},{error:d(()=>[s("div",_e,[o(u,{size:"30",color:"#c0c4cc",name:"el-icon-Picture"})])]),_:1},8,["src"])]),_:1})),s("div",Ie,[s("div",be,c(e.adminInfo.nickname),1),s("div",ve,[s("div",null,c(t(n)("routine.adminInfo.Last logged in on"))+" "+c(e.adminInfo.last_login_time),1)])]),o(se),s("div",he,[(p(),b(T,{onKeyup:a[10]||(a[10]=y(i=>w(),["enter"])),key:e.formKey,"label-position":"top",rules:M,ref_key:"formRef",ref:_,model:e.adminInfo},{default:d(()=>[o(m,{label:t(n)("routine.adminInfo.user name")},{default:d(()=>[o(f,{disabled:"",modelValue:e.adminInfo.username,"onUpdate:modelValue":a[0]||(a[0]=i=>e.adminInfo.username=i)},null,8,["modelValue"])]),_:1},8,["label"]),o(m,{label:t(n)("routine.adminInfo.User nickname"),prop:"nickname"},{default:d(()=>[o(f,{placeholder:t(n)("routine.adminInfo.Please enter a nickname"),modelValue:e.adminInfo.nickname,"onUpdate:modelValue":a[1]||(a[1]=i=>e.adminInfo.nickname=i)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),o(m,{label:t(n)("routine.adminInfo.e-mail address"),prop:"email"},{default:d(()=>[o(f,{placeholder:t(n)("Please input field",{field:t(n)("routine.adminInfo.e-mail address")}),modelValue:e.adminInfo.email,"onUpdate:modelValue":a[2]||(a[2]=i=>e.adminInfo.email=i)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),o(m,{label:t(n)("routine.adminInfo.phone number"),prop:"mobile"},{default:d(()=>[o(f,{placeholder:t(n)("Please input field",{field:t(n)("routine.adminInfo.phone number")}),modelValue:e.adminInfo.mobile,"onUpdate:modelValue":a[3]||(a[3]=i=>e.adminInfo.mobile=i)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),o(m,{label:t(n)("routine.adminInfo.autograph"),prop:"motto"},{default:d(()=>[o(f,{onKeyup:[a[4]||(a[4]=y(F(()=>{},["stop"]),["enter"])),a[5]||(a[5]=y(F(i=>w(),["ctrl"]),["enter"]))],placeholder:t(n)("routine.adminInfo.This guy is lazy and doesn write anything"),type:"textarea",modelValue:e.adminInfo.motto,"onUpdate:modelValue":a[6]||(a[6]=i=>e.adminInfo.motto=i)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),o(m,{label:t(n)("routine.adminInfo.New password"),prop:"password"},{default:d(()=>[o(f,{type:"password",placeholder:t(n)("routine.adminInfo.Please leave blank if not modified"),modelValue:e.adminInfo.password,"onUpdate:modelValue":a[7]||(a[7]=i=>e.adminInfo.password=i)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),o(m,null,{default:d(()=>[o(x,{type:"primary",loading:e.buttonLoading,onClick:a[8]||(a[8]=i=>w())},{default:d(()=>[k(c(t(n)("routine.adminInfo.Save changes")),1)]),_:1},8,["loading"]),o(x,{onClick:a[9]||(a[9]=i=>t(ie)(_.value))},{default:d(()=>[k(c(t(n)("Reset")),1)]),_:1})]),_:1})]),_:1},8,["rules","model"]))])])]),_:1}),ne((p(),b(L,{xs:24,sm:24,md:24,lg:12},{default:d(()=>[o(E,{header:t(n)("routine.adminInfo.Operation log"),shadow:"never"},{default:d(()=>[o(R,null,{default:d(()=>[(p(!0),U(ae,null,oe(e.log,(i,H)=>(p(),b(j,{key:H,size:"large",timestamp:t(de)(i.create_time)},{default:d(()=>[k(c(i.title),1)]),_:2},1032,["timestamp"]))),128))]),_:1}),o(q,{currentPage:e.logCurrentPage,"page-size":e.logPageSize,"page-sizes":[12,22,52,100],background:"",layout:"prev, next, jumper",total:e.logTotal,onSizeChange:B,onCurrentChange:D},null,8,["currentPage","page-size","total"])]),_:1},8,["header"])]),_:1})),[[G,e.logLoading]])]),_:1})])}}}),Fe=me(we,[["__scopeId","data-v-07f830e4"]]);export{Fe as default};