import { ref } from 'vue'


export const useMain = () => {
  // 表单
  const formList: Record<string, any>[] = [
    {
      label: '邮箱',
      key: 'email',
      icon: 'email',
      type: 'input',
      placeholder: '请输入邮箱',
      rules: [
        { required: true, message: '请输入邮箱', trigger: 'blur' },
      ]
    },
    {
      label: '密码',
      key: 'password',
      icon: 'lock',
      type: 'password',
      placeholder: '请输入密码',
      rules: [
        { required: true, message: '请输入密码', trigger: 'blur' },
      ]
    }
  ]

  // 数据
  const form = ref<Record<string, string>>({
    email: '',
    password: '',
  })

  // 构造登录参数
  const getLoginParams = () => {
    return form.value
  }

  // 登陆
  const onLogin = () => {

  }



  return {
    formList,
    form,
    getLoginParams,
    onLogin
  }

}
