gerson
2024-07-07 d5f17f079d4af2a173015dc86a4d6d472731fac6
src/layout/component/sidebar/components/MenuList.vue
@@ -16,7 +16,8 @@
         <div class="user_head">
            <span
               ><span
                  ><span class="user-head">{{ firstUserCharacter }}</span><span class="identifying"><!----></span></span
                  ><span class="user-head">{{ firstUserCharacter }}</span
                  ><span class="identifying"><!----></span></span
               ><span class="user_name"> {{ userName }} </span></span
            ><span ref="toggleExitLoginBtnRef"
               ><span
@@ -36,12 +37,12 @@
         </div>
      </div>
   </div>
   <div class="pc-login" v-show="state.isShowLogin">
   <div class="pc-login  items-center justify-center" style="display:flex" v-show="state.isShowLogin">
      <div class="login_box">
         <div class="sign_in">
            <i class="ywicon icon-guanbi closes" @click="handleClose"></i>
            <h1><span class="ml-[33px]">登录 ChatAI</span></h1>
            <el-form ref="loginFormRef" :model="state.loginForm" :rules="loginRules" class="demo-ruleForm" size="large">
            <h1><span>登录 WI 水务</span></h1>
            <el-form ref="loginFormRef" :model="state.loginForm" :rules="loginRules" class="demo-ruleForm mt-[24px]" size="large">
               <el-form-item label="账号" prop="account">
                  <el-input v-model="state.loginForm.account" clearable />
               </el-form-item>
@@ -49,7 +50,7 @@
                  <el-input v-model="state.loginForm.pwd" type="password" autocomplete="off" clearable />
               </el-form-item>
            </el-form>
            <div class="mt-[115px]">
            <div class="mt-[24px]">
               <el-button type="primary" @click="onSubmit" class="set-login_btn">登录</el-button>
            </div>
         </div>
@@ -62,20 +63,20 @@
import { computed, onMounted, reactive, ref, watchEffect } from 'vue';
import { PostLogin } from '/@/api/ai/user';
import router from '/@/router';
import emitter from '/@/utils/mitt';
import { accessSessionKey, userNameKey } from '/@/utils/request';
import { gotoRoute } from '/@/utils/route';
import { Local } from '/@/utils/storage';
import emitter from '/@/utils/mitt';
const loginFormRef = ref<FormInstance>(null);
const isLoginStatus = ref(!!Local.get(accessSessionKey));
const userName = ref('');
const firstUserCharacter =computed(()=>userName.value?.[0]?.toUpperCase());
watchEffect(()=>{
   if(!isLoginStatus.value)return;
   userName.value = Local.get(userNameKey)
})
const firstUserCharacter = computed(() => userName.value?.[0]?.toUpperCase());
watchEffect(() => {
   if (!isLoginStatus.value) return;
   userName.value = Local.get(userNameKey);
});
let state = reactive({
   asideTitleList: [
      {
@@ -132,7 +133,7 @@
      pass: state.loginForm.pwd,
   });
   Local.set(accessSessionKey, res.hswatersession);
   Local.set(userNameKey,state.loginForm.account);
   Local.set(userNameKey, state.loginForm.account);
   state.isShowLogin = false;
   isLoginStatus.value = true;
   window.location.reload();
@@ -149,7 +150,6 @@
   state.isShowExitLogin = false;
   isLoginStatus.value = false;
   Local.remove(accessSessionKey);
};
const toggleExitLoginBtnRef = ref<HTMLDivElement>(null);
@@ -161,11 +161,13 @@
onMounted(() => {
   emitter.on('openLoginDlg', () => {
      if(state.isShowLogin || isLoginStatus.value)return;
      if (state.isShowLogin || isLoginStatus.value) return;
      openLoginDlg();
   });
   emitter.on('logout', () => {});
   emitter.on('logout', () => {
      logoutClick();
   });
   document.addEventListener('click', listenClickOtherExit);
});
@@ -352,9 +354,9 @@
   .login_box {
      position: relative;
      width: 450px;
      height: 550px;
      margin: 15vh auto;
      .sign_in {
         padding: 39px;
         position: relative;
         width: 100%;
         height: 100%;
@@ -385,12 +387,10 @@
         h1 {
            box-sizing: content-box;
            width: 100%;
            margin-top: 25px;
            font-size: 30px;
            font-weight: 500;
            color: #1c153a;
            text-align: left !important;
            margin-bottom: 105px;
         }
         .demo-ruleForm {
            :deep(.el-input__wrapper) {