index.js 103 KB
Newer Older
陈帅's avatar
陈帅 committed
1 2 3 4 5 6 7 8
(function(global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined'
    ? (module.exports = factory(require('mockjs'), require('moment')))
    : typeof define === 'function' && define.amd
    ? define(['mockjs', 'moment'], factory)
    : ((global = global || self), (global.mock = factory(global.mockjs, global.moment)));
})(this, function(mockjs, moment) {
  'use strict';
期贤's avatar
期贤 committed
9 10 11 12 13 14 15 16 17 18

  mockjs = mockjs && mockjs.hasOwnProperty('default') ? mockjs['default'] : mockjs;
  moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;

  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
陈帅's avatar
陈帅 committed
19
        writable: true,
期贤's avatar
期贤 committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  function _objectSpread(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};
      var ownKeys = Object.keys(source);

      if (typeof Object.getOwnPropertySymbols === 'function') {
陈帅's avatar
陈帅 committed
34 35 36 37 38
        ownKeys = ownKeys.concat(
          Object.getOwnPropertySymbols(source).filter(function(sym) {
            return Object.getOwnPropertyDescriptor(source, sym).enumerable;
          }),
        );
期贤's avatar
期贤 committed
39 40
      }

陈帅's avatar
陈帅 committed
41
      ownKeys.forEach(function(key) {
期贤's avatar
期贤 committed
42 43 44 45 46 47 48
        _defineProperty(target, key, source[key]);
      });
    }

    return target;
  }

陈帅's avatar
陈帅 committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
  const titles = [
    'Alipay',
    'Angular',
    'Ant Design',
    'Ant Design Pro',
    'Bootstrap',
    'React',
    'Vue',
    'Webpack',
  ];
  const avatars = [
    'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay
    'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png', // Angular
    'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png', // Ant Design
    'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png', // Ant Design Pro
    'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap
    'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React
    'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue
    'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png',
  ];
  const avatars2 = [
    'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
    'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png',
    'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png',
    'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png',
    'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png',
    'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
    'https://gw.alipayobjects.com/zos/rmsportal/psOgztMplJMGpVEqfcgF.png',
    'https://gw.alipayobjects.com/zos/rmsportal/ZpBqSxLxVEXfcUNoPKrz.png',
    'https://gw.alipayobjects.com/zos/rmsportal/laiEnJdGHVOhJrUShBaJ.png',
    'https://gw.alipayobjects.com/zos/rmsportal/UrQsqscbKEpNuJcvBZBu.png',
  ];
  const covers = [
    'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
    'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
    'https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png',
    'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png',
  ];
  const desc = [
    '那是一种内在的东西, 他们到达不了,也无法触及的',
    '希望是一个好东西,也许是最好的,好东西是不会消亡的',
    '生命就像一盒巧克力,结果往往出人意料',
    '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
    '那时候我只会想自己想要什么,从不想自己拥有什么',
  ];
  const user = [
    '付小小',
    '曲丽丽',
    '林东东',
    '周星星',
    '吴加好',
    '朱偏右',
    '鱼酱',
    '乐哥',
    '谭小仪',
    '仲尼',
  ];
期贤's avatar
期贤 committed
106 107 108 109 110 111 112 113 114 115

  function fakeList(count) {
    const list = [];

    for (let i = 0; i < count; i += 1) {
      list.push({
        id: `fake-list-${i}`,
        owner: user[i % 10],
        title: titles[i % 8],
        avatar: avatars[i % 8],
陈帅's avatar
陈帅 committed
116
        cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)],
期贤's avatar
期贤 committed
117 118 119 120 121 122 123
        status: ['active', 'exception', 'normal'][i % 3],
        percent: Math.ceil(Math.random() * 50) + 50,
        logo: avatars[i % 8],
        href: 'https://ant.design',
        updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
        createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
        subDescription: desc[i % 5],
陈帅's avatar
陈帅 committed
124 125
        description:
          '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
期贤's avatar
期贤 committed
126 127 128 129 130
        activeUser: Math.ceil(Math.random() * 100000) + 100000,
        newUser: Math.ceil(Math.random() * 1000) + 1000,
        star: Math.ceil(Math.random() * 100) + 100,
        like: Math.ceil(Math.random() * 100) + 100,
        message: Math.ceil(Math.random() * 10) + 10,
陈帅's avatar
陈帅 committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
        content:
          '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
        members: [
          {
            avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
            name: '曲丽丽',
            id: 'member1',
          },
          {
            avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
            name: '王昭君',
            id: 'member2',
          },
          {
            avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
            name: '董娜娜',
            id: 'member3',
          },
        ],
期贤's avatar
期贤 committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
      });
    }

    return list;
  }

  let sourceData;

  function getFakeList(req, res) {
    const params = req.query;
    const count = params.count * 1 || 20;
    const result = fakeList(count);
    sourceData = result;
    return res.json(result);
  }

  function postFakeList(req, res) {
    const {
      /* url = '', */
陈帅's avatar
陈帅 committed
169
      body,
期贤's avatar
期贤 committed
170 171
    } = req; // const params = getUrlParams(url);

陈帅's avatar
陈帅 committed
172
    const { method, id } = body; // const count = (params.count * 1) || 20;
期贤's avatar
期贤 committed
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192

    let result = sourceData;

    switch (method) {
      case 'delete':
        result = result.filter(item => item.id !== id);
        break;

      case 'update':
        result.forEach((item, i) => {
          if (item.id === id) {
            result[i] = Object.assign(item, body);
          }
        });
        break;

      case 'post':
        result.unshift({
          body,
          id: `fake-list-${result.length}`,
陈帅's avatar
陈帅 committed
193
          createdAt: new Date().getTime(),
期贤's avatar
期贤 committed
194 195 196 197 198 199 200 201 202 203
        });
        break;

      default:
        break;
    }

    return res.json(result);
  }

陈帅's avatar
陈帅 committed
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
  const getNotice = [
    {
      id: 'xxx1',
      title: titles[0],
      logo: avatars[0],
      description: '那是一种内在的东西,他们到达不了,也无法触及的',
      updatedAt: new Date(),
      member: '科学搬砖组',
      href: '',
      memberLink: '',
    },
    {
      id: 'xxx2',
      title: titles[1],
      logo: avatars[1],
      description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
      updatedAt: new Date('2017-07-24'),
      member: '全组都是吴彦祖',
      href: '',
      memberLink: '',
    },
    {
      id: 'xxx3',
      title: titles[2],
      logo: avatars[2],
      description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
      updatedAt: new Date(),
      member: '中二少女团',
      href: '',
      memberLink: '',
    },
    {
      id: 'xxx4',
      title: titles[3],
      logo: avatars[3],
      description: '那时候我只会想自己想要什么,从不想自己拥有什么',
      updatedAt: new Date('2017-07-23'),
      member: '程序员日常',
      href: '',
      memberLink: '',
    },
    {
      id: 'xxx5',
      title: titles[4],
      logo: avatars[4],
      description: '凛冬将至',
      updatedAt: new Date('2017-07-23'),
      member: '高逼格设计天团',
      href: '',
      memberLink: '',
    },
    {
      id: 'xxx6',
      title: titles[5],
      logo: avatars[5],
      description: '生命就像一盒巧克力,结果往往出人意料',
      updatedAt: new Date('2017-07-23'),
      member: '骗你来学计算机',
      href: '',
      memberLink: '',
    },
  ];
  const getActivities = [
    {
      id: 'trend-1',
      updatedAt: new Date(),
      user: {
        name: '曲丽丽',
        avatar: avatars2[0],
      },
      group: {
        name: '高逼格设计天团',
        link: 'http://github.com/',
      },
      project: {
        name: '六月迭代',
        link: 'http://github.com/',
      },
      template: '在 @{group} 新建项目 @{project}',
期贤's avatar
期贤 committed
283
    },
陈帅's avatar
陈帅 committed
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
    {
      id: 'trend-2',
      updatedAt: new Date(),
      user: {
        name: '付小小',
        avatar: avatars2[1],
      },
      group: {
        name: '高逼格设计天团',
        link: 'http://github.com/',
      },
      project: {
        name: '六月迭代',
        link: 'http://github.com/',
      },
      template: '在 @{group} 新建项目 @{project}',
期贤's avatar
期贤 committed
300
    },
陈帅's avatar
陈帅 committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
    {
      id: 'trend-3',
      updatedAt: new Date(),
      user: {
        name: '林东东',
        avatar: avatars2[2],
      },
      group: {
        name: '中二少女团',
        link: 'http://github.com/',
      },
      project: {
        name: '六月迭代',
        link: 'http://github.com/',
      },
      template: '在 @{group} 新建项目 @{project}',
期贤's avatar
期贤 committed
317
    },
陈帅's avatar
陈帅 committed
318 319 320 321 322 323 324 325 326 327 328 329
    {
      id: 'trend-4',
      updatedAt: new Date(),
      user: {
        name: '周星星',
        avatar: avatars2[4],
      },
      project: {
        name: '5 月日常迭代',
        link: 'http://github.com/',
      },
      template: '将 @{project} 更新至已发布状态',
期贤's avatar
期贤 committed
330
    },
陈帅's avatar
陈帅 committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
    {
      id: 'trend-5',
      updatedAt: new Date(),
      user: {
        name: '朱偏右',
        avatar: avatars2[3],
      },
      project: {
        name: '工程效能',
        link: 'http://github.com/',
      },
      comment: {
        name: '留言',
        link: 'http://github.com/',
      },
      template: '在 @{project} 发布了 @{comment}',
期贤's avatar
期贤 committed
347
    },
陈帅's avatar
陈帅 committed
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
    {
      id: 'trend-6',
      updatedAt: new Date(),
      user: {
        name: '乐哥',
        avatar: avatars2[5],
      },
      group: {
        name: '程序员日常',
        link: 'http://github.com/',
      },
      project: {
        name: '品牌迭代',
        link: 'http://github.com/',
      },
      template: '在 @{group} 新建项目 @{project}',
期贤's avatar
期贤 committed
364
    },
陈帅's avatar
陈帅 committed
365
  ];
期贤's avatar
期贤 committed
366 367 368 369 370 371 372 373 374 375

  function getFakeCaptcha(req, res) {
    return res.json('captcha-xxx');
  }

  var api = {
    'GET /api/project/notice': getNotice,
    'GET /api/activities': getActivities,
    'POST /api/forms': (req, res) => {
      res.send({
陈帅's avatar
陈帅 committed
376
        message: 'Ok',
期贤's avatar
期贤 committed
377 378 379
      });
    },
    'GET /api/tags': mockjs.mock({
陈帅's avatar
陈帅 committed
380 381 382 383 384 385 386
      'list|100': [
        {
          name: '@city',
          'value|1-100': 150,
          'type|0-2': 1,
        },
      ],
期贤's avatar
期贤 committed
387 388 389
    }),
    'GET /api/fake_list': getFakeList,
    'POST /api/fake_list': postFakeList,
陈帅's avatar
陈帅 committed
390
    'GET /api/captcha': getFakeCaptcha,
期贤's avatar
期贤 committed
391 392 393 394 395 396 397 398 399
  };

  const visitData = [];
  const beginDay = new Date().getTime();
  const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];

  for (let i = 0; i < fakeY.length; i += 1) {
    visitData.push({
      x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
陈帅's avatar
陈帅 committed
400
      y: fakeY[i],
期贤's avatar
期贤 committed
401 402 403 404 405 406 407 408 409
    });
  }

  const visitData2 = [];
  const fakeY2 = [1, 6, 4, 8, 3, 7, 2];

  for (let i = 0; i < fakeY2.length; i += 1) {
    visitData2.push({
      x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
陈帅's avatar
陈帅 committed
410
      y: fakeY2[i],
期贤's avatar
期贤 committed
411 412 413 414 415 416 417 418
    });
  }

  const salesData = [];

  for (let i = 0; i < 12; i += 1) {
    salesData.push({
      x: `${i + 1}月`,
陈帅's avatar
陈帅 committed
419
      y: Math.floor(Math.random() * 1000) + 200,
期贤's avatar
期贤 committed
420 421 422 423 424 425 426 427 428 429 430
    });
  }

  const searchData = [];

  for (let i = 0; i < 50; i += 1) {
    searchData.push({
      index: i + 1,
      keyword: `搜索关键词-${i}`,
      count: Math.floor(Math.random() * 1000),
      range: Math.floor(Math.random() * 100),
陈帅's avatar
陈帅 committed
431
      status: Math.floor((Math.random() * 10) % 2),
期贤's avatar
期贤 committed
432 433 434
    });
  }

陈帅's avatar
陈帅 committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
  const salesTypeData = [
    {
      x: '家用电器',
      y: 4544,
    },
    {
      x: '食用酒水',
      y: 3321,
    },
    {
      x: '个护健康',
      y: 3113,
    },
    {
      x: '服饰箱包',
      y: 2341,
    },
    {
      x: '母婴产品',
      y: 1231,
    },
    {
      x: '其他',
      y: 1231,
    },
  ];
  const salesTypeDataOnline = [
    {
      x: '家用电器',
      y: 244,
    },
    {
      x: '食用酒水',
      y: 321,
    },
    {
      x: '个护健康',
      y: 311,
    },
    {
      x: '服饰箱包',
      y: 41,
    },
    {
      x: '母婴产品',
      y: 121,
    },
    {
      x: '其他',
      y: 111,
    },
  ];
  const salesTypeDataOffline = [
    {
      x: '家用电器',
      y: 99,
    },
    {
      x: '食用酒水',
      y: 188,
    },
    {
      x: '个护健康',
      y: 344,
    },
    {
      x: '服饰箱包',
      y: 255,
    },
    {
      x: '其他',
      y: 65,
    },
  ];
