import Mock from 'mockjs'

let Random = Mock.Random;

// worldDetail
let worldDetail = function () {
    let item = [];
    for (var i = 0; i < 30; i++) {
        item.push({
            "id": "@guid",
            "name": "@region",
            "Confirmed": "@integer(36844, 368449)",
            "Deaths": "@integer(1099, 10993)",
            "Recovered": "@integer(1986, 19865)",
        })
    }

    let res = {
        Rs: item,
        Code: 0,
        Memo: ''
    };
    return res;
};

let testTable = function () {
    let item = [];

    let members = [
        {id: 1, name: '霍元甲', userCode: '15253135600', vipType: 1},
        {id: 2, name: '陈真', userCode: '15253135602', vipType: 2},
        {id: 3, name: '成龙', userCode: '15253135604', vipType: 1},
    ]

    for (var i = 0; i < 6; i++) {
        item.push({
            "id": "@guid",
            "userCode": "@integer(15253135600, 15253135699)",
            "name": "@region",
            "tel": "@integer(15253135600, 15253135699)",
            "phone": "@integer(15253135600, 15253135699)",
            "shop": "@region",
            "create": "@datetime",
            "expTime": "@datetime",
            "valid": "@datetime",
            "Confirmed": "@integer(36844, 368449)",
            "Deaths": "@integer(1099, 10993)",
            "Recovered": "@integer(1986, 9999)",
            "kick": "@integer(1986, 9999)",
            "Status": "@integer(1, 2)",
            "color": "@hex",
            "memo": "@paragraph(1, 1)",
            "dialogValue": "@range(1, 3)",
            "vipType": "@integer(1, 2)",
            "members": members,
            "wxVisible": "@integer(0, 1)",
            "timeLong": "12:00-14:00",
            "timeScope": [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
        })
    }

    let res = {
        Rs: item,
        Code: 0,
        Memo: ''
    };
    return res;
};
let testTableLong = function () {
    let item = [];

    let members = [
        {id: 1, name: '霍元甲', userCode: '15253135600', vipType: 1},
        {id: 2, name: '陈真', userCode: '15253135602', vipType: 2},
        {id: 3, name: '成龙', userCode: '15253135604', vipType: 1},
    ]

    for (var i = 0; i < 70; i++) {
        item.push({
            "id": "@guid",
            "userCode": "@integer(15253135600, 15253135699)",
            "name": "@region",
            "tel": "@integer(15253135600, 15253135699)",
            "shop": "@region",
            "create": "@datetime",
            "expTime": "@datetime",
            "valid": "@datetime",
            "Confirmed": "@integer(36844, 368449)",
            "Deaths": "@integer(1099, 10993)",
            "Recovered": "@integer(1986, 9999)",
            "kick": "@integer(1986, 9999)",
            "Status": "@integer(1, 2)",
            "color": "@hex",
            "memo": "@paragraph(1, 1)",
            "dialogValue": "@range(1, 3)",
            "vipType": "@integer(1, 2)",
            "members": members,
            "wxVisible": "@integer(0, 1)",
            "timeLong": "12:00-14:00",
            "timeScope": [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
        })
    }

    let res = {
        Rs: item,
        Code: 0,
        Memo: ''
    };
    return res;
};

let testSelect = function () {
    let item = [];
    for (var i = 0; i < 30; i++) {
        item.push({
            "key": i + 1,
            "value": i + 1,
            "label": "@region",
        })
    }

    let res = {
        Rs: item,
        Code: 0,
        Memo: ''
    };
    return res;
};

let SignIn = function () {

    let Rs = {
        token: "@guid"
    };
    let res = {
        Rs: Rs,
        Code: 0,
        Memo: '登陆成功'
    };
    return res;
};

let editbasicinfo = function () {

    let res = {
        Code: 0,
        Memo: '修改成功'
    };
    return res;
};

let modPwd = function () {
    let res = {
        Code: 0,
        Memo: '修改成功'
    };
    return res;
};
let logout = function () {
    let res = {
        Code: 0,
        Memo: '退出成功'
    };
    return res;
};

let getNavListQuery = function () {
    let res = {
        Code: 0,
        Memo: '',
        Rs: [
            {
                clmid: "1",
                clmcode: "index",
                clmname: "系统首页",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-s-home",
                Childs: [
                    {
                        clmid: "/",
                        clmcode: "index",
                        clmname: "系统首页",
                        clmurl: "/",
                    },
                ]
            }, {
                clmid: "2",
                clmcode: "member",
                clmname: "会员管理",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "正式会员",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "临时会员",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "消费记录",
                        clmurl: "/record",
                    }
                ]
            }, {
                clmid: "3",
                clmcode: "member",
                clmname: "课程管理",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/lesson",
                        clmcode: "lesson",
                        clmname: "课目管理",
                        clmurl: "/lesson",
                    }, {
                        clmid: "/lessonTableTemplate",
                        clmcode: "lessonTableTemplate",
                        clmname: "课程表模板",
                        clmurl: "/lessonTableTemplate",
                    }, {
                        clmid: "/lessonTableManage",
                        clmcode: "lessonTableManage",
                        clmname: "课程表管理",
                        clmurl: "/lessonTableManage",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "预约管理",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "预约记录",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "上课管理",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "在线上课",
                        clmurl: "/record",
                    }, {
                        clmid: "/videoClass",
                        clmcode: "videoClass",
                        clmname: "视频上课",
                        clmurl: "/videoClass",
                    }, {
                        clmid: "/grpcDemo",
                        clmcode: "grpcDemo",
                        clmname: "grpcDemo",
                        clmurl: "/grpcDemo",
                    }
                ]
            }, {
                clmid: "4",
                clmcode: "member",
                clmname: "运动评估",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "动作管理",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "节点管理",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "动作节点",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "动作关键帧",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "课程动作",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "动作评分",
                        clmurl: "/record",
                    }
                ]
            }, {
                clmid: "5",
                clmcode: "member",
                clmname: "心率管理",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "心率设备",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "心率记录",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "演示设备",
                        clmurl: "/record",
                    }
                ]
            }, {
                clmid: "6",
                clmcode: "member",
                clmname: "报表统计",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "课程统计",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "会员统计",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "预约统计",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "教练课时统计",
                        clmurl: "/record",
                    }
                ]
            }, {
                clmid: "7",
                clmcode: "member",
                clmname: "系统管理",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "操作日志",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "个人信息",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "商家信息",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "商家区域",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "商家设施",
                        clmurl: "/record",
                    }
                ]
            }, {
                clmid: "8",
                clmcode: "member",
                clmname: "总店管理",
                clmurl: "/",
                prname: "",
                show: 3,
                icon: "el-icon-house",
                Childs: [
                    {
                        clmid: "/member",
                        clmcode: "member",
                        clmname: "商家设置",
                        clmurl: "/member",
                    }, {
                        clmid: "/tempMember",
                        clmcode: "tempMember",
                        clmname: "管理员管理",
                        clmurl: "/tempMember",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "跨店会员",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "商家区域",
                        clmurl: "/record",
                    }, {
                        clmid: "/record",
                        clmcode: "record",
                        clmname: "分组管理",
                        clmurl: "/record",
                    }
                ]
            },
        ]
    };
    return res;
}

var mockState = 1;
if (mockState == 1) {
    Mock.mock('/api/testSelect', 'post', testSelect());
    Mock.mock('/api/testTable', 'post', testTable());
    Mock.mock('/api/testTableLong', 'post', testTableLong());
    Mock.mock('/api/worldDetail', 'post', worldDetail());
    Mock.mock('/api/SignIn', 'post', SignIn());//用户登录
    Mock.mock('/api/editbasicinfo', 'post', editbasicinfo());//用户设置修改
    Mock.mock('/api/modPwd', 'post', modPwd());//密码修改
    Mock.mock('/api/logout', 'post', logout());//退出登陆
    Mock.mock('/api/getNavListQuery', 'post', getNavListQuery());//nav list
}

export default Mock;
