import {useAmis} from '../../components/constants.js'
import {userRegisterDialog} from '../../components/user/dialog-user-register.js'

useAmis(information => {
    return {
        type: 'page',
        title: information.title,
        subTitle: '统一登陆入口',
        body: [
            {
                type: 'grid',
                columns: [
                    {
                        xs: 0,
                        sm: 0,
                        md: 4,
                        body: [],
                    },
                    {
                        xs: 12,
                        sm: 12,
                        md: 4,
                        body: [
                            {
                                type: 'form',
                                title: '用户登陆',
                                api: '${base}/user/login',
                                redirect: '/pages/index/index.html?token=${token}',
                                mode: 'horizontal',
                                horizontal: {
                                    left: 2,
                                },
                                actions: [
                                    {
                                        type: 'action',
                                        label: '注册',
                                        ...userRegisterDialog(),
                                    },
                                    {
                                        type: 'action',
                                        actionType: 'submit',
                                        label: '登陆',
                                        level: 'primary',
                                    },
                                ],
                                body: [
                                    {
                                        type: 'input-email',
                                        name: 'username',
                                        label: '邮箱',
                                        placeholder: '请输入邮箱',
                                        required: true,
                                        clearable: true,
                                        clearValueOnEmpty: true,
                                    },
                                    {
                                        type: 'input-password',
                                        name: 'password',
                                        label: '密码',
                                        placeholder: '请再次输入密码',
                                        required: true,
                                    },
                                ],
                            },
                        ],
                    },
                    {
                        xs: 0,
                        sm: 0,
                        md: 4,
                        body: [],
                    },
                ],
            },
        ],
    }
})