期贤's avatar
期贤 committed
509 510 511 512 513
  const offlineData = [];

  for (let i = 0; i < 10; i += 1) {
    offlineData.push({
      name: `Stores ${i}`,
陈帅's avatar
陈帅 committed
514
      cvr: Math.ceil(Math.random() * 9) / 10,
期贤's avatar
期贤 committed
515 516 517 518 519 520 521 522 523
    });
  }

  const offlineChartData = [];

  for (let i = 0; i < 20; i += 1) {
    offlineChartData.push({
      x: new Date().getTime() + 1000 * 60 * 30 * i,
      y1: Math.floor(Math.random() * 100) + 10,
陈帅's avatar
陈帅 committed
524
      y2: Math.floor(Math.random() * 100) + 10,
期贤's avatar
期贤 committed
525 526 527
    });
  }

陈帅's avatar
陈帅 committed
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
  const radarOriginData = [
    {
      name: '个人',
      ref: 10,
      koubei: 8,
      output: 4,
      contribute: 5,
      hot: 7,
    },
    {
      name: '团队',
      ref: 3,
      koubei: 9,
      output: 6,
      contribute: 3,
      hot: 1,
    },
    {
      name: '部门',
      ref: 4,
      koubei: 1,
      output: 6,
      contribute: 5,
      hot: 7,
    },
  ];
