<!--
 * @Description:
 * @Author: czw (725551805@qq.com)
 * @Date: 2021-11-18 10:47:16
 * @LastEditors: czw (725551805@qq.com)
 * @LastEditTime: 2022-02-23 12:23:56
 * @FilePath: /glxt/src/views/logo.vue
-->
<template>
  <div class="page">
    <el-form ref="form"
             :model="form"
             label-width="80px">
      <el-form-item label="账号">
        <el-input v-model="form.add"
                  autocomplete='on'
                  type='text'></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.app"
                  autocomplete='on'
                  type='password'></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-button type="primary"
                   @click="onSubmit">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { setToken } from '@/util/auth'
import { postadd } from '@/api/rankingData'
export default {
  name: '', // 页面名称
  components: {}, // 挂载组件
  props: {}, // 组件传值
  data() {
    return {
      form: {
        add: '',
        app: '',
      },
    }
  },
  computed: {}, // 计算机属性 类似与data概念
  watch: {}, // 监控data中数据变化
  created() {}, // 生命周期-创建完成(可以访问当前this实例)
  mounted() {}, // 生命周期-挂载完成(可以访问DOM元素)
  methods: {
    onSubmit() {
      const params = {
        username: this.form.add,
        password: this.form.app,
      }
      // postadd(params).then((res) => {
      //   // if (res.data.code === 200) {

      //   // }
      setToken('w1rr6IsxZIud46dIrGIivNAroFpqN52sSpXhk3azpPq2ZTbUXhgKTOLheoRm')
      //   const token = res.data.access_token
      //   setToken(token)
      //   console.log(token, 'denglucheng')

      //   this.$router.push({ path: '/index' })
      // })
      this.$router.push({ path: '/index' })
    },
  }, // 挂载一些方法
}
</script>

<style lang="scss" scoped></style>
