wwf
昨天 34f5733bc1f126c572580fa849b9403dfcddd84b
src/views/login/index.vue
@@ -36,7 +36,7 @@
          <el-checkbox v-model="form.agreement" label="同意xxx服务协议" size="large" />
        </el-form-item>
        <el-button class="mt-1" @click="submitLogin()" type="primary" size="large" style="width: 100%;">
        <el-button class="mt-1" @click="submitLogin()" :loading="loginLoading" type="primary" size="large" style="width: 100%;">
          <el-text class="text-lg text-white">登录</el-text>
        </el-button>
      </el-form>
@@ -101,12 +101,14 @@
<script>
import { useLoginStore } from '@/stores/login.js'
import { useSessionStore } from '@/stores/session.js'
import { storeToRefs } from 'pinia';
export default {
  components: {},
  setup() {
    const { loginDialogVisible } = storeToRefs(useLoginStore())
    return { loginDialogVisible }
    const { setUserInfo } = useSessionStore()
    return { loginDialogVisible, setUserInfo }
  },
  data() {
    return {
@@ -129,6 +131,7 @@
      countdown: 180,
      countdownInterval: null,
      sendCodeLoading: false,
      loginLoading: false
    }
  },
  computed: {
@@ -179,10 +182,25 @@
    async submitLogin() {
      try {
        await this.$refs.accountForm.validate()
        this.loginLoading = true
        setTimeout(() => {
          localStorage.setItem('accessToken', '123456')
          this.getUserInfo()
          this.$message.success('登录成功')
          this.loginDialogVisible = false
          this.loginLoading = false
        }, 1000)
      } catch (error) {
        console.log()
      }
    },
    getUserInfo() {
      this.setUserInfo({
        id: '123456',
        username: '黄婷婷',
      })
    },
    async submitRegister() {
      try {
        await this.$refs.registerForm.validate()