期贤's avatar
期贤 committed
554 555 556 557 558 559
  const radarData = [];
  const radarTitleMap = {
    ref: '引用',
    koubei: '口碑',
    output: '产量',
    contribute: '贡献',
陈帅's avatar
陈帅 committed
560
    hot: '热度',
期贤's avatar
期贤 committed
561 562 563 564 565 566 567
  };
  radarOriginData.forEach(item => {
    Object.keys(item).forEach(key => {
      if (key !== 'name') {
        radarData.push({
          name: item.name,
          label: radarTitleMap[key],
陈帅's avatar
陈帅 committed
568
          value: item[key],
期贤's avatar
期贤 committed
569 570 571 572 573 574 575 576 577 578 579 580 581 582
        });
      }
    });
  });
  const getFakeChartData = {
    visitData,
    visitData2,
    salesData,
    searchData,
    offlineData,
    offlineChartData,
    salesTypeData,
    salesTypeDataOnline,
    salesTypeDataOffline,
陈帅's avatar
陈帅 committed
583
    radarData,
期贤's avatar
期贤 committed
584 585
  };
  var chart = {
陈帅's avatar
陈帅 committed
586
    'GET /api/fake_chart_data': getFakeChartData,
期贤's avatar
期贤 committed
587 588 589
  };

  var city = {
陈帅's avatar
陈帅 committed
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374
    '110000': [
      {
        province: '北京市',
        name: '市辖区',
        id: '110100',
      },
    ],
    '120000': [
      {
        province: '天津市',
        name: '市辖区',
        id: '120100',
      },
    ],
    '130000': [
      {
        province: '河北省',
        name: '石家庄市',
        id: '130100',
      },
      {
        province: '河北省',
        name: '唐山市',
        id: '130200',
      },
      {
        province: '河北省',
        name: '秦皇岛市',
        id: '130300',
      },
      {
        province: '河北省',
        name: '邯郸市',
        id: '130400',
      },
      {
        province: '河北省',
        name: '邢台市',
        id: '130500',
      },
      {
        province: '河北省',
        name: '保定市',
        id: '130600',
      },
      {
        province: '河北省',
        name: '张家口市',
        id: '130700',
      },
      {
        province: '河北省',
        name: '承德市',
        id: '130800',
      },
      {
        province: '河北省',
        name: '沧州市',
        id: '130900',
      },
      {
        province: '河北省',
        name: '廊坊市',
        id: '131000',
      },
      {
        province: '河北省',
        name: '衡水市',
        id: '131100',
      },
      {
        province: '河北省',
        name: '省直辖县级行政区划',
        id: '139000',
      },
    ],
    '140000': [
      {
        province: '山西省',
        name: '太原市',
        id: '140100',
      },
      {
        province: '山西省',
        name: '大同市',
        id: '140200',
      },
      {
        province: '山西省',
        name: '阳泉市',
        id: '140300',
      },
      {
        province: '山西省',
        name: '长治市',
        id: '140400',
      },
      {
        province: '山西省',
        name: '晋城市',
        id: '140500',
      },
      {
        province: '山西省',
        name: '朔州市',
        id: '140600',
      },
      {
        province: '山西省',
        name: '晋中市',
        id: '140700',
      },
      {
        province: '山西省',
        name: '运城市',
        id: '140800',
      },
      {
        province: '山西省',
        name: '忻州市',
        id: '140900',
      },
      {
        province: '山西省',
        name: '临汾市',
        id: '141000',
      },
      {
        province: '山西省',
        name: '吕梁市',
        id: '141100',
      },
    ],
    '150000': [
      {
        province: '内蒙古自治区',
        name: '呼和浩特市',
        id: '150100',
      },
      {
        province: '内蒙古自治区',
        name: '包头市',
        id: '150200',
      },
      {
        province: '内蒙古自治区',
        name: '乌海市',
        id: '150300',
      },
      {
        province: '内蒙古自治区',
        name: '赤峰市',
        id: '150400',
      },
      {
        province: '内蒙古自治区',
        name: '通辽市',
        id: '150500',
      },
      {
        province: '内蒙古自治区',
        name: '鄂尔多斯市',
        id: '150600',
      },
      {
        province: '内蒙古自治区',
        name: '呼伦贝尔市',
        id: '150700',
      },
      {
        province: '内蒙古自治区',
        name: '巴彦淖尔市',
        id: '150800',
      },
      {
        province: '内蒙古自治区',
        name: '乌兰察布市',
        id: '150900',
      },
      {
        province: '内蒙古自治区',
        name: '兴安盟',
        id: '152200',
      },
      {
        province: '内蒙古自治区',
        name: '锡林郭勒盟',
        id: '152500',
      },
      {
        province: '内蒙古自治区',
        name: '阿拉善盟',
        id: '152900',
      },
    ],
    '210000': [
      {
        province: '辽宁省',
        name: '沈阳市',
        id: '210100',
      },
      {
        province: '辽宁省',
        name: '大连市',
        id: '210200',
      },
      {
        province: '辽宁省',
        name: '鞍山市',
        id: '210300',
      },
      {
        province: '辽宁省',
        name: '抚顺市',
        id: '210400',
      },
      {
        province: '辽宁省',
        name: '本溪市',
        id: '210500',
      },
      {
        province: '辽宁省',
        name: '丹东市',
        id: '210600',
      },
      {
        province: '辽宁省',
        name: '锦州市',
        id: '210700',
      },
      {
        province: '辽宁省',
        name: '营口市',
        id: '210800',
      },
      {
        province: '辽宁省',
        name: '阜新市',
        id: '210900',
      },
      {
        province: '辽宁省',
        name: '辽阳市',
        id: '211000',
      },
      {
        province: '辽宁省',
        name: '盘锦市',
        id: '211100',
      },
      {
        province: '辽宁省',
        name: '铁岭市',
        id: '211200',
      },
      {
        province: '辽宁省',
        name: '朝阳市',
        id: '211300',
      },
      {
        province: '辽宁省',
        name: '葫芦岛市',
        id: '211400',
      },
    ],
    '220000': [
      {
        province: '吉林省',
        name: '长春市',
        id: '220100',
      },
      {
        province: '吉林省',
        name: '吉林市',
        id: '220200',
      },
      {
        province: '吉林省',
        name: '四平市',
        id: '220300',
      },
      {
        province: '吉林省',
        name: '辽源市',
        id: '220400',
      },
      {
        province: '吉林省',
        name: '通化市',
        id: '220500',
      },
      {
        province: '吉林省',
        name: '白山市',
        id: '220600',
      },
      {
        province: '吉林省',
        name: '松原市',
        id: '220700',
      },
      {
        province: '吉林省',
        name: '白城市',
        id: '220800',
      },
      {
        province: '吉林省',
        name: '延边朝鲜族自治州',
        id: '222400',
      },
    ],
    '230000': [
      {
        province: '黑龙江省',
        name: '哈尔滨市',
        id: '230100',
      },
      {
        province: '黑龙江省',
        name: '齐齐哈尔市',
        id: '230200',
      },
      {
        province: '黑龙江省',
        name: '鸡西市',
        id: '230300',
      },
      {
        province: '黑龙江省',
        name: '鹤岗市',
        id: '230400',
      },
      {
        province: '黑龙江省',
        name: '双鸭山市',
        id: '230500',
      },
      {
        province: '黑龙江省',
        name: '大庆市',
        id: '230600',
      },
      {
        province: '黑龙江省',
        name: '伊春市',
        id: '230700',
      },
      {
        province: '黑龙江省',
        name: '佳木斯市',
        id: '230800',
      },
      {
        province: '黑龙江省',
        name: '七台河市',
        id: '230900',
      },
      {
        province: '黑龙江省',
        name: '牡丹江市',
        id: '231000',
      },
      {
        province: '黑龙江省',
        name: '黑河市',
        id: '231100',
      },
      {
        province: '黑龙江省',
        name: '绥化市',
        id: '231200',
      },
      {
        province: '黑龙江省',
        name: '大兴安岭地区',
        id: '232700',
      },
    ],
    '310000': [
      {
        province: '上海市',
        name: '市辖区',
        id: '310100',
      },
    ],
    '320000': [
      {
        province: '江苏省',
        name: '南京市',
        id: '320100',
      },
      {
        province: '江苏省',
        name: '无锡市',
        id: '320200',
      },
      {
        province: '江苏省',
        name: '徐州市',
        id: '320300',
      },
      {
        province: '江苏省',
        name: '常州市',
        id: '320400',
      },
      {
        province: '江苏省',
        name: '苏州市',
        id: '320500',
      },
      {
        province: '江苏省',
        name: '南通市',
        id: '320600',
      },
      {
        province: '江苏省',
        name: '连云港市',
        id: '320700',
      },
      {
        province: '江苏省',
        name: '淮安市',
        id: '320800',
      },
      {
        province: '江苏省',
        name: '盐城市',
        id: '320900',
      },
      {
        province: '江苏省',
        name: '扬州市',
        id: '321000',
      },
      {
        province: '江苏省',
        name: '镇江市',
        id: '321100',
      },
      {
        province: '江苏省',
        name: '泰州市',
        id: '321200',
      },
      {
        province: '江苏省',
        name: '宿迁市',
        id: '321300',
      },
    ],
    '330000': [
      {
        province: '浙江省',
        name: '杭州市',
        id: '330100',
      },
      {
        province: '浙江省',
        name: '宁波市',
        id: '330200',
      },
      {
        province: '浙江省',
        name: '温州市',
        id: '330300',
      },
      {
        province: '浙江省',
        name: '嘉兴市',
        id: '330400',
      },
      {
        province: '浙江省',
        name: '湖州市',
        id: '330500',
      },
      {
        province: '浙江省',
        name: '绍兴市',
        id: '330600',
      },
      {
        province: '浙江省',
        name: '金华市',
        id: '330700',
      },
      {
        province: '浙江省',
        name: '衢州市',
        id: '330800',
      },
      {
        province: '浙江省',
        name: '舟山市',
        id: '330900',
      },
      {
        province: '浙江省',
        name: '台州市',
        id: '331000',
      },
      {
        province: '浙江省',
        name: '丽水市',
        id: '331100',
      },
    ],
    '340000': [
      {
        province: '安徽省',
        name: '合肥市',
        id: '340100',
      },
      {
        province: '安徽省',
        name: '芜湖市',
        id: '340200',
      },
      {
        province: '安徽省',
        name: '蚌埠市',
        id: '340300',
      },
      {
        province: '安徽省',
        name: '淮南市',
        id: '340400',
      },
      {
        province: '安徽省',
        name: '马鞍山市',
        id: '340500',
      },
      {
        province: '安徽省',
        name: '淮北市',
        id: '340600',
      },
      {
        province: '安徽省',
        name: '铜陵市',
        id: '340700',
      },
      {
        province: '安徽省',
        name: '安庆市',
        id: '340800',
      },
      {
        province: '安徽省',
        name: '黄山市',
        id: '341000',
      },
      {
        province: '安徽省',
        name: '滁州市',
        id: '341100',
      },
      {
        province: '安徽省',
        name: '阜阳市',
        id: '341200',
      },
      {
        province: '安徽省',
        name: '宿州市',
        id: '341300',
      },
      {
        province: '安徽省',
        name: '六安市',
        id: '341500',
      },
      {
        province: '安徽省',
        name: '亳州市',
        id: '341600',
      },
      {
        province: '安徽省',
        name: '池州市',
        id: '341700',
      },
      {
        province: '安徽省',
        name: '宣城市',
        id: '341800',
      },
    ],
    '350000': [
      {
        province: '福建省',
        name: '福州市',
        id: '350100',
      },
      {
        province: '福建省',
        name: '厦门市',
        id: '350200',
      },
      {
        province: '福建省',
        name: '莆田市',
        id: '350300',
      },
      {
        province: '福建省',
        name: '三明市',
        id: '350400',
      },
      {
        province: '福建省',
        name: '泉州市',
        id: '350500',
      },
      {
        province: '福建省',
        name: '漳州市',
        id: '350600',
      },
      {
        province: '福建省',
        name: '南平市',
        id: '350700',
      },
      {
        province: '福建省',
        name: '龙岩市',
        id: '350800',
      },
      {
        province: '福建省',
        name: '宁德市',
        id: '350900',
      },
    ],
    '360000': [
      {
        province: '江西省',
        name: '南昌市',
        id: '360100',
      },
      {
        province: '江西省',
        name: '景德镇市',
        id: '360200',
      },
      {
        province: '江西省',
        name: '萍乡市',
        id: '360300',
      },
      {
        province: '江西省',
        name: '九江市',
        id: '360400',
      },
      {
        province: '江西省',
        name: '新余市',
        id: '360500',
      },
      {
        province: '江西省',
        name: '鹰潭市',
        id: '360600',
      },
      {
        province: '江西省',
        name: '赣州市',
        id: '360700',
      },
      {
        province: '江西省',
        name: '吉安市',
        id: '360800',
      },
      {
        province: '江西省',
        name: '宜春市',
        id: '360900',
      },
      {
        province: '江西省',
        name: '抚州市',
        id: '361000',
      },
      {
        province: '江西省',
        name: '上饶市',
        id: '361100',
      },
    ],
    '370000': [
      {
        province: '山东省',
        name: '济南市',
        id: '370100',
      },
      {
        province: '山东省',
        name: '青岛市',
        id: '370200',
      },
      {
        province: '山东省',
        name: '淄博市',
        id: '370300',
      },
      {
        province: '山东省',
        name: '枣庄市',
        id: '370400',
      },
      {
        province: '山东省',
        name: '东营市',
        id: '370500',
      },
      {
        province: '山东省',
        name: '烟台市',
        id: '370600',
      },
      {
        province: '山东省',
        name: '潍坊市',
        id: '370700',
      },
      {
        province: '山东省',
        name: '济宁市',
        id: '370800',
      },
      {
        province: '山东省',
        name: '泰安市',
        id: '370900',
      },
      {
        province: '山东省',
        name: '威海市',
        id: '371000',
      },
      {
        province: '山东省',
        name: '日照市',
        id: '371100',
      },
      {
        province: '山东省',
        name: '莱芜市',
        id: '371200',
      },
      {
        province: '山东省',
        name: '临沂市',
        id: '371300',
      },
      {
        province: '山东省',
        name: '德州市',
        id: '371400',
      },
      {
        province: '山东省',
        name: '聊城市',
        id: '371500',
      },
      {
        province: '山东省',
        name: '滨州市',
        id: '371600',
      },
      {
        province: '山东省',
        name: '菏泽市',
        id: '371700',
      },
    ],
    '410000': [
      {
        province: '河南省',
        name: '郑州市',
        id: '410100',
      },
      {
        province: '河南省',
        name: '开封市',
        id: '410200',
      },
      {
        province: '河南省',
        name: '洛阳市',
        id: '410300',
      },
      {
        province: '河南省',
        name: '平顶山市',
        id: '410400',
      },
      {
        province: '河南省',
        name: '安阳市',
        id: '410500',
      },
      {
        province: '河南省',
        name: '鹤壁市',
        id: '410600',
      },
      {
        province: '河南省',
        name: '新乡市',
        id: '410700',
      },
      {
        province: '河南省',
        name: '焦作市',
        id: '410800',
      },
      {
        province: '河南省',
        name: '濮阳市',
        id: '410900',
      },
      {
        province: '河南省',
        name: '许昌市',
        id: '411000',
      },
      {
        province: '河南省',
        name: '漯河市',
        id: '411100',
      },
      {
        province: '河南省',
        name: '三门峡市',
        id: '411200',
      },
      {
        province: '河南省',
        name: '南阳市',
        id: '411300',
      },
      {
        province: '河南省',
        name: '商丘市',
        id: '411400',
      },
      {
        province: '河南省',
        name: '信阳市',
        id: '411500',
      },
      {
        province: '河南省',
        name: '周口市',
        id: '411600',
      },
      {
        province: '河南省',
        name: '驻马店市',
        id: '411700',
      },
      {
        province: '河南省',
        name: '省直辖县级行政区划',
        id: '419000',
      },
    ],
    '420000': [
      {
        province: '湖北省',
        name: '武汉市',
        id: '420100',
      },
      {
        province: '湖北省',
        name: '黄石市',
        id: '420200',
      },
      {
        province: '湖北省',
        name: '十堰市',
        id: '420300',
      },
      {
        province: '湖北省',
        name: '宜昌市',
        id: '420500',
      },
      {
        province: '湖北省',
        name: '襄阳市',
        id: '420600',
      },
      {
        province: '湖北省',
        name: '鄂州市',
        id: '420700',
      },
      {
        province: '湖北省',
        name: '荆门市',
        id: '420800',
      },
      {
        province: '湖北省',
        name: '孝感市',
        id: '420900',
      },
      {
        province: '湖北省',
        name: '荆州市',
        id: '421000',
      },
      {
        province: '湖北省',
        name: '黄冈市',
        id: '421100',
      },
      {
        province: '湖北省',
        name: '咸宁市',
        id: '421200',
      },
      {
        province: '湖北省',
        name: '随州市',
        id: '421300',
      },
      {
        province: '湖北省',
        name: '恩施土家族苗族自治州',
        id: '422800',
      },
      {
        province: '湖北省',
        name: '省直辖县级行政区划',
        id: '429000',
      },
    ],
    '430000': [
      {
        province: '湖南省',
        name: '长沙市',
        id: '430100',
      },
      {
        province: '湖南省',
        name: '株洲市',
        id: '430200',
      },
      {
        province: '湖南省',
        name: '湘潭市',
        id: '430300',
      },
      {
        province: '湖南省',
        name: '衡阳市',
        id: '430400',
      },
      {
        province: '湖南省',
        name: '邵阳市',
        id: '430500',
      },
      {
        province: '湖南省',
        name: '岳阳市',
        id: '430600',
      },
      {
        province: '湖南省',
        name: '常德市',
        id: '430700',
      },
      {
        province: '湖南省',
        name: '张家界市',
        id: '430800',
      },
      {
        province: '湖南省',
        name: '益阳市',
        id: '430900',
      },
      {
        province: '湖南省',
        name: '郴州市',
        id: '431000',
      },
      {
        province: '湖南省',
        name: '永州市',
        id: '431100',
      },
      {
        province: '湖南省',
        name: '怀化市',
        id: '431200',
      },
      {
        province: '湖南省',
        name: '娄底市',
        id: '431300',
      },
      {
        province: '湖南省',
        name: '湘西土家族苗族自治州',
        id: '433100',
      },
    ],
    '440000': [
      {
        province: '广东省',
        name: '广州市',
        id: '440100',
      },
      {
        province: '广东省',
        name: '韶关市',
        id: '440200',
      },
      {
        province: '广东省',
        name: '深圳市',
        id: '440300',
      },
      {
        province: '广东省',
        name: '珠海市',
        id: '440400',
      },
      {
        province: '广东省',
        name: '汕头市',
        id: '440500',
      },
      {
        province: '广东省',
        name: '佛山市',
        id: '440600',
      },
      {
        province: '广东省',
        name: '江门市',
        id: '440700',
      },
      {
        province: '广东省',
        name: '湛江市',
        id: '440800',
      },
      {
        province: '广东省',
        name: '茂名市',
        id: '440900',
      },
      {
        province: '广东省',
        name: '肇庆市',
        id: '441200',
      },
      {
        province: '广东省',
        name: '惠州市',
        id: '441300',
      },
      {
        province: '广东省',
        name: '梅州市',
        id: '441400',
      },
      {
        province: '广东省',
        name: '汕尾市',
        id: '441500',
      },
      {
        province: '广东省',
        name: '河源市',
        id: '441600',
      },
      {
        province: '广东省',
        name: '阳江市',
        id: '441700',
      },
      {
        province: '广东省',
        name: '清远市',
        id: '441800',
      },
      {
        province: '广东省',
        name: '东莞市',
        id: '441900',
      },
      {
        province: '广东省',
        name: '中山市',
        id: '442000',
      },
      {
        province: '广东省',
        name: '潮州市',
        id: '445100',
      },
      {
        province: '广东省',
        name: '揭阳市',
        id: '445200',
      },
      {
        province: '广东省',
        name: '云浮市',
        id: '445300',
      },
    ],
    '450000': [
      {
        province: '广西壮族自治区',
        name: '南宁市',
        id: '450100',
      },
      {
        province: '广西壮族自治区',
        name: '柳州市',
        id: '450200',
      },
      {
        province: '广西壮族自治区',
        name: '桂林市',
        id: '450300',
      },
      {
        province: '广西壮族自治区',
        name: '梧州市',
        id: '450400',
      },
      {
        province: '广西壮族自治区',
        name: '北海市',
        id: '450500',
      },
      {
        province: '广西壮族自治区',
        name: '防城港市',
        id: '450600',
      },
      {
        province: '广西壮族自治区',
        name: '钦州市',
        id: '450700',
      },
      {
        province: '广西壮族自治区',
        name: '贵港市',
        id: '450800',
      },
      {
        province: '广西壮族自治区',
        name: '玉林市',
        id: '450900',
      },
      {
        province: '广西壮族自治区',
        name: '百色市',
        id: '451000',
      },
      {
        province: '广西壮族自治区',
        name: '贺州市',
        id: '451100',
      },
      {
        province: '广西壮族自治区',
        name: '河池市',
        id: '451200',
      },
      {
        province: '广西壮族自治区',
        name: '来宾市',
        id: '451300',
      },
      {
        province: '广西壮族自治区',
        name: '崇左市',
        id: '451400',
      },
    ],
    '460000': [
      {
        province: '海南省',
        name: '海口市',
        id: '460100',
      },
      {
        province: '海南省',
        name: '三亚市',
        id: '460200',
      },
      {
        province: '海南省',
        name: '三沙市',
        id: '460300',
      },
      {
        province: '海南省',
        name: '儋州市',
        id: '460400',
      },
      {
        province: '海南省',
        name: '省直辖县级行政区划',
        id: '469000',
      },
    ],
    '500000': [
      {
        province: '重庆市',
        name: '市辖区',
        id: '500100',
      },
      {
        province: '重庆市',
        name: '',
        id: '500200',
      },
    ],
    '510000': [
      {
        province: '四川省',
        name: '成都市',
        id: '510100',
      },
      {
        province: '四川省',
        name: '自贡市',
        id: '510300',
      },
      {
        province: '四川省',
        name: '攀枝花市',
        id: '510400',
      },
      {
        province: '四川省',
        name: '泸州市',
        id: '510500',
      },
      {
        province: '四川省',
        name: '德阳市',
        id: '510600',
      },
      {
        province: '四川省',
        name: '绵阳市',
        id: '510700',
      },
      {
        province: '四川省',
        name: '广元市',
        id: '510800',
      },
      {
        province: '四川省',
        name: '遂宁市',
        id: '510900',
      },
      {
        province: '四川省',
        name: '内江市',
        id: '511000',
      },
      {
        province: '四川省',
        name: '乐山市',
        id: '511100',
      },
      {
        province: '四川省',
        name: '南充市',
        id: '511300',
      },
      {
        province: '四川省',
        name: '眉山市',
        id: '511400',
      },
      {
        province: '四川省',
        name: '宜宾市',
        id: '511500',
      },
      {
        province: '四川省',
        name: '广安市',
        id: '511600',
      },
      {
        province: '四川省',
        name: '达州市',
        id: '511700',
      },
      {
        province: '四川省',
        name: '雅安市',
        id: '511800',
      },
      {
        province: '四川省',
        name: '巴中市',
        id: '511900',
      },
      {
        province: '四川省',
        name: '资阳市',
        id: '512000',
      },
      {
        province: '四川省',
        name: '阿坝藏族羌族自治州',
        id: '513200',
      },
      {
        province: '四川省',
        name: '甘孜藏族自治州',
        id: '513300',
      },
      {
        province: '四川省',
        name: '凉山彝族自治州',
        id: '513400',
      },
    ],
    '520000': [
      {
        province: '贵州省',
        name: '贵阳市',
        id: '520100',
      },
      {
        province: '贵州省',
        name: '六盘水市',
        id: '520200',
      },
      {
        province: '贵州省',
        name: '遵义市',
        id: '520300',
      },
      {
        province: '贵州省',
        name: '安顺市',
        id: '520400',
      },
      {
        province: '贵州省',
        name: '毕节市',
        id: '520500',
      },
      {
        province: '贵州省',
        name: '铜仁市',
        id: '520600',
      },
      {
        province: '贵州省',
        name: '黔西南布依族苗族自治州',
        id: '522300',
      },
      {
        province: '贵州省',
        name: '黔东南苗族侗族自治州',
        id: '522600',
      },
      {
        province: '贵州省',
        name: '黔南布依族苗族自治州',
        id: '522700',
      },
    ],
    '530000': [
      {
        province: '云南省',
        name: '昆明市',
        id: '530100',
      },
      {
        province: '云南省',
        name: '曲靖市',
        id: '530300',
      },
      {
        province: '云南省',
        name: '玉溪市',
        id: '530400',
      },
      {
        province: '云南省',
        name: '保山市',
        id: '530500',
      },
      {
        province: '云南省',
        name: '昭通市',
        id: '530600',
      },
      {
        province: '云南省',
        name: '丽江市',
        id: '530700',
      },
      {
        province: '云南省',
        name: '普洱市',
        id: '530800',
      },
      {
        province: '云南省',
        name: '临沧市',
        id: '530900',
      },
      {
        province: '云南省',
        name: '楚雄彝族自治州',
        id: '532300',
      },
      {
        province: '云南省',
        name: '红河哈尼族彝族自治州',
        id: '532500',
      },
      {
        province: '云南省',
        name: '文山壮族苗族自治州',
        id: '532600',
      },
      {
        province: '云南省',
        name: '西双版纳傣族自治州',
        id: '532800',
      },
      {
        province: '云南省',
        name: '大理白族自治州',
        id: '532900',
      },
      {
        province: '云南省',
        name: '德宏傣族景颇族自治州',
        id: '533100',
      },
      {
        province: '云南省',
        name: '怒江傈僳族自治州',
        id: '533300',
      },
      {
        province: '云南省',
        name: '迪庆藏族自治州',
        id: '533400',
      },
    ],
    '540000': [
      {
        province: '西藏自治区',
        name: '拉萨市',
        id: '540100',
      },
      {
        province: '西藏自治区',
        name: '日喀则市',
        id: '540200',
      },
      {
        province: '西藏自治区',
        name: '昌都市',
        id: '540300',
      },
      {
        province: '西藏自治区',
        name: '林芝市',
        id: '540400',
      },
      {
        province: '西藏自治区',
        name: '山南市',
        id: '540500',
      },
      {
        province: '西藏自治区',
        name: '那曲地区',
        id: '542400',
      },
      {
        province: '西藏自治区',
        name: '阿里地区',
        id: '542500',
      },
    ],
    '610000': [
      {
        province: '陕西省',
        name: '西安市',
        id: '610100',
      },
      {
        province: '陕西省',
        name: '铜川市',
        id: '610200',
      },
      {
        province: '陕西省',
        name: '宝鸡市',
        id: '610300',
      },
      {
        province: '陕西省',
        name: '咸阳市',
        id: '610400',
      },
      {
        province: '陕西省',
        name: '渭南市',
        id: '610500',
      },
      {
        province: '陕西省',
        name: '延安市',
        id: '610600',
      },
      {
        province: '陕西省',
        name: '汉中市',
        id: '610700',
      },
      {
        province: '陕西省',
        name: '榆林市',
        id: '610800',
      },
      {
        province: '陕西省',
        name: '安康市',
        id: '610900',
      },
      {
        province: '陕西省',
        name: '商洛市',
        id: '611000',
      },
    ],
    '620000': [
      {
        province: '甘肃省',
        name: '兰州市',
        id: '620100',
      },
      {
        province: '甘肃省',
        name: '嘉峪关市',
        id: '620200',
      },
      {
        province: '甘肃省',
        name: '金昌市',
        id: '620300',
      },
      {
        province: '甘肃省',
        name: '白银市',
        id: '620400',
      },
      {
        province: '甘肃省',
        name: '天水市',
        id: '620500',
      },
      {
        province: '甘肃省',
        name: '武威市',
        id: '620600',
      },
      {
        province: '甘肃省',
        name: '张掖市',
        id: '620700',
      },
      {
        province: '甘肃省',
        name: '平凉市',
        id: '620800',
      },
      {
        province: '甘肃省',
        name: '酒泉市',
        id: '620900',
      },
      {
        province: '甘肃省',
        name: '庆阳市',
        id: '621000',
      },
      {
        province: '甘肃省',
        name: '定西市',
        id: '621100',
      },
      {
        province: '甘肃省',
        name: '陇南市',
        id: '621200',
      },
      {
        province: '甘肃省',
        name: '临夏回族自治州',
        id: '622900',
      },
      {
        province: '甘肃省',
        name: '甘南藏族自治州',
        id: '623000',
      },
    ],
    '630000': [
      {
        province: '青海省',
        name: '西宁市',
        id: '630100',
      },
      {
        province: '青海省',
        name: '海东市',
        id: '630200',
      },
      {
        province: '青海省',
        name: '海北藏族自治州',
        id: '632200',
      },
      {
        province: '青海省',
        name: '黄南藏族自治州',
        id: '632300',
      },
      {
        province: '青海省',
        name: '海南藏族自治州',
        id: '632500',
      },
      {
        province: '青海省',
        name: '果洛藏族自治州',
        id: '632600',
      },
      {
        province: '青海省',
        name: '玉树藏族自治州',
        id: '632700',
      },
      {
        province: '青海省',
        name: '海西蒙古族藏族自治州',
        id: '632800',
      },
    ],
    '640000': [
      {
        province: '宁夏回族自治区',
        name: '银川市',
        id: '640100',
      },
      {
        province: '宁夏回族自治区',
        name: '石嘴山市',
        id: '640200',
      },
      {
        province: '宁夏回族自治区',
        name: '吴忠市',
        id: '640300',
      },
      {
        province: '宁夏回族自治区',
        name: '固原市',
        id: '640400',
      },
      {
        province: '宁夏回族自治区',
        name: '中卫市',
        id: '640500',
      },
    ],
    '650000': [
      {
        province: '新疆维吾尔自治区',
        name: '乌鲁木齐市',
        id: '650100',
      },
      {
        province: '新疆维吾尔自治区',
        name: '克拉玛依市',
        id: '650200',
      },
      {
        province: '新疆维吾尔自治区',
        name: '吐鲁番市',
        id: '650400',
      },
      {
        province: '新疆维吾尔自治区',
        name: '哈密市',
        id: '650500',
      },
      {
        province: '新疆维吾尔自治区',
        name: '昌吉回族自治州',
        id: '652300',
      },
      {
        province: '新疆维吾尔自治区',
        name: '博尔塔拉蒙古自治州',
        id: '652700',
      },
      {
        province: '新疆维吾尔自治区',
        name: '巴音郭楞蒙古自治州',
        id: '652800',
      },
      {
        province: '新疆维吾尔自治区',
        name: '阿克苏地区',
        id: '652900',
      },
      {
        province: '新疆维吾尔自治区',
        name: '克孜勒苏柯尔克孜自治州',
        id: '653000',
      },
      {
        province: '新疆维吾尔自治区',
        name: '喀什地区',
        id: '653100',
      },
      {
        province: '新疆维吾尔自治区',
        name: '和田地区',
        id: '653200',
      },
      {
        province: '新疆维吾尔自治区',
        name: '伊犁哈萨克自治州',
        id: '654000',
      },
      {
        province: '新疆维吾尔自治区',
        name: '塔城地区',
        id: '654200',
      },
      {
        province: '新疆维吾尔自治区',
        name: '阿勒泰地区',
        id: '654300',
      },
      {
        province: '新疆维吾尔自治区',
        name: '自治区直辖县级行政区划',
        id: '659000',
      },
    ],
  };

  var province = [
期贤's avatar
期贤 committed
2375
    {
陈帅's avatar
陈帅 committed
2376 2377
      name: '北京市',
      id: '110000',
期贤's avatar
期贤 committed
2378 2379
    },
    {
陈帅's avatar
陈帅 committed
2380 2381
      name: '天津市',
      id: '120000',
期贤's avatar
期贤 committed
2382 2383
    },
    {
陈帅's avatar
陈帅 committed
2384 2385
      name: '河北省',
      id: '130000',
期贤's avatar
期贤 committed
2386 2387
    },
    {
陈帅's avatar
陈帅 committed
2388 2389
      name: '山西省',
      id: '140000',
期贤's avatar
期贤 committed
2390 2391
    },
    {
陈帅's avatar
陈帅 committed
2392 2393
      name: '内蒙古自治区',
      id: '150000',
期贤's avatar
期贤 committed
2394 2395
    },
    {
陈帅's avatar
陈帅 committed
2396 2397
      name: '辽宁省',
      id: '210000',
期贤's avatar
期贤 committed
2398 2399
    },
    {
陈帅's avatar
陈帅 committed
2400 2401
      name: '吉林省',
      id: '220000',
期贤's avatar
期贤 committed
2402 2403
    },
    {
陈帅's avatar
陈帅 committed
2404 2405
      name: '黑龙江省',
      id: '230000',
期贤's avatar
期贤 committed
2406 2407
    },
    {
陈帅's avatar
陈帅 committed
2408 2409
      name: '上海市',
      id: '310000',
期贤's avatar
期贤 committed
2410 2411
    },
    {
陈帅's avatar
陈帅 committed
2412 2413
      name: '江苏省',
      id: '320000',
期贤's avatar
期贤 committed
2414 2415
    },
    {
陈帅's avatar
陈帅 committed
2416 2417
      name: '浙江省',
      id: '330000',
期贤's avatar
期贤 committed
2418 2419
    },
    {
陈帅's avatar
陈帅 committed
2420 2421
      name: '安徽省',
      id: '340000',
期贤's avatar
期贤 committed
2422 2423
    },
    {
陈帅's avatar
陈帅 committed
2424 2425
      name: '福建省',
      id: '350000',
期贤's avatar
期贤 committed
2426 2427
    },
    {
陈帅's avatar
陈帅 committed
2428 2429
      name: '江西省',
      id: '360000',
期贤's avatar
期贤 committed
2430 2431
    },
    {
陈帅's avatar
陈帅 committed
2432 2433
      name: '山东省',
      id: '370000',
期贤's avatar
期贤 committed
2434 2435
    },
    {
陈帅's avatar
陈帅 committed
2436 2437
      name: '河南省',
      id: '410000',
期贤's avatar
期贤 committed
2438 2439
    },
    {
陈帅's avatar
陈帅 committed
2440 2441
      name: '湖北省',
      id: '420000',
期贤's avatar
期贤 committed
2442 2443
    },
    {
陈帅's avatar
陈帅 committed
2444 2445
      name: '湖南省',
      id: '430000',
期贤's avatar
期贤 committed
2446 2447
    },
    {
陈帅's avatar
陈帅 committed
2448 2449
      name: '广东省',
      id: '440000',
期贤's avatar
期贤 committed
2450 2451
    },
    {
陈帅's avatar
陈帅 committed
2452 2453
      name: '广西壮族自治区',
      id: '450000',
期贤's avatar
期贤 committed
2454 2455
    },
    {
陈帅's avatar
陈帅 committed
2456 2457
      name: '海南省',
      id: '460000',
期贤's avatar
期贤 committed
2458 2459
    },
    {
陈帅's avatar
陈帅 committed
2460 2461
      name: '重庆市',
      id: '500000',
期贤's avatar
期贤 committed
2462 2463
    },
    {
陈帅's avatar
陈帅 committed
2464 2465
      name: '四川省',
      id: '510000',
期贤's avatar
期贤 committed
2466 2467
    },
    {
陈帅's avatar
陈帅 committed
2468 2469
      name: '贵州省',
      id: '520000',
期贤's avatar
期贤 committed
2470 2471
    },
    {
陈帅's avatar
陈帅 committed
2472 2473
      name: '云南省',
      id: '530000',
期贤's avatar
期贤 committed
2474 2475
    },
    {
陈帅's avatar
陈帅 committed
2476 2477
      name: '西藏自治区',
      id: '540000',
期贤's avatar
期贤 committed
2478 2479
    },
    {
陈帅's avatar
陈帅 committed
2480 2481
      name: '陕西省',
      id: '610000',
期贤's avatar
期贤 committed
2482 2483
    },
    {
陈帅's avatar
陈帅 committed
2484 2485
      name: '甘肃省',
      id: '620000',
期贤's avatar
期贤 committed
2486 2487
    },
    {
陈帅's avatar
陈帅 committed
2488 2489
      name: '青海省',
      id: '630000',
期贤's avatar
期贤 committed
2490 2491
    },
    {
陈帅's avatar
陈帅 committed
2492 2493
      name: '宁夏回族自治区',
      id: '640000',
期贤's avatar
期贤 committed
2494 2495
    },
    {
陈帅's avatar
陈帅 committed
2496 2497
      name: '新疆维吾尔自治区',
      id: '650000',
期贤's avatar
期贤 committed
2498 2499
    },
    {
陈帅's avatar
陈帅 committed
2500 2501
      name: '台湾省',
      id: '710000',
期贤's avatar
期贤 committed
2502 2503
    },
    {
陈帅's avatar
陈帅 committed
2504 2505
      name: '香港特别行政区',
      id: '810000',
期贤's avatar
期贤 committed
2506 2507
    },
    {
陈帅's avatar
陈帅 committed
2508 2509
      name: '澳门特别行政区',
      id: '820000',
期贤's avatar
期贤 committed
2510
    },
陈帅's avatar
陈帅 committed
2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522
  ];
  function getProvince(req, res) {
    return res.json(province);
  }

  function getCity(req, res) {
    return res.json(city[req.params.province]);
  }

  var geographic = {
    'GET /api/geographic/province': getProvince,
    'GET /api/geographic/city/:province': getCity,
期贤's avatar
期贤 committed
2523 2524
  };

