import Mock from 'mockjs'

let Random = Mock.Random;

// worldDetail
let worldDetail = function () {
    let item = [];
    for (let 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 (let 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 (let 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 (let 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"
            },{
                clmid: 2,
                clmurl: "/",
                clmcode: "member",
                clmname: "会员管理",
                prname: "",
                show: 3,
                icon: "el-icon-s-custom",
                Childs: [
                    {
                        clmid: 21,
                        clmcode: "memberFull",
                        clmurl: "/memberFull",
                        clmname: "正式会员1",
                    }, {
                        clmid: 22,
                        clmcode: "memberTemporary",
                        clmurl: "/memberTemporary",
                        clmname: "临时会员",
                    }, {
                        clmid: 23,
                        clmcode: "memberCost",
                        clmurl: "/memberCost",
                        clmname: "会员消费",
                    }
                ]
            },  {
                clmid: 3,
                clmurl: "/",
                clmcode: "lesson",
                clmname: "课程管理",
                prname: "",
                show: 3,
                icon: "el-icon-school",
                Childs: [
                    {
                        clmid: 31,
                        clmcode: "classManage",
                        clmurl: "/classManage",
                        clmname: "上课管理",
                    },  {
                        clmid: 32,
                        clmcode: "lessonManage",
                        clmurl: "/lessonManage",
                        clmname: "课目管理",
                    }, {
                        clmid: 33,
                        clmcode: "lessonTableTemplate",
                        clmurl: "/lessonTableTemplate",
                        clmname: "课程表模板",
                    }, {
                        clmid: 34,
                        clmcode: "lessonTableManage",
                        clmurl: "/lessonTableManage",
                        clmname: "课程表管理",
                    }, {
                        clmid: 35,
                        clmcode: "appointManage",
                        clmurl: "/appointManage",
                        clmname: "预约管理",
                    }, {
                        clmid: 36,
                        clmcode: "appointRecord",
                        clmurl: "/appointRecord",
                        clmname: "预约记录",
                    }, {
                        clmid: 37,
                        clmcode: "classInVideo",
                        clmurl: "/classInVideo",
                        clmname: "视频上课",
                    }
                ]
            }, {
                clmid: 4,
                clmurl: "/",
                clmcode: "assessment",
                clmname: "运动评估",
                prname: "",
                show: 3,
                icon: "el-icon-edit",
                Childs: [
                    {
                        clmid: 41,
                        clmcode: "movementManage",
                        clmurl: "/movementManage",
                        clmname: "动作管理",
                    }, {
                        clmid: 42,
                        clmcode: "nodeMange",
                        clmurl: "/nodeMange",
                        clmname: "节点管理",
                    }, {
                        clmid: 43,
                        clmcode: "actionNode",
                        clmurl: "/actionNode",
                        clmname: "动作节点",
                    }, {
                        clmid: 44,
                        clmcode: "actionKeyFrame",
                        clmurl: "/actionKeyFrame",
                        clmname: "动作关键帧",
                    }, {
                        clmid: 45,
                        clmcode: "lessonAction",
                        clmurl: "/lessonAction",
                        clmname: "课程动作",
                    }, {
                        clmid: 46,
                        clmcode: "movementScore",
                        clmurl: "/movementScore",
                        clmname: "动作评分",
                    }
                ]
            }, {
                clmid: 5,
                clmurl: "/",
                clmcode: "heartRate",
                clmname: "心率管理",
                prname: "",
                show: 3,
                icon: "el-icon-more",
                Childs: [
                    {
                        clmid: 51,
                        clmcode: "hrSensor",
                        clmurl: "/hrSensor",
                        clmname: "心率设备",
                    }, {
                        clmid: 52,
                        clmcode: "hrSensorLog",
                        clmurl: "/hrSensorLog",
                        clmname: "心率记录",
                    }, {
                        clmid: 53,
                        clmcode: "demoDevice",
                        clmurl: "/demoDevice",
                        clmname: "演示设备",
                    }
                ]
            }, {
                clmid: 6,
                clmurl: "/",
                clmcode: "report",
                clmname: "报表统计",
                prname: "",
                show: 3,
                icon: "el-icon-s-data",
                Childs: [
                    {
                        clmid: 61,
                        clmcode: "classHourStatistics",
                        clmurl: "/classHourStatistics",
                        clmname: "课时统计",
                    }, {
                        clmid: 62,
                        clmcode: "memberStatistics",
                        clmurl: "/memberStatistics",
                        clmname: "会员统计",
                    }, {
                        clmid: 63,
                        clmcode: "appointStatistics",
                        clmurl: "/appointStatistics",
                        clmname: "预约统计",
                    }, {
                        clmid: 64,
                        clmcode: "coachHourStatistics",
                        clmurl: "/coachHourStatistics",
                        clmname: "教练课时统计",
                    }
                ]
            }, {
                clmid: 7,
                clmurl: "/",
                clmcode: "system",
                clmname: "系统管理",
                prname: "",
                show: 3,
                icon: "el-icon-s-tools",
                Childs: [
                    {
                        clmid: 71,
                        clmcode: "operateLog",
                        clmurl: "/operateLog",
                        clmname: "操作日志",
                    }, {
                        clmid: 72,
                        clmcode: "personSetting",
                        clmurl: "/personSetting",
                        clmname: "个人设置",
                    }, {
                        clmid: 73,
                        clmcode: "shopSetting",
                        clmurl: "/shopSetting",
                        clmname: "商家设置",
                    }, {
                        clmid: 74,
                        clmcode: "shopAres",
                        clmurl: "/shopAres",
                        clmname: "商家区域",
                    }, {
                        clmid: 75,
                        clmcode: "shopDevice",
                        clmurl: "/shopDevice",
                        clmname: "商家设备",
                    }
                ]
            }, {
                clmid: 8,
                clmurl: "/",
                clmcode: "admin",
                clmname: "总店管理",
                prname: "",
                show: 3,
                icon: "el-icon-office-building",
                Childs: [
                    {
                        clmid: 81,
                        clmcode: "adminShopSetting",
                        clmurl: "/adminShopSetting",
                        clmname: "商家设置",
                    }, {
                        clmid:82,
                        clmcode: "administrator",
                        clmurl: "/administrator",
                        clmname: "管理员管理",
                    }, {
                        clmid: 83,
                        clmcode: "memberCross",
                        clmurl: "/memberCross",
                        clmname: "跨店会员",
                    }, {
                        clmid: 84,
                        clmcode: "adminShopArea",
                        clmurl: "/adminShopArea",
                        clmname: "商家区域",
                    }, {
                        clmid:85,
                        clmcode: "groupManage",
                        clmurl: "/groupManage",
                        clmname: "分组管理",
                    }
                ]
            },
        ]
    };
    return res;
}

let 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;
