Unverified Commit 49ac86cc authored by 陈帅's avatar 陈帅 Committed by GitHub

Merge pull request #25 from ant-design/screenshot

add snapshot.png
parents 0382be73 8fd56f96
AccountCenter/snapshot.png

50.6 KB | W: | H:

AccountCenter/snapshot.png

322 KB | W: | H:

AccountCenter/snapshot.png
AccountCenter/snapshot.png
AccountCenter/snapshot.png
AccountCenter/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -166,7 +166,7 @@ function fakeList(count: number): ListItemDataType[] { ...@@ -166,7 +166,7 @@ function fakeList(count: number): ListItemDataType[] {
function getFakeList(req: { query: any }, res: { json: (arg0: ListItemDataType[]) => void }) { function getFakeList(req: { query: any }, res: { json: (arg0: ListItemDataType[]) => void }) {
const params = req.query; const params = req.query;
const count = params.count * 1 || 20; const count = params.count * 1 || 5;
const result = fakeList(count); const result = fakeList(count);
return res.json(result); return res.json(result);
......
AccountSettings/snapshot.png

48.5 KB | W: | H:

AccountSettings/snapshot.png

77.3 KB | W: | H:

AccountSettings/snapshot.png
AccountSettings/snapshot.png
AccountSettings/snapshot.png
AccountSettings/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
DashboardAnalysis/snapshot.png

59.9 KB | W: | H:

DashboardAnalysis/snapshot.png

272 KB | W: | H:

DashboardAnalysis/snapshot.png
DashboardAnalysis/snapshot.png
DashboardAnalysis/snapshot.png
DashboardAnalysis/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
DashboardMonitor/snapshot.png

169 KB | W: | H:

DashboardMonitor/snapshot.png

280 KB | W: | H:

DashboardMonitor/snapshot.png
DashboardMonitor/snapshot.png
DashboardMonitor/snapshot.png
DashboardMonitor/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
DashboardWorkplace/snapshot.png

137 KB | W: | H:

DashboardWorkplace/snapshot.png

223 KB | W: | H:

DashboardWorkplace/snapshot.png
DashboardWorkplace/snapshot.png
DashboardWorkplace/snapshot.png
DashboardWorkplace/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -7,6 +7,9 @@ flow ...@@ -7,6 +7,9 @@ flow
```sh ```sh
umi block add ant-design-pro/flow umi block add ant-design-pro/flow
``` ```
## SNAPSHOT
![SNAPSHOT](./snapshot.png)
## LICENSE ## LICENSE
......
...@@ -7,6 +7,9 @@ flow ...@@ -7,6 +7,9 @@ flow
```sh ```sh
umi block add ant-design-pro/flow umi block add ant-design-pro/flow
``` ```
## SNAPSHOT
![SNAPSHOT](./snapshot.png)
## LICENSE ## LICENSE
......
...@@ -7,6 +7,9 @@ flow ...@@ -7,6 +7,9 @@ flow
```sh ```sh
umi block add ant-design-pro/flow umi block add ant-design-pro/flow
``` ```
## SNAPSHOT
![SNAPSHOT](./snapshot.png)
## LICENSE ## LICENSE
......
Exception403/snapshot.png

38.7 KB | W: | H:

Exception403/snapshot.png

63.6 KB | W: | H:

Exception403/snapshot.png
Exception403/snapshot.png
Exception403/snapshot.png
Exception403/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
Exception404/snapshot.png

29.8 KB | W: | H:

Exception404/snapshot.png

58.6 KB | W: | H:

Exception404/snapshot.png
Exception404/snapshot.png
Exception404/snapshot.png
Exception404/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
Exception500/snapshot.png

30.4 KB | W: | H:

Exception500/snapshot.png

58 KB | W: | H:

Exception500/snapshot.png
Exception500/snapshot.png
Exception500/snapshot.png
Exception500/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
FormAdvancedForm/snapshot.png

54.6 KB | W: | H:

FormAdvancedForm/snapshot.png

105 KB | W: | H:

FormAdvancedForm/snapshot.png
FormAdvancedForm/snapshot.png
FormAdvancedForm/snapshot.png
FormAdvancedForm/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
FormBasicForm/snapshot.png

46.7 KB | W: | H:

FormBasicForm/snapshot.png

80.7 KB | W: | H:

FormBasicForm/snapshot.png
FormBasicForm/snapshot.png
FormBasicForm/snapshot.png
FormBasicForm/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
FormStepForm/snapshot.png

47.9 KB | W: | H:

FormStepForm/snapshot.png

80.6 KB | W: | H:

FormStepForm/snapshot.png
FormStepForm/snapshot.png
FormStepForm/snapshot.png
FormStepForm/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ListBasicList/snapshot.png

83.3 KB | W: | H:

ListBasicList/snapshot.png

131 KB | W: | H:

ListBasicList/snapshot.png
ListBasicList/snapshot.png
ListBasicList/snapshot.png
ListBasicList/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ListCardList/snapshot.png

83.3 KB | W: | H:

ListCardList/snapshot.png

154 KB | W: | H:

ListCardList/snapshot.png
ListCardList/snapshot.png
ListCardList/snapshot.png
ListCardList/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -8,6 +8,10 @@ SearchList ...@@ -8,6 +8,10 @@ SearchList
umi block add ant-design-pro/searchlist umi block add ant-design-pro/searchlist
``` ```
## SNAPSHOT
![SNAPSHOT](./snapshot.png)
## LICENSE ## LICENSE
MIT MIT
ListSearchApplications/snapshot.png

52.2 KB | W: | H:

ListSearchApplications/snapshot.png

68.9 KB | W: | H:

ListSearchApplications/snapshot.png
ListSearchApplications/snapshot.png
ListSearchApplications/snapshot.png
ListSearchApplications/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ListSearchArticles/snapshot.png

85.8 KB | W: | H:

ListSearchArticles/snapshot.png

290 KB | W: | H:

ListSearchArticles/snapshot.png
ListSearchArticles/snapshot.png
ListSearchArticles/snapshot.png
ListSearchArticles/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ListSearchProjects/snapshot.png

252 KB | W: | H:

ListSearchProjects/snapshot.png

395 KB | W: | H:

ListSearchProjects/snapshot.png
ListSearchProjects/snapshot.png
ListSearchProjects/snapshot.png
ListSearchProjects/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ListTableList/snapshot.png

99.5 KB | W: | H:

ListTableList/snapshot.png

129 KB | W: | H:

ListTableList/snapshot.png
ListTableList/snapshot.png
ListTableList/snapshot.png
ListTableList/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ProfileAdvanced/snapshot.png

73.8 KB | W: | H:

ProfileAdvanced/snapshot.png

209 KB | W: | H:

ProfileAdvanced/snapshot.png
ProfileAdvanced/snapshot.png
ProfileAdvanced/snapshot.png
ProfileAdvanced/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ProfileBasic/snapshot.png

72.4 KB | W: | H:

ProfileBasic/snapshot.png

134 KB | W: | H:

ProfileBasic/snapshot.png
ProfileBasic/snapshot.png
ProfileBasic/snapshot.png
ProfileBasic/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ResultFail/snapshot.png

26.8 KB | W: | H:

ResultFail/snapshot.png

50.6 KB | W: | H:

ResultFail/snapshot.png
ResultFail/snapshot.png
ResultFail/snapshot.png
ResultFail/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
ResultSuccess/snapshot.png

44.6 KB | W: | H:

ResultSuccess/snapshot.png

75.5 KB | W: | H:

ResultSuccess/snapshot.png
ResultSuccess/snapshot.png
ResultSuccess/snapshot.png
ResultSuccess/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
UserLogin/snapshot.png

16.8 KB | W: | H:

UserLogin/snapshot.png

40 KB | W: | H:

UserLogin/snapshot.png
UserLogin/snapshot.png
UserLogin/snapshot.png
UserLogin/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
UserRegister/snapshot.png

15.7 KB | W: | H:

UserRegister/snapshot.png

37.8 KB | W: | H:

UserRegister/snapshot.png
UserRegister/snapshot.png
UserRegister/snapshot.png
UserRegister/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
UserRegisterResult/snapshot.png

22.2 KB | W: | H:

UserRegisterResult/snapshot.png

46.4 KB | W: | H:

UserRegisterResult/snapshot.png
UserRegisterResult/snapshot.png
UserRegisterResult/snapshot.png
UserRegisterResult/snapshot.png
  • 2-up
  • Swipe
  • Onion skin
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable eslint-comments/no-unlimited-disable */
const { spawn } = require('child_process');
const puppeteer = require('puppeteer');
const { join, dirname } = require('path');
const fs = require('fs');
const getNpmRegistry = require('getnpmregistry');
const execa = require('execa');
const env = Object.create(process.env);
env.BROWSER = 'none';
env.TEST = true;
env.COMPRESS = 'none';
env.PROGRESS = 'none';
env.BLOCK_PAGES_LAYOUT = 'blankLayout';
let browser;
const startServer = async path => {
let once = false;
return new Promise(resolve => {
env.PAGES_PATH = path + '/src';
console.log(path);
const startServer = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['run', 'start'], {
env,
});
console.log('Starting development server');
startServer.stdout.on('data', data => {
console.log(data.toString());
// hack code , wait umi
if (!once && data.toString().indexOf('Compiled successfully') >= 0) {
// eslint-disable-next-line
once = true;
return resolve(startServer);
}
});
});
};
const autoScroll = page => {
return page.evaluate(() => {
return new Promise((resolve, reject) => {
var totalHeight = 0;
var distance = 100;
var timer = setInterval(() => {
var scrollHeight = document.body.scrollHeight;
window.scrollBy(0, distance);
totalHeight += distance;
if (totalHeight >= scrollHeight) {
clearInterval(timer);
resolve();
}
}, 100);
});
});
};
const getImage = async (page, path) => {
const server = await startServer(path);
await page.reload('http://127.0.0.1:8000');
await page.setViewport({
width: 1440,
height: 800,
});
await autoScroll(page);
await page.screenshot({
path: join(path, 'snapshot.png'),
fullPage: true,
});
server.kill();
};
const openBrowser = async () => {
browser = await puppeteer.launch({
headless: false,
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--no-first-run',
'--no-zygote',
'--no-sandbox',
],
});
const page = await browser.newPage();
page.goto('http://127.0.0.1:8000');
return page;
};
const getAllFile = async () => {
const cwd = join(__dirname, '../');
const files = fs.readdirSync(cwd);
return files.filter(path => {
const itemPath = join(cwd, path);
const stat = fs.statSync(itemPath);
if (path.includes('.') || path.includes('_') || path.includes('node_modules')) {
return false;
}
if (stat.isDirectory()) {
return true;
}
return false;
});
};
getAllFile().then(async dirList => {
const registry = await getNpmRegistry();
const page = await openBrowser();
const loopGetImage = async index => {
try {
console.log('install ' + dirList[index] + ' dependencies');
await execa('yarn', ['install', `--registry=${registry}`], {
cwd: join(__dirname, '../' + dirList[index]),
});
await getImage(page, dirList[index]);
if (dirList.length > index) {
console.log('Screenshot ' + dirList[index]);
return loopGetImage(index + 1);
}
} catch (error) {
console.log(error);
}
return Promise.resolve(true);
};
await loopGetImage(0);
browser.close();
});
{ {
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "cross-env PAGES_PATH='DashboardAnalysis/src' umi dev", "dev": "cross-env PAGES_PATH='AccountCenter/src' umi dev",
"start": "umi dev",
"lint": "npm run lint:ts && npm run lint:style && npm run lint:prettier", "lint": "npm run lint:ts && npm run lint:style && npm run lint:prettier",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"lint-staged:ts": "tslint", "lint-staged:ts": "tslint",
...@@ -31,11 +32,17 @@ ...@@ -31,11 +32,17 @@
"numeral": "^2.0.6", "numeral": "^2.0.6",
"react-dom": "^16.8.6" "react-dom": "^16.8.6"
}, },
"optionalDependencies": {
"puppeteer": "^1.17.0"
},
"devDependencies": { "devDependencies": {
"@types/classnames": "^2.2.7", "@types/classnames": "^2.2.7",
"@types/numeral": "^0.0.25", "@types/numeral": "^0.0.25",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"check-prettier": "^1.0.3", "check-prettier": "^1.0.3",
"cross-port-killer": "^1.1.1",
"execa": "^1.0.0",
"getnpmregistry": "^1.0.1",
"glob": "^7.1.3", "glob": "^7.1.3",
"husky": "^2.2.0", "husky": "^2.2.0",
"lint-staged": "^8.1.0", "lint-staged": "^8.1.0",
...@@ -51,9 +58,9 @@ ...@@ -51,9 +58,9 @@
"tslint-config-prettier": "^1.17.0", "tslint-config-prettier": "^1.17.0",
"tslint-eslint-rules": "^5.4.0", "tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0", "tslint-react": "^3.6.0",
"typescript": "^3.4.5", "typescript": "^3.5.1",
"umi": "^2.6.17", "umi": "^2.6.17",
"umi-plugin-block-dev": "^2.0.2", "umi-plugin-block-dev": "^2.1.11",
"umi-plugin-react": "^1.7.6", "umi-plugin-react": "^1.7.6",
"umi-request": "^1.0.0" "umi-request": "^1.0.0"
}, },
......
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