Skip to content

Commit 0c57eda

Browse files
author
hzj
committed
update
1 parent b6a51c3 commit 0c57eda

File tree

6 files changed

+35
-10
lines changed

6 files changed

+35
-10
lines changed

docker/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
ports:
1212
- 8001:80
1313
volumes:
14-
- webDist:/webDist
14+
- webDir:/webDir
1515

1616

1717
web:
@@ -20,7 +20,7 @@ services:
2020
dockerfile: Dockerfile
2121
container_name: blog_web
2222
volumes:
23-
- webDist:/www/web/build
23+
- webDir:/www/web/build
2424

2525
volumes:
26-
webDist:
26+
webDir:

docker/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# hzjio.com web side
22
server {
33
listen 80;
4-
root /webDist;
4+
root /webDir;
55

66
location / {
77
index index.html;

scripts/start.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Do this as the first thing so that any code reading it knows the right env.
44
process.env.BABEL_ENV = 'development';
55
process.env.NODE_ENV = 'development';
6+
process.env.PORT = '3001';
67

78
// Makes the script crash on unhandled rejections instead of silently
89
// ignoring them. In the future, promise rejections that are not handled will

src/app_config.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
1-
export const Config = {
1+
let config: AppConfig;
22

3+
4+
const mockConfig = {
35
/** api域名 */
46
// ApiDomain : 'https://www.hzjio.com'
57

68
/** mock api domain */
7-
ApiDomain : 'http://mock.eolinker.com/betP9Ab5500fe5e2f88721c31b19e9898cac277e32e6866?uri='
8-
};
9+
ApiDomain: 'http://mock.eolinker.com/betP9Ab5500fe5e2f88721c31b19e9898cac277e32e6866?uri='
10+
};
11+
12+
const devConfig = {
13+
ApiDomain: 'http://localhost:3000'
14+
};
15+
16+
const prodConfig = {
17+
ApiDomain: 'http://api.hzjio.com'
18+
};
19+
20+
if (process.env.NODE_ENV === 'development') {
21+
config = devConfig;
22+
} else if (process.env.NODE_ENV === 'mock') {
23+
config = mockConfig;
24+
} else {
25+
config = prodConfig;
26+
}
27+
28+
export default config;
29+
30+
interface AppConfig {
31+
ApiDomain: string;
32+
}

src/const/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Config } from "../app_config";
1+
import Config from "../app_config";
22

33
/** api 域名 */
44
export const ApiDomain = Config.ApiDomain;

src/containers/home/article_item/article_item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
2-
import './article_item.scss';
32
import { Link } from "react-router-dom";
3+
import './article_item.scss';
44

55
export class HomeArticleItem extends React.Component<HomeArticleItemProps> {
66

@@ -10,7 +10,7 @@ export class HomeArticleItem extends React.Component<HomeArticleItemProps> {
1010

1111
public render() {
1212
return (
13-
<Link to={`articles/${this.props.id}`} href="javascript:;" className="homeArticle">
13+
<Link to={`article/${this.props.id}`} href="javascript:;" className="homeArticle">
1414
<div className="homeArticle-title">{this.props.title}</div>
1515
<div className="homeArticle-summary">{this.props.summary}</div>
1616
</Link>

0 commit comments

Comments
 (0)