陈帅's avatar
陈帅 committed
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628
  const getNotices = (req, res) =>
    res.json([
      {
        id: '000000001',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
        title: '你收到了 14 份新周报',
        datetime: '2017-08-09',
        type: 'notification',
      },
      {
        id: '000000002',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
        title: '你推荐的 曲妮妮 已通过第三轮面试',
        datetime: '2017-08-08',
        type: 'notification',
      },
      {
        id: '000000003',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
        title: '这种模板可以区分多种通知类型',
        datetime: '2017-08-07',
        read: true,
        type: 'notification',
      },
      {
        id: '000000004',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
        title: '左侧图标用于区分不同的类型',
        datetime: '2017-08-07',
        type: 'notification',
      },
      {
        id: '000000005',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
        title: '内容不要超过两行字,超出时自动截断',
        datetime: '2017-08-07',
        type: 'notification',
      },
      {
        id: '000000006',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
        title: '曲丽丽 评论了你',
        description: '描述信息描述信息描述信息',
        datetime: '2017-08-07',
        type: 'message',
        clickClose: true,
      },
      {
        id: '000000007',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
        title: '朱偏右 回复了你',
        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
        datetime: '2017-08-07',
        type: 'message',
        clickClose: true,
      },
      {
        id: '000000008',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
        title: '标题',
        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
        datetime: '2017-08-07',
        type: 'message',
        clickClose: true,
      },
      {
        id: '000000009',
        title: '任务名称',
        description: '任务需要在 2017-01-12 20:00 前启动',
        extra: '未开始',
        status: 'todo',
        type: 'event',
      },
      {
        id: '000000010',
        title: '第三方紧急代码变更',
        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
        extra: '马上到期',
        status: 'urgent',
        type: 'event',
      },
      {
        id: '000000011',
        title: '信息安全考试',
        description: '指派竹尔于 2017-01-09 前完成更新并发布',
        extra: '已耗时 8 天',
        status: 'doing',
        type: 'event',
      },
      {
        id: '000000012',
        title: 'ABCD 版本发布',
        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
        extra: '进行中',
        status: 'processing',
        type: 'event',
      },
    ]);

  var notices = {
    'GET /api/notices': getNotices,
  };

  const basicGoods = [
期贤's avatar
期贤 committed
2629
    {
陈帅's avatar
陈帅 committed
2630 2631 2632 2633 2634 2635
      id: '1234561',
      name: '矿泉水 550ml',
      barcode: '12421432143214321',
      price: '2.00',
      num: '1',
      amount: '2.00',
期贤's avatar
期贤 committed
2636 2637
    },
    {
陈帅's avatar
陈帅 committed
2638 2639 2640 2641 2642 2643
      id: '1234562',
      name: '凉茶 300ml',
      barcode: '12421432143214322',
      price: '3.00',
      num: '2',
      amount: '6.00',
期贤's avatar
期贤 committed
2644 2645
    },
    {
陈帅's avatar
陈帅 committed
2646 2647 2648 2649 2650 2651
      id: '1234563',
      name: '好吃的薯片',
      barcode: '12421432143214323',
      price: '7.00',
      num: '4',
      amount: '28.00',
期贤's avatar
期贤 committed
2652 2653
    },
    {
陈帅's avatar
陈帅 committed
2654 2655 2656 2657 2658 2659
      id: '1234564',
      name: '特别好吃的蛋卷',
      barcode: '12421432143214324',
      price: '8.50',
      num: '3',
      amount: '25.50',
期贤's avatar
期贤 committed
2660
    },
陈帅's avatar
陈帅 committed
2661 2662
  ];
  const basicProgress = [
期贤's avatar
期贤 committed
2663
    {
陈帅's avatar
陈帅 committed
2664 2665 2666 2667 2668 2669
      key: '1',
      time: '2017-10-01 14:10',
      rate: '联系客户',
      status: 'processing',
      operator: '取货员 ID1234',
      cost: '5mins',
期贤's avatar
期贤 committed
2670 2671
    },
    {
陈帅's avatar
陈帅 committed
2672 2673 2674 2675 2676 2677
      key: '2',
      time: '2017-10-01 14:05',
      rate: '取货员出发',
      status: 'success',
      operator: '取货员 ID1234',
      cost: '1h',
期贤's avatar
期贤 committed
2678 2679
    },
    {
陈帅's avatar
陈帅 committed
2680 2681 2682 2683 2684 2685
      key: '3',
      time: '2017-10-01 13:05',
      rate: '取货员接单',
      status: 'success',
      operator: '取货员 ID1234',
      cost: '5mins',
期贤's avatar
期贤 committed
2686 2687
    },
    {
陈帅's avatar
陈帅 committed
2688 2689 2690 2691 2692 2693
      key: '4',
      time: '2017-10-01 13:00',
      rate: '申请审批通过',
      status: 'success',
      operator: '系统',
      cost: '1h',
期贤's avatar
期贤 committed
2694 2695
    },
    {
陈帅's avatar
陈帅 committed
2696 2697 2698 2699 2700 2701
      key: '5',
      time: '2017-10-01 12:00',
      rate: '发起退货申请',
      status: 'success',
      operator: '用户',
      cost: '5mins',
期贤's avatar
期贤 committed
2702
    },
陈帅's avatar
陈帅 committed
2703 2704
  ];
  const advancedOperation1 = [
期贤's avatar
期贤 committed
2705
    {
陈帅's avatar
陈帅 committed
2706 2707 2708 2709 2710 2711
      key: 'op1',
      type: '订购关系生效',
      name: '曲丽丽',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '-',
期贤's avatar
期贤 committed
2712 2713
    },
    {
陈帅's avatar
陈帅 committed
2714 2715 2716 2717 2718 2719
      key: 'op2',
      type: '财务复审',
      name: '付小小',
      status: 'reject',
      updatedAt: '2017-10-03  19:23:12',
      memo: '不通过原因',
期贤's avatar
期贤 committed
2720 2721
    },
    {
陈帅's avatar
陈帅 committed
2722 2723 2724 2725 2726 2727
      key: 'op3',
      type: '部门初审',
      name: '周毛毛',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '-',
期贤's avatar
期贤 committed
2728 2729
    },
    {
陈帅's avatar
陈帅 committed
2730 2731 2732 2733 2734 2735
      key: 'op4',
      type: '提交订单',
      name: '林东东',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '很棒',
期贤's avatar
期贤 committed
2736 2737
    },
    {
陈帅's avatar
陈帅 committed
2738 2739 2740 2741 2742 2743
      key: 'op5',
      type: '创建订单',
      name: '汗牙牙',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '-',
期贤's avatar
期贤 committed
2744
    },
陈帅's avatar
陈帅 committed
2745 2746
  ];
  const advancedOperation2 = [
期贤's avatar
期贤 committed
2747
    {
陈帅's avatar
陈帅 committed
2748 2749 2750 2751 2752 2753
      key: 'op1',
      type: '订购关系生效',
      name: '曲丽丽',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '-',
期贤's avatar
期贤 committed
2754
    },
陈帅's avatar
陈帅 committed
2755 2756
  ];
  const advancedOperation3 = [
期贤's avatar
期贤 committed
2757
    {
陈帅's avatar
陈帅 committed
2758 2759 2760 2761 2762 2763
      key: 'op1',
      type: '创建订单',
      name: '汗牙牙',
      status: 'agree',
      updatedAt: '2017-10-03  19:23:12',
      memo: '-',
期贤's avatar
期贤 committed
2764
    },
陈帅's avatar
陈帅 committed
2765
  ];
