const consts = {
    keyToken: 'mx-token',
    keyUserInfo: 'mx-userInfo',
    keyAppConfig: 'mx-appConfig',
    keyCacheUniquePrefix: 'mx-transfer-cache-',
    keyTheme: 'mx-theme',
    keyParentIdentifier: 'from=wechat',
    keyGuideRead: 'mx-guideRead-v1',
    keyUserAgreed: 'mx-userAgreed',
    keyDisplayPermission: 'mx-displayPermission',
    keyOutTradeNo: 'mx-outTradeNo',
    keyCulturalExamType: '职高对口升学',
    propAppConfig: 'appConfig',
    routes: {
        index: {url: '/pagesMain/pages/index/index', type: 'tab'},
        portal: {url: '/pages/ie/portal', type: 'tab'},
        personalCenter: {url: '/pages/personal-center/index/index', type: 'tab'},
        login: '/pagesSystem/pages/login/login',
        register: '/pages/login/register',
        activate: '/pages/personal-center/bind-card/bind-card',
        forgetPwd: '/pages/login/forget-pwd',
        guide: {url: '/pages/index/guide', animationType: 'pop-in'},
        bindMobile: {url: '/pages/login/bind-mobile', animationType: 'pop-in'},
        bindProfile: '/pages/login/bind-profile',
        setting: '/pages/personal-center/setting/setting',
        basicInfo: '/pages/personal-center/basic-info/basic-info',
        newsIndex: '/pages/news/index/index',
        newsDetail: '/pagesOther/pages/news/detail/detail',
        newsGroup: '/pagesOther/pages/news/group/group',
        videoPlay: '/pagesOther/pages/video-center/play/play'
    },
    globalEvents: {
        paperCompleted: 'globalEvents-paperCompleted',
        collegeSelected: 'globalEvents-collegeSelected',
        aiFilterShortcutClear: 'globalEvents-aiFilterShortcutClear',
        voluntaryChanged: 'globalEvents-voluntaryChanged'
    },
    serverErrors: {
        400: '请求无效 (Bad request)',
        401: '操作未授权，请登陆',
        402: '登陆凭据失效，请重新登陆',
        403: '没有权限访问',
        404: '请求资源不存在',
        405: '权限不足，请开通VIP'
    },
    commonStyle: {
        blockFloatTitle: {
            position: 'absolute',
            color: '#fff',
            fontSize: '18px',
            fontFamily: 'PingFangSC-Medium, PingFang SC',
            left: '15px',
            top: '15px'
        },
        blockFloatDesc: {
            position: 'absolute',
            color: '#fff',
            fontSize: '18px',
            fontFamily: 'PingFangSC-Medium, PingFang SC',
            left: '15px',
            top: '40px',
            opacity: 0.5
        },
        blockNormalTitle: {
            color: '#666666',
            fontSize: '14px',
            fontFamily: 'PingFangSC-Medium, PingFang SC',
        },
        blockNormalDesc: {
            color: '#999999',
            fontSize: '12px',
            fontFamily: 'PingFangSC-Regular, PingFang SC'
        }
    },
    enum: {
        scoreLock: {
            // 待锁定状态
            locking: -1,
            // 正常状态
            unlock: 0,
            // 已锁定状态
            locked: 1
        },
        /// @description 心理健康测评
        mentalHealthTestType: 4,
        brochureType: {
            introduction: 1,
            enrollRule: 2,
            examTime: 3,
            work: 4,
            otherRule: 5
        },
        ai: {
            voluntaryType: {
                ai: 'AI',
                multiple: 'Multiple'
            },
            renderType: {
                def: 0,
                ai: 1,
                calculate: 2
            },
            inputType: {
                text: 'Text', // 普通文本，一般情况下输入均使用此类。数值也可以使用此类型，结合校验规则使用
                score: 'Score', // AI的特殊输入类型，带分制的分数 // 此类输入之后可能涉及输入条件动态变化，NOTE：后面再考虑这种情况。
                number: 'Number', // 数值，会限制键盘，但因为小数点之类的键盘并不太好控制，所以如果能不使用还是使用Text
                radio: 'Radio', // radio单选。如果固定2个，用radio，否则用picker。一般超过3个会折行，影响美观
                picker: 'Picker', // picker单选，一般使用Picker做单选。
                checkbox: 'Checkbox', // 多选
                eyesight: 'Eyesight' // 视力，特殊项，前端自己生成了选项
            },
            pickType: {
                all: {
                    text: '全部',
                    value: 'All'
                },
                danger: {
                    text: '冲刺型',
                    value: 'Danger'
                },
                normal: {
                    text: '稳妥型',
                    value: 'Normal'
                },
                safety: {
                    text: '保守型',
                    value: 'Safety'
                }
            },
            pickEmpty: {
                enrollPass: {
                    text: '无概率',
                    value: '0'
                },
                new: {
                    text: '新增',
                    value: '1'
                }
            },
            ruleCategory: {
                none: {
                    text: '未知',
                    value: 'None'
                },
                enroll: {
                    text: '录取规则',
                    formText: '填写成绩',
                    value: 'Enroll'
                },
                special: {
                    text: '特殊要求',
                    formText: '其它信息',
                    value: 'Special'
                }
            },
            ruleType: {
                none: 'None', // 缺省类型
                scoreTotal: 'ScoreTotal', // 总分，综合分
                scoreUnion: 'ScoreUnion', // 学考，文化成绩
                scoreBase: 'ScoreBase', // 校考，非学考，文化成绩
                scoreSkill: 'ScoreSkill', // 技能分，非文化成绩
                scoreSingle: 'ScoreSingle', // 单科成绩
                special: 'Special', // 附加要求
                readonly: 'Readonly', // 只读项，只展示，不参与判定
                other: 'Other' // 未知项
            }
        },
        simulatePickTypes: [{
            text: '冲刺型',
            value: '0'
        }, {
            text: '稳妥型',
            value: '1'
        }, {
            text: '保守型',
            value: '2'
        }]
    },
    question: {
        // 客观题类型
        objectiveTypes: [1, 3, 6, 7],
        // 客观题-单选类型
        radioTypes: [1, 6, 7],
        // 客观题-多选类型
        checkboxTypes: [3],
        // 转方法
        isObjective: function (typeId) {
            return this.objectiveTypes.some(t => t == typeId)
        },
        isRadio: function (typeId) {
            return this.radioTypes.some(t => t == typeId)
        },
        isCheckbox: function (typeId) {
            return this.checkboxTypes.some(t => t == typeId)
        }
    },
    scrollIntoOption: {
        block: 'center',
        behavior: 'smooth'
    },
    recommendMajorSortFn: (a, b) => a.localPriority - b.localPriority
}

export function getTabRoutes() {
    return Object.values(consts.routes)
        .filter(r => r.type == 'tab')
        .map(r => r.url)
}

export default consts
