| | |
| | | <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 |
| | |
| | | </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> |
| | |
| | | <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> |
| | |
| | | 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: [ |
| | | { |
| | |
| | | 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(); |
| | |
| | | state.isShowExitLogin = false; |
| | | isLoginStatus.value = false; |
| | | Local.remove(accessSessionKey); |
| | | |
| | | }; |
| | | const toggleExitLoginBtnRef = ref<HTMLDivElement>(null); |
| | | |
| | |
| | | |
| | | 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); |
| | | }); |
| | |
| | | .login_box { |
| | | position: relative; |
| | | width: 450px; |
| | | height: 550px; |
| | | margin: 15vh auto; |
| | | .sign_in { |
| | | padding: 39px; |
| | | position: relative; |
| | | width: 100%; |
| | | height: 100%; |
| | |
| | | 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) { |