期贤's avatar
期贤 committed
2766 2767 2768
  const getProfileAdvancedData = {
    advancedOperation1,
    advancedOperation2,
陈帅's avatar
陈帅 committed
2769
    advancedOperation3,
期贤's avatar
期贤 committed
2770
  };
陈帅's avatar
陈帅 committed
2771
  const { Random } = mockjs;
期贤's avatar
期贤 committed
2772 2773 2774
  var profile = {
    'GET /api/profile/advanced': getProfileAdvancedData,
    'GET /api/profile/basic': (req, res) => {
陈帅's avatar
陈帅 committed
2775
      const { id } = req.query;
期贤's avatar
期贤 committed
2776 2777 2778 2779
      const application = {
        id,
        status: '已取货',
        orderNo: Random.id(),
陈帅's avatar
陈帅 committed
2780
        childOrderNo: Random.id(),
期贤's avatar
期贤 committed
2781 2782 2783 2784 2785 2786
      };
      const userInfo = {
        name: Random.cname(),
        tel: '18100000000',
        delivery: '菜鸟物流',
        addr: '浙江省杭州市西湖区万塘路18号',
陈帅's avatar
陈帅 committed
2787
        remark: '备注',
期贤's avatar
期贤 committed
2788 2789 2790 2791 2792
      };
      res.json({
        userInfo,
        application,
        basicGoods,
陈帅's avatar
陈帅 committed
2793
        basicProgress,
期贤's avatar
期贤 committed
2794
      });
陈帅's avatar
陈帅 committed
2795
    },
期贤's avatar
期贤 committed
2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820
  };

  /*! https://mths.be/punycode v1.4.1 by @mathias */

  /** Highest positive signed 32-bit float value */
  var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1

  /** Bootstring parameters */

  var base = 36;
  var tMin = 1;
  var tMax = 26;
  var skew = 38;
  var damp = 700;
  var initialBias = 72;
  var initialN = 128; // 0x80

  var delimiter = '-'; // '\x2D'
  var regexNonASCII = /[^\x20-\x7E]/; // unprintable ASCII chars + non-ASCII chars

  var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators

  /** Error messages */

  var errors = {
陈帅's avatar
陈帅 committed
2821
    overflow: 'Overflow: input needs wider integers to process',
期贤's avatar
期贤 committed
2822
    'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
陈帅's avatar
陈帅 committed
2823
    'invalid-input': 'Invalid input',
期贤's avatar
期贤 committed
2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903
  };
  /** Convenience shortcuts */

  var baseMinusTMin = base - tMin;
  var floor = Math.floor;
  var stringFromCharCode = String.fromCharCode;
  /*--------------------------------------------------------------------------*/

  /**
   * A generic error utility function.
   * @private
   * @param {String} type The error type.
   * @returns {Error} Throws a `RangeError` with the applicable error message.
   */

  function error(type) {
    throw new RangeError(errors[type]);
  }
  /**
   * A generic `Array#map` utility function.
   * @private
   * @param {Array} array The array to iterate over.
   * @param {Function} callback The function that gets called for every array
   * item.
   * @returns {Array} A new array of values returned by the callback function.
   */

  function map(array, fn) {
    var length = array.length;
    var result = [];

    while (length--) {
      result[length] = fn(array[length]);
    }

    return result;
  }
  /**
   * A simple `Array#map`-like wrapper to work with domain name strings or email
   * addresses.
   * @private
   * @param {String} domain The domain name or email address.
   * @param {Function} callback The function that gets called for every
   * character.
   * @returns {Array} A new string of characters returned by the callback
   * function.
   */

  function mapDomain(string, fn) {
    var parts = string.split('@');
    var result = '';

    if (parts.length > 1) {
      // In email addresses, only the domain name should be punycoded. Leave
      // the local part (i.e. everything up to `@`) intact.
      result = parts[0] + '@';
      string = parts[1];
    } // Avoid `split(regex)` for IE8 compatibility. See #17.

    string = string.replace(regexSeparators, '\x2E');
    var labels = string.split('.');
    var encoded = map(labels, fn).join('.');
    return result + encoded;
  }
  /**
   * Creates an array containing the numeric code points of each Unicode
   * character in the string. While JavaScript uses UCS-2 internally,
   * this function will convert a pair of surrogate halves (each of which
   * UCS-2 exposes as separate characters) into a single code point,
   * matching UTF-16.
   * @see `punycode.ucs2.encode`
   * @see <https://mathiasbynens.be/notes/javascript-encoding>
   * @memberOf punycode.ucs2
   * @name decode
   * @param {String} string The Unicode input string (UCS-2).
   * @returns {Array} The new array of code points.
   */

  function ucs2decode(string) {
    var output = [],
陈帅's avatar
陈帅 committed
2904 2905 2906 2907
      counter = 0,
      length = string.length,
      value,
      extra;
期贤's avatar
期贤 committed
2908 2909 2910 2911

    while (counter < length) {
      value = string.charCodeAt(counter++);

陈帅's avatar
陈帅 committed
2912
      if (value >= 0xd800 && value <= 0xdbff && counter < length) {
期贤's avatar
期贤 committed
2913 2914 2915
        // high surrogate, and there is a next character
        extra = string.charCodeAt(counter++);

陈帅's avatar
陈帅 committed
2916
        if ((extra & 0xfc00) == 0xdc00) {
期贤's avatar
期贤 committed
2917
          // low surrogate
陈帅's avatar
陈帅 committed
2918
          output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
期贤's avatar
期贤 committed
2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959
        } else {
          // unmatched surrogate; only append this code unit, in case the next
          // code unit is the high surrogate of a surrogate pair
          output.push(value);
          counter--;
        }
      } else {
        output.push(value);
      }
    }

    return output;
  }
  /**
   * Converts a digit/integer into a basic code point.
   * @see `basicToDigit()`
   * @private
   * @param {Number} digit The numeric value of a basic code point.
   * @returns {Number} The basic code point whose value (when used for
   * representing integers) is `digit`, which needs to be in the range
   * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
   * used; else, the lowercase form is used. The behavior is undefined
   * if `flag` is non-zero and `digit` has no uppercase form.
   */

  function digitToBasic(digit, flag) {
    //  0..25 map to ASCII a..z or A..Z
    // 26..35 map to ASCII 0..9
    return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  }
  /**
   * Bias adaptation function as per section 3.4 of RFC 3492.
   * https://tools.ietf.org/html/rfc3492#section-3.4
   * @private
   */

  function adapt(delta, numPoints, firstTime) {
    var k = 0;
    delta = firstTime ? floor(delta / damp) : delta >> 1;
    delta += floor(delta / numPoints);

陈帅's avatar
陈帅 committed
2960 2961 2962 2963 2964 2965
    for (
      ;
      /* no initialization */
      delta > (baseMinusTMin * tMax) >> 1;
      k += base
    ) {
期贤's avatar
期贤 committed
2966 2967 2968
      delta = floor(delta / baseMinusTMin);
    }

陈帅's avatar
陈帅 committed
2969
    return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew));
期贤's avatar
期贤 committed
2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980
  }
  /**
   * Converts a string of Unicode symbols (e.g. a domain name label) to a
   * Punycode string of ASCII-only symbols.
   * @memberOf punycode
   * @param {String} input The string of Unicode symbols.
   * @returns {String} The resulting Punycode string of ASCII-only symbols.
   */

  function encode(input) {
    var n,
陈帅's avatar
陈帅 committed
2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997
      delta,
      handledCPCount,
      basicLength,
      bias,
      j,
      m,
      q,
      k,
      t,
      currentValue,
      output = [],
      /** `inputLength` will hold the number of code points in `input`. */
      inputLength,
      /** Cached calculation results */
      handledCPCountPlusOne,
      baseMinusT,
      qMinusT; // Convert the input in UCS-2 to Unicode
期贤's avatar
期贤 committed
2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052

    input = ucs2decode(input); // Cache the length

    inputLength = input.length; // Initialize the state

    n = initialN;
    delta = 0;
    bias = initialBias; // Handle the basic code points

    for (j = 0; j < inputLength; ++j) {
      currentValue = input[j];

      if (currentValue < 0x80) {
        output.push(stringFromCharCode(currentValue));
      }
    }

    handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled;
    // `basicLength` is the number of basic code points.
    // Finish the basic string - if it is not empty - with a delimiter

    if (basicLength) {
      output.push(delimiter);
    } // Main encoding loop:

    while (handledCPCount < inputLength) {
      // All non-basic code points < n have been handled already. Find the next
      // larger one:
      for (m = maxInt, j = 0; j < inputLength; ++j) {
        currentValue = input[j];

        if (currentValue >= n && currentValue < m) {
          m = currentValue;
        }
      } // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
      // but guard against overflow

      handledCPCountPlusOne = handledCPCount + 1;

      if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
        error('overflow');
      }

      delta += (m - n) * handledCPCountPlusOne;
      n = m;

      for (j = 0; j < inputLength; ++j) {
        currentValue = input[j];

        if (currentValue < n && ++delta > maxInt) {
          error('overflow');
        }

        if (currentValue == n) {
          // Represent delta as a generalized variable-length integer
陈帅's avatar
陈帅 committed
3053 3054 3055 3056 3057 3058
          for (
            q = delta, k = base;
            ;
            /* no condition */
            k += base
          ) {
期贤's avatar
期贤 committed
3059 3060 3061 3062 3063 3064 3065 3066
            t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;

            if (q < t) {
              break;
            }

            qMinusT = q - t;
            baseMinusT = base - t;
陈帅's avatar
陈帅 committed
3067
            output.push(stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)));
期贤's avatar
期贤 committed
3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096
            q = floor(qMinusT / baseMinusT);
          }

          output.push(stringFromCharCode(digitToBasic(q, 0)));
          bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
          delta = 0;
          ++handledCPCount;
        }
      }

      ++delta;
      ++n;
    }

    return output.join('');
  }
  /**
   * Converts a Unicode string representing a domain name or an email address to
   * Punycode. Only the non-ASCII parts of the domain name will be converted,
   * i.e. it doesn't matter if you call it with a domain that's already in
   * ASCII.
   * @memberOf punycode
   * @param {String} input The domain name or email address to convert, as a
   * Unicode string.
   * @returns {String} The Punycode representation of the given domain name or
   * email address.
   */

  function toASCII(input) {
陈帅's avatar
陈帅 committed
3097
    return mapDomain(input, function(string) {
期贤's avatar
期贤 committed
3098 3099 3100 3101 3102 3103
      return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
    });
  }

  // shim for using process in browser

陈帅's avatar
陈帅 committed
3104
  if (typeof global.setTimeout === 'function');
期贤's avatar
期贤 committed
3105

陈帅's avatar
陈帅 committed
3106
  if (typeof global.clearTimeout === 'function');
期贤's avatar
期贤 committed
3107 3108 3109

  var performance = global.performance || {};

陈帅's avatar
陈帅 committed
3110 3111 3112 3113 3114 3115 3116 3117 3118
  var performanceNow =
    performance.now ||
    performance.mozNow ||
    performance.msNow ||
    performance.oNow ||
    performance.webkitNow ||
    function() {
      return new Date().getTime();
    }; // generate timestamp or delta
期贤's avatar
期贤 committed
3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160

  // Copyright Joyent, Inc. and other Node contributors.
  function isNull(arg) {
    return arg === null;
  }
  function isNullOrUndefined(arg) {
    return arg == null;
  }
  function isString(arg) {
    return typeof arg === 'string';
  }
  function isObject(arg) {
    return typeof arg === 'object' && arg !== null;
  }

  // Copyright Joyent, Inc. and other Node contributors.
  //
  // Permission is hereby granted, free of charge, to any person obtaining a
  // copy of this software and associated documentation files (the
  // "Software"), to deal in the Software without restriction, including
  // without limitation the rights to use, copy, modify, merge, publish,
  // distribute, sublicense, and/or sell copies of the Software, and to permit
  // persons to whom the Software is furnished to do so, subject to the
  // following conditions:
  //
  // The above copyright notice and this permission notice shall be included
  // in all copies or substantial portions of the Software.
  //
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
  // If obj.hasOwnProperty has been overridden, then calling
  // obj.hasOwnProperty(prop) will break.
  // See: https://github.com/joyent/node/issues/1707
  function hasOwnProperty(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
  }

陈帅's avatar
陈帅 committed
3161 3162 3163 3164 3165
  var isArray =
    Array.isArray ||
    function(xs) {
      return Object.prototype.toString.call(xs) === '[object Array]';
    };
期贤's avatar
期贤 committed
3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191

  function stringifyPrimitive(v) {
    switch (typeof v) {
      case 'string':
        return v;

      case 'boolean':
        return v ? 'true' : 'false';

      case 'number':
        return isFinite(v) ? v : '';

      default:
        return '';
    }
  }

  function stringify(obj, sep, eq, name) {
    sep = sep || '&';
    eq = eq || '=';

    if (obj === null) {
      obj = undefined;
    }

    if (typeof obj === 'object') {
陈帅's avatar
陈帅 committed
3192
      return map$1(objectKeys(obj), function(k) {
期贤's avatar
期贤 committed
3193 3194 3195
        var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;

        if (isArray(obj[k])) {
陈帅's avatar
陈帅 committed
3196
          return map$1(obj[k], function(v) {
期贤's avatar
期贤 committed
3197 3198 3199 3200 3201 3202 3203 3204 3205
            return ks + encodeURIComponent(stringifyPrimitive(v));
          }).join(sep);
        } else {
          return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
        }
      }).join(sep);
    }

    if (!name) return '';
陈帅's avatar
陈帅 committed
3206 3207 3208 3209 3210
    return (
      encodeURIComponent(stringifyPrimitive(name)) +
      eq +
      encodeURIComponent(stringifyPrimitive(obj))
    );
期贤's avatar
期贤 committed
3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223
  }

  function map$1(xs, f) {
    if (xs.map) return xs.map(f);
    var res = [];

    for (var i = 0; i < xs.length; i++) {
      res.push(f(xs[i], i));
    }

    return res;
  }

陈帅's avatar
陈帅 committed
3224 3225 3226 3227
  var objectKeys =
    Object.keys ||
    function(obj) {
      var res = [];
期贤's avatar
期贤 committed
3228

陈帅's avatar
陈帅 committed
3229 3230 3231
      for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
      }
期贤's avatar
期贤 committed
3232

陈帅's avatar
陈帅 committed
3233 3234
      return res;
    };
期贤's avatar
期贤 committed
3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260

  function parse(qs, sep, eq, options) {
    sep = sep || '&';
    eq = eq || '=';
    var obj = {};

    if (typeof qs !== 'string' || qs.length === 0) {
      return obj;
    }

    var regexp = /\+/g;
    qs = qs.split(sep);
    var maxKeys = 1000;

    if (options && typeof options.maxKeys === 'number') {
      maxKeys = options.maxKeys;
    }

    var len = qs.length; // maxKeys <= 0 means that we should not limit keys count

    if (maxKeys > 0 && len > maxKeys) {
      len = maxKeys;
    }

    for (var i = 0; i < len; ++i) {
      var x = qs[i].replace(regexp, '%20'),
陈帅's avatar
陈帅 committed
3261 3262 3263 3264 3265
        idx = x.indexOf(eq),
        kstr,
        vstr,
        k,
        v;
期贤's avatar
期贤 committed
3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308

      if (idx >= 0) {
        kstr = x.substr(0, idx);
        vstr = x.substr(idx + 1);
      } else {
        kstr = x;
        vstr = '';
      }

      k = decodeURIComponent(kstr);
      v = decodeURIComponent(vstr);

      if (!hasOwnProperty(obj, k)) {
        obj[k] = v;
      } else if (isArray(obj[k])) {
        obj[k].push(v);
      } else {
        obj[k] = [obj[k], v];
      }
    }

    return obj;
  }

  // Copyright Joyent, Inc. and other Node contributors.
  function Url() {
    this.protocol = null;
    this.slashes = null;
    this.auth = null;
    this.host = null;
    this.port = null;
    this.hostname = null;
    this.hash = null;
    this.search = null;
    this.query = null;
    this.pathname = null;
    this.path = null;
    this.href = null;
  } // Reference: RFC 3986, RFC 1808, RFC 2396
  // define these here so at least they only have to be
  // compiled once on the first module load.

  var protocolPattern = /^([a-z0-9.+-]+:)/i,
陈帅's avatar
陈帅 committed
3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350
    portPattern = /:[0-9]*$/,
    // Special case for a simple path URL
    simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
    // RFC 2396: characters reserved for delimiting URLs.
    // We actually just auto-escape these.
    delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
    // RFC 2396: characters not allowed for various reasons.
    unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
    autoEscape = ["'"].concat(unwise),
    // Characters that are never ever allowed in a hostname.
    // Note that any invalid chars are also handled, but these
    // are the ones that are *expected* to be seen, so we fast-path
    // them.
    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
    hostEndingChars = ['/', '?', '#'],
    hostnameMaxLen = 255,
    hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
    hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
    // protocols that can allow "unsafe" and "unwise" chars.
    unsafeProtocol = {
      javascript: true,
      'javascript:': true,
    },
    // protocols that never have a hostname.
    hostlessProtocol = {
      javascript: true,
      'javascript:': true,
    },
    // protocols that always contain a // bit.
    slashedProtocol = {
      http: true,
      https: true,
      ftp: true,
      gopher: true,
      file: true,
      'http:': true,
      'https:': true,
      'ftp:': true,
      'gopher:': true,
      'file:': true,
    };
期贤's avatar
期贤 committed
3351 3352 3353 3354 3355 3356 3357 3358

  function urlParse(url, parseQueryString, slashesDenoteHost) {
    if (url && isObject(url) && url instanceof Url) return url;
    var u = new Url();
    u.parse(url, parseQueryString, slashesDenoteHost);
    return u;
  }

陈帅's avatar
陈帅 committed
3359
  Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
期贤's avatar
期贤 committed
3360 3361 3362 3363 3364
    return parse$1(this, url, parseQueryString, slashesDenoteHost);
  };

  function parse$1(self, url, parseQueryString, slashesDenoteHost) {
    if (!isString(url)) {
陈帅's avatar
陈帅 committed
3365
      throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
期贤's avatar
期贤 committed
3366 3367 3368 3369 3370
    } // Copy chrome, IE, opera backslash-handling behavior.
    // Back slashes before the query string get converted to forward slashes
    // See: https://code.google.com/p/chromium/issues/detail?id=25916

    var queryIndex = url.indexOf('?'),
陈帅's avatar
陈帅 committed
3371 3372 3373
      splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
      uSplit = url.split(splitter),
      slashRegex = /\\/g;
期贤's avatar
期贤 committed
3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429
    uSplit[0] = uSplit[0].replace(slashRegex, '/');
    url = uSplit.join(splitter);
    var rest = url; // trim before proceeding.
    // This is to support parse stuff like "  http://foo.com  \n"

    rest = rest.trim();

    if (!slashesDenoteHost && url.split('#').length === 1) {
      // Try fast path regexp
      var simplePath = simplePathPattern.exec(rest);

      if (simplePath) {
        self.path = rest;
        self.href = rest;
        self.pathname = simplePath[1];

        if (simplePath[2]) {
          self.search = simplePath[2];

          if (parseQueryString) {
            self.query = parse(self.search.substr(1));
          } else {
            self.query = self.search.substr(1);
          }
        } else if (parseQueryString) {
          self.search = '';
          self.query = {};
        }

        return self;
      }
    }

    var proto = protocolPattern.exec(rest);

    if (proto) {
      proto = proto[0];
      var lowerProto = proto.toLowerCase();
      self.protocol = lowerProto;
      rest = rest.substr(proto.length);
    } // figure out if it's got a host
    // user@server is *always* interpreted as a hostname, and url
    // resolution will treat //foo/bar as host=foo,path=bar because that's
    // how the browser resolves relative URLs.

    if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
      var slashes = rest.substr(0, 2) === '//';

      if (slashes && !(proto && hostlessProtocol[proto])) {
        rest = rest.substr(2);
        self.slashes = true;
      }
    }

    var i, hec, l, p;

