Commit 3d3b5ad4 authored by 陈帅's avatar 陈帅

script: use default prettier

parent fc136b6a
ports: ports:
- port: 8000 - port: 8000
onOpen: open-preview onOpen: open-preview
tasks: tasks:
- init: npm install - init: npm install
command: npm start command: npm start
...@@ -2,3 +2,15 @@ ...@@ -2,3 +2,15 @@
package.json package.json
.umi .umi
.umi-production .umi-production
/dist
.dockerignore
.DS_Store
.eslintignore
*.png
*.toml
docker
.editorconfig
Dockerfile*
.gitignore
.prettierignore
LICENSE
\ No newline at end of file
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
"options": { "options": {
"parser": "json" "parser": "json"
} }
},
{
"files": "document.ejs",
"options": {
"parser": "html"
}
} }
] ]
} }
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
"stylelint-config-rational-order", "stylelint-config-rational-order",
"stylelint-config-prettier" "stylelint-config-prettier"
], ],
"plugins": [ "plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"],
"stylelint-order",
"stylelint-declaration-block-no-ignored-properties"
],
"rules": { "rules": {
"no-descending-specificity": null, "no-descending-specificity": null,
"plugin/declaration-block-no-ignored-properties": true "plugin/declaration-block-no-ignored-properties": true
......
...@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo ...@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
Examples of behavior that contributes to creating a positive environment include: Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language - Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences - Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism - Gracefully accepting constructive criticism
* Focusing on what is best for the community - Focusing on what is best for the community
* Showing empathy towards other community members - Showing empathy towards other community members
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances - The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks - Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment - Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission - Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting - Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities ## Our Responsibilities
......
...@@ -115,7 +115,6 @@ Toute forme de contribution est la bienvenue, voici quelques exemples de façons ...@@ -115,7 +115,6 @@ Toute forme de contribution est la bienvenue, voici quelques exemples de façons
- Soumettre des [issues](http://github.com/ant-design/ant-design-pro/issues) pour reporter les bugs ou poser des questions. - Soumettre des [issues](http://github.com/ant-design/ant-design-pro/issues) pour reporter les bugs ou poser des questions.
- Proposer des [pull requests](http://github.com/ant-design/ant-design-pro/pulls) pour améliorer notre code. - Proposer des [pull requests](http://github.com/ant-design/ant-design-pro/pulls) pour améliorer notre code.
<div align="center"> <div align="center">
<a href="https://www.netlify.com"> <a href="https://www.netlify.com">
<img src="https://www.netlify.com/img/global/badges/netlify-color-bg.svg"/> <img src="https://www.netlify.com/img/global/badges/netlify-color-bg.svg"/>
......
...@@ -112,4 +112,4 @@ const getAntdSerials = (color: string) => { ...@@ -112,4 +112,4 @@ const getAntdSerials = (color: string) => {
}); });
const colorPalettes = generate(color); const colorPalettes = generate(color);
return lightens.concat(colorPalettes); return lightens.concat(colorPalettes);
} };
version: "3.5" version: '3.5'
services: services:
ant-design-pro_dev: ant-design-pro_dev:
...@@ -7,7 +7,7 @@ services: ...@@ -7,7 +7,7 @@ services:
build: build:
context: ../ context: ../
dockerfile: Dockerfile.dev dockerfile: Dockerfile.dev
container_name: "ant-design-pro_dev" container_name: 'ant-design-pro_dev'
volumes: volumes:
- ../src:/usr/src/app/src - ../src:/usr/src/app/src
- ../config:/usr/src/app/config - ../config:/usr/src/app/config
......
(function (global, factory) { (function(global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('mockjs'), require('moment')) : typeof exports === 'object' && typeof module !== 'undefined'
typeof define === 'function' && define.amd ? define(['mockjs', 'moment'], factory) : ? (module.exports = factory(require('mockjs'), require('moment')))
(global = global || self, global.mock = factory(global.mockjs, global.moment)); : typeof define === 'function' && define.amd
}(this, function (mockjs, moment) { 'use strict'; ? define(['mockjs', 'moment'], factory)
: ((global = global || self), (global.mock = factory(global.mockjs, global.moment)));
})(this, function(mockjs, moment) {
'use strict';
mockjs = mockjs && mockjs.hasOwnProperty('default') ? mockjs['default'] : mockjs; mockjs = mockjs && mockjs.hasOwnProperty('default') ? mockjs['default'] : mockjs;
moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment; moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;
...@@ -13,7 +16,7 @@ ...@@ -13,7 +16,7 @@
value: value, value: value,
enumerable: true, enumerable: true,
configurable: true, configurable: true,
writable: true writable: true,
}); });
} else { } else {
obj[key] = value; obj[key] = value;
...@@ -28,12 +31,14 @@ ...@@ -28,12 +31,14 @@
var ownKeys = Object.keys(source); var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') { if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable; return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})); }),
);
} }
ownKeys.forEach(function (key) { ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]); _defineProperty(target, key, source[key]);
}); });
} }
...@@ -41,19 +46,63 @@ ...@@ -41,19 +46,63 @@
return target; return target;
} }
const titles = ['Alipay', 'Angular', 'Ant Design', 'Ant Design Pro', 'Bootstrap', 'React', 'Vue', 'Webpack']; const titles = [
const avatars = ['https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay '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/zOsKZmFRdUtvpqCImOVY.png', // Angular
'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png', // Ant Design '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/sfjbOqnsXXJgNCjCzDBL.png', // Ant Design Pro
'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap
'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React 'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React
'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue
'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png']; '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 avatars2 = [
const desc = ['那是一种内在的东西, 他们到达不了,也无法触及的', '希望是一个好东西,也许是最好的,好东西是不会消亡的', '生命就像一盒巧克力,结果往往出人意料', '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', '那时候我只会想自己想要什么,从不想自己拥有什么']; 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
const user = ['付小小', '曲丽丽', '林东东', '周星星', '吴加好', '朱偏右', '鱼酱', '乐哥', '谭小仪', '仲尼']; '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 = [
'付小小',
'曲丽丽',
'林东东',
'周星星',
'吴加好',
'朱偏右',
'鱼酱',
'乐哥',
'谭小仪',
'仲尼',
];
function fakeList(count) { function fakeList(count) {
const list = []; const list = [];
...@@ -64,7 +113,7 @@ ...@@ -64,7 +113,7 @@
owner: user[i % 10], owner: user[i % 10],
title: titles[i % 8], title: titles[i % 8],
avatar: avatars[i % 8], avatar: avatars[i % 8],
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4], cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)],
status: ['active', 'exception', 'normal'][i % 3], status: ['active', 'exception', 'normal'][i % 3],
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
...@@ -72,26 +121,32 @@ ...@@ -72,26 +121,32 @@
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i), updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
createdAt: 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], subDescription: desc[i % 5],
description: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
activeUser: Math.ceil(Math.random() * 100000) + 100000, activeUser: Math.ceil(Math.random() * 100000) + 100000,
newUser: Math.ceil(Math.random() * 1000) + 1000, newUser: Math.ceil(Math.random() * 1000) + 1000,
star: Math.ceil(Math.random() * 100) + 100, star: Math.ceil(Math.random() * 100) + 100,
like: Math.ceil(Math.random() * 100) + 100, like: Math.ceil(Math.random() * 100) + 100,
message: Math.ceil(Math.random() * 10) + 10, message: Math.ceil(Math.random() * 10) + 10,
content: '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。', content:
members: [{ '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
members: [
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
name: '曲丽丽', name: '曲丽丽',
id: 'member1' id: 'member1',
}, { },
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
name: '王昭君', name: '王昭君',
id: 'member2' id: 'member2',
}, { },
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
name: '董娜娜', name: '董娜娜',
id: 'member3' id: 'member3',
}] },
],
}); });
} }
...@@ -111,13 +166,10 @@ ...@@ -111,13 +166,10 @@
function postFakeList(req, res) { function postFakeList(req, res) {
const { const {
/* url = '', */ /* url = '', */
body body,
} = req; // const params = getUrlParams(url); } = req; // const params = getUrlParams(url);
const { const { method, id } = body; // const count = (params.count * 1) || 20;
method,
id
} = body; // const count = (params.count * 1) || 20;
let result = sourceData; let result = sourceData;
...@@ -138,7 +190,7 @@ ...@@ -138,7 +190,7 @@
result.unshift({ result.unshift({
body, body,
id: `fake-list-${result.length}`, id: `fake-list-${result.length}`,
createdAt: new Date().getTime() createdAt: new Date().getTime(),
}); });
break; break;
...@@ -149,7 +201,8 @@ ...@@ -149,7 +201,8 @@
return res.json(result); return res.json(result);
} }
const getNotice = [{ const getNotice = [
{
id: 'xxx1', id: 'xxx1',
title: titles[0], title: titles[0],
logo: avatars[0], logo: avatars[0],
...@@ -157,8 +210,9 @@ ...@@ -157,8 +210,9 @@
updatedAt: new Date(), updatedAt: new Date(),
member: '科学搬砖组', member: '科学搬砖组',
href: '', href: '',
memberLink: '' memberLink: '',
}, { },
{
id: 'xxx2', id: 'xxx2',
title: titles[1], title: titles[1],
logo: avatars[1], logo: avatars[1],
...@@ -166,8 +220,9 @@ ...@@ -166,8 +220,9 @@
updatedAt: new Date('2017-07-24'), updatedAt: new Date('2017-07-24'),
member: '全组都是吴彦祖', member: '全组都是吴彦祖',
href: '', href: '',
memberLink: '' memberLink: '',
}, { },
{
id: 'xxx3', id: 'xxx3',
title: titles[2], title: titles[2],
logo: avatars[2], logo: avatars[2],
...@@ -175,8 +230,9 @@ ...@@ -175,8 +230,9 @@
updatedAt: new Date(), updatedAt: new Date(),
member: '中二少女团', member: '中二少女团',
href: '', href: '',
memberLink: '' memberLink: '',
}, { },
{
id: 'xxx4', id: 'xxx4',
title: titles[3], title: titles[3],
logo: avatars[3], logo: avatars[3],
...@@ -184,8 +240,9 @@ ...@@ -184,8 +240,9 @@
updatedAt: new Date('2017-07-23'), updatedAt: new Date('2017-07-23'),
member: '程序员日常', member: '程序员日常',
href: '', href: '',
memberLink: '' memberLink: '',
}, { },
{
id: 'xxx5', id: 'xxx5',
title: titles[4], title: titles[4],
logo: avatars[4], logo: avatars[4],
...@@ -193,8 +250,9 @@ ...@@ -193,8 +250,9 @@
updatedAt: new Date('2017-07-23'), updatedAt: new Date('2017-07-23'),
member: '高逼格设计天团', member: '高逼格设计天团',
href: '', href: '',
memberLink: '' memberLink: '',
}, { },
{
id: 'xxx6', id: 'xxx6',
title: titles[5], title: titles[5],
logo: avatars[5], logo: avatars[5],
...@@ -202,101 +260,109 @@ ...@@ -202,101 +260,109 @@
updatedAt: new Date('2017-07-23'), updatedAt: new Date('2017-07-23'),
member: '骗你来学计算机', member: '骗你来学计算机',
href: '', href: '',
memberLink: '' memberLink: '',
}]; },
const getActivities = [{ ];
const getActivities = [
{
id: 'trend-1', id: 'trend-1',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '曲丽丽', name: '曲丽丽',
avatar: avatars2[0] avatar: avatars2[0],
}, },
group: { group: {
name: '高逼格设计天团', name: '高逼格设计天团',
link: 'http://github.com/' link: 'http://github.com/',
}, },
project: { project: {
name: '六月迭代', name: '六月迭代',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '在 @{group} 新建项目 @{project}' template: '在 @{group} 新建项目 @{project}',
}, { },
{
id: 'trend-2', id: 'trend-2',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '付小小', name: '付小小',
avatar: avatars2[1] avatar: avatars2[1],
}, },
group: { group: {
name: '高逼格设计天团', name: '高逼格设计天团',
link: 'http://github.com/' link: 'http://github.com/',
}, },
project: { project: {
name: '六月迭代', name: '六月迭代',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '在 @{group} 新建项目 @{project}' template: '在 @{group} 新建项目 @{project}',
}, { },
{
id: 'trend-3', id: 'trend-3',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '林东东', name: '林东东',
avatar: avatars2[2] avatar: avatars2[2],
}, },
group: { group: {
name: '中二少女团', name: '中二少女团',
link: 'http://github.com/' link: 'http://github.com/',
}, },
project: { project: {
name: '六月迭代', name: '六月迭代',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '在 @{group} 新建项目 @{project}' template: '在 @{group} 新建项目 @{project}',
}, { },
{
id: 'trend-4', id: 'trend-4',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '周星星', name: '周星星',
avatar: avatars2[4] avatar: avatars2[4],
}, },
project: { project: {
name: '5 月日常迭代', name: '5 月日常迭代',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '将 @{project} 更新至已发布状态' template: '将 @{project} 更新至已发布状态',
}, { },
{
id: 'trend-5', id: 'trend-5',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '朱偏右', name: '朱偏右',
avatar: avatars2[3] avatar: avatars2[3],
}, },
project: { project: {
name: '工程效能', name: '工程效能',
link: 'http://github.com/' link: 'http://github.com/',
}, },
comment: { comment: {
name: '留言', name: '留言',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '在 @{project} 发布了 @{comment}' template: '在 @{project} 发布了 @{comment}',
}, { },
{
id: 'trend-6', id: 'trend-6',
updatedAt: new Date(), updatedAt: new Date(),
user: { user: {
name: '乐哥', name: '乐哥',
avatar: avatars2[5] avatar: avatars2[5],
}, },
group: { group: {
name: '程序员日常', name: '程序员日常',
link: 'http://github.com/' link: 'http://github.com/',
}, },
project: { project: {
name: '品牌迭代', name: '品牌迭代',
link: 'http://github.com/' link: 'http://github.com/',
}, },
template: '在 @{group} 新建项目 @{project}' template: '在 @{group} 新建项目 @{project}',
}]; },
];
function getFakeCaptcha(req, res) { function getFakeCaptcha(req, res) {
return res.json('captcha-xxx'); return res.json('captcha-xxx');
...@@ -307,19 +373,21 @@ ...@@ -307,19 +373,21 @@
'GET /api/activities': getActivities, 'GET /api/activities': getActivities,
'POST /api/forms': (req, res) => { 'POST /api/forms': (req, res) => {
res.send({ res.send({
message: 'Ok' message: 'Ok',
}); });
}, },
'GET /api/tags': mockjs.mock({ 'GET /api/tags': mockjs.mock({
'list|100': [{ 'list|100': [
{
name: '@city', name: '@city',
'value|1-100': 150, 'value|1-100': 150,
'type|0-2': 1 'type|0-2': 1,
}] },
],
}), }),
'GET /api/fake_list': getFakeList, 'GET /api/fake_list': getFakeList,
'POST /api/fake_list': postFakeList, 'POST /api/fake_list': postFakeList,
'GET /api/captcha': getFakeCaptcha 'GET /api/captcha': getFakeCaptcha,
}; };
const visitData = []; const visitData = [];
...@@ -329,7 +397,7 @@ ...@@ -329,7 +397,7 @@
for (let i = 0; i < fakeY.length; i += 1) { for (let i = 0; i < fakeY.length; i += 1) {
visitData.push({ visitData.push({
x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'), x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
y: fakeY[i] y: fakeY[i],
}); });
} }
...@@ -339,7 +407,7 @@ ...@@ -339,7 +407,7 @@
for (let i = 0; i < fakeY2.length; i += 1) { for (let i = 0; i < fakeY2.length; i += 1) {
visitData2.push({ visitData2.push({
x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'), x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
y: fakeY2[i] y: fakeY2[i],
}); });
} }
...@@ -348,7 +416,7 @@ ...@@ -348,7 +416,7 @@
for (let i = 0; i < 12; i += 1) { for (let i = 0; i < 12; i += 1) {
salesData.push({ salesData.push({
x: `${i + 1}月`, x: `${i + 1}月`,
y: Math.floor(Math.random() * 1000) + 200 y: Math.floor(Math.random() * 1000) + 200,
}); });
} }
...@@ -360,70 +428,90 @@ ...@@ -360,70 +428,90 @@
keyword: `搜索关键词-${i}`, keyword: `搜索关键词-${i}`,
count: Math.floor(Math.random() * 1000), count: Math.floor(Math.random() * 1000),
range: Math.floor(Math.random() * 100), range: Math.floor(Math.random() * 100),
status: Math.floor(Math.random() * 10 % 2) status: Math.floor((Math.random() * 10) % 2),
}); });
} }
const salesTypeData = [{ const salesTypeData = [
{
x: '家用电器', x: '家用电器',
y: 4544 y: 4544,
}, { },
{
x: '食用酒水', x: '食用酒水',
y: 3321 y: 3321,
}, { },
{
x: '个护健康', x: '个护健康',
y: 3113 y: 3113,
}, { },
{
x: '服饰箱包', x: '服饰箱包',
y: 2341 y: 2341,
}, { },
{
x: '母婴产品', x: '母婴产品',
y: 1231 y: 1231,
}, { },
{
x: '其他', x: '其他',
y: 1231 y: 1231,
}]; },
const salesTypeDataOnline = [{ ];
const salesTypeDataOnline = [
{
x: '家用电器', x: '家用电器',
y: 244 y: 244,
}, { },
{
x: '食用酒水', x: '食用酒水',
y: 321 y: 321,
}, { },
{
x: '个护健康', x: '个护健康',
y: 311 y: 311,
}, { },
{
x: '服饰箱包', x: '服饰箱包',
y: 41 y: 41,
}, { },
{
x: '母婴产品', x: '母婴产品',
y: 121 y: 121,
}, { },
{
x: '其他', x: '其他',
y: 111 y: 111,
}]; },
const salesTypeDataOffline = [{ ];
const salesTypeDataOffline = [
{
x: '家用电器', x: '家用电器',
y: 99 y: 99,
}, { },
{
x: '食用酒水', x: '食用酒水',
y: 188 y: 188,
}, { },
{
x: '个护健康', x: '个护健康',
y: 344 y: 344,
}, { },
{
x: '服饰箱包', x: '服饰箱包',
y: 255 y: 255,
}, { },
{
x: '其他', x: '其他',
y: 65 y: 65,
}]; },
];
const offlineData = []; const offlineData = [];
for (let i = 0; i < 10; i += 1) { for (let i = 0; i < 10; i += 1) {
offlineData.push({ offlineData.push({
name: `Stores ${i}`, name: `Stores ${i}`,
cvr: Math.ceil(Math.random() * 9) / 10 cvr: Math.ceil(Math.random() * 9) / 10,
}); });
} }
...@@ -433,39 +521,43 @@ ...@@ -433,39 +521,43 @@
offlineChartData.push({ offlineChartData.push({
x: new Date().getTime() + 1000 * 60 * 30 * i, x: new Date().getTime() + 1000 * 60 * 30 * i,
y1: Math.floor(Math.random() * 100) + 10, y1: Math.floor(Math.random() * 100) + 10,
y2: Math.floor(Math.random() * 100) + 10 y2: Math.floor(Math.random() * 100) + 10,
}); });
} }
const radarOriginData = [{ const radarOriginData = [
{
name: '个人', name: '个人',
ref: 10, ref: 10,
koubei: 8, koubei: 8,
output: 4, output: 4,
contribute: 5, contribute: 5,
hot: 7 hot: 7,
}, { },
{
name: '团队', name: '团队',
ref: 3, ref: 3,
koubei: 9, koubei: 9,
output: 6, output: 6,
contribute: 3, contribute: 3,
hot: 1 hot: 1,
}, { },
{
name: '部门', name: '部门',
ref: 4, ref: 4,
koubei: 1, koubei: 1,
output: 6, output: 6,
contribute: 5, contribute: 5,
hot: 7 hot: 7,
}]; },
];
const radarData = []; const radarData = [];
const radarTitleMap = { const radarTitleMap = {
ref: '引用', ref: '引用',
koubei: '口碑', koubei: '口碑',
output: '产量', output: '产量',
contribute: '贡献', contribute: '贡献',
hot: '热度' hot: '热度',
}; };
radarOriginData.forEach(item => { radarOriginData.forEach(item => {
Object.keys(item).forEach(key => { Object.keys(item).forEach(key => {
...@@ -473,7 +565,7 @@ ...@@ -473,7 +565,7 @@
radarData.push({ radarData.push({
name: item.name, name: item.name,
label: radarTitleMap[key], label: radarTitleMap[key],
value: item[key] value: item[key],
}); });
} }
}); });
...@@ -488,1937 +580,1935 @@ ...@@ -488,1937 +580,1935 @@
salesTypeData, salesTypeData,
salesTypeDataOnline, salesTypeDataOnline,
salesTypeDataOffline, salesTypeDataOffline,
radarData radarData,
}; };
var chart = { var chart = {
'GET /api/fake_chart_data': getFakeChartData 'GET /api/fake_chart_data': getFakeChartData,
}; };
var city = { var city = {
"110000": [ '110000': [
{ {
province: "北京市", province: '北京市',
name: "市辖区", name: '市辖区',
id: "110100" id: '110100',
} },
], ],
"120000": [ '120000': [
{ {
province: "天津市", province: '天津市',
name: "市辖区", name: '市辖区',
id: "120100" id: '120100',
} },
], ],
"130000": [ '130000': [
{ {
province: "河北省", province: '河北省',
name: "石家庄市", name: '石家庄市',
id: "130100" id: '130100',
}, },
{ {
province: "河北省", province: '河北省',
name: "唐山市", name: '唐山市',
id: "130200" id: '130200',
}, },
{ {
province: "河北省", province: '河北省',
name: "秦皇岛市", name: '秦皇岛市',
id: "130300" id: '130300',
}, },
{ {
province: "河北省", province: '河北省',
name: "邯郸市", name: '邯郸市',
id: "130400" id: '130400',
}, },
{ {
province: "河北省", province: '河北省',
name: "邢台市", name: '邢台市',
id: "130500" id: '130500',
}, },
{ {
province: "河北省", province: '河北省',
name: "保定市", name: '保定市',
id: "130600" id: '130600',
}, },
{ {
province: "河北省", province: '河北省',
name: "张家口市", name: '张家口市',
id: "130700" id: '130700',
}, },
{ {
province: "河北省", province: '河北省',
name: "承德市", name: '承德市',
id: "130800" id: '130800',
}, },
{ {
province: "河北省", province: '河北省',
name: "沧州市", name: '沧州市',
id: "130900" id: '130900',
}, },
{ {
province: "河北省", province: '河北省',
name: "廊坊市", name: '廊坊市',
id: "131000" id: '131000',
}, },
{ {
province: "河北省", province: '河北省',
name: "衡水市", name: '衡水市',
id: "131100" id: '131100',
}, },
{ {
province: "河北省", province: '河北省',
name: "省直辖县级行政区划", name: '省直辖县级行政区划',
id: "139000" id: '139000',
} },
], ],
"140000": [ '140000': [
{ {
province: "山西省", province: '山西省',
name: "太原市", name: '太原市',
id: "140100" id: '140100',
}, },
{ {
province: "山西省", province: '山西省',
name: "大同市", name: '大同市',
id: "140200" id: '140200',
}, },
{ {
province: "山西省", province: '山西省',
name: "阳泉市", name: '阳泉市',
id: "140300" id: '140300',
}, },
{ {
province: "山西省", province: '山西省',
name: "长治市", name: '长治市',
id: "140400" id: '140400',
}, },
{ {
province: "山西省", province: '山西省',
name: "晋城市", name: '晋城市',
id: "140500" id: '140500',
}, },
{ {
province: "山西省", province: '山西省',
name: "朔州市", name: '朔州市',
id: "140600" id: '140600',
}, },
{ {
province: "山西省", province: '山西省',
name: "晋中市", name: '晋中市',
id: "140700" id: '140700',
}, },
{ {
province: "山西省", province: '山西省',
name: "运城市", name: '运城市',
id: "140800" id: '140800',
}, },
{ {
province: "山西省", province: '山西省',
name: "忻州市", name: '忻州市',
id: "140900" id: '140900',
}, },
{ {
province: "山西省", province: '山西省',
name: "临汾市", name: '临汾市',
id: "141000" id: '141000',
}, },
{ {
province: "山西省", province: '山西省',
name: "吕梁市", name: '吕梁市',
id: "141100" id: '141100',
} },
], ],
"150000": [ '150000': [
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "呼和浩特市", name: '呼和浩特市',
id: "150100" id: '150100',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "包头市", name: '包头市',
id: "150200" id: '150200',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "乌海市", name: '乌海市',
id: "150300" id: '150300',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "赤峰市", name: '赤峰市',
id: "150400" id: '150400',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "通辽市", name: '通辽市',
id: "150500" id: '150500',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "鄂尔多斯市", name: '鄂尔多斯市',
id: "150600" id: '150600',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "呼伦贝尔市", name: '呼伦贝尔市',
id: "150700" id: '150700',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "巴彦淖尔市", name: '巴彦淖尔市',
id: "150800" id: '150800',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "乌兰察布市", name: '乌兰察布市',
id: "150900" id: '150900',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "兴安盟", name: '兴安盟',
id: "152200" id: '152200',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "锡林郭勒盟", name: '锡林郭勒盟',
id: "152500" id: '152500',
}, },
{ {
province: "内蒙古自治区", province: '内蒙古自治区',
name: "阿拉善盟", name: '阿拉善盟',
id: "152900" id: '152900',
} },
], ],
"210000": [ '210000': [
{ {
province: "辽宁省", province: '辽宁省',
name: "沈阳市", name: '沈阳市',
id: "210100" id: '210100',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "大连市", name: '大连市',
id: "210200" id: '210200',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "鞍山市", name: '鞍山市',
id: "210300" id: '210300',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "抚顺市", name: '抚顺市',
id: "210400" id: '210400',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "本溪市", name: '本溪市',
id: "210500" id: '210500',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "丹东市", name: '丹东市',
id: "210600" id: '210600',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "锦州市", name: '锦州市',
id: "210700" id: '210700',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "营口市", name: '营口市',
id: "210800" id: '210800',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "阜新市", name: '阜新市',
id: "210900" id: '210900',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "辽阳市", name: '辽阳市',
id: "211000" id: '211000',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "盘锦市", name: '盘锦市',
id: "211100" id: '211100',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "铁岭市", name: '铁岭市',
id: "211200" id: '211200',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "朝阳市", name: '朝阳市',
id: "211300" id: '211300',
}, },
{ {
province: "辽宁省", province: '辽宁省',
name: "葫芦岛市", name: '葫芦岛市',
id: "211400" id: '211400',
} },
], ],
"220000": [ '220000': [
{ {
province: "吉林省", province: '吉林省',
name: "长春市", name: '长春市',
id: "220100" id: '220100',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "吉林市", name: '吉林市',
id: "220200" id: '220200',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "四平市", name: '四平市',
id: "220300" id: '220300',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "辽源市", name: '辽源市',
id: "220400" id: '220400',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "通化市", name: '通化市',
id: "220500" id: '220500',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "白山市", name: '白山市',
id: "220600" id: '220600',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "松原市", name: '松原市',
id: "220700" id: '220700',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "白城市", name: '白城市',
id: "220800" id: '220800',
}, },
{ {
province: "吉林省", province: '吉林省',
name: "延边朝鲜族自治州", name: '延边朝鲜族自治州',
id: "222400" id: '222400',
} },
], ],
"230000": [ '230000': [
{ {
province: "黑龙江省", province: '黑龙江省',
name: "哈尔滨市", name: '哈尔滨市',
id: "230100" id: '230100',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "齐齐哈尔市", name: '齐齐哈尔市',
id: "230200" id: '230200',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "鸡西市", name: '鸡西市',
id: "230300" id: '230300',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "鹤岗市", name: '鹤岗市',
id: "230400" id: '230400',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "双鸭山市", name: '双鸭山市',
id: "230500" id: '230500',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "大庆市", name: '大庆市',
id: "230600" id: '230600',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "伊春市", name: '伊春市',
id: "230700" id: '230700',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "佳木斯市", name: '佳木斯市',
id: "230800" id: '230800',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "七台河市", name: '七台河市',
id: "230900" id: '230900',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "牡丹江市", name: '牡丹江市',
id: "231000" id: '231000',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "黑河市", name: '黑河市',
id: "231100" id: '231100',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "绥化市", name: '绥化市',
id: "231200" id: '231200',
}, },
{ {
province: "黑龙江省", province: '黑龙江省',
name: "大兴安岭地区", name: '大兴安岭地区',
id: "232700" id: '232700',
} },
], ],
"310000": [ '310000': [
{ {
province: "上海市", province: '上海市',
name: "市辖区", name: '市辖区',
id: "310100" id: '310100',
} },
], ],
"320000": [ '320000': [
{ {
province: "江苏省", province: '江苏省',
name: "南京市", name: '南京市',
id: "320100" id: '320100',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "无锡市", name: '无锡市',
id: "320200" id: '320200',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "徐州市", name: '徐州市',
id: "320300" id: '320300',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "常州市", name: '常州市',
id: "320400" id: '320400',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "苏州市", name: '苏州市',
id: "320500" id: '320500',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "南通市", name: '南通市',
id: "320600" id: '320600',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "连云港市", name: '连云港市',
id: "320700" id: '320700',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "淮安市", name: '淮安市',
id: "320800" id: '320800',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "盐城市", name: '盐城市',
id: "320900" id: '320900',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "扬州市", name: '扬州市',
id: "321000" id: '321000',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "镇江市", name: '镇江市',
id: "321100" id: '321100',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "泰州市", name: '泰州市',
id: "321200" id: '321200',
}, },
{ {
province: "江苏省", province: '江苏省',
name: "宿迁市", name: '宿迁市',
id: "321300" id: '321300',
} },
], ],
"330000": [ '330000': [
{ {
province: "浙江省", province: '浙江省',
name: "杭州市", name: '杭州市',
id: "330100" id: '330100',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "宁波市", name: '宁波市',
id: "330200" id: '330200',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "温州市", name: '温州市',
id: "330300" id: '330300',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "嘉兴市", name: '嘉兴市',
id: "330400" id: '330400',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "湖州市", name: '湖州市',
id: "330500" id: '330500',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "绍兴市", name: '绍兴市',
id: "330600" id: '330600',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "金华市", name: '金华市',
id: "330700" id: '330700',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "衢州市", name: '衢州市',
id: "330800" id: '330800',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "舟山市", name: '舟山市',
id: "330900" id: '330900',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "台州市", name: '台州市',
id: "331000" id: '331000',
}, },
{ {
province: "浙江省", province: '浙江省',
name: "丽水市", name: '丽水市',
id: "331100" id: '331100',
} },
], ],
"340000": [ '340000': [
{ {
province: "安徽省", province: '安徽省',
name: "合肥市", name: '合肥市',
id: "340100" id: '340100',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "芜湖市", name: '芜湖市',
id: "340200" id: '340200',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "蚌埠市", name: '蚌埠市',
id: "340300" id: '340300',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "淮南市", name: '淮南市',
id: "340400" id: '340400',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "马鞍山市", name: '马鞍山市',
id: "340500" id: '340500',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "淮北市", name: '淮北市',
id: "340600" id: '340600',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "铜陵市", name: '铜陵市',
id: "340700" id: '340700',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "安庆市", name: '安庆市',
id: "340800" id: '340800',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "黄山市", name: '黄山市',
id: "341000" id: '341000',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "滁州市", name: '滁州市',
id: "341100" id: '341100',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "阜阳市", name: '阜阳市',
id: "341200" id: '341200',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "宿州市", name: '宿州市',
id: "341300" id: '341300',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "六安市", name: '六安市',
id: "341500" id: '341500',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "亳州市", name: '亳州市',
id: "341600" id: '341600',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "池州市", name: '池州市',
id: "341700" id: '341700',
}, },
{ {
province: "安徽省", province: '安徽省',
name: "宣城市", name: '宣城市',
id: "341800" id: '341800',
} },
], ],
"350000": [ '350000': [
{ {
province: "福建省", province: '福建省',
name: "福州市", name: '福州市',
id: "350100" id: '350100',
}, },
{ {
province: "福建省", province: '福建省',
name: "厦门市", name: '厦门市',
id: "350200" id: '350200',
}, },
{ {
province: "福建省", province: '福建省',
name: "莆田市", name: '莆田市',
id: "350300" id: '350300',
}, },
{ {
province: "福建省", province: '福建省',
name: "三明市", name: '三明市',
id: "350400" id: '350400',
}, },
{ {
province: "福建省", province: '福建省',
name: "泉州市", name: '泉州市',
id: "350500" id: '350500',
}, },
{ {
province: "福建省", province: '福建省',
name: "漳州市", name: '漳州市',
id: "350600" id: '350600',
}, },
{ {
province: "福建省", province: '福建省',
name: "南平市", name: '南平市',
id: "350700" id: '350700',
}, },
{ {
province: "福建省", province: '福建省',
name: "龙岩市", name: '龙岩市',
id: "350800" id: '350800',
}, },
{ {
province: "福建省", province: '福建省',
name: "宁德市", name: '宁德市',
id: "350900" id: '350900',
} },
], ],
"360000": [ '360000': [
{ {
province: "江西省", province: '江西省',
name: "南昌市", name: '南昌市',
id: "360100" id: '360100',
}, },
{ {
province: "江西省", province: '江西省',
name: "景德镇市", name: '景德镇市',
id: "360200" id: '360200',
}, },
{ {
province: "江西省", province: '江西省',
name: "萍乡市", name: '萍乡市',
id: "360300" id: '360300',
}, },
{ {
province: "江西省", province: '江西省',
name: "九江市", name: '九江市',
id: "360400" id: '360400',
}, },
{ {
province: "江西省", province: '江西省',
name: "新余市", name: '新余市',
id: "360500" id: '360500',
}, },
{ {
province: "江西省", province: '江西省',
name: "鹰潭市", name: '鹰潭市',
id: "360600" id: '360600',
}, },
{ {
province: "江西省", province: '江西省',
name: "赣州市", name: '赣州市',
id: "360700" id: '360700',
}, },
{ {
province: "江西省", province: '江西省',
name: "吉安市", name: '吉安市',
id: "360800" id: '360800',
}, },
{ {
province: "江西省", province: '江西省',
name: "宜春市", name: '宜春市',
id: "360900" id: '360900',
}, },
{ {
province: "江西省", province: '江西省',
name: "抚州市", name: '抚州市',
id: "361000" id: '361000',
}, },
{ {
province: "江西省", province: '江西省',
name: "上饶市", name: '上饶市',
id: "361100" id: '361100',
} },
], ],
"370000": [ '370000': [
{ {
province: "山东省", province: '山东省',
name: "济南市", name: '济南市',
id: "370100" id: '370100',
}, },
{ {
province: "山东省", province: '山东省',
name: "青岛市", name: '青岛市',
id: "370200" id: '370200',
}, },
{ {
province: "山东省", province: '山东省',
name: "淄博市", name: '淄博市',
id: "370300" id: '370300',
}, },
{ {
province: "山东省", province: '山东省',
name: "枣庄市", name: '枣庄市',
id: "370400" id: '370400',
}, },
{ {
province: "山东省", province: '山东省',
name: "东营市", name: '东营市',
id: "370500" id: '370500',
}, },
{ {
province: "山东省", province: '山东省',
name: "烟台市", name: '烟台市',
id: "370600" id: '370600',
}, },
{ {
province: "山东省", province: '山东省',
name: "潍坊市", name: '潍坊市',
id: "370700" id: '370700',
}, },
{ {
province: "山东省", province: '山东省',
name: "济宁市", name: '济宁市',
id: "370800" id: '370800',
}, },
{ {
province: "山东省", province: '山东省',
name: "泰安市", name: '泰安市',
id: "370900" id: '370900',
}, },
{ {
province: "山东省", province: '山东省',
name: "威海市", name: '威海市',
id: "371000" id: '371000',
}, },
{ {
province: "山东省", province: '山东省',
name: "日照市", name: '日照市',
id: "371100" id: '371100',
}, },
{ {
province: "山东省", province: '山东省',
name: "莱芜市", name: '莱芜市',
id: "371200" id: '371200',
}, },
{ {
province: "山东省", province: '山东省',
name: "临沂市", name: '临沂市',
id: "371300" id: '371300',
}, },
{ {
province: "山东省", province: '山东省',
name: "德州市", name: '德州市',
id: "371400" id: '371400',
}, },
{ {
province: "山东省", province: '山东省',
name: "聊城市", name: '聊城市',
id: "371500" id: '371500',
}, },
{ {
province: "山东省", province: '山东省',
name: "滨州市", name: '滨州市',
id: "371600" id: '371600',
}, },
{ {
province: "山东省", province: '山东省',
name: "菏泽市", name: '菏泽市',
id: "371700" id: '371700',
} },
], ],
"410000": [ '410000': [
{ {
province: "河南省", province: '河南省',
name: "郑州市", name: '郑州市',
id: "410100" id: '410100',
}, },
{ {
province: "河南省", province: '河南省',
name: "开封市", name: '开封市',
id: "410200" id: '410200',
}, },
{ {
province: "河南省", province: '河南省',
name: "洛阳市", name: '洛阳市',
id: "410300" id: '410300',
}, },
{ {
province: "河南省", province: '河南省',
name: "平顶山市", name: '平顶山市',
id: "410400" id: '410400',
}, },
{ {
province: "河南省", province: '河南省',
name: "安阳市", name: '安阳市',
id: "410500" id: '410500',
}, },
{ {
province: "河南省", province: '河南省',
name: "鹤壁市", name: '鹤壁市',
id: "410600" id: '410600',
}, },
{ {
province: "河南省", province: '河南省',
name: "新乡市", name: '新乡市',
id: "410700" id: '410700',
}, },
{ {
province: "河南省", province: '河南省',
name: "焦作市", name: '焦作市',
id: "410800" id: '410800',
}, },
{ {
province: "河南省", province: '河南省',
name: "濮阳市", name: '濮阳市',
id: "410900" id: '410900',
}, },
{ {
province: "河南省", province: '河南省',
name: "许昌市", name: '许昌市',
id: "411000" id: '411000',
}, },
{ {
province: "河南省", province: '河南省',
name: "漯河市", name: '漯河市',
id: "411100" id: '411100',
}, },
{ {
province: "河南省", province: '河南省',
name: "三门峡市", name: '三门峡市',
id: "411200" id: '411200',
}, },
{ {
province: "河南省", province: '河南省',
name: "南阳市", name: '南阳市',
id: "411300" id: '411300',
}, },
{ {
province: "河南省", province: '河南省',
name: "商丘市", name: '商丘市',
id: "411400" id: '411400',
}, },
{ {
province: "河南省", province: '河南省',
name: "信阳市", name: '信阳市',
id: "411500" id: '411500',
}, },
{ {
province: "河南省", province: '河南省',
name: "周口市", name: '周口市',
id: "411600" id: '411600',
}, },
{ {
province: "河南省", province: '河南省',
name: "驻马店市", name: '驻马店市',
id: "411700" id: '411700',
}, },
{ {
province: "河南省", province: '河南省',
name: "省直辖县级行政区划", name: '省直辖县级行政区划',
id: "419000" id: '419000',
} },
], ],
"420000": [ '420000': [
{ {
province: "湖北省", province: '湖北省',
name: "武汉市", name: '武汉市',
id: "420100" id: '420100',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "黄石市", name: '黄石市',
id: "420200" id: '420200',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "十堰市", name: '十堰市',
id: "420300" id: '420300',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "宜昌市", name: '宜昌市',
id: "420500" id: '420500',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "襄阳市", name: '襄阳市',
id: "420600" id: '420600',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "鄂州市", name: '鄂州市',
id: "420700" id: '420700',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "荆门市", name: '荆门市',
id: "420800" id: '420800',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "孝感市", name: '孝感市',
id: "420900" id: '420900',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "荆州市", name: '荆州市',
id: "421000" id: '421000',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "黄冈市", name: '黄冈市',
id: "421100" id: '421100',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "咸宁市", name: '咸宁市',
id: "421200" id: '421200',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "随州市", name: '随州市',
id: "421300" id: '421300',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "恩施土家族苗族自治州", name: '恩施土家族苗族自治州',
id: "422800" id: '422800',
}, },
{ {
province: "湖北省", province: '湖北省',
name: "省直辖县级行政区划", name: '省直辖县级行政区划',
id: "429000" id: '429000',
} },
], ],
"430000": [ '430000': [
{ {
province: "湖南省", province: '湖南省',
name: "长沙市", name: '长沙市',
id: "430100" id: '430100',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "株洲市", name: '株洲市',
id: "430200" id: '430200',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "湘潭市", name: '湘潭市',
id: "430300" id: '430300',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "衡阳市", name: '衡阳市',
id: "430400" id: '430400',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "邵阳市", name: '邵阳市',
id: "430500" id: '430500',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "岳阳市", name: '岳阳市',
id: "430600" id: '430600',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "常德市", name: '常德市',
id: "430700" id: '430700',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "张家界市", name: '张家界市',
id: "430800" id: '430800',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "益阳市", name: '益阳市',
id: "430900" id: '430900',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "郴州市", name: '郴州市',
id: "431000" id: '431000',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "永州市", name: '永州市',
id: "431100" id: '431100',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "怀化市", name: '怀化市',
id: "431200" id: '431200',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "娄底市", name: '娄底市',
id: "431300" id: '431300',
}, },
{ {
province: "湖南省", province: '湖南省',
name: "湘西土家族苗族自治州", name: '湘西土家族苗族自治州',
id: "433100" id: '433100',
} },
], ],
"440000": [ '440000': [
{ {
province: "广东省", province: '广东省',
name: "广州市", name: '广州市',
id: "440100" id: '440100',
}, },
{ {
province: "广东省", province: '广东省',
name: "韶关市", name: '韶关市',
id: "440200" id: '440200',
}, },
{ {
province: "广东省", province: '广东省',
name: "深圳市", name: '深圳市',
id: "440300" id: '440300',
}, },
{ {
province: "广东省", province: '广东省',
name: "珠海市", name: '珠海市',
id: "440400" id: '440400',
}, },
{ {
province: "广东省", province: '广东省',
name: "汕头市", name: '汕头市',
id: "440500" id: '440500',
}, },
{ {
province: "广东省", province: '广东省',
name: "佛山市", name: '佛山市',
id: "440600" id: '440600',
}, },
{ {
province: "广东省", province: '广东省',
name: "江门市", name: '江门市',
id: "440700" id: '440700',
}, },
{ {
province: "广东省", province: '广东省',
name: "湛江市", name: '湛江市',
id: "440800" id: '440800',
}, },
{ {
province: "广东省", province: '广东省',
name: "茂名市", name: '茂名市',
id: "440900" id: '440900',
}, },
{ {
province: "广东省", province: '广东省',
name: "肇庆市", name: '肇庆市',
id: "441200" id: '441200',
}, },
{ {
province: "广东省", province: '广东省',
name: "惠州市", name: '惠州市',
id: "441300" id: '441300',
}, },
{ {
province: "广东省", province: '广东省',
name: "梅州市", name: '梅州市',
id: "441400" id: '441400',
}, },
{ {
province: "广东省", province: '广东省',
name: "汕尾市", name: '汕尾市',
id: "441500" id: '441500',
}, },
{ {
province: "广东省", province: '广东省',
name: "河源市", name: '河源市',
id: "441600" id: '441600',
}, },
{ {
province: "广东省", province: '广东省',
name: "阳江市", name: '阳江市',
id: "441700" id: '441700',
}, },
{ {
province: "广东省", province: '广东省',
name: "清远市", name: '清远市',
id: "441800" id: '441800',
}, },
{ {
province: "广东省", province: '广东省',
name: "东莞市", name: '东莞市',
id: "441900" id: '441900',
}, },
{ {
province: "广东省", province: '广东省',
name: "中山市", name: '中山市',
id: "442000" id: '442000',
}, },
{ {
province: "广东省", province: '广东省',
name: "潮州市", name: '潮州市',
id: "445100" id: '445100',
}, },
{ {
province: "广东省", province: '广东省',
name: "揭阳市", name: '揭阳市',
id: "445200" id: '445200',
}, },
{ {
province: "广东省", province: '广东省',
name: "云浮市", name: '云浮市',
id: "445300" id: '445300',
} },
], ],
"450000": [ '450000': [
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "南宁市", name: '南宁市',
id: "450100" id: '450100',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "柳州市", name: '柳州市',
id: "450200" id: '450200',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "桂林市", name: '桂林市',
id: "450300" id: '450300',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "梧州市", name: '梧州市',
id: "450400" id: '450400',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "北海市", name: '北海市',
id: "450500" id: '450500',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "防城港市", name: '防城港市',
id: "450600" id: '450600',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "钦州市", name: '钦州市',
id: "450700" id: '450700',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "贵港市", name: '贵港市',
id: "450800" id: '450800',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "玉林市", name: '玉林市',
id: "450900" id: '450900',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "百色市", name: '百色市',
id: "451000" id: '451000',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "贺州市", name: '贺州市',
id: "451100" id: '451100',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "河池市", name: '河池市',
id: "451200" id: '451200',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "来宾市", name: '来宾市',
id: "451300" id: '451300',
}, },
{ {
province: "广西壮族自治区", province: '广西壮族自治区',
name: "崇左市", name: '崇左市',
id: "451400" id: '451400',
} },
], ],
"460000": [ '460000': [
{ {
province: "海南省", province: '海南省',
name: "海口市", name: '海口市',
id: "460100" id: '460100',
}, },
{ {
province: "海南省", province: '海南省',
name: "三亚市", name: '三亚市',
id: "460200" id: '460200',
}, },
{ {
province: "海南省", province: '海南省',
name: "三沙市", name: '三沙市',
id: "460300" id: '460300',
}, },
{ {
province: "海南省", province: '海南省',
name: "儋州市", name: '儋州市',
id: "460400" id: '460400',
}, },
{ {
province: "海南省", province: '海南省',
name: "省直辖县级行政区划", name: '省直辖县级行政区划',
id: "469000" id: '469000',
} },
], ],
"500000": [ '500000': [
{ {
province: "重庆市", province: '重庆市',
name: "市辖区", name: '市辖区',
id: "500100" id: '500100',
}, },
{ {
province: "重庆市", province: '重庆市',
name: "", name: '',
id: "500200" id: '500200',
} },
], ],
"510000": [ '510000': [
{ {
province: "四川省", province: '四川省',
name: "成都市", name: '成都市',
id: "510100" id: '510100',
}, },
{ {
province: "四川省", province: '四川省',
name: "自贡市", name: '自贡市',
id: "510300" id: '510300',
}, },
{ {
province: "四川省", province: '四川省',
name: "攀枝花市", name: '攀枝花市',
id: "510400" id: '510400',
}, },
{ {
province: "四川省", province: '四川省',
name: "泸州市", name: '泸州市',
id: "510500" id: '510500',
}, },
{ {
province: "四川省", province: '四川省',
name: "德阳市", name: '德阳市',
id: "510600" id: '510600',
}, },
{ {
province: "四川省", province: '四川省',
name: "绵阳市", name: '绵阳市',
id: "510700" id: '510700',
}, },
{ {
province: "四川省", province: '四川省',
name: "广元市", name: '广元市',
id: "510800" id: '510800',
}, },
{ {
province: "四川省", province: '四川省',
name: "遂宁市", name: '遂宁市',
id: "510900" id: '510900',
}, },
{ {
province: "四川省", province: '四川省',
name: "内江市", name: '内江市',
id: "511000" id: '511000',
}, },
{ {
province: "四川省", province: '四川省',
name: "乐山市", name: '乐山市',
id: "511100" id: '511100',
}, },
{ {
province: "四川省", province: '四川省',
name: "南充市", name: '南充市',
id: "511300" id: '511300',
}, },
{ {
province: "四川省", province: '四川省',
name: "眉山市", name: '眉山市',
id: "511400" id: '511400',
}, },
{ {
province: "四川省", province: '四川省',
name: "宜宾市", name: '宜宾市',
id: "511500" id: '511500',
}, },
{ {
province: "四川省", province: '四川省',
name: "广安市", name: '广安市',
id: "511600" id: '511600',
}, },
{ {
province: "四川省", province: '四川省',
name: "达州市", name: '达州市',
id: "511700" id: '511700',
}, },
{ {
province: "四川省", province: '四川省',
name: "雅安市", name: '雅安市',
id: "511800" id: '511800',
}, },
{ {
province: "四川省", province: '四川省',
name: "巴中市", name: '巴中市',
id: "511900" id: '511900',
}, },
{ {
province: "四川省", province: '四川省',
name: "资阳市", name: '资阳市',
id: "512000" id: '512000',
}, },
{ {
province: "四川省", province: '四川省',
name: "阿坝藏族羌族自治州", name: '阿坝藏族羌族自治州',
id: "513200" id: '513200',
}, },
{ {
province: "四川省", province: '四川省',
name: "甘孜藏族自治州", name: '甘孜藏族自治州',
id: "513300" id: '513300',
}, },
{ {
province: "四川省", province: '四川省',
name: "凉山彝族自治州", name: '凉山彝族自治州',
id: "513400" id: '513400',
} },
], ],
"520000": [ '520000': [
{ {
province: "贵州省", province: '贵州省',
name: "贵阳市", name: '贵阳市',
id: "520100" id: '520100',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "六盘水市", name: '六盘水市',
id: "520200" id: '520200',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "遵义市", name: '遵义市',
id: "520300" id: '520300',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "安顺市", name: '安顺市',
id: "520400" id: '520400',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "毕节市", name: '毕节市',
id: "520500" id: '520500',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "铜仁市", name: '铜仁市',
id: "520600" id: '520600',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "黔西南布依族苗族自治州", name: '黔西南布依族苗族自治州',
id: "522300" id: '522300',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "黔东南苗族侗族自治州", name: '黔东南苗族侗族自治州',
id: "522600" id: '522600',
}, },
{ {
province: "贵州省", province: '贵州省',
name: "黔南布依族苗族自治州", name: '黔南布依族苗族自治州',
id: "522700" id: '522700',
} },
], ],
"530000": [ '530000': [
{ {
province: "云南省", province: '云南省',
name: "昆明市", name: '昆明市',
id: "530100" id: '530100',
}, },
{ {
province: "云南省", province: '云南省',
name: "曲靖市", name: '曲靖市',
id: "530300" id: '530300',
}, },
{ {
province: "云南省", province: '云南省',
name: "玉溪市", name: '玉溪市',
id: "530400" id: '530400',
}, },
{ {
province: "云南省", province: '云南省',
name: "保山市", name: '保山市',
id: "530500" id: '530500',
}, },
{ {
province: "云南省", province: '云南省',
name: "昭通市", name: '昭通市',
id: "530600" id: '530600',
}, },
{ {
province: "云南省", province: '云南省',
name: "丽江市", name: '丽江市',
id: "530700" id: '530700',
}, },
{ {
province: "云南省", province: '云南省',
name: "普洱市", name: '普洱市',
id: "530800" id: '530800',
}, },
{ {
province: "云南省", province: '云南省',
name: "临沧市", name: '临沧市',
id: "530900" id: '530900',
}, },
{ {
province: "云南省", province: '云南省',
name: "楚雄彝族自治州", name: '楚雄彝族自治州',
id: "532300" id: '532300',
}, },
{ {
province: "云南省", province: '云南省',
name: "红河哈尼族彝族自治州", name: '红河哈尼族彝族自治州',
id: "532500" id: '532500',
}, },
{ {
province: "云南省", province: '云南省',
name: "文山壮族苗族自治州", name: '文山壮族苗族自治州',
id: "532600" id: '532600',
}, },
{ {
province: "云南省", province: '云南省',
name: "西双版纳傣族自治州", name: '西双版纳傣族自治州',
id: "532800" id: '532800',
}, },
{ {
province: "云南省", province: '云南省',
name: "大理白族自治州", name: '大理白族自治州',
id: "532900" id: '532900',
}, },
{ {
province: "云南省", province: '云南省',
name: "德宏傣族景颇族自治州", name: '德宏傣族景颇族自治州',
id: "533100" id: '533100',
}, },
{ {
province: "云南省", province: '云南省',
name: "怒江傈僳族自治州", name: '怒江傈僳族自治州',
id: "533300" id: '533300',
}, },
{ {
province: "云南省", province: '云南省',
name: "迪庆藏族自治州", name: '迪庆藏族自治州',
id: "533400" id: '533400',
} },
], ],
"540000": [ '540000': [
{ {
province: "西藏自治区", province: '西藏自治区',
name: "拉萨市", name: '拉萨市',
id: "540100" id: '540100',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "日喀则市", name: '日喀则市',
id: "540200" id: '540200',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "昌都市", name: '昌都市',
id: "540300" id: '540300',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "林芝市", name: '林芝市',
id: "540400" id: '540400',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "山南市", name: '山南市',
id: "540500" id: '540500',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "那曲地区", name: '那曲地区',
id: "542400" id: '542400',
}, },
{ {
province: "西藏自治区", province: '西藏自治区',
name: "阿里地区", name: '阿里地区',
id: "542500" id: '542500',
} },
], ],
"610000": [ '610000': [
{ {
province: "陕西省", province: '陕西省',
name: "西安市", name: '西安市',
id: "610100" id: '610100',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "铜川市", name: '铜川市',
id: "610200" id: '610200',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "宝鸡市", name: '宝鸡市',
id: "610300" id: '610300',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "咸阳市", name: '咸阳市',
id: "610400" id: '610400',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "渭南市", name: '渭南市',
id: "610500" id: '610500',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "延安市", name: '延安市',
id: "610600" id: '610600',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "汉中市", name: '汉中市',
id: "610700" id: '610700',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "榆林市", name: '榆林市',
id: "610800" id: '610800',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "安康市", name: '安康市',
id: "610900" id: '610900',
}, },
{ {
province: "陕西省", province: '陕西省',
name: "商洛市", name: '商洛市',
id: "611000" id: '611000',
} },
], ],
"620000": [ '620000': [
{ {
province: "甘肃省", province: '甘肃省',
name: "兰州市", name: '兰州市',
id: "620100" id: '620100',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "嘉峪关市", name: '嘉峪关市',
id: "620200" id: '620200',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "金昌市", name: '金昌市',
id: "620300" id: '620300',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "白银市", name: '白银市',
id: "620400" id: '620400',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "天水市", name: '天水市',
id: "620500" id: '620500',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "武威市", name: '武威市',
id: "620600" id: '620600',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "张掖市", name: '张掖市',
id: "620700" id: '620700',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "平凉市", name: '平凉市',
id: "620800" id: '620800',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "酒泉市", name: '酒泉市',
id: "620900" id: '620900',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "庆阳市", name: '庆阳市',
id: "621000" id: '621000',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "定西市", name: '定西市',
id: "621100" id: '621100',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "陇南市", name: '陇南市',
id: "621200" id: '621200',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "临夏回族自治州", name: '临夏回族自治州',
id: "622900" id: '622900',
}, },
{ {
province: "甘肃省", province: '甘肃省',
name: "甘南藏族自治州", name: '甘南藏族自治州',
id: "623000" id: '623000',
} },
], ],
"630000": [ '630000': [
{ {
province: "青海省", province: '青海省',
name: "西宁市", name: '西宁市',
id: "630100" id: '630100',
}, },
{ {
province: "青海省", province: '青海省',
name: "海东市", name: '海东市',
id: "630200" id: '630200',
}, },
{ {
province: "青海省", province: '青海省',
name: "海北藏族自治州", name: '海北藏族自治州',
id: "632200" id: '632200',
}, },
{ {
province: "青海省", province: '青海省',
name: "黄南藏族自治州", name: '黄南藏族自治州',
id: "632300" id: '632300',
}, },
{ {
province: "青海省", province: '青海省',
name: "海南藏族自治州", name: '海南藏族自治州',
id: "632500" id: '632500',
}, },
{ {
province: "青海省", province: '青海省',
name: "果洛藏族自治州", name: '果洛藏族自治州',
id: "632600" id: '632600',
}, },
{ {
province: "青海省", province: '青海省',
name: "玉树藏族自治州", name: '玉树藏族自治州',
id: "632700" id: '632700',
}, },
{ {
province: "青海省", province: '青海省',
name: "海西蒙古族藏族自治州", name: '海西蒙古族藏族自治州',
id: "632800" id: '632800',
} },
], ],
"640000": [ '640000': [
{ {
province: "宁夏回族自治区", province: '宁夏回族自治区',
name: "银川市", name: '银川市',
id: "640100" id: '640100',
}, },
{ {
province: "宁夏回族自治区", province: '宁夏回族自治区',
name: "石嘴山市", name: '石嘴山市',
id: "640200" id: '640200',
}, },
{ {
province: "宁夏回族自治区", province: '宁夏回族自治区',
name: "吴忠市", name: '吴忠市',
id: "640300" id: '640300',
}, },
{ {
province: "宁夏回族自治区", province: '宁夏回族自治区',
name: "固原市", name: '固原市',
id: "640400" id: '640400',
}, },
{ {
province: "宁夏回族自治区", province: '宁夏回族自治区',
name: "中卫市", name: '中卫市',
id: "640500" id: '640500',
} },
], ],
"650000": [ '650000': [
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "乌鲁木齐市", name: '乌鲁木齐市',
id: "650100" id: '650100',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "克拉玛依市", name: '克拉玛依市',
id: "650200" id: '650200',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "吐鲁番市", name: '吐鲁番市',
id: "650400" id: '650400',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "哈密市", name: '哈密市',
id: "650500" id: '650500',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "昌吉回族自治州", name: '昌吉回族自治州',
id: "652300" id: '652300',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "博尔塔拉蒙古自治州", name: '博尔塔拉蒙古自治州',
id: "652700" id: '652700',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "巴音郭楞蒙古自治州", name: '巴音郭楞蒙古自治州',
id: "652800" id: '652800',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "阿克苏地区", name: '阿克苏地区',
id: "652900" id: '652900',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "克孜勒苏柯尔克孜自治州", name: '克孜勒苏柯尔克孜自治州',
id: "653000" id: '653000',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "喀什地区", name: '喀什地区',
id: "653100" id: '653100',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "和田地区", name: '和田地区',
id: "653200" id: '653200',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "伊犁哈萨克自治州", name: '伊犁哈萨克自治州',
id: "654000" id: '654000',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "塔城地区", name: '塔城地区',
id: "654200" id: '654200',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "阿勒泰地区", name: '阿勒泰地区',
id: "654300" id: '654300',
}, },
{ {
province: "新疆维吾尔自治区", province: '新疆维吾尔自治区',
name: "自治区直辖县级行政区划", name: '自治区直辖县级行政区划',
id: "659000" id: '659000',
} },
] ],
}; };
var province = [ var province = [
{ {
"name": "北京市", name: '北京市',
"id": "110000" id: '110000',
}, },
{ {
"name": "天津市", name: '天津市',
"id": "120000" id: '120000',
}, },
{ {
"name": "河北省", name: '河北省',
"id": "130000" id: '130000',
}, },
{ {
"name": "山西省", name: '山西省',
"id": "140000" id: '140000',
}, },
{ {
"name": "内蒙古自治区", name: '内蒙古自治区',
"id": "150000" id: '150000',
}, },
{ {
"name": "辽宁省", name: '辽宁省',
"id": "210000" id: '210000',
}, },
{ {
"name": "吉林省", name: '吉林省',
"id": "220000" id: '220000',
}, },
{ {
"name": "黑龙江省", name: '黑龙江省',
"id": "230000" id: '230000',
}, },
{ {
"name": "上海市", name: '上海市',
"id": "310000" id: '310000',
}, },
{ {
"name": "江苏省", name: '江苏省',
"id": "320000" id: '320000',
}, },
{ {
"name": "浙江省", name: '浙江省',
"id": "330000" id: '330000',
}, },
{ {
"name": "安徽省", name: '安徽省',
"id": "340000" id: '340000',
}, },
{ {
"name": "福建省", name: '福建省',
"id": "350000" id: '350000',
}, },
{ {
"name": "江西省", name: '江西省',
"id": "360000" id: '360000',
}, },
{ {
"name": "山东省", name: '山东省',
"id": "370000" id: '370000',
}, },
{ {
"name": "河南省", name: '河南省',
"id": "410000" id: '410000',
}, },
{ {
"name": "湖北省", name: '湖北省',
"id": "420000" id: '420000',
}, },
{ {
"name": "湖南省", name: '湖南省',
"id": "430000" id: '430000',
}, },
{ {
"name": "广东省", name: '广东省',
"id": "440000" id: '440000',
}, },
{ {
"name": "广西壮族自治区", name: '广西壮族自治区',
"id": "450000" id: '450000',
}, },
{ {
"name": "海南省", name: '海南省',
"id": "460000" id: '460000',
}, },
{ {
"name": "重庆市", name: '重庆市',
"id": "500000" id: '500000',
}, },
{ {
"name": "四川省", name: '四川省',
"id": "510000" id: '510000',
}, },
{ {
"name": "贵州省", name: '贵州省',
"id": "520000" id: '520000',
}, },
{ {
"name": "云南省", name: '云南省',
"id": "530000" id: '530000',
}, },
{ {
"name": "西藏自治区", name: '西藏自治区',
"id": "540000" id: '540000',
}, },
{ {
"name": "陕西省", name: '陕西省',
"id": "610000" id: '610000',
}, },
{ {
"name": "甘肃省", name: '甘肃省',
"id": "620000" id: '620000',
}, },
{ {
"name": "青海省", name: '青海省',
"id": "630000" id: '630000',
}, },
{ {
"name": "宁夏回族自治区", name: '宁夏回族自治区',
"id": "640000" id: '640000',
}, },
{ {
"name": "新疆维吾尔自治区", name: '新疆维吾尔自治区',
"id": "650000" id: '650000',
}, },
{ {
"name": "台湾省", name: '台湾省',
"id": "710000" id: '710000',
}, },
{ {
"name": "香港特别行政区", name: '香港特别行政区',
"id": "810000" id: '810000',
}, },
{ {
"name": "澳门特别行政区", name: '澳门特别行政区',
"id": "820000" id: '820000',
} },
] ];
;
function getProvince(req, res) { function getProvince(req, res) {
return res.json(province); return res.json(province);
} }
...@@ -2429,249 +2519,280 @@ ...@@ -2429,249 +2519,280 @@
var geographic = { var geographic = {
'GET /api/geographic/province': getProvince, 'GET /api/geographic/province': getProvince,
'GET /api/geographic/city/:province': getCity 'GET /api/geographic/city/:province': getCity,
}; };
const getNotices = (req, res) => res.json([{ const getNotices = (req, res) =>
res.json([
{
id: '000000001', id: '000000001',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你收到了 14 份新周报', title: '你收到了 14 份新周报',
datetime: '2017-08-09', datetime: '2017-08-09',
type: 'notification' type: 'notification',
}, { },
{
id: '000000002', id: '000000002',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
title: '你推荐的 曲妮妮 已通过第三轮面试', title: '你推荐的 曲妮妮 已通过第三轮面试',
datetime: '2017-08-08', datetime: '2017-08-08',
type: 'notification' type: 'notification',
}, { },
{
id: '000000003', id: '000000003',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
title: '这种模板可以区分多种通知类型', title: '这种模板可以区分多种通知类型',
datetime: '2017-08-07', datetime: '2017-08-07',
read: true, read: true,
type: 'notification' type: 'notification',
}, { },
{
id: '000000004', id: '000000004',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
title: '左侧图标用于区分不同的类型', title: '左侧图标用于区分不同的类型',
datetime: '2017-08-07', datetime: '2017-08-07',
type: 'notification' type: 'notification',
}, { },
{
id: '000000005', id: '000000005',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '内容不要超过两行字,超出时自动截断', title: '内容不要超过两行字,超出时自动截断',
datetime: '2017-08-07', datetime: '2017-08-07',
type: 'notification' type: 'notification',
}, { },
{
id: '000000006', id: '000000006',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '曲丽丽 评论了你', title: '曲丽丽 评论了你',
description: '描述信息描述信息描述信息', description: '描述信息描述信息描述信息',
datetime: '2017-08-07', datetime: '2017-08-07',
type: 'message', type: 'message',
clickClose: true clickClose: true,
}, { },
{
id: '000000007', id: '000000007',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '朱偏右 回复了你', title: '朱偏右 回复了你',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07', datetime: '2017-08-07',
type: 'message', type: 'message',
clickClose: true clickClose: true,
}, { },
{
id: '000000008', id: '000000008',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '标题', title: '标题',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07', datetime: '2017-08-07',
type: 'message', type: 'message',
clickClose: true clickClose: true,
}, { },
{
id: '000000009', id: '000000009',
title: '任务名称', title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动', description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始', extra: '未开始',
status: 'todo', status: 'todo',
type: 'event' type: 'event',
}, { },
{
id: '000000010', id: '000000010',
title: '第三方紧急代码变更', title: '第三方紧急代码变更',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '马上到期', extra: '马上到期',
status: 'urgent', status: 'urgent',
type: 'event' type: 'event',
}, { },
{
id: '000000011', id: '000000011',
title: '信息安全考试', title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布', description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天', extra: '已耗时 8 天',
status: 'doing', status: 'doing',
type: 'event' type: 'event',
}, { },
{
id: '000000012', id: '000000012',
title: 'ABCD 版本发布', title: 'ABCD 版本发布',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '进行中', extra: '进行中',
status: 'processing', status: 'processing',
type: 'event' type: 'event',
}]); },
]);
var notices = { var notices = {
'GET /api/notices': getNotices 'GET /api/notices': getNotices,
}; };
const basicGoods = [{ const basicGoods = [
{
id: '1234561', id: '1234561',
name: '矿泉水 550ml', name: '矿泉水 550ml',
barcode: '12421432143214321', barcode: '12421432143214321',
price: '2.00', price: '2.00',
num: '1', num: '1',
amount: '2.00' amount: '2.00',
}, { },
{
id: '1234562', id: '1234562',
name: '凉茶 300ml', name: '凉茶 300ml',
barcode: '12421432143214322', barcode: '12421432143214322',
price: '3.00', price: '3.00',
num: '2', num: '2',
amount: '6.00' amount: '6.00',
}, { },
{
id: '1234563', id: '1234563',
name: '好吃的薯片', name: '好吃的薯片',
barcode: '12421432143214323', barcode: '12421432143214323',
price: '7.00', price: '7.00',
num: '4', num: '4',
amount: '28.00' amount: '28.00',
}, { },
{
id: '1234564', id: '1234564',
name: '特别好吃的蛋卷', name: '特别好吃的蛋卷',
barcode: '12421432143214324', barcode: '12421432143214324',
price: '8.50', price: '8.50',
num: '3', num: '3',
amount: '25.50' amount: '25.50',
}]; },
const basicProgress = [{ ];
const basicProgress = [
{
key: '1', key: '1',
time: '2017-10-01 14:10', time: '2017-10-01 14:10',
rate: '联系客户', rate: '联系客户',
status: 'processing', status: 'processing',
operator: '取货员 ID1234', operator: '取货员 ID1234',
cost: '5mins' cost: '5mins',
}, { },
{
key: '2', key: '2',
time: '2017-10-01 14:05', time: '2017-10-01 14:05',
rate: '取货员出发', rate: '取货员出发',
status: 'success', status: 'success',
operator: '取货员 ID1234', operator: '取货员 ID1234',
cost: '1h' cost: '1h',
}, { },
{
key: '3', key: '3',
time: '2017-10-01 13:05', time: '2017-10-01 13:05',
rate: '取货员接单', rate: '取货员接单',
status: 'success', status: 'success',
operator: '取货员 ID1234', operator: '取货员 ID1234',
cost: '5mins' cost: '5mins',
}, { },
{
key: '4', key: '4',
time: '2017-10-01 13:00', time: '2017-10-01 13:00',
rate: '申请审批通过', rate: '申请审批通过',
status: 'success', status: 'success',
operator: '系统', operator: '系统',
cost: '1h' cost: '1h',
}, { },
{
key: '5', key: '5',
time: '2017-10-01 12:00', time: '2017-10-01 12:00',
rate: '发起退货申请', rate: '发起退货申请',
status: 'success', status: 'success',
operator: '用户', operator: '用户',
cost: '5mins' cost: '5mins',
}]; },
const advancedOperation1 = [{ ];
const advancedOperation1 = [
{
key: 'op1', key: 'op1',
type: '订购关系生效', type: '订购关系生效',
name: '曲丽丽', name: '曲丽丽',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '-' memo: '-',
}, { },
{
key: 'op2', key: 'op2',
type: '财务复审', type: '财务复审',
name: '付小小', name: '付小小',
status: 'reject', status: 'reject',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '不通过原因' memo: '不通过原因',
}, { },
{
key: 'op3', key: 'op3',
type: '部门初审', type: '部门初审',
name: '周毛毛', name: '周毛毛',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '-' memo: '-',
}, { },
{
key: 'op4', key: 'op4',
type: '提交订单', type: '提交订单',
name: '林东东', name: '林东东',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '很棒' memo: '很棒',
}, { },
{
key: 'op5', key: 'op5',
type: '创建订单', type: '创建订单',
name: '汗牙牙', name: '汗牙牙',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '-' memo: '-',
}]; },
const advancedOperation2 = [{ ];
const advancedOperation2 = [
{
key: 'op1', key: 'op1',
type: '订购关系生效', type: '订购关系生效',
name: '曲丽丽', name: '曲丽丽',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '-' memo: '-',
}]; },
const advancedOperation3 = [{ ];
const advancedOperation3 = [
{
key: 'op1', key: 'op1',
type: '创建订单', type: '创建订单',
name: '汗牙牙', name: '汗牙牙',
status: 'agree', status: 'agree',
updatedAt: '2017-10-03 19:23:12', updatedAt: '2017-10-03 19:23:12',
memo: '-' memo: '-',
}]; },
];
const getProfileAdvancedData = { const getProfileAdvancedData = {
advancedOperation1, advancedOperation1,
advancedOperation2, advancedOperation2,
advancedOperation3 advancedOperation3,
}; };
const { const { Random } = mockjs;
Random
} = mockjs;
var profile = { var profile = {
'GET /api/profile/advanced': getProfileAdvancedData, 'GET /api/profile/advanced': getProfileAdvancedData,
'GET /api/profile/basic': (req, res) => { 'GET /api/profile/basic': (req, res) => {
const { const { id } = req.query;
id
} = req.query;
const application = { const application = {
id, id,
status: '已取货', status: '已取货',
orderNo: Random.id(), orderNo: Random.id(),
childOrderNo: Random.id() childOrderNo: Random.id(),
}; };
const userInfo = { const userInfo = {
name: Random.cname(), name: Random.cname(),
tel: '18100000000', tel: '18100000000',
delivery: '菜鸟物流', delivery: '菜鸟物流',
addr: '浙江省杭州市西湖区万塘路18号', addr: '浙江省杭州市西湖区万塘路18号',
remark: '备注' remark: '备注',
}; };
res.json({ res.json({
userInfo, userInfo,
application, application,
basicGoods, basicGoods,
basicProgress basicProgress,
}); });
} },
}; };
/*! https://mths.be/punycode v1.4.1 by @mathias */ /*! https://mths.be/punycode v1.4.1 by @mathias */
...@@ -2697,9 +2818,9 @@ ...@@ -2697,9 +2818,9 @@
/** Error messages */ /** Error messages */
var errors = { var errors = {
'overflow': 'Overflow: input needs wider integers to process', overflow: 'Overflow: input needs wider integers to process',
'not-basic': 'Illegal input >= 0x80 (not a basic code point)', 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
'invalid-input': 'Invalid input' 'invalid-input': 'Invalid input',
}; };
/** Convenience shortcuts */ /** Convenience shortcuts */
...@@ -2727,7 +2848,6 @@ ...@@ -2727,7 +2848,6 @@
* @returns {Array} A new array of values returned by the callback function. * @returns {Array} A new array of values returned by the callback function.
*/ */
function map(array, fn) { function map(array, fn) {
var length = array.length; var length = array.length;
var result = []; var result = [];
...@@ -2749,7 +2869,6 @@ ...@@ -2749,7 +2869,6 @@
* function. * function.
*/ */
function mapDomain(string, fn) { function mapDomain(string, fn) {
var parts = string.split('@'); var parts = string.split('@');
var result = ''; var result = '';
...@@ -2761,7 +2880,6 @@ ...@@ -2761,7 +2880,6 @@
string = parts[1]; string = parts[1];
} // Avoid `split(regex)` for IE8 compatibility. See #17. } // Avoid `split(regex)` for IE8 compatibility. See #17.
string = string.replace(regexSeparators, '\x2E'); string = string.replace(regexSeparators, '\x2E');
var labels = string.split('.'); var labels = string.split('.');
var encoded = map(labels, fn).join('.'); var encoded = map(labels, fn).join('.');
...@@ -2781,7 +2899,6 @@ ...@@ -2781,7 +2899,6 @@
* @returns {Array} The new array of code points. * @returns {Array} The new array of code points.
*/ */
function ucs2decode(string) { function ucs2decode(string) {
var output = [], var output = [],
counter = 0, counter = 0,
...@@ -2792,13 +2909,13 @@ ...@@ -2792,13 +2909,13 @@
while (counter < length) { while (counter < length) {
value = string.charCodeAt(counter++); value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) { if (value >= 0xd800 && value <= 0xdbff && counter < length) {
// high surrogate, and there is a next character // high surrogate, and there is a next character
extra = string.charCodeAt(counter++); extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) { if ((extra & 0xfc00) == 0xdc00) {
// low surrogate // low surrogate
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
} else { } else {
// unmatched surrogate; only append this code unit, in case the next // unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair // code unit is the high surrogate of a surrogate pair
...@@ -2824,7 +2941,6 @@ ...@@ -2824,7 +2941,6 @@
* if `flag` is non-zero and `digit` has no uppercase form. * if `flag` is non-zero and `digit` has no uppercase form.
*/ */
function digitToBasic(digit, flag) { function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z // 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9 // 26..35 map to ASCII 0..9
...@@ -2836,19 +2952,21 @@ ...@@ -2836,19 +2952,21 @@
* @private * @private
*/ */
function adapt(delta, numPoints, firstTime) { function adapt(delta, numPoints, firstTime) {
var k = 0; var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1; delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints); delta += floor(delta / numPoints);
for (; for (
;
/* no initialization */ /* no initialization */
delta > baseMinusTMin * tMax >> 1; k += base) { delta > (baseMinusTMin * tMax) >> 1;
k += base
) {
delta = floor(delta / baseMinusTMin); delta = floor(delta / baseMinusTMin);
} }
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew));
} }
/** /**
* Converts a string of Unicode symbols (e.g. a domain name label) to a * Converts a string of Unicode symbols (e.g. a domain name label) to a
...@@ -2871,10 +2989,8 @@ ...@@ -2871,10 +2989,8 @@
t, t,
currentValue, currentValue,
output = [], output = [],
/** `inputLength` will hold the number of code points in `input`. */ /** `inputLength` will hold the number of code points in `input`. */
inputLength, inputLength,
/** Cached calculation results */ /** Cached calculation results */
handledCPCountPlusOne, handledCPCountPlusOne,
baseMinusT, baseMinusT,
...@@ -2904,7 +3020,6 @@ ...@@ -2904,7 +3020,6 @@
output.push(delimiter); output.push(delimiter);
} // Main encoding loop: } // Main encoding loop:
while (handledCPCount < inputLength) { while (handledCPCount < inputLength) {
// All non-basic code points < n have been handled already. Find the next // All non-basic code points < n have been handled already. Find the next
// larger one: // larger one:
...@@ -2917,7 +3032,6 @@ ...@@ -2917,7 +3032,6 @@
} // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, } // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
// but guard against overflow // but guard against overflow
handledCPCountPlusOne = handledCPCount + 1; handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
...@@ -2936,9 +3050,12 @@ ...@@ -2936,9 +3050,12 @@
if (currentValue == n) { if (currentValue == n) {
// Represent delta as a generalized variable-length integer // Represent delta as a generalized variable-length integer
for (q = delta, k = base;; for (
q = delta, k = base;
;
/* no condition */ /* no condition */
k += base) { k += base
) {
t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
if (q < t) { if (q < t) {
...@@ -2947,7 +3064,7 @@ ...@@ -2947,7 +3064,7 @@
qMinusT = q - t; qMinusT = q - t;
baseMinusT = base - t; baseMinusT = base - t;
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); output.push(stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)));
q = floor(qMinusT / baseMinusT); q = floor(qMinusT / baseMinusT);
} }
...@@ -2977,20 +3094,26 @@ ...@@ -2977,20 +3094,26 @@
*/ */
function toASCII(input) { function toASCII(input) {
return mapDomain(input, function (string) { return mapDomain(input, function(string) {
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
}); });
} }
// shim for using process in browser // shim for using process in browser
if (typeof global.setTimeout === 'function') ; if (typeof global.setTimeout === 'function');
if (typeof global.clearTimeout === 'function') ; if (typeof global.clearTimeout === 'function');
var performance = global.performance || {}; var performance = global.performance || {};
var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () { var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function() {
return new Date().getTime(); return new Date().getTime();
}; // generate timestamp or delta }; // generate timestamp or delta
...@@ -3035,7 +3158,9 @@ ...@@ -3035,7 +3158,9 @@
return Object.prototype.hasOwnProperty.call(obj, prop); return Object.prototype.hasOwnProperty.call(obj, prop);
} }
var isArray = Array.isArray || function (xs) { var isArray =
Array.isArray ||
function(xs) {
return Object.prototype.toString.call(xs) === '[object Array]'; return Object.prototype.toString.call(xs) === '[object Array]';
}; };
...@@ -3064,11 +3189,11 @@ ...@@ -3064,11 +3189,11 @@
} }
if (typeof obj === 'object') { if (typeof obj === 'object') {
return map$1(objectKeys(obj), function (k) { return map$1(objectKeys(obj), function(k) {
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
if (isArray(obj[k])) { if (isArray(obj[k])) {
return map$1(obj[k], function (v) { return map$1(obj[k], function(v) {
return ks + encodeURIComponent(stringifyPrimitive(v)); return ks + encodeURIComponent(stringifyPrimitive(v));
}).join(sep); }).join(sep);
} else { } else {
...@@ -3078,7 +3203,11 @@ ...@@ -3078,7 +3203,11 @@
} }
if (!name) return ''; if (!name) return '';
return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); return (
encodeURIComponent(stringifyPrimitive(name)) +
eq +
encodeURIComponent(stringifyPrimitive(obj))
);
} }
function map$1(xs, f) { function map$1(xs, f) {
...@@ -3092,7 +3221,9 @@ ...@@ -3092,7 +3221,9 @@
return res; return res;
} }
var objectKeys = Object.keys || function (obj) { var objectKeys =
Object.keys ||
function(obj) {
var res = []; var res = [];
for (var key in obj) { for (var key in obj) {
...@@ -3184,7 +3315,7 @@ ...@@ -3184,7 +3315,7 @@
// RFC 2396: characters not allowed for various reasons. // RFC 2396: characters not allowed for various reasons.
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
// Allowed by RFCs, but cause of XSS attacks. Always escape these. // Allowed by RFCs, but cause of XSS attacks. Always escape these.
autoEscape = ['\''].concat(unwise), autoEscape = ["'"].concat(unwise),
// Characters that are never ever allowed in a hostname. // Characters that are never ever allowed in a hostname.
// Note that any invalid chars are also handled, but these // Note that any invalid chars are also handled, but these
// are the ones that are *expected* to be seen, so we fast-path // are the ones that are *expected* to be seen, so we fast-path
...@@ -3196,26 +3327,26 @@ ...@@ -3196,26 +3327,26 @@
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
// protocols that can allow "unsafe" and "unwise" chars. // protocols that can allow "unsafe" and "unwise" chars.
unsafeProtocol = { unsafeProtocol = {
'javascript': true, javascript: true,
'javascript:': true 'javascript:': true,
}, },
// protocols that never have a hostname. // protocols that never have a hostname.
hostlessProtocol = { hostlessProtocol = {
'javascript': true, javascript: true,
'javascript:': true 'javascript:': true,
}, },
// protocols that always contain a // bit. // protocols that always contain a // bit.
slashedProtocol = { slashedProtocol = {
'http': true, http: true,
'https': true, https: true,
'ftp': true, ftp: true,
'gopher': true, gopher: true,
'file': true, file: true,
'http:': true, 'http:': true,
'https:': true, 'https:': true,
'ftp:': true, 'ftp:': true,
'gopher:': true, 'gopher:': true,
'file:': true 'file:': true,
}; };
function urlParse(url, parseQueryString, slashesDenoteHost) { function urlParse(url, parseQueryString, slashesDenoteHost) {
...@@ -3225,18 +3356,17 @@ ...@@ -3225,18 +3356,17 @@
return u; return u;
} }
Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) { Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
return parse$1(this, url, parseQueryString, slashesDenoteHost); return parse$1(this, url, parseQueryString, slashesDenoteHost);
}; };
function parse$1(self, url, parseQueryString, slashesDenoteHost) { function parse$1(self, url, parseQueryString, slashesDenoteHost) {
if (!isString(url)) { if (!isString(url)) {
throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url); throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
} // Copy chrome, IE, opera backslash-handling behavior. } // Copy chrome, IE, opera backslash-handling behavior.
// Back slashes before the query string get converted to forward slashes // Back slashes before the query string get converted to forward slashes
// See: https://code.google.com/p/chromium/issues/detail?id=25916 // See: https://code.google.com/p/chromium/issues/detail?id=25916
var queryIndex = url.indexOf('?'), var queryIndex = url.indexOf('?'),
splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#', splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
uSplit = url.split(splitter), uSplit = url.split(splitter),
...@@ -3286,7 +3416,6 @@ ...@@ -3286,7 +3416,6 @@
// resolution will treat //foo/bar as host=foo,path=bar because that's // resolution will treat //foo/bar as host=foo,path=bar because that's
// how the browser resolves relative URLs. // how the browser resolves relative URLs.
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
var slashes = rest.substr(0, 2) === '//'; var slashes = rest.substr(0, 2) === '//';
...@@ -3298,7 +3427,7 @@ ...@@ -3298,7 +3427,7 @@
var i, hec, l, p; var i, hec, l, p;
if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) { if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) {
// there's a hostname. // there's a hostname.
// the first instance of /, ?, ;, or # ends the host. // the first instance of /, ?, ;, or # ends the host.
// //
...@@ -3321,7 +3450,6 @@ ...@@ -3321,7 +3450,6 @@
} // at this point, either we have an explicit point where the } // at this point, either we have an explicit point where the
// auth portion cannot go past, or the last @ char is the decider. // auth portion cannot go past, or the last @ char is the decider.
var auth, atSign; var auth, atSign;
if (hostEnd === -1) { if (hostEnd === -1) {
...@@ -3334,14 +3462,12 @@ ...@@ -3334,14 +3462,12 @@
} // Now we have a portion which is definitely the auth. } // Now we have a portion which is definitely the auth.
// Pull that off. // Pull that off.
if (atSign !== -1) { if (atSign !== -1) {
auth = rest.slice(0, atSign); auth = rest.slice(0, atSign);
rest = rest.slice(atSign + 1); rest = rest.slice(atSign + 1);
self.auth = decodeURIComponent(auth); self.auth = decodeURIComponent(auth);
} // the host is the remaining to the left of the first non-host char } // the host is the remaining to the left of the first non-host char
hostEnd = -1; hostEnd = -1;
for (i = 0; i < nonHostChars.length; i++) { for (i = 0; i < nonHostChars.length; i++) {
...@@ -3349,7 +3475,6 @@ ...@@ -3349,7 +3475,6 @@
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec; if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
} // if we still have not hit it, then the entire thing is a host. } // if we still have not hit it, then the entire thing is a host.
if (hostEnd === -1) hostEnd = rest.length; if (hostEnd === -1) hostEnd = rest.length;
self.host = rest.slice(0, hostEnd); self.host = rest.slice(0, hostEnd);
rest = rest.slice(hostEnd); // pull out port. rest = rest.slice(hostEnd); // pull out port.
...@@ -3360,7 +3485,8 @@ ...@@ -3360,7 +3485,8 @@
self.hostname = self.hostname || ''; // if hostname begins with [ and ends with ] self.hostname = self.hostname || ''; // if hostname begins with [ and ends with ]
// assume that it's an IPv6 address. // assume that it's an IPv6 address.
var ipv6Hostname = self.hostname[0] === '[' && self.hostname[self.hostname.length - 1] === ']'; // validate a little. var ipv6Hostname =
self.hostname[0] === '[' && self.hostname[self.hostname.length - 1] === ']'; // validate a little.
if (!ipv6Hostname) { if (!ipv6Hostname) {
var hostparts = self.hostname.split(/\./); var hostparts = self.hostname.split(/\./);
...@@ -3383,7 +3509,6 @@ ...@@ -3383,7 +3509,6 @@
} }
} // we test again with ASCII char only } // we test again with ASCII char only
if (!newpart.match(hostnamePartPattern)) { if (!newpart.match(hostnamePartPattern)) {
var validParts = hostparts.slice(0, i); var validParts = hostparts.slice(0, i);
var notHost = hostparts.slice(i + 1); var notHost = hostparts.slice(i + 1);
...@@ -3436,7 +3561,6 @@ ...@@ -3436,7 +3561,6 @@
} // now rest is set to the post-host stuff. } // now rest is set to the post-host stuff.
// chop off any delim chars. // chop off any delim chars.
if (!unsafeProtocol[lowerProto]) { if (!unsafeProtocol[lowerProto]) {
// First, make 100% sure that any "autoEscape" chars get // First, make 100% sure that any "autoEscape" chars get
// escaped, even if encodeURIComponent doesn't think they // escaped, even if encodeURIComponent doesn't think they
...@@ -3454,7 +3578,6 @@ ...@@ -3454,7 +3578,6 @@
} }
} // chop off from the tail first. } // chop off from the tail first.
var hash = rest.indexOf('#'); var hash = rest.indexOf('#');
if (hash !== -1) { if (hash !== -1) {
...@@ -3486,14 +3609,12 @@ ...@@ -3486,14 +3609,12 @@
self.pathname = '/'; self.pathname = '/';
} //to support http.request } //to support http.request
if (self.pathname || self.search) { if (self.pathname || self.search) {
p = self.pathname || ''; p = self.pathname || '';
var s = self.search || ''; var s = self.search || '';
self.path = p + s; self.path = p + s;
} // finally, reconstruct the href based on what has been validated. } // finally, reconstruct the href based on what has been validated.
self.href = format(self); self.href = format(self);
return self; return self;
} // format a parsed object into a url string } // format a parsed object into a url string
...@@ -3527,11 +3648,11 @@ ...@@ -3527,11 +3648,11 @@
query = stringify(self.query); query = stringify(self.query);
} }
var search = self.search || query && '?' + query || ''; var search = self.search || (query && '?' + query) || '';
if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
// unless they had them to begin with. // unless they had them to begin with.
if (self.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) { if (self.slashes || ((!protocol || slashedProtocol[protocol]) && host !== false)) {
host = '//' + (host || ''); host = '//' + (host || '');
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
} else if (!host) { } else if (!host) {
...@@ -3540,22 +3661,22 @@ ...@@ -3540,22 +3661,22 @@
if (hash && hash.charAt(0) !== '#') hash = '#' + hash; if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
if (search && search.charAt(0) !== '?') search = '?' + search; if (search && search.charAt(0) !== '?') search = '?' + search;
pathname = pathname.replace(/[?#]/g, function (match) { pathname = pathname.replace(/[?#]/g, function(match) {
return encodeURIComponent(match); return encodeURIComponent(match);
}); });
search = search.replace('#', '%23'); search = search.replace('#', '%23');
return protocol + host + pathname + search + hash; return protocol + host + pathname + search + hash;
} }
Url.prototype.format = function () { Url.prototype.format = function() {
return format(this); return format(this);
}; };
Url.prototype.resolve = function (relative) { Url.prototype.resolve = function(relative) {
return this.resolveObject(urlParse(relative, false, true)).format(); return this.resolveObject(urlParse(relative, false, true)).format();
}; };
Url.prototype.resolveObject = function (relative) { Url.prototype.resolveObject = function(relative) {
if (isString(relative)) { if (isString(relative)) {
var rel = new Url(); var rel = new Url();
rel.parse(relative, false, true); rel.parse(relative, false, true);
...@@ -3571,7 +3692,6 @@ ...@@ -3571,7 +3692,6 @@
} // hash is always overridden, no matter what. } // hash is always overridden, no matter what.
// even href="" will remove it. // even href="" will remove it.
result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here. result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.
if (relative.href === '') { if (relative.href === '') {
...@@ -3579,7 +3699,6 @@ ...@@ -3579,7 +3699,6 @@
return result; return result;
} // hrefs like //foo/bar always cut to the protocol. } // hrefs like //foo/bar always cut to the protocol.
if (relative.slashes && !relative.protocol) { if (relative.slashes && !relative.protocol) {
// take everything except the protocol from relative // take everything except the protocol from relative
var rkeys = Object.keys(relative); var rkeys = Object.keys(relative);
...@@ -3589,7 +3708,6 @@ ...@@ -3589,7 +3708,6 @@
if (rkey !== 'protocol') result[rkey] = relative[rkey]; if (rkey !== 'protocol') result[rkey] = relative[rkey];
} //urlParse appends trailing / to urls like http://www.example.com } //urlParse appends trailing / to urls like http://www.example.com
if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) { if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
result.path = result.pathname = '/'; result.path = result.pathname = '/';
} }
...@@ -3656,12 +3774,12 @@ ...@@ -3656,12 +3774,12 @@
} }
var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/', var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/', isRelAbs = relative.host || (relative.pathname && relative.pathname.charAt(0) === '/'),
mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname),
removeAllDots = mustEndAbs, removeAllDots = mustEndAbs,
srcPath = result.pathname && result.pathname.split('/') || [], srcPath = (result.pathname && result.pathname.split('/')) || [],
psychotic = result.protocol && !slashedProtocol[result.protocol]; psychotic = result.protocol && !slashedProtocol[result.protocol];
relPath = relative.pathname && relative.pathname.split('/') || []; // if the url is a non-slashed url, then relative relPath = (relative.pathname && relative.pathname.split('/')) || []; // if the url is a non-slashed url, then relative
// links like ../.. should be able // links like ../.. should be able
// to crawl up to the hostname, as well. This is strange. // to crawl up to the hostname, as well. This is strange.
// result.protocol has already been set by now. // result.protocol has already been set by now.
...@@ -3672,7 +3790,8 @@ ...@@ -3672,7 +3790,8 @@
result.port = null; result.port = null;
if (result.host) { if (result.host) {
if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host); if (srcPath[0] === '') srcPath[0] = result.host;
else srcPath.unshift(result.host);
} }
result.host = ''; result.host = '';
...@@ -3682,7 +3801,8 @@ ...@@ -3682,7 +3801,8 @@
relative.port = null; relative.port = null;
if (relative.host) { if (relative.host) {
if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host); if (relPath[0] === '') relPath[0] = relative.host;
else relPath.unshift(relative.host);
} }
relative.host = null; relative.host = null;
...@@ -3696,7 +3816,8 @@ ...@@ -3696,7 +3816,8 @@
if (isRelAbs) { if (isRelAbs) {
// it's absolute. // it's absolute.
result.host = relative.host || relative.host === '' ? relative.host : result.host; result.host = relative.host || relative.host === '' ? relative.host : result.host;
result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname; result.hostname =
relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
result.search = relative.search; result.search = relative.search;
result.query = relative.query; result.query = relative.query;
srcPath = relPath; // fall through to the dot-handling below. srcPath = relPath; // fall through to the dot-handling below.
...@@ -3729,7 +3850,8 @@ ...@@ -3729,7 +3850,8 @@
result.query = relative.query; //to support http.request result.query = relative.query; //to support http.request
if (!isNull(result.pathname) || !isNull(result.search)) { if (!isNull(result.pathname) || !isNull(result.search)) {
result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); result.path =
(result.pathname ? result.pathname : '') + (result.search ? result.search : '');
} }
result.href = result.format(); result.href = result.format();
...@@ -3753,9 +3875,10 @@ ...@@ -3753,9 +3875,10 @@
// however, if it ends in anything else non-slashy, // however, if it ends in anything else non-slashy,
// then it must NOT get a trailing slash. // then it must NOT get a trailing slash.
var last = srcPath.slice(-1)[0]; var last = srcPath.slice(-1)[0];
var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir var hasTrailingSlash =
((result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..')) ||
last === ''; // strip single dots, resolve double dots to parent dir
// if the path tries to go above the root, `up` ends up > 0 // if the path tries to go above the root, `up` ends up > 0
var up = 0; var up = 0;
...@@ -3774,7 +3897,6 @@ ...@@ -3774,7 +3897,6 @@
} }
} // if the path is allowed to go above the root, restore leading ..s } // if the path is allowed to go above the root, restore leading ..s
if (!mustEndAbs && !removeAllDots) { if (!mustEndAbs && !removeAllDots) {
for (; up--; up) { for (; up--; up) {
srcPath.unshift('..'); srcPath.unshift('..');
...@@ -3789,7 +3911,7 @@ ...@@ -3789,7 +3911,7 @@
srcPath.push(''); srcPath.push('');
} }
var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back var isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/'); // put the host back
if (psychotic) { if (psychotic) {
result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host
...@@ -3804,7 +3926,7 @@ ...@@ -3804,7 +3926,7 @@
} }
} }
mustEndAbs = mustEndAbs || result.host && srcPath.length; mustEndAbs = mustEndAbs || (result.host && srcPath.length);
if (mustEndAbs && !isAbsolute) { if (mustEndAbs && !isAbsolute) {
srcPath.unshift(''); srcPath.unshift('');
...@@ -3817,7 +3939,6 @@ ...@@ -3817,7 +3939,6 @@
result.pathname = srcPath.join('/'); result.pathname = srcPath.join('/');
} //to support request.http } //to support request.http
if (!isNull(result.pathname) || !isNull(result.search)) { if (!isNull(result.pathname) || !isNull(result.search)) {
result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
} }
...@@ -3828,7 +3949,7 @@ ...@@ -3828,7 +3949,7 @@
return result; return result;
}; };
Url.prototype.parseHost = function () { Url.prototype.parseHost = function() {
return parseHost(this); return parseHost(this);
}; };
...@@ -3856,7 +3977,10 @@ ...@@ -3856,7 +3977,10 @@
key: i, key: i,
disabled: i % 6 === 0, disabled: i % 6 === 0,
href: 'https://ant.design', href: 'https://ant.design',
avatar: ['https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png'][i % 2], avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name: `TradeCode ${i}`, name: `TradeCode ${i}`,
title: `一个任务名称 ${i}`, title: `一个任务名称 ${i}`,
owner: '曲丽丽', owner: '曲丽丽',
...@@ -3865,7 +3989,7 @@ ...@@ -3865,7 +3989,7 @@
status: Math.floor(Math.random() * 10) % 4, status: Math.floor(Math.random() * 10) % 4,
updatedAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`), updatedAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
createdAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`), createdAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
progress: Math.ceil(Math.random() * 100) progress: Math.ceil(Math.random() * 100),
}); });
} }
...@@ -3894,7 +4018,9 @@ ...@@ -3894,7 +4018,9 @@
const status = params.status.split(','); const status = params.status.split(',');
let filterDataSource = []; let filterDataSource = [];
status.forEach(s => { status.forEach(s => {
filterDataSource = filterDataSource.concat(dataSource.filter(data => parseInt(data.status, 10) === parseInt(s[0], 10))); filterDataSource = filterDataSource.concat(
dataSource.filter(data => parseInt(data.status, 10) === parseInt(s[0], 10)),
);
}); });
dataSource = filterDataSource; dataSource = filterDataSource;
} }
...@@ -3914,8 +4040,8 @@ ...@@ -3914,8 +4040,8 @@
pagination: { pagination: {
total: dataSource.length, total: dataSource.length,
pageSize, pageSize,
current: parseInt(params.currentPage, 10) || 1 current: parseInt(params.currentPage, 10) || 1,
} },
}; };
return res.json(result); return res.json(result);
} }
...@@ -3927,13 +4053,8 @@ ...@@ -3927,13 +4053,8 @@
url = req.url; // eslint-disable-line url = req.url; // eslint-disable-line
} }
const body = b && b.body || req.body; const body = (b && b.body) || req.body;
const { const { method, name, desc, key } = body;
method,
name,
desc,
key
} = body;
switch (method) { switch (method) {
/* eslint no-case-declarations:0 */ /* eslint no-case-declarations:0 */
...@@ -3946,7 +4067,10 @@ ...@@ -3946,7 +4067,10 @@
tableListDataSource.unshift({ tableListDataSource.unshift({
key: i, key: i,
href: 'https://ant.design', href: 'https://ant.design',
avatar: ['https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png'][i % 2], avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name: `TradeCode ${i}`, name: `TradeCode ${i}`,
title: `一个任务名称 ${i}`, title: `一个任务名称 ${i}`,
owner: '曲丽丽', owner: '曲丽丽',
...@@ -3955,7 +4079,7 @@ ...@@ -3955,7 +4079,7 @@
status: Math.floor(Math.random() * 10) % 2, status: Math.floor(Math.random() * 10) % 2,
updatedAt: new Date(), updatedAt: new Date(),
createdAt: new Date(), createdAt: new Date(),
progress: Math.ceil(Math.random() * 100) progress: Math.ceil(Math.random() * 100),
}); });
break; break;
...@@ -3964,7 +4088,7 @@ ...@@ -3964,7 +4088,7 @@
if (item.key === key) { if (item.key === key) {
Object.assign(item, { Object.assign(item, {
desc, desc,
name name,
}); });
return item; return item;
} }
...@@ -3982,7 +4106,7 @@ ...@@ -3982,7 +4106,7 @@
var rule = { var rule = {
'GET /api/rule': getRule, 'GET /api/rule': getRule,
'POST /api/rule': postRule 'POST /api/rule': postRule,
}; };
// 代码中会兼容本地 service mock 以及部署站点的静态数据 // 代码中会兼容本地 service mock 以及部署站点的静态数据
...@@ -4090,45 +4214,45 @@ ...@@ -4090,45 +4214,45 @@
geographic: { geographic: {
province: { province: {
label: '浙江省', label: '浙江省',
key: '330000' key: '330000',
}, },
city: { city: {
label: '杭州市', label: '杭州市',
key: '330100' key: '330100',
} },
}, },
address: '西湖区工专路 77 号', address: '西湖区工专路 77 号',
phone: '0752-268888888' phone: '0752-268888888',
}, },
// GET POST 可省略 // GET POST 可省略
'GET /api/users': [{ 'GET /api/users': [
{
key: '1', key: '1',
name: 'John Brown', name: 'John Brown',
age: 32, age: 32,
address: 'New York No. 1 Lake Park' address: 'New York No. 1 Lake Park',
}, { },
{
key: '2', key: '2',
name: 'Jim Green', name: 'Jim Green',
age: 42, age: 42,
address: 'London No. 1 Lake Park' address: 'London No. 1 Lake Park',
}, { },
{
key: '3', key: '3',
name: 'Joe Black', name: 'Joe Black',
age: 32, age: 32,
address: 'Sidney No. 1 Lake Park' address: 'Sidney No. 1 Lake Park',
}], },
],
'POST /api/login/account': (req, res) => { 'POST /api/login/account': (req, res) => {
const { const { password, userName, type } = req.body;
password,
userName,
type
} = req.body;
if (password === 'ant.design' && userName === 'admin') { if (password === 'ant.design' && userName === 'admin') {
res.send({ res.send({
status: 'ok', status: 'ok',
type, type,
currentAuthority: 'admin' currentAuthority: 'admin',
}); });
return; return;
} }
...@@ -4137,7 +4261,7 @@ ...@@ -4137,7 +4261,7 @@
res.send({ res.send({
status: 'ok', status: 'ok',
type, type,
currentAuthority: 'user' currentAuthority: 'user',
}); });
return; return;
} }
...@@ -4145,13 +4269,13 @@ ...@@ -4145,13 +4269,13 @@
res.send({ res.send({
status: 'error', status: 'error',
type, type,
currentAuthority: 'guest' currentAuthority: 'guest',
}); });
}, },
'POST /api/register': (req, res) => { 'POST /api/register': (req, res) => {
res.send({ res.send({
status: 'ok', status: 'ok',
currentAuthority: 'user' currentAuthority: 'user',
}); });
}, },
'GET /api/500': (req, res) => { 'GET /api/500': (req, res) => {
...@@ -4160,7 +4284,7 @@ ...@@ -4160,7 +4284,7 @@
status: 500, status: 500,
error: 'error', error: 'error',
message: 'error', message: 'error',
path: '/base/category/list' path: '/base/category/list',
}); });
}, },
'GET /api/404': (req, res) => { 'GET /api/404': (req, res) => {
...@@ -4169,7 +4293,7 @@ ...@@ -4169,7 +4293,7 @@
status: 404, status: 404,
error: 'Not Found', error: 'Not Found',
message: 'No message available', message: 'No message available',
path: '/base/category/list/2121212' path: '/base/category/list/2121212',
}); });
}, },
'GET /api/403': (req, res) => { 'GET /api/403': (req, res) => {
...@@ -4178,7 +4302,7 @@ ...@@ -4178,7 +4302,7 @@
status: 403, status: 403,
error: 'Unauthorized', error: 'Unauthorized',
message: 'Unauthorized', message: 'Unauthorized',
path: '/base/category/list' path: '/base/category/list',
}); });
}, },
'GET /api/401': (req, res) => { 'GET /api/401': (req, res) => {
...@@ -4187,13 +4311,12 @@ ...@@ -4187,13 +4311,12 @@
status: 401, status: 401,
error: 'Unauthorized', error: 'Unauthorized',
message: 'Unauthorized', message: 'Unauthorized',
path: '/base/category/list' path: '/base/category/list',
}); });
} },
}; };
const data = _objectSpread({}, api, chart, geographic, notices, profile, rule, user$1); const data = _objectSpread({}, api, chart, geographic, notices, profile, rule, user$1);
return data; return data;
});
}));
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"lint:prettier": "check-prettier lint", "lint:prettier": "check-prettier lint",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"lint:ts": "tslint -p . -c tslint.yml", "lint:ts": "tslint -p . -c tslint.yml",
"prettier": " check-prettier write", "prettier": "prettier -c --write '**/*'",
"site": "npm run fetch:blocks && npm run functions:build && umi build", "site": "npm run fetch:blocks && npm run functions:build && umi build",
"start": "umi dev", "start": "umi dev",
"start:no-mock": "cross-env MOCK=none umi dev", "start:no-mock": "cross-env MOCK=none umi dev",
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
"lint-staged": { "lint-staged": {
"**/*.less": "stylelint --syntax less", "**/*.less": "stylelint --syntax less",
"**/*.{js,jsx}": "npm run lint-staged:js", "**/*.{js,jsx}": "npm run lint-staged:js",
"**/*.{js,ts,tsx,md,json,jsx,less}": [ "**/*.{js,jsx,tsx,ts,less,md,json}": [
"npm run prettier", "prettier --write",
"git add" "git add"
], ],
"**/*.{ts,tsx}": "npm run lint-staged:ts" "**/*.{ts,tsx}": "npm run lint-staged:ts"
......
...@@ -30,18 +30,16 @@ ...@@ -30,18 +30,16 @@
font-variant: tabular-nums; font-variant: tabular-nums;
line-height: 1.5; line-height: 1.5;
list-style: none; list-style: none;
-webkit-font-feature-settings: "tnum"; -webkit-font-feature-settings: 'tnum';
font-feature-settings: "tnum"; font-feature-settings: 'tnum';
position: absolute; position: absolute;
display: none; display: none;
color: #1890ff; color: #1890ff;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
opacity: 0; opacity: 0;
-webkit-transition: -webkit-transform 0.3s -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
cubic-bezier(0.78, 0.14, 0.15, 0.86); transition: -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: -webkit-transform 0.3s
cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86), transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
-webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
......
...@@ -37,7 +37,7 @@ startServer.stdout.on('data', data => { ...@@ -37,7 +37,7 @@ startServer.stdout.on('data', data => {
['test', '--', '--maxWorkers=1', '--runInBand'], ['test', '--', '--maxWorkers=1', '--runInBand'],
{ {
stdio: 'inherit', stdio: 'inherit',
} },
); );
testCmd.on('exit', code => { testCmd.on('exit', code => {
startServer.kill(); startServer.kill();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment