index.832ef71b.js 10 KB

1
  1. import{a as v}from"./request.2147e2b4.js";import{_ as y,E as S,b as n,o as u,e as C,w as l,f as o,g as h,c as f,h as m,t as b,i as F,F as E,j as P,p as D,k as A,l as k}from"./index.079de249.js";const $={name:"MenuManagementEdit",data(){return{form:{loginId:"",password:"",sure_pwd:""},surePwd:"",rules:{password:[{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5BC6\u7801"}],sure_pwd:[{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u786E\u8BA4\u5BC6\u7801"}]},title:"",dialogFormVisible:!1}},created(){},methods:{async showEdit(){this.form.loginId=localStorage.getItem("satoken"),this.dialogFormVisible=!0},close(){this.$refs.form.resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1},save(){this.$refs.form.validate(async t=>{if(t){if(this.form.password!==this.form.sure_pwd){this.$message.warning("\u60A8\u8F93\u5165\u7684\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165");return}delete this.form.sure_pwd,await v.post("/sso/updatePW",this.form).then(e=>{S.success(e.data.msg)}),this.close(),await this.logout().catch(e=>{console.error(e)})}})},async logout(){await v.post("/sso/logout",{loginId:localStorage.getItem("satoken")}).then(t=>{localStorage.removeItem("loginId"),localStorage.removeItem("satoken"),this.$router.push("/login")}).catch(t=>{console.error(t)})}}},W=h("\u53D6 \u6D88"),B=h("\u786E \u5B9A");function M(t,e,_,I,s,d){const c=n("el-input"),i=n("el-form-item"),r=n("el-form"),g=n("el-button"),w=n("el-dialog");return u(),C(w,{"append-to-body":"","close-on-click-modal":!1,title:s.title,modelValue:s.dialogFormVisible,"onUpdate:modelValue":e[2]||(e[2]=p=>s.dialogFormVisible=p),width:"40%",onClose:d.close},{footer:l(()=>[o(g,{onClick:d.close},{default:l(()=>[W]),_:1},8,["onClick"]),o(g,{type:"primary",onClick:d.save},{default:l(()=>[B]),_:1},8,["onClick"])]),default:l(()=>[o(r,{ref:"form","label-width":"100px",model:s.form,rules:s.rules},{default:l(()=>[o(i,{label:"\u65B0\u5BC6\u7801:",prop:"password"},{default:l(()=>[o(c,{modelValue:s.form.password,"onUpdate:modelValue":e[0]||(e[0]=p=>s.form.password=p),"show-password":"",type:"password"},null,8,["modelValue"])]),_:1}),o(i,{label:"\u786E\u8BA4\u5BC6\u7801:",prop:"sure_pwd"},{default:l(()=>[o(c,{modelValue:s.form.sure_pwd,"onUpdate:modelValue":e[1]||(e[1]=p=>s.form.sure_pwd=p),"show-password":"",type:"password"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue","onClose"])}var T=y($,[["render",M],["__scopeId","data-v-6a8000b7"]]);const q={name:"MenuManagementEdit",data(){return{form:{username:"",name:"",avatar:"",intro:null,age:null,sex:null,phone:null,email:null},rules:{username:[{required:!0,trigger:"blur",message:""}],name:[{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u6635\u79F0"}]},title:"\u4E2A\u4EBA\u4E2D\u5FC3",dialogFormVisible:!1,loginId:""}},created(){},methods:{async showEdit(){this.form.id=localStorage.getItem("satoken"),await v.post("/SysUserAcc/getById",{id:this.form.id}).then(t=>{this.form=t.data.data}),this.dialogFormVisible=!0},close(){this.$refs.form.resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1,this.$emit("child-event")},save(){this.$refs.form.validate(async t=>{t&&await v.post("/SysUserAcc/update",this.form).then(e=>{S.success(e.data.msg),this.close()})})}}},N=h("\u7537"),G=h("\u5973"),j=h("\u53D6 \u6D88"),z=h("\u786E \u5B9A");function H(t,e,_,I,s,d){const c=n("el-input"),i=n("el-form-item"),r=n("in-input"),g=n("el-radio"),w=n("el-radio-group"),p=n("el-form"),V=n("el-button"),x=n("el-dialog");return u(),C(x,{"append-to-body":"","close-on-click-modal":!1,title:s.title,modelValue:s.dialogFormVisible,"onUpdate:modelValue":e[8]||(e[8]=a=>s.dialogFormVisible=a),width:"40%",onClose:d.close},{footer:l(()=>[o(V,{onClick:d.close},{default:l(()=>[j]),_:1},8,["onClick"]),o(V,{type:"primary",onClick:d.save},{default:l(()=>[z]),_:1},8,["onClick"])]),default:l(()=>[o(p,{ref:"form","label-width":"100px",model:s.form,rules:s.rules},{default:l(()=>[o(i,{label:"\u8D26\u53F7:",prop:"username"},{default:l(()=>[o(c,{modelValue:s.form.username,"onUpdate:modelValue":e[0]||(e[0]=a=>s.form.username=a),disabled:""},null,8,["modelValue"])]),_:1}),o(i,{label:"\u6635\u79F0:",prop:"name"},{default:l(()=>[o(c,{modelValue:s.form.name,"onUpdate:modelValue":e[1]||(e[1]=a=>s.form.name=a)},null,8,["modelValue"])]),_:1}),o(r,{type:"img",name:"\u7528\u6237\u5934\u50CF\uFF1A",modelValue:s.form.avatar,"onUpdate:modelValue":e[2]||(e[2]=a=>s.form.avatar=a)},null,8,["modelValue"]),o(i,{label:"\u6027\u522B"},{default:l(()=>[o(w,{modelValue:s.form.sex,"onUpdate:modelValue":e[3]||(e[3]=a=>s.form.sex=a)},{default:l(()=>[o(g,{label:1},{default:l(()=>[N]),_:1}),o(g,{label:2},{default:l(()=>[G]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(i,{label:"\u5E74\u9F84"},{default:l(()=>[o(c,{type:"number",modelValue:s.form.age,"onUpdate:modelValue":e[4]||(e[4]=a=>s.form.age=a)},null,8,["modelValue"])]),_:1}),o(i,{label:"\u624B\u673A\u53F7",prop:"phone"},{default:l(()=>[o(c,{modelValue:s.form.phone,"onUpdate:modelValue":e[5]||(e[5]=a=>s.form.phone=a)},null,8,["modelValue"])]),_:1}),o(i,{label:"\u90AE\u7BB1"},{default:l(()=>[o(c,{modelValue:s.form.email,"onUpdate:modelValue":e[6]||(e[6]=a=>s.form.email=a)},null,8,["modelValue"])]),_:1}),o(i,{label:"\u7B80\u4ECB"},{default:l(()=>[o(c,{modelValue:s.form.intro,"onUpdate:modelValue":e[7]||(e[7]=a=>s.form.intro=a),rows:3,type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue","onClose"])}var J=y(q,[["render",H],["__scopeId","data-v-f6affa38"]]);const K={name:"VabAvatar",components:{changePwd:T,userDetails:J},data(){return{active:!1,avatar:"",username:""}},created(){localStorage.getItem("satoken")?this.getUser():this.$router.push("/login")},methods:{handleCommand(t){switch(t){case"logout":this.logout();break;case"password":this.$refs.changePwd.showEdit();break;case"user":this.$refs.userDetails.showEdit();break}},handleVisibleChange(t){this.active=t},async logout(){await v.post("/sso/logout",{loginId:localStorage.getItem("satoken")}).then(t=>{localStorage.removeItem("loginId"),localStorage.removeItem("satoken"),this.$router.push("/login")}).catch(t=>{console.error(t)})},async getUser(){this.listLoading=!0,await v.post("/sso/userInfo",{loginId:localStorage.getItem("satoken")}).then(t=>{console.log(t.data,"-----------xvxvxvvxvv");const e=t.data.data;this.username=e.username,this.avatar=e.avatar,this.listLoading=!1}).catch(t=>{console.error(t)})}}},O={class:"avatar-dropdown"},Q={class:"avatar-dropdown"},R={class:"user-name"},X={class:"hidden-xs-only"},Y=h(" \u4E2A\u4EBA\u4E2D\u5FC3 "),Z=h(" \u4FEE\u6539\u5BC6\u7801 "),ee=h(" \u9000\u51FA\u767B\u5F55 ");function oe(t,e,_,I,s,d){const c=n("el-avatar"),i=n("el-icon-ArrowDown"),r=n("el-icon"),g=n("el-icon-User"),w=n("el-dropdown-item"),p=n("el-icon-Edit"),V=n("el-icon-Setting"),x=n("el-dropdown-menu"),a=n("el-dropdown"),L=n("changePwd"),U=n("userDetails");return u(),f("div",O,[o(a,{onCommand:d.handleCommand,onVisibleChange:d.handleVisibleChange},{dropdown:l(()=>[o(x,null,{default:l(()=>[o(w,{command:"user"},{default:l(()=>[o(r,{class:"el-icon-edit"},{default:l(()=>[o(g)]),_:1}),Y]),_:1}),o(w,{command:"password"},{default:l(()=>[o(r,{class:"el-icon-edit"},{default:l(()=>[o(p)]),_:1}),Z]),_:1}),o(w,{command:"logout"},{default:l(()=>[o(r,null,{default:l(()=>[o(V)]),_:1}),ee]),_:1})]),_:1})]),default:l(()=>[m("span",Q,[o(c,{class:"user-avatar",src:s.avatar},null,8,["src"]),m("div",R,[m("span",X,b(s.username),1),o(r,{class:"el-icon--right",style:{position:"relative",top:"2px"}},{default:l(()=>[o(i)]),_:1})])])]),_:1},8,["onCommand","onVisibleChange"]),o(L,{ref:"changePwd"},null,512),o(U,{ref:"userDetails",onChildEvent:d.getUser},null,8,["onChildEvent"])])}var te=y(K,[["render",oe],["__scopeId","data-v-6b51fae7"]]),se="/assets/logo-bencao.f0d81966.png";const le={name:"Home",components:{VabAvatar:te},data(){return{list:[],webList:[],isLogin:!1,screenWidth:"",settingStore:F()}},async created(){localStorage.getItem("satoken")?(await this.docheckIsLogin(),this.isLogin?(console.log(this.isLogin,"this.isLoginthis.isLoginthis.isLoginthis.isLogin"),await this.doGetClientLists()):(localStorage.removeItem("loginId"),localStorage.removeItem("satoken"),this.$router.push("/login"))):this.$router.push("/login")},mounted(){this.screenWidth=document.body.clientWidth,window.onresize=()=>(()=>{this.screenWidth=document.body.clientWidth,this.screenWidth>500?this.list=this.webList.filter(t=>t.deviceType==0):this.list=this.webList.filter(t=>t.deviceType==1)})()},methods:{async docheckIsLogin(){let t={keyword:localStorage.getItem("satoken")};await v.post("/sso/getListServer",t).then(e=>{console.log(e.data,"-----------xvxvxvvxvv");const _=e.data.data;console.log(_.length,"-----------xvxvxvvxvv"),this.isLogin=!!_.length}).catch(e=>{console.error(e)})},skipUrl(t){window.open(t+"?loginId="+localStorage.getItem("satoken"),"_blank")},async doGetClientLists(){let t={loginId:localStorage.getItem("satoken")};await v.post("/sso/getClientList",t).then(e=>{console.log(e.data,"-----------cccc");const _=e.data.data;this.list=_,this.webList=_}).catch(e=>{console.error(e)}),console.log(this.IsPhone(),"this.IsPhone()"),this.IsPhone()?this.list=this.webList.filter(e=>e.deviceType==1):this.list=this.webList.filter(e=>e.deviceType==0)},IsPhone(){var t=navigator.userAgent,e=/mobile/i.test(t);return e}}},ne=t=>(D("data-v-f9505d6c"),t=t(),A(),t),ae={class:"container"},ie={class:"container-prop"},re={class:"top-nav"},de={class:"nav"},ce=ne(()=>m("div",{class:"logo"},[m("img",{mode:"widthFix",src:se})],-1)),me={class:"nav-title"},ue={class:"exit"},_e={class:"content"},pe=["onClick"],he={key:0,class:"icon_1"},ge={key:1,class:"icon_2"},fe={key:2,class:"icon_3"},ve={key:3,class:"icon_4"};function we(t,e,_,I,s,d){const c=n("VabAvatar");return u(),f("div",ae,[m("div",ie,[m("div",re,[m("div",de,[ce,m("div",me,b(s.settingStore.title),1),m("div",ue,[o(c)])])]),m("div",_e,[(u(!0),f(E,null,P(s.list,(i,r)=>(u(),f("div",{key:r,class:"content-item",onClick:g=>d.skipUrl(i.allowUrl)},[r%4==0?(u(),f("div",he,b(i.name),1)):k("",!0),r%4==1?(u(),f("div",ge,b(i.name),1)):k("",!0),r%4==2?(u(),f("div",fe,b(i.name),1)):k("",!0),r%4==3?(u(),f("div",ve,b(i.name),1)):k("",!0)],8,pe))),128))])])])}var ke=y(le,[["render",we],["__scopeId","data-v-f9505d6c"]]);export{ke as default};