陈帅's avatar
陈帅 committed
3430
    if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) {
期贤's avatar
期贤 committed
3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487
      // there's a hostname.
      // the first instance of /, ?, ;, or # ends the host.
      //
      // If there is an @ in the hostname, then non-host chars *are* allowed
      // to the left of the last @ sign, unless some host-ending character
      // comes *before* the @-sign.
      // URLs are obnoxious.
      //
      // ex:
      // http://a@b@c/ => user:a@b host:c
      // http://a@b?@c => user:a host:c path:/?@c
      // v0.12 TODO(isaacs): This is not quite how Chrome does things.
      // Review our test case against browsers more comprehensively.
      // find the first instance of any hostEndingChars
      var hostEnd = -1;

      for (i = 0; i < hostEndingChars.length; i++) {
        hec = rest.indexOf(hostEndingChars[i]);
        if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
      } // at this point, either we have an explicit point where the
      // auth portion cannot go past, or the last @ char is the decider.

      var auth, atSign;

      if (hostEnd === -1) {
        // atSign can be anywhere.
        atSign = rest.lastIndexOf('@');
      } else {
        // atSign must be in auth portion.
        // http://a@b/c@d => host:b auth:a path:/c@d
        atSign = rest.lastIndexOf('@', hostEnd);
      } // Now we have a portion which is definitely the auth.
      // Pull that off.

      if (atSign !== -1) {
        auth = rest.slice(0, atSign);
        rest = rest.slice(atSign + 1);
        self.auth = decodeURIComponent(auth);
      } // the host is the remaining to the left of the first non-host char

      hostEnd = -1;

      for (i = 0; i < nonHostChars.length; i++) {
        hec = rest.indexOf(nonHostChars[i]);
        if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
      } // if we still have not hit it, then the entire thing is a host.

      if (hostEnd === -1) hostEnd = rest.length;
      self.host = rest.slice(0, hostEnd);
      rest = rest.slice(hostEnd); // pull out port.

      parseHost(self); // we've indicated that there is a hostname,
      // so even if it's empty, it has to be present.

      self.hostname = self.hostname || ''; // if hostname begins with [ and ends with ]
      // assume that it's an IPv6 address.

陈帅's avatar
陈帅 committed
3488 3489
      var ipv6Hostname =
        self.hostname[0] === '[' && self.hostname[self.hostname.length - 1] === ']'; // validate a little.
期贤's avatar
期贤 committed
3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631

      if (!ipv6Hostname) {
        var hostparts = self.hostname.split(/\./);

        for (i = 0, l = hostparts.length; i < l; i++) {
          var part = hostparts[i];
          if (!part) continue;

          if (!part.match(hostnamePartPattern)) {
            var newpart = '';

            for (var j = 0, k = part.length; j < k; j++) {
              if (part.charCodeAt(j) > 127) {
                // we replace non-ASCII char with a temporary placeholder
                // we need this to make sure size of hostname is not
                // broken by replacing non-ASCII by nothing
                newpart += 'x';
              } else {
                newpart += part[j];
              }
            } // we test again with ASCII char only

            if (!newpart.match(hostnamePartPattern)) {
              var validParts = hostparts.slice(0, i);
              var notHost = hostparts.slice(i + 1);
              var bit = part.match(hostnamePartStart);

              if (bit) {
                validParts.push(bit[1]);
                notHost.unshift(bit[2]);
              }

              if (notHost.length) {
                rest = '/' + notHost.join('.') + rest;
              }

              self.hostname = validParts.join('.');
              break;
            }
          }
        }
      }

      if (self.hostname.length > hostnameMaxLen) {
        self.hostname = '';
      } else {
        // hostnames are always lower case.
        self.hostname = self.hostname.toLowerCase();
      }

      if (!ipv6Hostname) {
        // IDNA Support: Returns a punycoded representation of "domain".
        // It only converts parts of the domain name that
        // have non-ASCII characters, i.e. it doesn't matter if
        // you call it with a domain that already is ASCII-only.
        self.hostname = toASCII(self.hostname);
      }

      p = self.port ? ':' + self.port : '';
      var h = self.hostname || '';
      self.host = h + p;
      self.href += self.host; // strip [ and ] from the hostname
      // the host field still retains them, though

      if (ipv6Hostname) {
        self.hostname = self.hostname.substr(1, self.hostname.length - 2);

        if (rest[0] !== '/') {
          rest = '/' + rest;
        }
      }
    } // now rest is set to the post-host stuff.
    // chop off any delim chars.

    if (!unsafeProtocol[lowerProto]) {
      // First, make 100% sure that any "autoEscape" chars get
      // escaped, even if encodeURIComponent doesn't think they
      // need to be.
      for (i = 0, l = autoEscape.length; i < l; i++) {
        var ae = autoEscape[i];
        if (rest.indexOf(ae) === -1) continue;
        var esc = encodeURIComponent(ae);

        if (esc === ae) {
          esc = escape(ae);
        }

        rest = rest.split(ae).join(esc);
      }
    } // chop off from the tail first.

    var hash = rest.indexOf('#');

    if (hash !== -1) {
      // got a fragment string.
      self.hash = rest.substr(hash);
      rest = rest.slice(0, hash);
    }

    var qm = rest.indexOf('?');

    if (qm !== -1) {
      self.search = rest.substr(qm);
      self.query = rest.substr(qm + 1);

      if (parseQueryString) {
        self.query = parse(self.query);
      }

      rest = rest.slice(0, qm);
    } else if (parseQueryString) {
      // no query string, but parseQueryString still requested
      self.search = '';
      self.query = {};
    }

    if (rest) self.pathname = rest;

    if (slashedProtocol[lowerProto] && self.hostname && !self.pathname) {
      self.pathname = '/';
    } //to support http.request

    if (self.pathname || self.search) {
      p = self.pathname || '';
      var s = self.search || '';
      self.path = p + s;
    } // finally, reconstruct the href based on what has been validated.

    self.href = format(self);
    return self;
  } // format a parsed object into a url string

  function format(self) {
    var auth = self.auth || '';

    if (auth) {
      auth = encodeURIComponent(auth);
      auth = auth.replace(/%3A/i, ':');
      auth += '@';
    }

    var protocol = self.protocol || '',
陈帅's avatar
陈帅 committed
3632 3633 3634 3635
      pathname = self.pathname || '',
      hash = self.hash || '',
      host = false,
      query = '';
期贤's avatar
期贤 committed
3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650

    if (self.host) {
      host = auth + self.host;
    } else if (self.hostname) {
      host = auth + (self.hostname.indexOf(':') === -1 ? self.hostname : '[' + this.hostname + ']');

      if (self.port) {
        host += ':' + self.port;
      }
    }

    if (self.query && isObject(self.query) && Object.keys(self.query).length) {
      query = stringify(self.query);
    }

陈帅's avatar
陈帅 committed
3651
    var search = self.search || (query && '?' + query) || '';
期贤's avatar
期贤 committed
3652 3653 3654
    if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.
    // unless they had them to begin with.

陈帅's avatar
陈帅 committed
3655
    if (self.slashes || ((!protocol || slashedProtocol[protocol]) && host !== false)) {
期贤's avatar
期贤 committed
3656 3657 3658 3659 3660 3661 3662 3663
      host = '//' + (host || '');
      if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
    } else if (!host) {
      host = '';
    }

    if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
    if (search && search.charAt(0) !== '?') search = '?' + search;
陈帅's avatar
陈帅 committed
3664
    pathname = pathname.replace(/[?#]/g, function(match) {
期贤's avatar
期贤 committed
3665 3666 3667 3668 3669 3670
      return encodeURIComponent(match);
    });
    search = search.replace('#', '%23');
    return protocol + host + pathname + search + hash;
  }

陈帅's avatar
陈帅 committed
3671
  Url.prototype.format = function() {
期贤's avatar
期贤 committed
3672 3673 3674
    return format(this);
  };

陈帅's avatar
陈帅 committed
3675
  Url.prototype.resolve = function(relative) {
期贤's avatar
期贤 committed
3676 3677 3678
    return this.resolveObject(urlParse(relative, false, true)).format();
  };

陈帅's avatar
陈帅 committed
3679
  Url.prototype.resolveObject = function(relative) {
期贤's avatar
期贤 committed
3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776
    if (isString(relative)) {
      var rel = new Url();
      rel.parse(relative, false, true);
      relative = rel;
    }

    var result = new Url();
    var tkeys = Object.keys(this);

    for (var tk = 0; tk < tkeys.length; tk++) {
      var tkey = tkeys[tk];
      result[tkey] = this[tkey];
    } // hash is always overridden, no matter what.
    // even href="" will remove it.

    result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.

    if (relative.href === '') {
      result.href = result.format();
      return result;
    } // hrefs like //foo/bar always cut to the protocol.

    if (relative.slashes && !relative.protocol) {
      // take everything except the protocol from relative
      var rkeys = Object.keys(relative);

      for (var rk = 0; rk < rkeys.length; rk++) {
        var rkey = rkeys[rk];
        if (rkey !== 'protocol') result[rkey] = relative[rkey];
      } //urlParse appends trailing / to urls like http://www.example.com

      if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
        result.path = result.pathname = '/';
      }

      result.href = result.format();
      return result;
    }

    var relPath;

    if (relative.protocol && relative.protocol !== result.protocol) {
      // if it's a known url protocol, then changing
      // the protocol does weird things
      // first, if it's not file:, then we MUST have a host,
      // and if there was a path
      // to begin with, then we MUST have a path.
      // if it is file:, then the host is dropped,
      // because that's known to be hostless.
      // anything else is assumed to be absolute.
      if (!slashedProtocol[relative.protocol]) {
        var keys = Object.keys(relative);

        for (var v = 0; v < keys.length; v++) {
          var k = keys[v];
          result[k] = relative[k];
        }

        result.href = result.format();
        return result;
      }

      result.protocol = relative.protocol;

      if (!relative.host && !hostlessProtocol[relative.protocol]) {
        relPath = (relative.pathname || '').split('/');

        while (relPath.length && !(relative.host = relPath.shift()));

        if (!relative.host) relative.host = '';
        if (!relative.hostname) relative.hostname = '';
        if (relPath[0] !== '') relPath.unshift('');
        if (relPath.length < 2) relPath.unshift('');
        result.pathname = relPath.join('/');
      } else {
        result.pathname = relative.pathname;
      }

      result.search = relative.search;
      result.query = relative.query;
      result.host = relative.host || '';
      result.auth = relative.auth;
      result.hostname = relative.hostname || relative.host;
      result.port = relative.port; // to support http.request

      if (result.pathname || result.search) {
        var p = result.pathname || '';
        var s = result.search || '';
        result.path = p + s;
      }

      result.slashes = result.slashes || relative.slashes;
      result.href = result.format();
      return result;
    }

    var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
陈帅's avatar
陈帅 committed
3777 3778 3779 3780 3781 3782
      isRelAbs = relative.host || (relative.pathname && relative.pathname.charAt(0) === '/'),
      mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname),
      removeAllDots = mustEndAbs,
      srcPath = (result.pathname && result.pathname.split('/')) || [],
      psychotic = result.protocol && !slashedProtocol[result.protocol];
    relPath = (relative.pathname && relative.pathname.split('/')) || []; // if the url is a non-slashed url, then relative
期贤's avatar
期贤 committed
3783 3784 3785 3786 3787 3788 3789 3790 3791 3792
    // links like ../.. should be able
    // to crawl up to the hostname, as well.  This is strange.
    // result.protocol has already been set by now.
    // Later on, put the first path part into the host field.

    if (psychotic) {
      result.hostname = '';
      result.port = null;

      if (result.host) {
陈帅's avatar
陈帅 committed
3793 3794
        if (srcPath[0] === '') srcPath[0] = result.host;
        else srcPath.unshift(result.host);
期贤's avatar
期贤 committed
3795 3796 3797 3798 3799 3800 3801 3802 3803
      }

      result.host = '';

      if (relative.protocol) {
        relative.hostname = null;
        relative.port = null;

        if (relative.host) {
陈帅's avatar
陈帅 committed
3804 3805
          if (relPath[0] === '') relPath[0] = relative.host;
          else relPath.unshift(relative.host);
期贤's avatar
期贤 committed
3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818
        }

        relative.host = null;
      }

      mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
    }

    var authInHost;

    if (isRelAbs) {
      // it's absolute.
      result.host = relative.host || relative.host === '' ? relative.host : result.host;
陈帅's avatar
陈帅 committed
3819 3820
      result.hostname =
        relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
期贤's avatar
期贤 committed
3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852
      result.search = relative.search;
      result.query = relative.query;
      srcPath = relPath; // fall through to the dot-handling below.
    } else if (relPath.length) {
      // it's relative
      // throw away the existing file, and take the new path instead.
      if (!srcPath) srcPath = [];
      srcPath.pop();
      srcPath = srcPath.concat(relPath);
      result.search = relative.search;
      result.query = relative.query;
    } else if (!isNullOrUndefined(relative.search)) {
      // just pull out the search.
      // like href='?foo'.
      // Put this after the other two cases because it simplifies the booleans
      if (psychotic) {
        result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host
        //this especially happens in cases like
        //url.resolveObject('mailto:local1@domain1', 'local2@domain2')

        authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;

        if (authInHost) {
          result.auth = authInHost.shift();
          result.host = result.hostname = authInHost.shift();
        }
      }

      result.search = relative.search;
      result.query = relative.query; //to support http.request

      if (!isNull(result.pathname) || !isNull(result.search)) {
陈帅's avatar
陈帅 committed
3853 3854
        result.path =
          (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
期贤's avatar
期贤 committed
3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878
      }

      result.href = result.format();
      return result;
    }

    if (!srcPath.length) {
      // no path at all.  easy.
      // we've already handled the other stuff above.
      result.pathname = null; //to support http.request

      if (result.search) {
        result.path = '/' + result.search;
      } else {
        result.path = null;
      }

      result.href = result.format();
      return result;
    } // if a url ENDs in . or .., then it must get a trailing slash.
    // however, if it ends in anything else non-slashy,
    // then it must NOT get a trailing slash.

    var last = srcPath.slice(-1)[0];
陈帅's avatar
陈帅 committed
3879 3880 3881
    var hasTrailingSlash =
      ((result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..')) ||
      last === ''; // strip single dots, resolve double dots to parent dir
期贤's avatar
期贤 committed
3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913
    // if the path tries to go above the root, `up` ends up > 0

    var up = 0;

    for (var i = srcPath.length; i >= 0; i--) {
      last = srcPath[i];

      if (last === '.') {
        srcPath.splice(i, 1);
      } else if (last === '..') {
        srcPath.splice(i, 1);
        up++;
      } else if (up) {
        srcPath.splice(i, 1);
        up--;
      }
    } // if the path is allowed to go above the root, restore leading ..s

    if (!mustEndAbs && !removeAllDots) {
      for (; up--; up) {
        srcPath.unshift('..');
      }
    }

    if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
      srcPath.unshift('');
    }

    if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
      srcPath.push('');
    }

陈帅's avatar
陈帅 committed
3914
    var isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/'); // put the host back
期贤's avatar
期贤 committed
3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928

    if (psychotic) {
      result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host
      //this especially happens in cases like
      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')

      authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;

      if (authInHost) {
        result.auth = authInHost.shift();
        result.host = result.hostname = authInHost.shift();
      }
    }

陈帅's avatar
陈帅 committed
3929
    mustEndAbs = mustEndAbs || (result.host && srcPath.length);
期贤's avatar
期贤 committed
3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951

    if (mustEndAbs && !isAbsolute) {
      srcPath.unshift('');
    }

    if (!srcPath.length) {
      result.pathname = null;
      result.path = null;
    } else {
      result.pathname = srcPath.join('/');
    } //to support request.http

    if (!isNull(result.pathname) || !isNull(result.search)) {
      result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
    }

    result.auth = relative.auth || result.auth;
    result.slashes = result.slashes || relative.slashes;
    result.href = result.format();
    return result;
  };

