1 |
- import{a as g}from"./request.4a9b498d.js";import{_ as b,b as a,o as c,e as V,w as n,f as o,g as k,c as h,h as l,t as p,i as L,F as C,j as $,p as P,k as F,l as w}from"./index.b197ef74.js";const U={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 e=>{if(e){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 g.post("/sso/updatePW",this.form).then(t=>{this.$baseMessage("\u4FEE\u6539\u6210\u529F","success",!1,"vab-hey-message-success")}),this.close(),await this.logout().catch(t=>{console.error(t)})}})},async logout(){await g.post("/sso/logout",{loginId:localStorage.getItem("satoken")}).then(e=>{localStorage.removeItem("loginId"),localStorage.removeItem("satoken"),this.$router.push("/login")}).catch(e=>{console.error(e)})}}},A=k("\u53D6 \u6D88"),W=k("\u786E \u5B9A");function E(e,t,d,I,s,_){const u=a("el-input"),r=a("el-form-item"),i=a("el-form"),v=a("el-button"),f=a("el-dialog");return c(),V(f,{"append-to-body":"","close-on-click-modal":!1,title:s.title,modelValue:s.dialogFormVisible,"onUpdate:modelValue":t[2]||(t[2]=m=>s.dialogFormVisible=m),width:"40%",onClose:_.close},{footer:n(()=>[o(v,{onClick:_.close},{default:n(()=>[A]),_:1},8,["onClick"]),o(v,{type:"primary",onClick:_.save},{default:n(()=>[W]),_:1},8,["onClick"])]),default:n(()=>[o(i,{ref:"form","label-width":"100px",model:s.form,rules:s.rules},{default:n(()=>[o(r,{label:"\u65B0\u5BC6\u7801:",prop:"password"},{default:n(()=>[o(u,{modelValue:s.form.password,"onUpdate:modelValue":t[0]||(t[0]=m=>s.form.password=m),"show-password":"",type:"password"},null,8,["modelValue"])]),_:1}),o(r,{label:"\u786E\u8BA4\u5BC6\u7801:",prop:"sure_pwd"},{default:n(()=>[o(u,{modelValue:s.form.sure_pwd,"onUpdate:modelValue":t[1]||(t[1]=m=>s.form.sure_pwd=m),"show-password":"",type:"password"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue","onClose"])}var D=b(U,[["render",E],["__scopeId","data-v-1dbe1c50"]]);const T={name:"VabAvatar",components:{changePwd:D},data(){return{active:!1,avatar:"",username:""}},created(){localStorage.getItem("satoken")?this.getUser():this.$router.push("/login")},methods:{handleCommand(e){switch(e){case"logout":this.logout();break;case"password":this.$refs.changePwd.showEdit();break}},handleVisibleChange(e){this.active=e},async logout(){await g.post("/sso/logout",{loginId:localStorage.getItem("satoken")}).then(e=>{localStorage.removeItem("loginId"),localStorage.removeItem("satoken"),this.$router.push("/login")}).catch(e=>{console.error(e)})},async getUser(){this.listLoading=!0,await g.post("/sso/userInfo",{loginId:localStorage.getItem("satoken")}).then(e=>{console.log(e.data,"-----------xvxvxvvxvv");const t=e.data.data;this.username=t.username,this.avatar=t.avatar,this.listLoading=!1}).catch(e=>{console.error(e)})}}},B={class:"avatar-dropdown"},N={class:"avatar-dropdown"},M={class:"user-name"},q={class:"hidden-xs-only"},G=k(" \u4FEE\u6539\u5BC6\u7801 "),j=k(" \u9000\u51FA\u767B\u5F55 ");function z(e,t,d,I,s,_){const u=a("el-avatar"),r=a("el-icon-ArrowDown"),i=a("el-icon"),v=a("el-icon-Edit"),f=a("el-dropdown-item"),m=a("el-icon-Setting"),y=a("el-dropdown-menu"),S=a("el-dropdown"),x=a("changePwd");return c(),h("div",B,[o(S,{onCommand:_.handleCommand,onVisibleChange:_.handleVisibleChange},{dropdown:n(()=>[o(y,null,{default:n(()=>[o(f,{command:"password"},{default:n(()=>[o(i,{class:"el-icon-edit"},{default:n(()=>[o(v)]),_:1}),G]),_:1}),o(f,{command:"logout"},{default:n(()=>[o(i,null,{default:n(()=>[o(m)]),_:1}),j]),_:1})]),_:1})]),default:n(()=>[l("span",N,[o(u,{class:"user-avatar",src:s.avatar},null,8,["src"]),l("div",M,[l("span",q,p(s.username),1),o(i,{class:"el-icon--right",style:{position:"relative",top:"2px"}},{default:n(()=>[o(r)]),_:1})])])]),_:1},8,["onCommand","onVisibleChange"]),o(x,{ref:"changePwd"},null,512)])}var H=b(T,[["render",z],["__scopeId","data-v-410a8bc5"]]),J="/assets/logo-bencao.f0d81966.png";const K={name:"Home",components:{VabAvatar:H},data(){return{list:[],webList:[],isLogin:!1,screenWidth:"",settingStore:L()}},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(e=>e.deviceType==0):this.list=this.webList.filter(e=>e.deviceType==1)})()},methods:{async docheckIsLogin(){let e={keyword:localStorage.getItem("satoken")};await g.post("/sso/getListServer",e).then(t=>{console.log(t.data,"-----------xvxvxvvxvv");const d=t.data.data;console.log(d.length,"-----------xvxvxvvxvv"),this.isLogin=!!d.length}).catch(t=>{console.error(t)})},skipUrl(e){window.open(e+"?loginId="+localStorage.getItem("satoken"),"_blank")},async doGetClientLists(){let e={loginId:localStorage.getItem("satoken")};await g.post("/sso/getClientList",e).then(t=>{console.log(t.data,"-----------cccc");const d=t.data.data;this.list=d,this.webList=d}).catch(t=>{console.error(t)}),console.log(this.IsPhone(),"this.IsPhone()"),this.IsPhone()?this.list=this.webList.filter(t=>t.deviceType==1):this.list=this.webList.filter(t=>t.deviceType==0)},IsPhone(){var e=navigator.userAgent,t=/mobile/i.test(e);return t}}},O=e=>(P("data-v-f9505d6c"),e=e(),F(),e),Q={class:"container"},R={class:"container-prop"},X={class:"top-nav"},Y={class:"nav"},Z=O(()=>l("div",{class:"logo"},[l("img",{mode:"widthFix",src:J})],-1)),ee={class:"nav-title"},te={class:"exit"},oe={class:"content"},se=["onClick"],ae={key:0,class:"icon_1"},ne={key:1,class:"icon_2"},ie={key:2,class:"icon_3"},le={key:3,class:"icon_4"};function re(e,t,d,I,s,_){const u=a("VabAvatar");return c(),h("div",Q,[l("div",R,[l("div",X,[l("div",Y,[Z,l("div",ee,p(s.settingStore.title),1),l("div",te,[o(u)])])]),l("div",oe,[(c(!0),h(C,null,$(s.list,(r,i)=>(c(),h("div",{key:i,class:"content-item",onClick:v=>_.skipUrl(r.allowUrl)},[i%4==0?(c(),h("div",ae,p(r.name),1)):w("",!0),i%4==1?(c(),h("div",ne,p(r.name),1)):w("",!0),i%4==2?(c(),h("div",ie,p(r.name),1)):w("",!0),i%4==3?(c(),h("div",le,p(r.name),1)):w("",!0)],8,se))),128))])])])}var _e=b(K,[["render",re],["__scopeId","data-v-f9505d6c"]]);export{_e as default};
|