陈帅's avatar
陈帅 committed
3952
  Url.prototype.parseHost = function() {
期贤's avatar
期贤 committed
3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979
    return parseHost(this);
  };

  function parseHost(self) {
    var host = self.host;
    var port = portPattern.exec(host);

    if (port) {
      port = port[0];

      if (port !== ':') {
        self.port = port.substr(1);
      }

      host = host.substr(0, host.length - port.length);
    }

    if (host) self.hostname = host;
  }

  let tableListDataSource = [];

  for (let i = 0; i < 46; i += 1) {
    tableListDataSource.push({
      key: i,
      disabled: i % 6 === 0,
      href: 'https://ant.design',
陈帅's avatar
陈帅 committed
3980 3981 3982 3983
      avatar: [
        'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
        'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
      ][i % 2],
期贤's avatar
期贤 committed
3984 3985 3986 3987 3988 3989 3990 3991
      name: `TradeCode ${i}`,
      title: `一个任务名称 ${i}`,
      owner: '曲丽丽',
      desc: '这是一段描述',
      callNo: Math.floor(Math.random() * 1000),
      status: Math.floor(Math.random() * 10) % 4,
      updatedAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
      createdAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
陈帅's avatar
陈帅 committed
3992
      progress: Math.ceil(Math.random() * 100),
期贤's avatar
期贤 committed
3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020
    });
  }

  function getRule(req, res, u) {
    let url = u;

    if (!url || Object.prototype.toString.call(url) !== '[object String]') {
      url = req.url; // eslint-disable-line
    }

    const params = urlParse(url, true).query;
    let dataSource = tableListDataSource;

    if (params.sorter) {
      const s = params.sorter.split('_');
      dataSource = dataSource.sort((prev, next) => {
        if (s[1] === 'descend') {
          return next[s[0]] - prev[s[0]];
        }

        return prev[s[0]] - next[s[0]];
      });
    }

    if (params.status) {
      const status = params.status.split(',');
      let filterDataSource = [];
      status.forEach(s => {
陈帅's avatar
陈帅 committed
4021 4022 4023
        filterDataSource = filterDataSource.concat(
          dataSource.filter(data => parseInt(data.status, 10) === parseInt(s[0], 10)),
        );
期贤's avatar
期贤 committed
4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042
      });
      dataSource = filterDataSource;
    }

    if (params.name) {
      dataSource = dataSource.filter(data => data.name.indexOf(params.name) > -1);
    }

    let pageSize = 10;

    if (params.pageSize) {
      pageSize = params.pageSize * 1;
    }

    const result = {
      list: dataSource,
      pagination: {
        total: dataSource.length,
        pageSize,
陈帅's avatar
陈帅 committed
4043 4044
        current: parseInt(params.currentPage, 10) || 1,
      },
期贤's avatar
期贤 committed
4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055
    };
    return res.json(result);
  }

  function postRule(req, res, u, b) {
    let url = u;

    if (!url || Object.prototype.toString.call(url) !== '[object String]') {
      url = req.url; // eslint-disable-line
    }

陈帅's avatar
陈帅 committed
4056 4057
    const body = (b && b.body) || req.body;
    const { method, name, desc, key } = body;
期贤's avatar
期贤 committed
4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069

    switch (method) {
      /* eslint no-case-declarations:0 */
      case 'delete':
        tableListDataSource = tableListDataSource.filter(item => key.indexOf(item.key) === -1);
        break;

      case 'post':
        const i = Math.ceil(Math.random() * 10000);
        tableListDataSource.unshift({
          key: i,
          href: 'https://ant.design',
陈帅's avatar
陈帅 committed
4070 4071 4072 4073
          avatar: [
            'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
            'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
          ][i % 2],
期贤's avatar
期贤 committed
4074 4075 4076 4077 4078 4079 4080 4081
          name: `TradeCode ${i}`,
          title: `一个任务名称 ${i}`,
          owner: '曲丽丽',
          desc,
          callNo: Math.floor(Math.random() * 1000),
          status: Math.floor(Math.random() * 10) % 2,
          updatedAt: new Date(),
          createdAt: new Date(),
陈帅's avatar
陈帅 committed
4082
          progress: Math.ceil(Math.random() * 100),
期贤's avatar
期贤 committed
4083 4084 4085 4086 4087 4088 4089 4090
        });
        break;

      case 'update':
        tableListDataSource = tableListDataSource.map(item => {
          if (item.key === key) {
            Object.assign(item, {
              desc,
陈帅's avatar
陈帅 committed
4091
              name,
期贤's avatar
期贤 committed
4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108
            });
            return item;
          }

          return item;
        });
        break;

      default:
        break;
    }

    return getRule(req, res, u);
  }

  var rule = {
    'GET /api/rule': getRule,
陈帅's avatar
陈帅 committed
4109
    'POST /api/rule': postRule,
期贤's avatar
期贤 committed
4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122
  };

  // 代码中会兼容本地 service mock 以及部署站点的静态数据
  var user$1 = {
    // 支持值为 Object 和 Array
    'GET /api/currentUser': {
      name: 'Serati Ma',
      avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
      userid: '00000001',
      email: 'antdesign@alipay.com',
      signature: '海纳百川,有容乃大',
      title: '交互专家',
      group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
陈帅's avatar
add tag  
陈帅 committed
4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148
      tags: [
        {
          key: '0',
          label: '很有想法的',
        },
        {
          key: '1',
          label: '专注设计',
        },
        {
          key: '2',
          label: '辣~',
        },
        {
          key: '3',
          label: '大长腿',
        },
        {
          key: '4',
          label: '川妹子',
        },
        {
          key: '5',
          label: '海纳百川',
        },
      ],
陈帅's avatar
陈帅 committed
4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210
      notice: [
        {
          id: 'xxx1',
          title: titles[0],
          logo: avatars[0],
          description: '那是一种内在的东西,他们到达不了,也无法触及的',
          updatedAt: new Date(),
          member: '科学搬砖组',
          href: '',
          memberLink: '',
        },
        {
          id: 'xxx2',
          title: titles[1],
          logo: avatars[1],
          description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
          updatedAt: new Date('2017-07-24'),
          member: '全组都是吴彦祖',
          href: '',
          memberLink: '',
        },
        {
          id: 'xxx3',
          title: titles[2],
          logo: avatars[2],
          description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
          updatedAt: new Date(),
          member: '中二少女团',
          href: '',
          memberLink: '',
        },
        {
          id: 'xxx4',
          title: titles[3],
          logo: avatars[3],
          description: '那时候我只会想自己想要什么,从不想自己拥有什么',
          updatedAt: new Date('2017-07-23'),
          member: '程序员日常',
          href: '',
          memberLink: '',
        },
        {
          id: 'xxx5',
          title: titles[4],
          logo: avatars[4],
          description: '凛冬将至',
          updatedAt: new Date('2017-07-23'),
          member: '高逼格设计天团',
          href: '',
          memberLink: '',
        },
        {
          id: 'xxx6',
          title: titles[5],
          logo: avatars[5],
          description: '生命就像一盒巧克力,结果往往出人意料',
          updatedAt: new Date('2017-07-23'),
          member: '骗你来学计算机',
          href: '',
          memberLink: '',
        },
      ],
期贤's avatar
期贤 committed
4211 4212 4213 4214 4215 4216
      notifyCount: 12,
      unreadCount: 11,
      country: 'China',
      geographic: {
        province: {
          label: '浙江省',
陈帅's avatar
陈帅 committed
4217
          key: '330000',
期贤's avatar
期贤 committed
4218 4219 4220
        },
        city: {
          label: '杭州市',
陈帅's avatar
陈帅 committed
4221 4222
          key: '330100',
        },
期贤's avatar
期贤 committed
4223 4224
      },
      address: '西湖区工专路 77 号',
陈帅's avatar
陈帅 committed
4225
      phone: '0752-268888888',
期贤's avatar
期贤 committed
4226 4227
    },
    // GET POST 可省略
陈帅's avatar
陈帅 committed
4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247
    'GET /api/users': [
      {
        key: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York No. 1 Lake Park',
      },
      {
        key: '2',
        name: 'Jim Green',
        age: 42,
        address: 'London No. 1 Lake Park',
      },
      {
        key: '3',
        name: 'Joe Black',
        age: 32,
        address: 'Sidney No. 1 Lake Park',
      },
    ],
期贤's avatar
期贤 committed
4248
    'POST /api/login/account': (req, res) => {
陈帅's avatar
陈帅 committed
4249
      const { password, userName, type } = req.body;
期贤's avatar
期贤 committed
4250 4251 4252 4253 4254

      if (password === 'ant.design' && userName === 'admin') {
        res.send({
          status: 'ok',
          type,
陈帅's avatar
陈帅 committed
4255
          currentAuthority: 'admin',
期贤's avatar
期贤 committed
4256 4257 4258 4259 4260 4261 4262 4263
        });
        return;
      }

      if (password === 'ant.design' && userName === 'user') {
        res.send({
          status: 'ok',
          type,
陈帅's avatar
陈帅 committed
4264
          currentAuthority: 'user',
期贤's avatar
期贤 committed
4265 4266 4267 4268 4269 4270 4271
        });
        return;
      }

      res.send({
        status: 'error',
        type,
陈帅's avatar
陈帅 committed
4272
        currentAuthority: 'guest',
期贤's avatar
期贤 committed
4273 4274 4275 4276 4277
      });
    },
    'POST /api/register': (req, res) => {
      res.send({
        status: 'ok',
陈帅's avatar
陈帅 committed
4278
        currentAuthority: 'user',
期贤's avatar
期贤 committed
4279 4280 4281 4282 4283 4284 4285 4286
      });
    },
    'GET /api/500': (req, res) => {
      res.status(500).send({
        timestamp: 1513932555104,
        status: 500,
        error: 'error',
        message: 'error',
陈帅's avatar
陈帅 committed
4287
        path: '/base/category/list',
期贤's avatar
期贤 committed
4288 4289 4290 4291 4292 4293 4294 4295
      });
    },
    'GET /api/404': (req, res) => {
      res.status(404).send({
        timestamp: 1513932643431,
        status: 404,
        error: 'Not Found',
        message: 'No message available',
陈帅's avatar
陈帅 committed
4296
        path: '/base/category/list/2121212',
期贤's avatar
期贤 committed
4297 4298 4299 4300 4301 4302 4303 4304
      });
    },
    'GET /api/403': (req, res) => {
      res.status(403).send({
        timestamp: 1513932555104,
        status: 403,
        error: 'Unauthorized',
        message: 'Unauthorized',
陈帅's avatar
陈帅 committed
4305
        path: '/base/category/list',
期贤's avatar
期贤 committed
4306 4307 4308 4309 4310 4311 4312 4313
      });
    },
    'GET /api/401': (req, res) => {
      res.status(401).send({
        timestamp: 1513932555104,
        status: 401,
        error: 'Unauthorized',
        message: 'Unauthorized',
陈帅's avatar
陈帅 committed
4314
        path: '/base/category/list',
期贤's avatar
期贤 committed
4315
      });
陈帅's avatar
陈帅 committed
4316
    },
期贤's avatar
期贤 committed
4317 4318 4319 4320 4321
  };

  const data = _objectSpread({}, api, chart, geographic, notices, profile, rule, user$1);

  return data;
陈帅's avatar
陈帅 committed
4322
});