├── .angular-cli.json
├── .editorconfig
├── .gitignore
├── README.md
├── doc
└── chihu2-web.gif
├── e2e
├── app.e2e-spec.ts
├── app.po.ts
└── tsconfig.e2e.json
├── karma.conf.js
├── package.json
├── protractor.conf.js
├── src
├── app
│ ├── app,component.js
│ ├── app-routes
│ │ ├── app-routes.module.ts
│ │ ├── can-activate.service.spec.ts
│ │ ├── can-activate.service.ts
│ │ ├── resolve-article.service.spec.ts
│ │ ├── resolve-article.service.ts
│ │ ├── resolve-people.service.spec.ts
│ │ ├── resolve-people.service.ts
│ │ ├── resolve-share.service.spec.ts
│ │ ├── resolve-share.service.ts
│ │ ├── resolve-work.service.spec.ts
│ │ └── resolve-work.service.ts
│ ├── app.component.html
│ ├── app.component.scss
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── components
│ │ └── home
│ │ │ ├── answer-card
│ │ │ ├── answer-card,component.js
│ │ │ ├── answer-card.component.html
│ │ │ ├── answer-card.component.scss
│ │ │ ├── answer-card.component.spec.ts
│ │ │ ├── answer-card.component.ts
│ │ │ └── answer-card.module.ts
│ │ │ ├── card
│ │ │ ├── card,component.js
│ │ │ ├── card.component.html
│ │ │ ├── card.component.scss
│ │ │ ├── card.component.spec.ts
│ │ │ ├── card.component.ts
│ │ │ └── card.module.ts
│ │ │ ├── food
│ │ │ ├── food,component.js
│ │ │ ├── food.component.html
│ │ │ ├── food.component.scss
│ │ │ ├── food.component.spec.ts
│ │ │ ├── food.component.ts
│ │ │ └── food.module.ts
│ │ │ ├── iheader
│ │ │ ├── iheader,component.js
│ │ │ ├── iheader.component.html
│ │ │ ├── iheader.component.scss
│ │ │ ├── iheader.component.spec.ts
│ │ │ ├── iheader.component.ts
│ │ │ └── iheader.module.ts
│ │ │ ├── no-data
│ │ │ ├── no-data,component.js
│ │ │ ├── no-data.component.html
│ │ │ ├── no-data.component.scss
│ │ │ ├── no-data.component.spec.ts
│ │ │ ├── no-data.component.ts
│ │ │ └── no-data.module.ts
│ │ │ ├── photoswipe
│ │ │ ├── photoswipe.component.html
│ │ │ ├── photoswipe.component.scss
│ │ │ ├── photoswipe.component.spec.ts
│ │ │ ├── photoswipe.component.ts
│ │ │ └── photoswipe.module.ts
│ │ │ ├── send-que
│ │ │ ├── send-que,component.js
│ │ │ ├── send-que.component.html
│ │ │ ├── send-que.component.scss
│ │ │ ├── send-que.component.spec.ts
│ │ │ ├── send-que.component.ts
│ │ │ └── send-que.module.ts
│ │ │ ├── send-share
│ │ │ ├── send-share,component.js
│ │ │ ├── send-share.component.html
│ │ │ ├── send-share.component.scss
│ │ │ ├── send-share.component.spec.ts
│ │ │ ├── send-share.component.ts
│ │ │ └── send-share.module.ts
│ │ │ ├── share-card
│ │ │ ├── share-card,component.js
│ │ │ ├── share-card.component.html
│ │ │ ├── share-card.component.scss
│ │ │ ├── share-card.component.spec.ts
│ │ │ ├── share-card.component.ts
│ │ │ └── share-card.module.ts
│ │ │ ├── side-bar
│ │ │ ├── side-bar,component.js
│ │ │ ├── side-bar.component.html
│ │ │ ├── side-bar.component.scss
│ │ │ ├── side-bar.component.spec.ts
│ │ │ ├── side-bar.component.ts
│ │ │ └── side-bar.module.ts
│ │ │ └── steps
│ │ │ ├── steps,component.js
│ │ │ ├── steps.component.html
│ │ │ ├── steps.component.scss
│ │ │ ├── steps.component.spec.ts
│ │ │ ├── steps.component.ts
│ │ │ └── steps.module.ts
│ ├── home
│ │ ├── index
│ │ │ ├── article
│ │ │ │ ├── article-routing.module.ts
│ │ │ │ ├── article.component.html
│ │ │ │ ├── article.component.scss
│ │ │ │ ├── article.component.spec.ts
│ │ │ │ ├── article.component.ts
│ │ │ │ └── article.module.ts
│ │ │ ├── home
│ │ │ │ ├── home,component.js
│ │ │ │ ├── home-routing.module.ts
│ │ │ │ ├── home.component.html
│ │ │ │ ├── home.component.scss
│ │ │ │ ├── home.component.spec.ts
│ │ │ │ ├── home.component.ts
│ │ │ │ └── home.module.ts
│ │ │ ├── hot-work
│ │ │ │ ├── hot-work-routing.module.ts
│ │ │ │ ├── hot-work.component.html
│ │ │ │ ├── hot-work.component.scss
│ │ │ │ ├── hot-work.component.spec.ts
│ │ │ │ ├── hot-work.component.ts
│ │ │ │ └── hot-work.module.ts
│ │ │ ├── index,component.js
│ │ │ ├── index-routing.module.ts
│ │ │ ├── index.component.html
│ │ │ ├── index.component.scss
│ │ │ ├── index.component.spec.ts
│ │ │ ├── index.component.ts
│ │ │ ├── index.module.ts
│ │ │ ├── open-article
│ │ │ │ ├── open-article,component.js
│ │ │ │ ├── open-article-routing.module.ts
│ │ │ │ ├── open-article.component.html
│ │ │ │ ├── open-article.component.scss
│ │ │ │ ├── open-article.component.spec.ts
│ │ │ │ ├── open-article.component.ts
│ │ │ │ └── open-article.module.ts
│ │ │ ├── open-share
│ │ │ │ ├── open-share,component.js
│ │ │ │ ├── open-share-routing.module.ts
│ │ │ │ ├── open-share.component.html
│ │ │ │ ├── open-share.component.scss
│ │ │ │ ├── open-share.component.spec.ts
│ │ │ │ ├── open-share.component.ts
│ │ │ │ └── open-share.module.ts
│ │ │ ├── send-work
│ │ │ │ ├── send-work,component.js
│ │ │ │ ├── send-work-routing.module.ts
│ │ │ │ ├── send-work.component.html
│ │ │ │ ├── send-work.component.scss
│ │ │ │ ├── send-work.component.spec.ts
│ │ │ │ ├── send-work.component.ts
│ │ │ │ └── send-work.module.ts
│ │ │ ├── share
│ │ │ │ ├── share-routing.module.ts
│ │ │ │ ├── share.component.html
│ │ │ │ ├── share.component.scss
│ │ │ │ ├── share.component.spec.ts
│ │ │ │ ├── share.component.ts
│ │ │ │ └── share.module.ts
│ │ │ └── work
│ │ │ │ ├── work,component.js
│ │ │ │ ├── work-routing.module.ts
│ │ │ │ ├── work.component.html
│ │ │ │ ├── work.component.scss
│ │ │ │ ├── work.component.spec.ts
│ │ │ │ ├── work.component.ts
│ │ │ │ └── work.module.ts
│ │ ├── login
│ │ │ ├── login,component.js
│ │ │ ├── login-routing.module.ts
│ │ │ ├── login.component.html
│ │ │ ├── login.component.scss
│ │ │ ├── login.component.spec.ts
│ │ │ ├── login.component.ts
│ │ │ ├── login.module.ts
│ │ │ ├── signin
│ │ │ │ ├── signin,component.js
│ │ │ │ ├── signin-routing.module.ts
│ │ │ │ ├── signin.component.html
│ │ │ │ ├── signin.component.scss
│ │ │ │ ├── signin.component.spec.ts
│ │ │ │ ├── signin.component.ts
│ │ │ │ └── signin.module.ts
│ │ │ └── signup
│ │ │ │ ├── signup,component.js
│ │ │ │ ├── signup-routing.module.ts
│ │ │ │ ├── signup.component.html
│ │ │ │ ├── signup.component.scss
│ │ │ │ ├── signup.component.spec.ts
│ │ │ │ ├── signup.component.ts
│ │ │ │ └── signup.module.ts
│ │ ├── nofound
│ │ │ ├── nofound,component.js
│ │ │ ├── nofound-routing.module.ts
│ │ │ ├── nofound.component.html
│ │ │ ├── nofound.component.scss
│ │ │ ├── nofound.component.spec.ts
│ │ │ ├── nofound.component.ts
│ │ │ └── nofound.module.ts
│ │ └── people
│ │ │ ├── article
│ │ │ ├── article-routing.module.ts
│ │ │ ├── article.component.html
│ │ │ ├── article.component.scss
│ │ │ ├── article.component.spec.ts
│ │ │ ├── article.component.ts
│ │ │ └── article.module.ts
│ │ │ ├── collect
│ │ │ ├── collect-routing.module.ts
│ │ │ ├── collect.component.html
│ │ │ ├── collect.component.scss
│ │ │ ├── collect.component.spec.ts
│ │ │ ├── collect.component.ts
│ │ │ └── collect.module.ts
│ │ │ ├── fork-que
│ │ │ ├── fork-que-routing.module.ts
│ │ │ ├── fork-que.component.html
│ │ │ ├── fork-que.component.scss
│ │ │ ├── fork-que.component.spec.ts
│ │ │ ├── fork-que.component.ts
│ │ │ └── fork-que.module.ts
│ │ │ ├── fork-user
│ │ │ ├── fork-user-routing.module.ts
│ │ │ ├── fork-user.component.html
│ │ │ ├── fork-user.component.scss
│ │ │ ├── fork-user.component.spec.ts
│ │ │ ├── fork-user.component.ts
│ │ │ └── fork-user.module.ts
│ │ │ ├── people,component.js
│ │ │ ├── people-routing.module.ts
│ │ │ ├── people.component.html
│ │ │ ├── people.component.scss
│ │ │ ├── people.component.spec.ts
│ │ │ ├── people.component.ts
│ │ │ ├── people.module.ts
│ │ │ ├── que
│ │ │ ├── que-routing.module.ts
│ │ │ ├── que.component.html
│ │ │ ├── que.component.scss
│ │ │ ├── que.component.spec.ts
│ │ │ ├── que.component.ts
│ │ │ └── que.module.ts
│ │ │ ├── share
│ │ │ ├── share-routing.module.ts
│ │ │ ├── share.component.html
│ │ │ ├── share.component.scss
│ │ │ ├── share.component.spec.ts
│ │ │ ├── share.component.ts
│ │ │ └── share.module.ts
│ │ │ └── work
│ │ │ ├── work,component.js
│ │ │ ├── work-routing.module.ts
│ │ │ ├── work.component.html
│ │ │ ├── work.component.scss
│ │ │ ├── work.component.spec.ts
│ │ │ ├── work.component.ts
│ │ │ └── work.module.ts
│ └── service
│ │ ├── user.service.spec.ts
│ │ └── user.service.ts
├── assets
│ ├── .gitkeep
│ ├── default-skin
│ │ ├── default-skin.css
│ │ ├── default-skin.png
│ │ ├── default-skin.svg
│ │ └── preloader.gif
│ ├── img
│ │ ├── addimg.png
│ │ └── download.png
│ ├── photoswipe-ui-default.min.js
│ ├── photoswipe.css
│ └── photoswipe.min.js
├── chihu.ico
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── index.html
├── main.ts
├── polyfills.ts
├── styles.scss
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── typings.d.ts
├── tsconfig.json
└── tslint.json
/.angular-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "project": {
4 | "name": "chihu-web-angular"
5 | },
6 | "apps": [{
7 | "root": "src",
8 | "outDir": "dist",
9 | "assets": [
10 | "assets",
11 | "favicon.ico"
12 | ],
13 | "index": "index.html",
14 | "main": "main.ts",
15 | "polyfills": "polyfills.ts",
16 | "test": "test.ts",
17 | "tsconfig": "tsconfig.app.json",
18 | "testTsconfig": "tsconfig.spec.json",
19 | "prefix": "app",
20 | "styles": [
21 | "styles.scss"
22 | ],
23 | "scripts": [],
24 | "environmentSource": "environments/environment.ts",
25 | "environments": {
26 | "dev": "environments/environment.ts",
27 | "prod": "environments/environment.prod.ts"
28 | }
29 | }],
30 | "e2e": {
31 | "protractor": {
32 | "config": "./protractor.conf.js"
33 | }
34 | },
35 | "lint": [{
36 | "project": "src/tsconfig.app.json",
37 | "exclude": "**/node_modules/**"
38 | },
39 | {
40 | "project": "src/tsconfig.spec.json",
41 | "exclude": "**/node_modules/**"
42 | },
43 | {
44 | "project": "e2e/tsconfig.e2e.json",
45 | "exclude": "**/node_modules/**"
46 | }
47 | ],
48 | "test": {
49 | "karma": {
50 | "config": "./karma.conf.js"
51 | }
52 | },
53 | "defaults": {
54 | "styleExt": "scss",
55 | "component": {}
56 | }
57 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Awesome chihu2 web DEMO created with Angular4.x
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Live Demo: https://chihu-team.github.io/
24 |
--------------------------------------------------------------------------------
/doc/chihu2-web.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/doc/chihu2-web.gif
--------------------------------------------------------------------------------
/e2e/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { ChihuWebAngularPage } from './app.po';
2 |
3 | describe('chihu-web-angular App', () => {
4 | let page: ChihuWebAngularPage;
5 |
6 | beforeEach(() => {
7 | page = new ChihuWebAngularPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getParagraphText()).toEqual('Welcome to app!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/e2e/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class ChihuWebAngularPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getParagraphText() {
9 | return element(by.css('app-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/e2e",
5 | "baseUrl": "./",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": [
9 | "jasmine",
10 | "jasminewd2",
11 | "node"
12 | ]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/0.13/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular/cli'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular/cli/plugins/karma')
14 | ],
15 | client:{
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | reports: [ 'html', 'lcovonly' ],
20 | fixWebpackSourcePaths: true
21 | },
22 | angularCli: {
23 | environment: 'dev'
24 | },
25 | reporters: ['progress', 'kjhtml'],
26 | port: 9876,
27 | colors: true,
28 | logLevel: config.LOG_INFO,
29 | autoWatch: true,
30 | browsers: ['Chrome'],
31 | singleRun: false
32 | });
33 | };
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chihu-web-angular",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "scripts": {
6 | "ng": "ng",
7 | "start": "ng serve",
8 | "build": "ng build",
9 | "test": "ng test",
10 | "lint": "ng lint",
11 | "e2e": "ng e2e"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/animations": "^4.0.0",
16 | "@angular/common": "^4.0.0",
17 | "@angular/compiler": "^4.0.0",
18 | "@angular/core": "^4.0.0",
19 | "@angular/forms": "^4.0.0",
20 | "@angular/http": "^4.0.0",
21 | "@angular/platform-browser": "^4.0.0",
22 | "@angular/platform-browser-dynamic": "^4.0.0",
23 | "@angular/router": "^4.0.0",
24 | "core-js": "^2.4.1",
25 | "ng2-file-upload": "^1.2.1",
26 | "rxjs": "^5.4.1",
27 | "zone.js": "^0.8.14"
28 | },
29 | "devDependencies": {
30 | "@angular/cli": "1.2.5",
31 | "@angular/compiler-cli": "^4.0.0",
32 | "@angular/language-service": "^4.0.0",
33 | "@types/jasmine": "~2.5.53",
34 | "@types/jasminewd2": "~2.0.2",
35 | "@types/node": "~6.0.60",
36 | "codelyzer": "~3.0.1",
37 | "jasmine-core": "~2.6.2",
38 | "jasmine-spec-reporter": "~4.1.0",
39 | "karma": "~1.7.0",
40 | "karma-chrome-launcher": "~2.1.1",
41 | "karma-cli": "~1.0.1",
42 | "karma-coverage-istanbul-reporter": "^1.2.1",
43 | "karma-jasmine": "~1.1.0",
44 | "karma-jasmine-html-reporter": "^0.2.2",
45 | "protractor": "~5.1.2",
46 | "ts-node": "~3.0.4",
47 | "tslint": "~5.3.2",
48 | "typescript": "~2.3.3"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './e2e/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: 'e2e/tsconfig.e2e.json'
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/src/app/app,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'app-root': {
5 | 'width': [{ 'unit': '%H', 'value': 1 }],
6 | 'height': [{ 'unit': '%V', 'value': 1 }],
7 | 'background': '#f7f8fa'
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/src/app/app-routes/app-routes.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule, Routes } from '@angular/router';
4 | import { CanActivateService } from './can-activate.service';
5 |
6 | const appRoutes: Routes = [
7 | // { path: 'text', component: Test1Component }
8 | {
9 | path: 'login',
10 | loadChildren: 'app/home/login/login.module#LoginModule'
11 | },
12 | {
13 | path: 'index',
14 | loadChildren: 'app/home/index/index.module#IndexModule',
15 | canActivate: [CanActivateService]
16 | },
17 | {
18 | path: '',
19 | loadChildren: 'app/home/index/index.module#IndexModule',
20 | canActivate: [CanActivateService]
21 | },
22 | {
23 | path: 'people/:id',
24 | loadChildren: 'app/home/people/people.module#PeopleModule',
25 | canActivate: [CanActivateService]
26 | },
27 | {
28 | path: '404', loadChildren: 'app/home/nofound/nofound.module#NofoundModule'
29 | },
30 | {
31 | path: '**', redirectTo: '/404'
32 | }
33 | ]
34 |
35 | @NgModule({
36 | imports: [
37 | CommonModule,
38 | RouterModule.forRoot(appRoutes, { useHash: true })
39 | ],
40 | exports: [
41 | RouterModule
42 | ],
43 | declarations: []
44 | })
45 | export class AppRoutesModule { }
46 |
--------------------------------------------------------------------------------
/src/app/app-routes/can-activate.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { CanActivateService } from './can-activate.service';
4 |
5 | describe('CanActivateService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [CanActivateService]
9 | });
10 | });
11 |
12 | it('should be created', inject([CanActivateService], (service: CanActivateService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/app-routes/can-activate.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { CanActivate } from '@angular/router';
3 | import { Router } from '@angular/router';
4 |
5 | @Injectable()
6 | export class CanActivateService {
7 |
8 | constructor( public router: Router ) { }
9 |
10 | canActivate(){
11 | if( !localStorage.user ){
12 | this.router.navigate(['login/signup']);
13 | }
14 | return true;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-article.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { ResolveArticleService } from './resolve-article.service';
4 |
5 | describe('ResolveArticleService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [ResolveArticleService]
9 | });
10 | });
11 |
12 | it('should be created', inject([ResolveArticleService], (service: ResolveArticleService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-article.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { Router, Resolve, ActivatedRouteSnapshot } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { Observable } from 'rxjs/Rx';
5 | import 'rxjs/add/operator/map';
6 |
7 | @Injectable()
8 | export class ResolveArticleService implements Resolve {
9 |
10 | data:any = {};
11 | _id;
12 |
13 | constructor( public http:Http, public router: Router ) { }
14 |
15 | resolve(route: ActivatedRouteSnapshot){
16 | this._id = route.params['id'];
17 |
18 | let url = "http://www.devonhello.com/chihu2/answer_dec";
19 |
20 | var headers = new Headers();
21 |
22 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
23 |
24 | return this.http.post(url, "id=" + this._id, {
25 | headers: headers
26 | }).map((res)=>{
27 | if(res['_body'] != '0'){
28 | return JSON.parse( res['_body'] )[0];
29 | }else{
30 | this.router.navigate(['/404']);
31 | }
32 | })
33 | }
34 |
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-people.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { ResolvePeopleService } from './resolve-people.service';
4 |
5 | describe('ResolvePeopleService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [ResolvePeopleService]
9 | });
10 | });
11 |
12 | it('should be created', inject([ResolvePeopleService], (service: ResolvePeopleService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-people.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { Router, Resolve, ActivatedRouteSnapshot } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { Observable } from 'rxjs/Rx';
5 | import 'rxjs/add/operator/map';
6 |
7 | @Injectable()
8 | export class ResolvePeopleService implements Resolve {
9 |
10 | _id;
11 | data:any = {};
12 |
13 | constructor( public http:Http, public router: Router ) { }
14 |
15 | resolve(route: ActivatedRouteSnapshot){
16 | this._id = route.params['id'];
17 |
18 | let url = "http://www.devonhello.com/chihu2/getuserdata";
19 |
20 | var headers = new Headers();
21 |
22 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
23 |
24 | return this.http.post(url, "id=" + this._id, {
25 | headers: headers
26 | }).map((res)=>{
27 | if(res['_body'] != '0'){
28 | return JSON.parse( res['_body'] )[0];
29 | }else{
30 | this.router.navigate(['/404']);
31 | }
32 | })
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-share.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { ResolveShareService } from './resolve-share.service';
4 |
5 | describe('ResolveShareService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [ResolveShareService]
9 | });
10 | });
11 |
12 | it('should be created', inject([ResolveShareService], (service: ResolveShareService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-share.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { Router, Resolve, ActivatedRouteSnapshot } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { Observable } from 'rxjs/Rx';
5 | import 'rxjs/add/operator/map';
6 |
7 | @Injectable()
8 | export class ResolveShareService implements Resolve {
9 |
10 | data:any = {};
11 | _id;
12 |
13 | constructor( public http:Http, public router: Router ) {}
14 |
15 | resolve(route: ActivatedRouteSnapshot){
16 | this._id = route.params['id'];
17 |
18 | let url = "http://www.devonhello.com/chihu2/share_dec";
19 |
20 | var headers = new Headers();
21 |
22 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
23 |
24 | return this.http.post(url, "id=" + this._id, {
25 | headers: headers
26 | }).map((res)=>{
27 | if(res['_body'] != '0'){
28 | return JSON.parse( res['_body'] )[0];
29 | }else{
30 | this.router.navigate(['/404']);
31 | }
32 | })
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-work.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { ResolveWorkService } from './resolve-work.service';
4 |
5 | describe('ResolveWorkServiceService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [ResolveWorkService]
9 | });
10 | });
11 |
12 | it('should be created', inject([ResolveWorkService], (service: ResolveWorkService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/app-routes/resolve-work.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { Router, Resolve, ActivatedRouteSnapshot } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { Observable } from 'rxjs/Rx';
5 | import 'rxjs/add/operator/map';
6 |
7 | @Injectable()
8 | export class ResolveWorkService implements Resolve {
9 |
10 | data:any = {};
11 | _id;
12 |
13 | constructor( public http:Http, public router: Router ) { }
14 |
15 | resolve(route: ActivatedRouteSnapshot){
16 | this._id = route.params['id'];
17 |
18 | let url = "http://www.devonhello.com/chihu2/article_dec";
19 |
20 | var headers = new Headers();
21 |
22 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
23 |
24 | return this.http.post(url, "id=" + this._id, {
25 | headers: headers
26 | }).map((res)=>{
27 | if(res['_body'] != '0'){
28 | return JSON.parse( res['_body'] )[0];
29 | }else{
30 | this.router.navigate(['/404']);
31 | }
32 | })
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 | .app-root {
2 | width: 100%;
3 | height: 100%;
4 | background: #f7f8fa;
5 | }
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 |
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | declarations: [
9 | AppComponent
10 | ],
11 | }).compileComponents();
12 | }));
13 |
14 | it('should create the app', async(() => {
15 | const fixture = TestBed.createComponent(AppComponent);
16 | const app = fixture.debugElement.componentInstance;
17 | expect(app).toBeTruthy();
18 | }));
19 |
20 | it(`should have as title 'app'`, async(() => {
21 | const fixture = TestBed.createComponent(AppComponent);
22 | const app = fixture.debugElement.componentInstance;
23 | expect(app.title).toEqual('app');
24 | }));
25 |
26 | it('should render title in a h1 tag', async(() => {
27 | const fixture = TestBed.createComponent(AppComponent);
28 | fixture.detectChanges();
29 | const compiled = fixture.debugElement.nativeElement;
30 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
31 | }));
32 | });
33 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.scss']
7 | })
8 | export class AppComponent {
9 | title = 'app';
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import { HttpModule } from '@angular/http';
4 | import { AppRoutesModule } from './app-routes/app-routes.module';
5 | import { AppComponent } from './app.component';
6 | import { CanActivateService } from './app-routes/can-activate.service';
7 | import { ResolveWorkService } from './app-routes/resolve-work.service';
8 | import { ResolveShareService } from './app-routes/resolve-share.service';
9 | import { ResolveArticleService } from './app-routes/resolve-article.service';
10 | import { ResolvePeopleService } from './app-routes/resolve-people.service';
11 | import { UserService } from './service/user.service';
12 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
13 |
14 | @NgModule({
15 | declarations: [
16 | AppComponent
17 | ],
18 | imports: [
19 | BrowserModule,
20 | AppRoutesModule,
21 | HttpModule,
22 | BrowserAnimationsModule
23 | ],
24 | providers: [
25 | CanActivateService,
26 | UserService,
27 | ResolveWorkService,
28 | ResolveShareService,
29 | ResolveArticleService,
30 | ResolvePeopleService
31 | ],
32 | bootstrap: [AppComponent]
33 | })
34 | export class AppModule { }
35 |
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'answer-card-component': {
5 | 'outline': 'none',
6 | 'padding': [{ 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }],
7 | 'background': '#fff',
8 | 'marginBottom': [{ 'unit': 'px', 'value': 10 }],
9 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
10 | 'boxSizing': 'border-box',
11 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }]
12 | },
13 | 'answer-card-component cur': {
14 | 'width': [{ 'unit': '%H', 'value': 1 }],
15 | 'cursor': 'pointer',
16 | 'outline': 'none'
17 | },
18 | 'answer-card-component header': {
19 | 'display': 'flex',
20 | 'alignItems': 'center'
21 | },
22 | 'answer-card-component header img': {
23 | 'width': [{ 'unit': 'px', 'value': 30 }],
24 | 'height': [{ 'unit': 'px', 'value': 30 }],
25 | 'borderRadius': '9999px',
26 | 'border': [{ 'unit': 'px', 'value': 2 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#f7fafc' }],
27 | 'boxSizing': 'border-box',
28 | 'verticalAlign': 'text-bottom'
29 | },
30 | 'answer-card-component header name': {
31 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }],
32 | 'fontWeight': '400',
33 | 'marginLeft': [{ 'unit': 'px', 'value': 15 }]
34 | },
35 | 'answer-card-component header time': {
36 | 'display': 'flex',
37 | 'flex': '1',
38 | 'justifyContent': 'flex-end',
39 | 'alignItems': 'center',
40 | 'color': '#9fadc7'
41 | },
42 | 'answer-card-component header time svg': {
43 | 'verticalAlign': 'text-bottom',
44 | 'fill': '#9fadc7',
45 | 'width': [{ 'unit': 'px', 'value': 20 }],
46 | 'height': [{ 'unit': 'px', 'value': 20 }]
47 | },
48 | 'answer-card-component wrap': {
49 | 'outline': 'none',
50 | 'cursor': 'pointer'
51 | },
52 | 'answer-card-component nav': {
53 | 'paddingTop': [{ 'unit': 'px', 'value': 20 }],
54 | 'color': '#9fadc7'
55 | },
56 | 'answer-card-component nav a': {
57 | 'fontSize': [{ 'unit': 'px', 'value': 15 }],
58 | 'lineHeight': [{ 'unit': 'px', 'value': 15 }],
59 | 'paddingRight': [{ 'unit': 'px', 'value': 15 }],
60 | 'textDecoration': 'none',
61 | 'color': '#9fadc7'
62 | },
63 | 'answer-card-component nav svg': {
64 | 'width': [{ 'unit': 'px', 'value': 16 }],
65 | 'height': [{ 'unit': 'px', 'value': 16 }],
66 | 'marginRight': [{ 'unit': 'px', 'value': 8 }],
67 | 'verticalAlign': 'text-bottom',
68 | 'fill': '#9fadc7'
69 | }
70 | });
71 |
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card.component.html:
--------------------------------------------------------------------------------
1 |
2 |
{{data.title}}
3 |
27 |
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card.component.scss:
--------------------------------------------------------------------------------
1 | .answer-card-component {
2 | outline: none;
3 | padding: 16px 20px;
4 | background: #fff;
5 | margin-bottom: 10px;
6 | border: 1px solid #e7eaf1;
7 | box-sizing: border-box;
8 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
9 | .cur {
10 | width: 100%;
11 | cursor: pointer;
12 | outline: none;
13 | }
14 | header {
15 | display: flex;
16 | align-items: center;
17 | img {
18 | width: 30px;
19 | height: 30px;
20 | border-radius: 9999px;
21 | border: 2px solid #f7fafc;
22 | box-sizing: border-box;
23 | vertical-align: text-bottom;
24 | }
25 | .name {
26 | margin: 0;
27 | font-weight: 400;
28 | margin-left: 15px;
29 | }
30 | .time {
31 | display: flex;
32 | flex: 1;
33 | justify-content: flex-end;
34 | align-items: center;
35 | color: #9fadc7;
36 | svg {
37 | vertical-align: text-bottom;
38 | fill: #9fadc7;
39 | width: 20px;
40 | height: 20px;
41 | }
42 | }
43 | }
44 | .wrap {
45 | outline: none;
46 | cursor: pointer;
47 | }
48 | nav {
49 | padding-top: 20px;
50 | color: #9fadc7;
51 | a {
52 | font-size: 15px;
53 | line-height: 15px;
54 | padding-right: 15px;
55 | text-decoration: none;
56 | color: #9fadc7;
57 | }
58 | svg {
59 | width: 16px;
60 | height: 16px;
61 | margin-right: 8px;
62 | vertical-align: text-bottom;
63 | fill: #9fadc7;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AnswerCardComponent } from './answer-card.component';
4 |
5 | describe('AnswerCardComponent', () => {
6 | let component: AnswerCardComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AnswerCardComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AnswerCardComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-answer-card',
5 | templateUrl: './answer-card.component.html',
6 | styleUrls: ['./answer-card.component.scss']
7 | })
8 | export class AnswerCardComponent implements OnInit {
9 |
10 | @Input() datas:any = [];
11 |
12 | constructor() { }
13 |
14 | ngOnInit() {
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/components/home/answer-card/answer-card.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule } from '@angular/router';
4 | import { AnswerCardComponent } from './answer-card.component';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | RouterModule
10 | ],
11 | exports:[AnswerCardComponent],
12 | declarations: [AnswerCardComponent]
13 | })
14 | export class AnswerCardModule { }
15 |
--------------------------------------------------------------------------------
/src/app/components/home/card/card.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { CardComponent } from './card.component';
4 |
5 | describe('CardComponent', () => {
6 | let component: CardComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ CardComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(CardComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/card/card.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-card',
5 | templateUrl: './card.component.html',
6 | styleUrls: ['./card.component.scss']
7 | })
8 | export class CardComponent implements OnInit {
9 |
10 | @Input() datas:any = [];
11 |
12 | constructor() { }
13 |
14 | ngOnInit() {
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/components/home/card/card.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule } from '@angular/router';
4 | import { CardComponent } from './card.component';
5 |
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | RouterModule
11 | ],
12 | exports:[CardComponent],
13 | declarations: [CardComponent]
14 | })
15 | export class CardModule { }
16 |
--------------------------------------------------------------------------------
/src/app/components/home/food/food,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'food-component food': {
5 | 'marginBottom': [{ 'unit': 'px', 'value': 50 }]
6 | },
7 | 'food-component food svg': {
8 | 'marginRight': [{ 'unit': 'px', 'value': 12 }]
9 | },
10 | 'food-component food food-list': {
11 | 'width': [{ 'unit': '%H', 'value': 1 }],
12 | 'display': 'flex',
13 | 'display': '-webkit-flex',
14 | 'alignItems': 'center',
15 | 'borderBottom': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'dashed' }, { 'unit': 'string', 'value': '#d6d6d6' }]
16 | },
17 | 'food-component food food-list food-name': {
18 | 'display': 'flex',
19 | 'flex': '1'
20 | },
21 | 'food-component food food-list food-len': {
22 | 'display': 'flex',
23 | 'flex': '1'
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/food/food.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
食材:
4 |
5 |
6 |
{{data.name}}
7 |
{{data.len}}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/components/home/food/food.component.scss:
--------------------------------------------------------------------------------
1 | .food-component {
2 | .food {
3 | margin-bottom: 50px;
4 | svg {
5 | margin-right: 12px;
6 | }
7 | .food-list {
8 | width: 100%;
9 | display: flex;
10 | display: -webkit-flex;
11 | align-items: center;
12 | border-bottom: 1px dashed #d6d6d6;
13 | .food-name {
14 | display: flex;
15 | flex: 1;
16 | }
17 | .food-len {
18 | display: flex;
19 | flex: 1;
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/app/components/home/food/food.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { FoodComponent } from './food.component';
4 |
5 | describe('FoodComponent', () => {
6 | let component: FoodComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ FoodComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(FoodComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/food/food.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-food',
5 | templateUrl: './food.component.html',
6 | styleUrls: ['./food.component.scss']
7 | })
8 | export class FoodComponent implements OnInit {
9 |
10 | @Input() datas:any = [];
11 |
12 | constructor() { }
13 |
14 | ngOnInit() {
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/components/home/food/food.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { FoodComponent } from './food.component';
4 |
5 | @NgModule({
6 | imports: [
7 | CommonModule
8 | ],
9 | exports:[FoodComponent],
10 | declarations: [FoodComponent]
11 | })
12 | export class FoodModule { }
13 |
--------------------------------------------------------------------------------
/src/app/components/home/iheader/iheader.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { IheaderComponent } from './iheader.component';
4 |
5 | describe('IheaderComponent', () => {
6 | let component: IheaderComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ IheaderComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(IheaderComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/iheader/iheader.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, trigger, state, style, transition, animate } from '@angular/core';
2 | import { Router } from '@angular/router';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-iheader',
7 | templateUrl: './iheader.component.html',
8 | styleUrls: ['./iheader.component.scss'],
9 | animations: [
10 | trigger('memuStatus',[
11 | state('on',style({
12 | opacity: '0',
13 | transform: 'scale(0.3)'
14 | })),
15 | state('off',style({
16 | opacity: '1',
17 | transform: 'scale(1)'
18 | })),
19 | transition('off => on', animate('300ms ease-in')),
20 | transition('on => off', animate('300ms ease-out'))
21 | ])
22 | ]
23 | })
24 | export class IheaderComponent implements OnInit {
25 |
26 | status:string = 'on';
27 | user:any = {};
28 |
29 | constructor( public router: Router, public userService: UserService ) {
30 | this.user = this.userService._user;
31 | }
32 |
33 | toggleStatus(){
34 | this.status = (this.status==="on")?'off':'on';
35 |
36 | }
37 |
38 | exit(){
39 | localStorage.clear();
40 | this.router.navigate(['login/signup']);
41 | }
42 |
43 | ngOnInit() {
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/app/components/home/iheader/iheader.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule } from '@angular/router';
4 | import { IheaderComponent } from './iheader.component';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | RouterModule
10 | ],
11 | exports:[IheaderComponent],
12 | declarations: [IheaderComponent]
13 | })
14 | export class IheaderModule { }
15 |
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'no-data-component': {
5 | 'background': '#fff',
6 | 'width': [{ 'unit': '%H', 'value': 1 }],
7 | 'height': [{ 'unit': 'px', 'value': 245 }],
8 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }],
9 | 'boxSizing': 'border-box',
10 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
11 | 'borderTop': [{ 'unit': 'string', 'value': 'none' }]
12 | },
13 | 'no-data-component no-data': {
14 | 'textAlign': 'center',
15 | 'fontSize': [{ 'unit': 'px', 'value': 15 }],
16 | 'color': '#8590a6',
17 | 'paddingTop': [{ 'unit': 'px', 'value': 20 }]
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data.component.scss:
--------------------------------------------------------------------------------
1 | .no-data-component {
2 | background: #fff;
3 | width: 100%;
4 | height: 245px;
5 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
6 | box-sizing: border-box;
7 | border: 1px solid #e7eaf1;
8 | border-top: none;
9 | .no-data {
10 | text-align: center;
11 | font-size: 15px;
12 | color: #8590a6;
13 | padding-top: 20px;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { NoDataComponent } from './no-data.component';
4 |
5 | describe('NoDataComponent', () => {
6 | let component: NoDataComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ NoDataComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(NoDataComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-no-data',
5 | templateUrl: './no-data.component.html',
6 | styleUrls: ['./no-data.component.scss']
7 | })
8 | export class NoDataComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/components/home/no-data/no-data.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { NoDataComponent } from './no-data.component';
4 |
5 | @NgModule({
6 | imports: [
7 | CommonModule
8 | ],
9 | exports:[NoDataComponent],
10 | declarations: [NoDataComponent]
11 | })
12 | export class NoDataModule { }
13 |
--------------------------------------------------------------------------------
/src/app/components/home/photoswipe/photoswipe.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
62 |
63 |
--------------------------------------------------------------------------------
/src/app/components/home/photoswipe/photoswipe.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/components/home/photoswipe/photoswipe.component.scss
--------------------------------------------------------------------------------
/src/app/components/home/photoswipe/photoswipe.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { PhotoswipeComponent } from './photoswipe.component';
4 |
5 | describe('PhotoswipeComponent', () => {
6 | let component: PhotoswipeComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ PhotoswipeComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(PhotoswipeComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/photoswipe/photoswipe.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-photoswipe',
5 | templateUrl: './photoswipe.component.html',
6 | styleUrls: ['./photoswipe.component.scss']
7 | })
8 | export class PhotoswipeComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/components/home/photoswipe/photoswipe.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { PhotoswipeComponent } from './photoswipe.component';
4 |
5 | @NgModule({
6 | imports: [
7 | CommonModule
8 | ],
9 | exports:[PhotoswipeComponent],
10 | declarations: [PhotoswipeComponent]
11 | })
12 | export class PhotoswipeModule { }
13 |
--------------------------------------------------------------------------------
/src/app/components/home/send-que/send-que.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
我要提问
5 |
6 |
7 |
提示:最多150个字符
8 |
9 |
发布
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/app/components/home/send-que/send-que.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SendQueComponent } from './send-que.component';
4 |
5 | describe('SendQueComponent', () => {
6 | let component: SendQueComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SendQueComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SendQueComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/send-que/send-que.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, trigger, state, style, transition, animate } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-send-que',
7 | templateUrl: './send-que.component.html',
8 | styleUrls: ['./send-que.component.scss'],
9 | animations: [
10 | trigger('sendQueStatus', [
11 | state('on', style({
12 | opacity: '0',
13 | zIndex: -2
14 | })),
15 | state('off', style({
16 | opacity: '1',
17 | zIndex: 999
18 | })),
19 | transition('off => on', animate('250ms ease-in')),
20 | transition('on => off', animate('250ms ease-out'))
21 | ])
22 | ]
23 | })
24 | export class SendQueComponent implements OnInit {
25 |
26 | status: string = 'on';
27 | isLoading = false;
28 | text = '';
29 | title = '';
30 |
31 | constructor(public http: Http, public userService: UserService) {
32 | this.userService.show_send_que.subscribe(() => {
33 | this.status = (this.status === "on") ? 'off' : 'on';
34 | });
35 | }
36 |
37 | colseShare() {
38 | this.isLoading = false;
39 | this.text = '';
40 | this.title = '';
41 | this.status = 'on';
42 | }
43 |
44 | send() {
45 |
46 | if(this.isLoading){
47 | alert("正在发布,请稍后...");
48 | return true;
49 | }
50 |
51 | if (this.text.length > 0 && this.title.length > 0) {
52 | this.isLoading = true;
53 | let url = "http://www.devonhello.com/chihu2/send_question";
54 |
55 | var headers = new Headers();
56 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
57 |
58 | this.http.post(url, "uid=" + this.userService._user._id + "&name=" + this.userService._user.nickname + "&userimg=" + this.userService._user.userimg + "&title=" + this.title + "&text=" + this.text, {
59 | headers: headers
60 | })
61 | .subscribe((res) => {
62 | this.isLoading = false;
63 | if (res.json()['result']['ok'] == '1') {
64 | this.text = '';
65 | this.title = '';
66 | } else {
67 | alert("系统错误");
68 | }
69 | this.colseShare();
70 | });
71 | } else {
72 | alert("操作有误!");
73 | }
74 | }
75 |
76 | ngOnInit() {
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/app/components/home/send-que/send-que.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { SendQueComponent } from './send-que.component';
4 | import { FormsModule } from '@angular/forms';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | FormsModule
10 | ],
11 | exports:[SendQueComponent],
12 | declarations: [SendQueComponent]
13 | })
14 | export class SendQueModule { }
15 |
--------------------------------------------------------------------------------
/src/app/components/home/send-share/send-share.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
分享你的心情
5 |
6 |
7 |
8 |
提示:至少添加一张图片,最多添加四张图片
9 |
13 |
发布
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/app/components/home/send-share/send-share.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SendShareComponent } from './send-share.component';
4 |
5 | describe('SendShareComponent', () => {
6 | let component: SendShareComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SendShareComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SendShareComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/send-share/send-share.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { SendShareComponent } from './send-share.component';
4 | import { FileUploadModule } from 'ng2-file-upload';
5 | import { FormsModule } from '@angular/forms';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | FileUploadModule,
11 | FormsModule
12 | ],
13 | exports:[SendShareComponent],
14 | declarations: [SendShareComponent]
15 | })
16 | export class SendShareModule { }
17 |
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'share-card-component cards': {
5 | 'width': [{ 'unit': '%H', 'value': 1 }],
6 | 'outline': 'none',
7 | 'padding': [{ 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }],
8 | 'background': '#fff',
9 | 'marginBottom': [{ 'unit': 'px', 'value': 10 }],
10 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
11 | 'boxSizing': 'border-box',
12 | 'borderRadius': '2px',
13 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }]
14 | },
15 | 'share-card-component cards header': {
16 | 'display': 'flex',
17 | 'alignItems': 'center'
18 | },
19 | 'share-card-component cards header img': {
20 | 'width': [{ 'unit': 'px', 'value': 30 }],
21 | 'height': [{ 'unit': 'px', 'value': 30 }],
22 | 'borderRadius': '9999px',
23 | 'border': [{ 'unit': 'px', 'value': 2 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#f7fafc' }],
24 | 'boxSizing': 'border-box',
25 | 'verticalAlign': 'text-bottom'
26 | },
27 | 'share-card-component cards header name': {
28 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }],
29 | 'fontWeight': '400',
30 | 'marginLeft': [{ 'unit': 'px', 'value': 15 }]
31 | },
32 | 'share-card-component cards header time': {
33 | 'display': 'flex',
34 | 'flex': '1',
35 | 'justifyContent': 'flex-end',
36 | 'alignItems': 'center',
37 | 'color': '#9fadc7'
38 | },
39 | 'share-card-component cards header time svg': {
40 | 'verticalAlign': 'text-bottom',
41 | 'fill': '#9fadc7',
42 | 'width': [{ 'unit': 'px', 'value': 20 }],
43 | 'height': [{ 'unit': 'px', 'value': 20 }]
44 | },
45 | 'share-card-component cards wrap': {
46 | 'outline': 'none',
47 | 'cursor': 'pointer'
48 | },
49 | 'share-card-component cards imgs-wrap': {
50 | 'width': [{ 'unit': '%H', 'value': 1 }],
51 | 'display': 'flex'
52 | },
53 | 'share-card-component cards imgs-wrap imgs': {
54 | 'width': [{ 'unit': 'px', 'value': 150 }],
55 | 'height': [{ 'unit': 'px', 'value': 150 }],
56 | 'marginRight': [{ 'unit': 'px', 'value': 12 }],
57 | 'backgroundPosition': 'center center !important',
58 | 'backgroundRepeat': 'no-repeat !important',
59 | 'backgroundSize': 'cover !important'
60 | },
61 | 'share-card-component cards text': {
62 | 'fontSize': [{ 'unit': 'px', 'value': 17 }],
63 | 'lineHeight': [{ 'unit': 'px', 'value': 28 }],
64 | 'color': '#666'
65 | },
66 | 'share-card-component cards nav': {
67 | 'paddingTop': [{ 'unit': 'px', 'value': 20 }],
68 | 'color': '#9fadc7'
69 | },
70 | 'share-card-component cards nav a': {
71 | 'fontSize': [{ 'unit': 'px', 'value': 15 }],
72 | 'lineHeight': [{ 'unit': 'px', 'value': 15 }],
73 | 'paddingRight': [{ 'unit': 'px', 'value': 15 }],
74 | 'textDecoration': 'none',
75 | 'color': '#9fadc7'
76 | },
77 | 'share-card-component cards nav svg': {
78 | 'width': [{ 'unit': 'px', 'value': 16 }],
79 | 'height': [{ 'unit': 'px', 'value': 16 }],
80 | 'marginRight': [{ 'unit': 'px', 'value': 8 }],
81 | 'verticalAlign': 'text-bottom',
82 | 'fill': '#9fadc7'
83 | }
84 | });
85 |
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card.component.scss:
--------------------------------------------------------------------------------
1 | .share-card-component {
2 | .cards {
3 | width: 100%;
4 | outline: none;
5 | padding: 16px 20px;
6 | background: #fff;
7 | margin-bottom: 10px;
8 | border: 1px solid #e7eaf1;
9 | box-sizing: border-box;
10 | border-radius: 2px;
11 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
12 | header {
13 | display: flex;
14 | align-items: center;
15 | img {
16 | width: 30px;
17 | height: 30px;
18 | border-radius: 9999px;
19 | border: 2px solid #f7fafc;
20 | box-sizing: border-box;
21 | vertical-align: text-bottom;
22 | }
23 | .name {
24 | margin: 0;
25 | font-weight: 400;
26 | margin-left: 15px;
27 | }
28 | .time {
29 | display: flex;
30 | flex: 1;
31 | justify-content: flex-end;
32 | align-items: center;
33 | color: #9fadc7;
34 | svg {
35 | vertical-align: text-bottom;
36 | fill: #9fadc7;
37 | width: 20px;
38 | height: 20px;
39 | }
40 | }
41 | }
42 | .wrap {
43 | outline: none;
44 | cursor: pointer;
45 | }
46 | .imgs-wrap {
47 | width: 100%;
48 | display: flex;
49 | .imgs {
50 | width: 150px;
51 | height: 150px;
52 | margin-right: 12px;
53 | background-position: center center !important;
54 | background-repeat: no-repeat !important;
55 | background-size: cover !important;
56 | }
57 | }
58 | .text {
59 | font-size: 17px;
60 | line-height: 28px;
61 | color: #666;
62 | }
63 | nav {
64 | padding-top: 20px;
65 | color: #9fadc7;
66 | a {
67 | font-size: 15px;
68 | line-height: 15px;
69 | padding-right: 15px;
70 | text-decoration: none;
71 | color: #9fadc7;
72 | }
73 | svg {
74 | width: 16px;
75 | height: 16px;
76 | margin-right: 8px;
77 | vertical-align: text-bottom;
78 | fill: #9fadc7;
79 | }
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ShareCardComponent } from './share-card.component';
4 |
5 | describe('ShareCardComponent', () => {
6 | let component: ShareCardComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ShareCardComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ShareCardComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-share-card',
5 | templateUrl: './share-card.component.html',
6 | styleUrls: ['./share-card.component.scss']
7 | })
8 | export class ShareCardComponent implements OnInit {
9 |
10 | @Input() datas:any = [];
11 |
12 | constructor() { }
13 |
14 | ngOnInit() {
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/components/home/share-card/share-card.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule } from '@angular/router';
4 | import { ShareCardComponent } from './share-card.component';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | RouterModule
10 | ],
11 | exports:[ShareCardComponent],
12 | declarations: [ShareCardComponent]
13 | })
14 | export class ShareCardModule { }
15 |
--------------------------------------------------------------------------------
/src/app/components/home/side-bar/side-bar.component.scss:
--------------------------------------------------------------------------------
1 | .side-bar-components {
2 | overflow: hidden;
3 | position: fixed;
4 | .TopstorySideBar {
5 | float: left;
6 | width: 296px;
7 | .iCard {
8 | width: 100%;
9 | padding-bottom: 10px;
10 | background: #fff;
11 | margin-bottom: 10px;
12 | border: 1px solid #e7eaf1;
13 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
14 | border-radius: 2px;
15 | box-sizing: border-box;
16 | .userimg {
17 | width: 80px;
18 | height: 80px;
19 | border-radius: 9999px;
20 | display: block;
21 | margin: 20px auto;
22 | border: 6px solid #f1f1f1;
23 | }
24 | h3 {
25 | text-align: center;
26 | margin-bottom: 8px;
27 | svg {
28 | vertical-align: text-bottom;
29 | }
30 | }
31 | .dec {
32 | display: flex;
33 | display: -webkit-flex;
34 | p {
35 | margin-bottom: 8px;
36 | }
37 | .items {
38 | flex-grow: 1;
39 | -webkit-flex-grow: 1;
40 | text-align: center;
41 | color: #ababab;
42 | }
43 | }
44 | }
45 | .ilist {
46 | width: 100%;
47 | background: #fff;
48 | border: 1px solid #e7eaf1;
49 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
50 | border-radius: 2px;
51 | box-sizing: border-box;
52 | .TopstorySideBar-navList {
53 | width: 100%;
54 | padding: 0;
55 | li {
56 | a {
57 | align-items: center;
58 | -webkit-box-align: center;
59 | display: flex;
60 | padding: 0 15px;
61 | height: 40px;
62 | overflow: hidden;
63 | font-size: 14px;
64 | color: #9fadc7;
65 | }
66 | svg {
67 | fill: #9fadc7;
68 | vertical-align: text-bottom;
69 | margin-right: 12px;
70 | width: 20px;
71 | height: 20px;
72 | }
73 | width: 100%;
74 | list-style: none;
75 | color: #9fadc7;
76 | transition: all .5s;
77 | cursor: pointer;
78 | }
79 | li:hover {
80 | background: #ebf3fb;
81 | }
82 | }
83 | }
84 | }
85 | .copy {
86 | font-size: 14px;
87 | display: block;
88 | width: 100%;
89 | padding-top: 6px;
90 | color: #ababab;
91 | text-align: center;
92 | a {
93 | color: #ababab;
94 | }
95 | svg {
96 | width: 14px;
97 | height: 14px;
98 | fill: #ababab;
99 | margin-right: 10px;
100 | vertical-align: text-bottom;
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/src/app/components/home/side-bar/side-bar.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SideBarComponent } from './side-bar.component';
4 |
5 | describe('SideBarComponent', () => {
6 | let component: SideBarComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SideBarComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SideBarComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/side-bar/side-bar.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-side-bar',
5 | templateUrl: './side-bar.component.html',
6 | styleUrls: ['./side-bar.component.scss']
7 | })
8 | export class SideBarComponent implements OnInit {
9 |
10 | user:any = {};
11 |
12 | constructor() {
13 | this.user = JSON.parse( localStorage.user );
14 |
15 | }
16 |
17 |
18 | ngOnInit() {
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/components/home/side-bar/side-bar.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { RouterModule } from '@angular/router';
4 | import { SideBarComponent } from './side-bar.component';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | RouterModule
10 | ],
11 | exports:[SideBarComponent],
12 | declarations: [SideBarComponent]
13 | })
14 | export class SideBarModule { }
15 |
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'steps-component steps svg': {
5 | 'marginRight': [{ 'unit': 'px', 'value': 12 }]
6 | },
7 | 'steps-component steps steps-list': {
8 | 'width': [{ 'unit': '%H', 'value': 1 }],
9 | 'marginBottom': [{ 'unit': 'px', 'value': 70 }]
10 | },
11 | 'steps-component steps steps-list steps-banner': {
12 | 'width': [{ 'unit': '%H', 'value': 1 }],
13 | 'height': [{ 'unit': 'px', 'value': 330 }],
14 | 'marginBottom': [{ 'unit': 'px', 'value': 16 }],
15 | 'backgroundPosition': 'center center !important',
16 | 'backgroundRepeat': 'no-repeat !important',
17 | 'backgroundSize': 'cover !important'
18 | },
19 | 'steps-component steps steps-list dec': {
20 | 'fontSize': [{ 'unit': 'px', 'value': 16 }],
21 | 'lineHeight': [{ 'unit': 'px', 'value': 26 }],
22 | 'color': '#9fadc7'
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
步骤:
4 | {{i+1}}
5 |
6 |
7 |
8 |
{{i+1}}:{{data.text}}
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps.component.scss:
--------------------------------------------------------------------------------
1 | .steps-component {
2 | .steps {
3 | svg {
4 | margin-right: 12px;
5 | }
6 | .steps-list {
7 | width: 100%;
8 | margin-bottom: 70px;
9 | .steps-banner {
10 | width: 100%;
11 | height: 330px;
12 | margin-bottom: 16px;
13 | background-position: center center !important;
14 | background-repeat: no-repeat !important;
15 | background-size: cover !important;
16 | }
17 | .dec {
18 | font-size: 16px;
19 | line-height: 26px;
20 | color: #9fadc7;
21 | }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { StepsComponent } from './steps.component';
4 |
5 | describe('StepsComponent', () => {
6 | let component: StepsComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ StepsComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(StepsComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input } from '@angular/core';
2 | import { UserService } from '../../../service/user.service';
3 |
4 | declare var PhotoSwipe: any;
5 | declare var PhotoSwipeUI_Default: any;
6 | declare var document: any;
7 | @Component({
8 | selector: 'app-steps',
9 | templateUrl: './steps.component.html',
10 | styleUrls: ['./steps.component.scss']
11 | })
12 | export class StepsComponent implements OnInit {
13 |
14 | @Input() datas:any = [];
15 | items = [];
16 | //PhotoSwipeUI 的dom对象存储
17 | pswpElement = null;
18 | //PhotoSwipe对象存储
19 | gallery: any = null;
20 |
21 |
22 | constructor(public userService: UserService) { }
23 |
24 | ngOnInit() {
25 | var len = this.datas.length;
26 |
27 | for (var i = 0; i < len; i++) {
28 | if (this.datas[i]["src"].length > 5) {
29 | var objs = {};
30 | objs["src"] = this.datas[i]["src"];
31 | objs["w"] = this.datas[i]["width"];
32 | objs["h"] = this.datas[i]["height"];
33 | objs["title"] = "步骤 " + (i + 1) + ":" + this.datas[i]["text"];
34 | this.items.push(objs);
35 | }
36 | }
37 |
38 | }
39 |
40 | //查看步骤图
41 | pswpElementInit(idx) {
42 | if(!this.pswpElement){
43 | this.pswpElement = document.querySelectorAll('.pswp')[0];
44 | }
45 |
46 | // define options (if needed)
47 | var options = {
48 | // optionName: 'option value'
49 | // for example:
50 | index: idx * 1 // start at first slide
51 | };
52 |
53 | // Initializes and opens PhotoSwipe
54 | this.gallery = new PhotoSwipe(this.pswpElement, PhotoSwipeUI_Default, this.items, options);
55 | this.gallery.init();
56 |
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/app/components/home/steps/steps.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { StepsComponent } from './steps.component';
4 |
5 | @NgModule({
6 | imports: [
7 | CommonModule
8 | ],
9 | exports:[StepsComponent],
10 | declarations: [StepsComponent]
11 | })
12 | export class StepsModule { }
13 |
--------------------------------------------------------------------------------
/src/app/home/index/article/article-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ArticleComponent } from './article.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ArticleComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ArticleRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/index/article/article.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/index/article/article.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/index/article/article.component.scss
--------------------------------------------------------------------------------
/src/app/home/index/article/article.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ArticleComponent } from './article.component';
4 |
5 | describe('ArticleComponent', () => {
6 | let component: ArticleComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ArticleComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ArticleComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/article/article.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-article',
7 | templateUrl: './article.component.html',
8 | styleUrls: ['./article.component.scss']
9 | })
10 | export class ArticleComponent implements OnInit {
11 |
12 | data:any = [];
13 |
14 | constructor( public http:Http, public userService: UserService ) {
15 | this.userService.scrollToTop.emit();
16 | this.getdata();
17 | }
18 |
19 | //获取数据
20 | getdata() {
21 |
22 | let url = "http://www.devonhello.com/chihu2/hot_answer";
23 |
24 | var headers = new Headers();
25 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
26 |
27 | this.http.post(url, "type=0", {
28 | headers: headers
29 | })
30 | .subscribe((res) => {
31 |
32 | this.data = this.data.concat(res.json());
33 | });
34 | }
35 |
36 | ngOnInit() {
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/home/index/article/article.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ArticleComponent } from './article.component';
4 | import { ArticleRoutingModule } from './article-routing.module';
5 | import { AnswerCardModule } from '../../../components/home/answer-card/answer-card.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | ArticleRoutingModule,
11 | AnswerCardModule
12 | ],
13 | declarations: [ArticleComponent]
14 | })
15 | export class ArticleModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'index-home-page TopstoryHeader': {
5 | 'display': 'flex',
6 | 'lineHeight': [{ 'unit': 'px', 'value': 58 }],
7 | 'padding': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 20 }],
8 | 'background': '#fff',
9 | 'marginBottom': [{ 'unit': 'px', 'value': 10 }],
10 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
11 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }],
12 | 'borderRadius': '2px',
13 | 'boxSizing': 'border-box'
14 | },
15 | 'index-home-page TopstoryHeader a': {
16 | 'textDecoration': 'none',
17 | 'marginRight': [{ 'unit': 'px', 'value': 40 }],
18 | 'fontSize': [{ 'unit': 'px', 'value': 16 }],
19 | 'display': 'inline-block'
20 | },
21 | 'index-home-page TopstoryHeader TopstoryHeader-nav a': {
22 | 'cursor': 'pointer',
23 | 'outline': 'none'
24 | },
25 | 'index-home-page TopstoryHeader TopstoryHeader-nav svg': {
26 | 'width': [{ 'unit': 'px', 'value': 16 }],
27 | 'height': [{ 'unit': 'px', 'value': 16 }],
28 | 'marginRight': [{ 'unit': 'px', 'value': 8 }],
29 | 'verticalAlign': 'text-bottom'
30 | }
31 | });
32 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { HomeComponent } from './home.component';
4 |
5 | const routes: Routes = [
6 | {
7 | path:'',
8 | component: HomeComponent
9 | }
10 | ];
11 |
12 | @NgModule({
13 | imports: [RouterModule.forChild(routes)],
14 | exports: [RouterModule]
15 | })
16 | export class HomeRoutingModule { }
17 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home.component.html:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home.component.scss:
--------------------------------------------------------------------------------
1 | .index-home-page {
2 | .TopstoryHeader {
3 | display: flex;
4 | line-height: 58px;
5 | padding: 0 20px;
6 | background: #fff;
7 | margin-bottom: 10px;
8 | border: 1px solid #e7eaf1;
9 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
10 | border-radius: 2px;
11 | box-sizing: border-box;
12 | a {
13 | text-decoration: none;
14 | margin-right: 40px;
15 | font-size: 16px;
16 | display: inline-block;
17 | }
18 | .TopstoryHeader-nav {
19 | a {
20 | cursor: pointer;
21 | outline: none;
22 | }
23 | svg {
24 | width: 16px;
25 | height: 16px;
26 | margin-right: 8px;
27 | vertical-align: text-bottom;
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/app/home/index/home/home.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { HomeComponent } from './home.component';
4 |
5 | describe('HomeComponent', () => {
6 | let component: HomeComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ HomeComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(HomeComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-home',
7 | templateUrl: './home.component.html',
8 | styleUrls: ['./home.component.scss']
9 | })
10 | export class HomeComponent implements OnInit, OnDestroy {
11 |
12 | datas = [];
13 | iswork = false;
14 | getDataSub;
15 |
16 | constructor(public http: Http, public userService: UserService) {
17 | this.getdata();
18 | this.getDataSub = this.userService.home_get_data.subscribe(() => {
19 | this.getdata();
20 | });
21 |
22 | }
23 |
24 | ngOnDestroy() {
25 | this.getDataSub.unsubscribe();
26 | }
27 |
28 |
29 | ngOnInit() {
30 | }
31 |
32 | //获取数据
33 | getdata() {
34 | if (this.iswork) {
35 | return;
36 | }
37 | this.iswork = true;
38 | let url = "http://www.devonhello.com/chihu2/home";
39 |
40 | var headers = new Headers();
41 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
42 |
43 | this.http.post(url, "len=" + this.datas.length, {
44 | headers: headers
45 | })
46 | .subscribe((res) => {
47 | this.iswork = false;
48 | this.datas = this.datas.concat(res.json());
49 |
50 | });
51 | }
52 |
53 | sendShare(){
54 | this.userService.show_send_share.emit();
55 | }
56 |
57 | sendQue(){
58 | this.userService.show_send_que.emit();
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/app/home/index/home/home.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { HomeComponent } from './home.component';
4 | import { HomeRoutingModule } from './home-routing.module';
5 | import { CardModule } from '../../../components/home/card/card.module';
6 | import { SendShareModule } from '../../../components/home/send-share/send-share.module';
7 | import { SendQueModule } from '../../../components/home/send-que/send-que.module';
8 | import { FileUploadModule } from 'ng2-file-upload';
9 |
10 | @NgModule({
11 | imports: [
12 | CommonModule,
13 | HomeRoutingModule,
14 | CardModule,
15 | FileUploadModule,
16 | SendShareModule,
17 | SendQueModule
18 | ],
19 | declarations: [HomeComponent]
20 | })
21 | export class HomeModule { }
22 |
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { HotWorkComponent } from './hot-work.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:HotWorkComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class HotWorkRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/index/hot-work/hot-work.component.scss
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { HotWorkComponent } from './hot-work.component';
4 |
5 | describe('HotWorkComponent', () => {
6 | let component: HotWorkComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ HotWorkComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(HotWorkComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-hot-work',
7 | templateUrl: './hot-work.component.html',
8 | styleUrls: ['./hot-work.component.scss']
9 | })
10 | export class HotWorkComponent implements OnInit,OnDestroy {
11 |
12 | datas = [];
13 | getDataSub;
14 |
15 | constructor(public http: Http, public userService: UserService) {
16 | this.getdata();
17 | this.getDataSub = this.userService.hot_work_get_data.subscribe(() => {
18 | this.getdata();
19 | });
20 | }
21 |
22 | getdata() {
23 |
24 | let url = "http://www.devonhello.com/chihu2/hot_work";
25 |
26 | var headers = new Headers();
27 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
28 |
29 | this.http.post(url, "type=1" + "&len=" + this.datas.length , {
30 | headers: headers
31 | })
32 | .subscribe((res) => {
33 |
34 | this.datas = this.datas.concat(res.json());
35 | });
36 | }
37 |
38 | ngOnDestroy() {
39 | this.getDataSub.unsubscribe();
40 | }
41 |
42 | ngOnInit() {
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/app/home/index/hot-work/hot-work.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { HotWorkComponent } from './hot-work.component';
4 | import { HotWorkRoutingModule } from './hot-work-routing.module';
5 | import { CardModule } from '../../../components/home/card/card.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | HotWorkRoutingModule,
11 | CardModule
12 | ],
13 | declarations: [HotWorkComponent]
14 | })
15 | export class HotWorkModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/index/index-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { IndexComponent } from './index.component';
4 |
5 | const routes: Routes = [
6 | {
7 | path: '',
8 | component: IndexComponent,
9 | children: [
10 | { path: '', loadChildren: 'app/home/index/home/home.module#HomeModule' },
11 | { path: 'home', loadChildren: 'app/home/index/home/home.module#HomeModule' },
12 | { path: 'share', loadChildren: 'app/home/index/share/share.module#ShareModule' },
13 | { path: 'work/:id', loadChildren: 'app/home/index/work/work.module#WorkModule' },
14 | { path: 'open-share/:id', loadChildren: 'app/home/index/open-share/open-share.module#OpenShareModule' },
15 | { path: 'article', loadChildren: 'app/home/index/article/article.module#ArticleModule' },
16 | { path: 'open-article/:id', loadChildren: 'app/home/index/open-article/open-article.module#OpenArticleModule' },
17 | { path: 'send-work', loadChildren: 'app/home/index/send-work/send-work.module#SendWorkModule' },
18 | { path: 'hot-work', loadChildren: 'app/home/index/hot-work/hot-work.module#HotWorkModule' },
19 | ],
20 | }
21 | ];
22 |
23 | @NgModule({
24 | imports: [RouterModule.forChild(routes)],
25 | exports: [RouterModule]
26 | })
27 | export class IndexRoutingModule { }
28 |
--------------------------------------------------------------------------------
/src/app/home/index/index.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/app/home/index/index.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { IndexComponent } from './index.component';
4 |
5 | describe('IndexComponent', () => {
6 | let component: IndexComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ IndexComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(IndexComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/index.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
2 | import { UserService } from '../../service/user.service';
3 | import { Router } from '@angular/router';
4 |
5 | declare var document: any;
6 | @Component({
7 | selector: 'app-index',
8 | templateUrl: './index.component.html',
9 | styleUrls: ['./index.component.scss']
10 | })
11 | export class IndexComponent implements OnInit {
12 |
13 | user: any = {};
14 | @ViewChild('scrollMe') public myScrollContainer: ElementRef;
15 |
16 | itimer = null;
17 |
18 | constructor(public router: Router, public userService: UserService) {
19 | this.user = this.userService._user;
20 | this.userService.scrollToTop.subscribe(() => {
21 | this.scrollToTop();
22 | })
23 |
24 | }
25 |
26 | ngOnInit() {
27 |
28 | }
29 |
30 | scrollToTop() {
31 | var nativeElement = this.myScrollContainer.nativeElement;
32 |
33 | this.itimer = setInterval(() => {
34 |
35 | var speed = (0 - nativeElement.scrollTop) / 20;
36 | speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
37 |
38 | if (speed == 0) {
39 | clearInterval(this.itimer);
40 | nativeElement.scrollTop = 0;
41 | } else {
42 | nativeElement.scrollTop += speed;
43 | }
44 |
45 | });
46 |
47 | }
48 |
49 |
50 |
51 | onscroll(ev) {
52 | //文档高度:ev.target.scrollHeight 可视窗口高度:clientHeight scrollTop
53 |
54 | var evtarget = ev.target;
55 |
56 | if (evtarget.scrollHeight == evtarget.clientHeight + evtarget.scrollTop) {
57 |
58 | switch (this.router.url.split('/')[1]) {
59 | case 'index':
60 | this.userService.home_get_data.emit();
61 | break;
62 | case 'share':
63 | this.userService.share_get_data.emit();
64 | break;
65 | case 'hot-work':
66 | this.userService.hot_work_get_data.emit();
67 | break;
68 | default:
69 | break;
70 | }
71 |
72 | }
73 |
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/src/app/home/index/index.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { IndexComponent } from './index.component';
4 | import { IndexRoutingModule } from './index-routing.module';
5 | import { IheaderModule } from '../../components/home/iheader/iheader.module';
6 | import { SideBarModule } from '../../components/home/side-bar/side-bar.module';
7 | import { PhotoswipeModule } from '../../components/home/photoswipe/photoswipe.module';
8 |
9 | @NgModule({
10 | imports: [
11 | CommonModule,
12 | IndexRoutingModule,
13 | IheaderModule,
14 | SideBarModule,
15 | PhotoswipeModule
16 | ],
17 | declarations: [IndexComponent]
18 | })
19 | export class IndexModule { }
20 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'open-article-page': {
5 | 'width': [{ 'unit': 'px', 'value': 694 }],
6 | 'padding': [{ 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }],
7 | 'marginBottom': [{ 'unit': 'px', 'value': 60 }],
8 | 'background': '#fff',
9 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
10 | 'boxSizing': 'border-box',
11 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }]
12 | },
13 | 'open-article-page header': {
14 | 'display': 'flex',
15 | 'alignItems': 'center'
16 | },
17 | 'open-article-page header img': {
18 | 'width': [{ 'unit': 'px', 'value': 30 }],
19 | 'height': [{ 'unit': 'px', 'value': 30 }],
20 | 'borderRadius': '9999px',
21 | 'border': [{ 'unit': 'px', 'value': 2 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#f7fafc' }],
22 | 'boxSizing': 'border-box',
23 | 'verticalAlign': 'text-bottom'
24 | },
25 | 'open-article-page header name': {
26 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }],
27 | 'fontWeight': '400',
28 | 'marginLeft': [{ 'unit': 'px', 'value': 15 }]
29 | },
30 | 'open-article-page header time': {
31 | 'display': 'flex',
32 | 'flex': '1',
33 | 'justifyContent': 'flex-end',
34 | 'alignItems': 'center',
35 | 'color': '#9fadc7'
36 | },
37 | 'open-article-page header time svg': {
38 | 'verticalAlign': 'text-bottom',
39 | 'fill': '#9fadc7',
40 | 'width': [{ 'unit': 'px', 'value': 20 }],
41 | 'height': [{ 'unit': 'px', 'value': 20 }]
42 | },
43 | 'open-article-page nav': {
44 | 'paddingTop': [{ 'unit': 'px', 'value': 20 }],
45 | 'color': '#9fadc7'
46 | },
47 | 'open-article-page nav a': {
48 | 'fontSize': [{ 'unit': 'px', 'value': 15 }],
49 | 'lineHeight': [{ 'unit': 'px', 'value': 15 }],
50 | 'paddingRight': [{ 'unit': 'px', 'value': 15 }],
51 | 'textDecoration': 'none',
52 | 'color': '#9fadc7'
53 | },
54 | 'open-article-page nav svg': {
55 | 'width': [{ 'unit': 'px', 'value': 16 }],
56 | 'height': [{ 'unit': 'px', 'value': 16 }],
57 | 'marginRight': [{ 'unit': 'px', 'value': 8 }],
58 | 'verticalAlign': 'text-bottom',
59 | 'fill': '#9fadc7'
60 | },
61 | 'open-article-page content': {
62 | 'paddingTop': [{ 'unit': 'px', 'value': 40 }]
63 | }
64 | });
65 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { OpenArticleComponent } from './open-article.component';
4 | import { ResolveArticleService } from '../../../app-routes/resolve-article.service';
5 |
6 | const routes: Routes = [{
7 | path:'',
8 | component:OpenArticleComponent,
9 | resolve:{
10 | data: ResolveArticleService
11 | }
12 | }];
13 |
14 | @NgModule({
15 | imports: [RouterModule.forChild(routes)],
16 | exports: [RouterModule]
17 | })
18 | export class OpenArticleRoutingModule { }
19 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article.component.html:
--------------------------------------------------------------------------------
1 |
2 |
{{data.title}}
3 |
11 |
22 |
25 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article.component.scss:
--------------------------------------------------------------------------------
1 | .open-article-page {
2 | width: 694px;
3 | padding: 16px 20px;
4 | margin-bottom: 60px;
5 | background: #fff;
6 | border: 1px solid #e7eaf1;
7 | box-sizing: border-box;
8 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
9 | header {
10 | display: flex;
11 | align-items: center;
12 | img {
13 | width: 30px;
14 | height: 30px;
15 | border-radius: 9999px;
16 | border: 2px solid #f7fafc;
17 | box-sizing: border-box;
18 | vertical-align: text-bottom;
19 | }
20 | .name {
21 | margin: 0;
22 | font-weight: 400;
23 | margin-left: 15px;
24 | }
25 | .time {
26 | display: flex;
27 | flex: 1;
28 | justify-content: flex-end;
29 | align-items: center;
30 | color: #9fadc7;
31 | svg {
32 | vertical-align: text-bottom;
33 | fill: #9fadc7;
34 | width: 20px;
35 | height: 20px;
36 | }
37 | }
38 | }
39 | nav {
40 | padding-top: 20px;
41 | color: #9fadc7;
42 | a {
43 | font-size: 15px;
44 | line-height: 15px;
45 | padding-right: 15px;
46 | text-decoration: none;
47 | color: #9fadc7;
48 | }
49 | svg {
50 | width: 16px;
51 | height: 16px;
52 | margin-right: 8px;
53 | vertical-align: text-bottom;
54 | fill: #9fadc7;
55 | }
56 | }
57 | .content {
58 | padding-top: 40px;
59 | }
60 | }
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { OpenArticleComponent } from './open-article.component';
4 |
5 | describe('OpenArticleComponent', () => {
6 | let component: OpenArticleComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ OpenArticleComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(OpenArticleComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { ActivatedRoute } from '@angular/router';
4 | import { DomSanitizer } from '@angular/platform-browser'
5 | import { UserService } from '../../../service/user.service';
6 |
7 | @Component({
8 | selector: 'app-open-article',
9 | templateUrl: './open-article.component.html',
10 | styleUrls: ['./open-article.component.scss']
11 | })
12 | export class OpenArticleComponent implements OnInit {
13 |
14 | _id:any;
15 | data:any = {};
16 | conts:any = 0;
17 |
18 | constructor( public sanitizer: DomSanitizer, public activatedRoute: ActivatedRoute, public http:Http, public userService: UserService ) {
19 | this.userService.scrollToTop.emit();
20 | this._id = this.activatedRoute.snapshot.params['id'];
21 | }
22 |
23 | tr(html){
24 | return this.sanitizer.bypassSecurityTrustHtml(html);
25 | }
26 |
27 | ngOnInit() {
28 | this.activatedRoute.data.subscribe((data)=>{
29 | this.data = data['data'];
30 | });
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/app/home/index/open-article/open-article.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { OpenArticleComponent } from './open-article.component';
4 | import { OpenArticleRoutingModule } from './open-article-routing.module';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | OpenArticleRoutingModule
10 | ],
11 | declarations: [OpenArticleComponent]
12 | })
13 | export class OpenArticleModule { }
14 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'open-share-page': {
5 | 'width': [{ 'unit': 'px', 'value': 694 }],
6 | 'minHeight': [{ 'unit': 'px', 'value': 603 }],
7 | 'outline': 'none',
8 | 'padding': [{ 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }],
9 | 'background': '#fff',
10 | 'marginBottom': [{ 'unit': 'px', 'value': 10 }],
11 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
12 | 'boxSizing': 'border-box',
13 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }]
14 | },
15 | 'open-share-page text': {
16 | 'color': '#848484',
17 | 'fontSize': [{ 'unit': 'px', 'value': 15 }],
18 | 'lineHeight': [{ 'unit': 'px', 'value': 28 }],
19 | 'marginBottom': [{ 'unit': 'px', 'value': 40 }]
20 | },
21 | 'open-share-page header': {
22 | 'display': 'flex',
23 | 'alignItems': 'center'
24 | },
25 | 'open-share-page header img': {
26 | 'width': [{ 'unit': 'px', 'value': 30 }],
27 | 'height': [{ 'unit': 'px', 'value': 30 }],
28 | 'borderRadius': '9999px',
29 | 'border': [{ 'unit': 'px', 'value': 2 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#f7fafc' }],
30 | 'boxSizing': 'border-box',
31 | 'verticalAlign': 'text-bottom'
32 | },
33 | 'open-share-page header name': {
34 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }],
35 | 'fontWeight': '400',
36 | 'marginLeft': [{ 'unit': 'px', 'value': 15 }]
37 | },
38 | 'open-share-page header time': {
39 | 'display': 'flex',
40 | 'flex': '1',
41 | 'justifyContent': 'flex-end',
42 | 'alignItems': 'center',
43 | 'color': '#9fadc7'
44 | },
45 | 'open-share-page header time svg': {
46 | 'verticalAlign': 'text-bottom',
47 | 'fill': '#9fadc7',
48 | 'width': [{ 'unit': 'px', 'value': 20 }],
49 | 'height': [{ 'unit': 'px', 'value': 20 }]
50 | },
51 | 'open-share-page imgs': {
52 | 'width': [{ 'unit': '%H', 'value': 0.95 }],
53 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'string', 'value': 'auto' }, { 'unit': 'px', 'value': 0 }, { 'unit': 'string', 'value': 'auto' }],
54 | 'border': [{ 'unit': 'px', 'value': 6 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
55 | 'boxSizing': 'border-box',
56 | 'display': 'block',
57 | 'marginBottom': [{ 'unit': 'px', 'value': 10 }]
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { OpenShareComponent } from './open-share.component';
4 | import { ResolveShareService } from '../../../app-routes/resolve-share.service';
5 |
6 | const routes: Routes = [{
7 | path:'',
8 | component:OpenShareComponent,
9 | resolve:{
10 | data: ResolveShareService
11 | }
12 | }];
13 |
14 | @NgModule({
15 | imports: [RouterModule.forChild(routes)],
16 | exports: [RouterModule]
17 | })
18 | export class OpenShareRoutingModule { }
19 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share.component.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
{{data.text}}
11 |
![]()
12 |
13 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share.component.scss:
--------------------------------------------------------------------------------
1 | .open-share-page {
2 | width: 694px;
3 | min-height: 603px;
4 | outline: none;
5 | padding: 16px 20px;
6 | background: #fff;
7 | margin-bottom: 10px;
8 | border: 1px solid #e7eaf1;
9 | box-sizing: border-box;
10 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
11 | .text {
12 | color: #848484;
13 | font-size: 15px;
14 | line-height: 28px;
15 | margin-bottom: 40px;
16 | }
17 | header {
18 | display: flex;
19 | align-items: center;
20 | img {
21 | width: 30px;
22 | height: 30px;
23 | border-radius: 9999px;
24 | border: 2px solid #f7fafc;
25 | box-sizing: border-box;
26 | vertical-align: text-bottom;
27 | }
28 | .name {
29 | margin: 0;
30 | font-weight: 400;
31 | margin-left: 15px;
32 | }
33 | .time {
34 | display: flex;
35 | flex: 1;
36 | justify-content: flex-end;
37 | align-items: center;
38 | color: #9fadc7;
39 | svg {
40 | vertical-align: text-bottom;
41 | fill: #9fadc7;
42 | width: 20px;
43 | height: 20px;
44 | }
45 | }
46 | }
47 | .imgs {
48 | width: 95%;
49 | margin: 0 auto;
50 | border: 6px solid #e7eaf1;
51 | box-sizing: border-box;
52 | display: block;
53 | margin-bottom: 10px;
54 | }
55 | }
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { OpenShareComponent } from './open-share.component';
4 |
5 | describe('OpenShareComponent', () => {
6 | let component: OpenShareComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ OpenShareComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(OpenShareComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { ActivatedRoute } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { UserService } from '../../../service/user.service';
5 |
6 | @Component({
7 | selector: 'app-open-share',
8 | templateUrl: './open-share.component.html',
9 | styleUrls: ['./open-share.component.scss']
10 | })
11 | export class OpenShareComponent implements OnInit {
12 |
13 |
14 | data:any = {};
15 |
16 | constructor( public activatedRoute: ActivatedRoute, public http:Http, public userService: UserService ) {
17 | this.userService.scrollToTop.emit();
18 | }
19 |
20 | ngOnInit() {
21 | this.activatedRoute.data.subscribe((data)=>{
22 | this.data = data['data'];
23 | });
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/home/index/open-share/open-share.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { OpenShareComponent } from './open-share.component';
4 | import { OpenShareRoutingModule } from './open-share-routing.module';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | OpenShareRoutingModule
10 | ],
11 | declarations: [OpenShareComponent]
12 | })
13 | export class OpenShareModule { }
14 |
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { SendWorkComponent } from './send-work.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:SendWorkComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class SendWorkRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work.component.html:
--------------------------------------------------------------------------------
1 |
2 |
添加菜谱名:
3 |
4 |
7 |
菜谱的描述:
8 |
9 |
用料:
10 |
24 |
25 | 添加用料
26 |
27 |
步骤:
28 |
34 |
35 | 添加步骤
36 |
37 |
提示:
38 |
39 |
40 | 发布菜谱
41 |
42 |
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work.component.scss:
--------------------------------------------------------------------------------
1 | .send-work-page {
2 | width: 694px;
3 | min-height: 603px;
4 | outline: none;
5 | padding: 16px 20px;
6 | background: #fff;
7 | margin-bottom: 10px;
8 | border: 1px solid #e7eaf1;
9 | box-sizing: border-box;
10 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
11 | color: #909090;
12 | input {
13 | outline: none;
14 | resize: none;
15 | padding: 1%;
16 | margin-bottom: 12px;
17 | border: 1px solid #f7f7f7;
18 | width: 98%;
19 | font-size: 16px;
20 | line-height: 28px;
21 | height: 28px;
22 | }
23 | .banner {
24 | width: 100%;
25 | height: 300px;
26 | background: #f7f7f7;
27 | justify-content: center;
28 | display: flex;
29 | flex-direction: column;
30 | text-align: center;
31 | color: #c5c5c5;
32 | }
33 | textarea {
34 | outline: none;
35 | resize: none;
36 | padding: 2%;
37 | margin-bottom: 12px;
38 | border: 1px solid #f7f7f7;
39 | width: 96%;
40 | font-size: 16px;
41 | line-height: 28px;
42 | height: 118px;
43 | }
44 | .food-wrap {
45 | width: 100%;
46 | display: flex;
47 | input {
48 | display: flex;
49 | flex-grow: 1;
50 | margin-bottom: 0;
51 | color: #ababab;
52 | }
53 | }
54 | .foods {
55 | margin-bottom: 20px;
56 | }
57 | .step-wrap {
58 | width: 100%;
59 | display: flex;
60 | textarea {
61 | outline: none;
62 | resize: none;
63 | padding: 2%;
64 | width: auto;
65 | border: 1px solid #f7f7f7;
66 | font-size: 16px;
67 | line-height: 28px;
68 | height: 118px;
69 | display: flex;
70 | flex-grow: 1;
71 | margin-right: 8px;
72 | }
73 | .step-banner {
74 | justify-content: center;
75 | display: flex;
76 | flex-direction: column;
77 | text-align: center;
78 | color: #c5c5c5;
79 | flex-grow: 1;
80 | height: 146px;
81 | background: #f7f7f7;
82 | }
83 | }
84 | .btn {
85 | width: 130px;
86 | height: 35px;
87 | background: #56abe4;
88 | color: #fff;
89 | line-height: 2;
90 | text-align: center;
91 | cursor: pointer;
92 | }
93 | }
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SendWorkComponent } from './send-work.component';
4 |
5 | describe('SendWorkComponent', () => {
6 | let component: SendWorkComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SendWorkComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SendWorkComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-send-work',
5 | templateUrl: './send-work.component.html',
6 | styleUrls: ['./send-work.component.scss']
7 | })
8 | export class SendWorkComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/home/index/send-work/send-work.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { SendWorkComponent } from './send-work.component';
4 | import { SendWorkRoutingModule } from './send-work-routing.module';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | SendWorkRoutingModule
10 | ],
11 | exports:[SendWorkComponent],
12 | declarations: [SendWorkComponent]
13 | })
14 | export class SendWorkModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/index/share/share-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ShareComponent } from './share.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ShareComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ShareRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/index/share/share.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/index/share/share.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/index/share/share.component.scss
--------------------------------------------------------------------------------
/src/app/home/index/share/share.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ShareComponent } from './share.component';
4 |
5 | describe('ShareComponent', () => {
6 | let component: ShareComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ShareComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ShareComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/share/share.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { UserService } from '../../../service/user.service';
4 |
5 | @Component({
6 | selector: 'app-share',
7 | templateUrl: './share.component.html',
8 | styleUrls: ['./share.component.scss']
9 | })
10 | export class ShareComponent implements OnInit, OnDestroy {
11 |
12 | data:any = [];
13 | iswork = false;
14 | getDataSub;
15 |
16 | constructor( public http:Http, public userService: UserService ) {
17 | this.userService.scrollToTop.emit();
18 | this.getdata();
19 | this.getDataSub = this.userService.share_get_data.subscribe(()=>{
20 | this.getdata();
21 | })
22 | }
23 |
24 | ngOnDestroy() {
25 | this.getDataSub.unsubscribe();
26 | }
27 |
28 | ngOnInit() {
29 | }
30 |
31 | //获取分享数据
32 | getdata() {
33 | if(this.iswork){
34 | return;
35 | }
36 | this.iswork = true;
37 | let url = "http://www.devonhello.com/chihu2/share";
38 |
39 | var headers = new Headers();
40 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
41 |
42 | this.http.post(url, "len=" + this.data.length, {
43 | headers: headers
44 | })
45 | .subscribe((res) => {
46 | this.iswork = false;
47 | this.data = this.data.concat(res.json());
48 | });
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/home/index/share/share.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ShareComponent } from './share.component';
4 | import { ShareRoutingModule } from './share-routing.module';
5 | import { ShareCardModule } from '../../../components/home/share-card/share-card.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | ShareRoutingModule,
11 | ShareCardModule
12 | ],
13 | declarations: [ShareComponent]
14 | })
15 | export class ShareModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/index/work/work,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'work-page': {
5 | 'width': [{ 'unit': 'px', 'value': 694 }],
6 | 'padding': [{ 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }, { 'unit': 'px', 'value': 16 }, { 'unit': 'px', 'value': 20 }],
7 | 'marginBottom': [{ 'unit': 'px', 'value': 60 }],
8 | 'background': '#fff',
9 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#e7eaf1' }],
10 | 'boxSizing': 'border-box',
11 | 'boxShadow': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 1 }, { 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'rgba(0, 37, 55, 0.05)' }]
12 | },
13 | 'work-page banner': {
14 | 'width': [{ 'unit': '%H', 'value': 1 }],
15 | 'height': [{ 'unit': 'px', 'value': 360 }],
16 | 'marginBottom': [{ 'unit': 'px', 'value': 16 }],
17 | 'backgroundPosition': 'center center !important',
18 | 'backgroundRepeat': 'no-repeat !important',
19 | 'backgroundSize': 'cover !important'
20 | },
21 | 'work-page user-basic': {
22 | 'width': [{ 'unit': '%H', 'value': 1 }],
23 | 'display': 'flex',
24 | 'display': '-webkit-flex',
25 | 'alignItems': 'center',
26 | 'color': '#666'
27 | },
28 | 'work-page user-basic img': {
29 | 'verticalAlign': 'text-bottom',
30 | 'borderRadius': '99999px',
31 | 'border': [{ 'unit': 'px', 'value': 3 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#f1f1f1' }],
32 | 'marginRight': [{ 'unit': 'px', 'value': 10 }],
33 | 'boxSizing': 'border-box',
34 | 'display': 'block',
35 | 'width': [{ 'unit': 'px', 'value': 40 }],
36 | 'height': [{ 'unit': 'px', 'value': 40 }]
37 | },
38 | 'work-page user-basic time': {
39 | 'alignItems': 'center',
40 | 'display': 'flex',
41 | 'marginLeft': [{ 'unit': 'px', 'value': 12 }],
42 | 'fontSize': [{ 'unit': 'px', 'value': 13 }],
43 | 'color': '#969696'
44 | },
45 | 'work-page user-basic time svg': {
46 | 'fill': '#969696'
47 | },
48 | 'work-page title': {
49 | 'color': '#666'
50 | },
51 | 'work-page title svg': {
52 | 'fill': '#666',
53 | 'marginRight': [{ 'unit': 'px', 'value': 12 }]
54 | },
55 | 'work-page dec': {
56 | 'fontSize': [{ 'unit': 'px', 'value': 16 }],
57 | 'lineHeight': [{ 'unit': 'px', 'value': 26 }],
58 | 'color': '#9fadc7'
59 | },
60 | 'work-page tips': {
61 | 'width': [{ 'unit': '%H', 'value': 1 }]
62 | },
63 | 'work-page tips svg': {
64 | 'marginRight': [{ 'unit': 'px', 'value': 12 }]
65 | },
66 | 'work-page tips tips-cont': {
67 | 'width': [{ 'unit': '%H', 'value': 0.95 }],
68 | 'padding': [{ 'unit': '%V', 'value': 0.025 }, { 'unit': '%H', 'value': 0.025 }, { 'unit': '%V', 'value': 0.025 }, { 'unit': '%H', 'value': 0.025 }],
69 | 'background': '#f5f5f5',
70 | 'color': '#666'
71 | }
72 | });
73 |
--------------------------------------------------------------------------------
/src/app/home/index/work/work-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { WorkComponent } from './work.component';
4 | import { ResolveWorkService } from '../../../app-routes/resolve-work.service';
5 |
6 | const routes: Routes = [{
7 | path:'',
8 | component:WorkComponent,
9 | resolve:{
10 | data: ResolveWorkService
11 | }
12 | }];
13 |
14 | @NgModule({
15 | imports: [RouterModule.forChild(routes)],
16 | exports: [RouterModule]
17 | })
18 | export class WorkRoutingModule { }
19 |
--------------------------------------------------------------------------------
/src/app/home/index/work/work.component.scss:
--------------------------------------------------------------------------------
1 | .work-page {
2 | width: 694px;
3 | padding: 16px 20px;
4 | margin-bottom: 60px;
5 | background: #fff;
6 | border: 1px solid #e7eaf1;
7 | box-sizing: border-box;
8 | box-shadow: 0 1px 3px rgba(0, 37, 55, .05);
9 | .banner {
10 | width: 100%;
11 | height: 360px;
12 | margin-bottom: 16px;
13 | background-position: center center !important;
14 | background-repeat: no-repeat !important;
15 | background-size: cover !important;
16 | }
17 | .user-basic {
18 | width: 100%;
19 | display: flex;
20 | display: -webkit-flex;
21 | align-items: center;
22 | color: #666;
23 | img {
24 | vertical-align: text-bottom;
25 | border-radius: 99999px;
26 | border: 3px solid #f1f1f1;
27 | margin-right: 10px;
28 | box-sizing: border-box;
29 | display: block;
30 | width: 40px;
31 | height: 40px;
32 | }
33 | .time {
34 | align-items: center;
35 | display: flex;
36 | margin-left: 12px;
37 | font-size: 13px;
38 | color: #969696;
39 | svg {
40 | fill: #969696;
41 | }
42 | }
43 | }
44 | .title {
45 | color: #666;
46 | svg {
47 | fill: #666;
48 | margin-right: 12px;
49 | }
50 | }
51 | .dec {
52 | font-size: 16px;
53 | line-height: 26px;
54 | color: #9fadc7;
55 | }
56 | .tips {
57 | width: 100%;
58 | svg {
59 | margin-right: 12px;
60 | }
61 | .tips-cont {
62 | width: 95%;
63 | padding: 2.5%;
64 | background: #f5f5f5;
65 | color: #666;
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/src/app/home/index/work/work.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { WorkComponent } from './work.component';
4 |
5 | describe('WorkComponent', () => {
6 | let component: WorkComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ WorkComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(WorkComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/index/work/work.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { ActivatedRoute } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 | import { UserService } from '../../../service/user.service';
5 |
6 | @Component({
7 | selector: 'app-work',
8 | templateUrl: './work.component.html',
9 | styleUrls: ['./work.component.scss']
10 | })
11 | export class WorkComponent implements OnInit {
12 |
13 | data:any = {};
14 |
15 | constructor( public activatedRoute: ActivatedRoute, public http:Http, public userService: UserService ) {
16 | this.userService.scrollToTop.emit();
17 | }
18 |
19 | ngOnInit() {
20 | this.activatedRoute.data.subscribe((data)=>{
21 | this.data = data['data'];
22 | });
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/app/home/index/work/work.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { WorkComponent } from './work.component';
4 | import { WorkRoutingModule } from './work-routing.module';
5 | import { StepsModule } from '../../../components/home/steps/steps.module';
6 | import { FoodModule } from '../../../components/home/food/food.module';
7 |
8 | @NgModule({
9 | imports: [
10 | CommonModule,
11 | WorkRoutingModule,
12 | StepsModule,
13 | FoodModule
14 | ],
15 | declarations: [WorkComponent]
16 | })
17 | export class WorkModule { }
18 |
--------------------------------------------------------------------------------
/src/app/home/login/login-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { CommonModule } from '@angular/common';
4 | import { LoginComponent } from './login.component';
5 |
6 | const routes: Routes = [
7 | {
8 | path: '',
9 | component: LoginComponent,
10 | children: [
11 | { path: '', loadChildren: 'app/home/login/signup/signup.module#SignupModule' },
12 | { path: 'signup', loadChildren: 'app/home/login/signup/signup.module#SignupModule' },
13 | { path: 'signin', loadChildren: 'app/home/login/signin/signin.module#SigninModule' },
14 |
15 | ],
16 | }
17 | ];
18 |
19 | @NgModule({
20 | imports: [ RouterModule.forChild(routes)],
21 | exports: [RouterModule]
22 | })
23 | export class LoginRoutingModule { }
24 |
--------------------------------------------------------------------------------
/src/app/home/login/login.component.scss:
--------------------------------------------------------------------------------
1 | a {
2 | text-decoration: none;
3 | }
4 |
5 | .login-page {
6 | position: absolute;
7 | top: 0;
8 | left: 0;
9 | right: 0;
10 | bottom: 0;
11 | overflow: auto;
12 | background: #f7fafc;
13 | }
14 |
15 | .top {
16 | width: 300px;
17 | margin: 0 auto;
18 | text-align: center;
19 | .logo {
20 | color: #0f88eb;
21 | font-size: 74px;
22 | margin: 64px auto 14px;
23 | }
24 | h2 {
25 | color: #555;
26 | margin: 20px 0 26px;
27 | font-weight: 400;
28 | font-size: 18px;
29 | line-height: 1;
30 | }
31 | }
32 |
33 | .dowm {
34 | width: 300px;
35 | margin: 0 auto;
36 | height: 41px;
37 | color: #5fa6e5;
38 | border: 1px solid #96c2e9;
39 | text-align: center;
40 | line-height: 41px;
41 | margin-top: 48px;
42 | font-size: 14px;
43 | }
44 |
45 | .copy-wrap {
46 | text-align: center;
47 | padding-top: 15px;
48 | .copy {
49 | font-size: 14px;
50 | display: block;
51 | width: 100%;
52 | padding-top: 6px;
53 | color: #ababab;
54 | text-align: center;
55 | a {
56 | color: #ababab;
57 | }
58 | svg {
59 | width: 14px;
60 | height: 14px;
61 | fill: #ababab;
62 | margin-right: 10px;
63 | vertical-align: text-bottom;
64 | }
65 | }
66 | }
67 |
68 | .index-tab-navs {
69 | width: 300px;
70 | margin: 0 auto;
71 | margin-bottom: 10px;
72 | overflow: hidden;
73 | .navs-slider {
74 | position: relative;
75 | width: 144px;
76 | overflow: hidden;
77 | margin: 0 auto;
78 | a {
79 | float: left;
80 | text-align: center;
81 | width: 4rem;
82 | line-height: 35px;
83 | color: #555;
84 | opacity: .7;
85 | text-decoration-line: none;
86 | font-size: 18px;
87 | }
88 | .active {
89 | color: #0F88E8;
90 | }
91 | .navs-slider-bar {
92 | position: absolute;
93 | width: 2.4rem;
94 | background: #0f88eb;
95 | height: 2px;
96 | position: absolute;
97 | bottom: 0;
98 | left: 0;
99 | margin: 0 0.8rem;
100 | transition: left .15s ease-in;
101 | -webkit-transition: left .15s ease-in;
102 | }
103 | }
104 | }
105 |
106 | .router-outlet-wrap {
107 | width: 300px;
108 | margin: 0 auto;
109 | }
--------------------------------------------------------------------------------
/src/app/home/login/login.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { LoginComponent } from './login.component';
4 |
5 | describe('LoginComponent', () => {
6 | let component: LoginComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ LoginComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(LoginComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, ElementRef } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-login',
5 | templateUrl: './login.component.html',
6 | styleUrls: ['./login.component.scss']
7 | })
8 | export class LoginComponent implements OnInit {
9 |
10 | iel:any;
11 |
12 | constructor(public el: ElementRef) {
13 |
14 | }
15 |
16 | change( index ){
17 | localStorage.clear();
18 | if(index != '0'){
19 | this.iel.style.left = '63px';
20 | }else{
21 | this.iel.style.left = '0';
22 | }
23 |
24 | }
25 |
26 | ngOnInit() {
27 | this.iel = this.el.nativeElement.querySelector('.navs-slider-bar');
28 | this.iel.style.left = '0';
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/app/home/login/login.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { LoginComponent } from './login.component';
4 | import { LoginRoutingModule } from './login-routing.module';
5 |
6 | @NgModule({
7 | imports: [
8 | CommonModule,
9 | LoginRoutingModule
10 | ],
11 | declarations: [LoginComponent]
12 | })
13 | export class LoginModule { }
14 |
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'group-inputs': {
5 | 'width': [{ 'unit': '%H', 'value': 1 }],
6 | 'background': '#fff',
7 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#eee' }],
8 | 'borderRadius': '6px',
9 | 'marginBottom': [{ 'unit': 'px', 'value': 18 }],
10 | 'overflow': 'hidden'
11 | },
12 | 'group-inputs input-wrapper': {
13 | 'width': [{ 'unit': '%H', 'value': 1 }],
14 | 'borderBottom': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#eee' }]
15 | },
16 | 'group-inputs input-wrapper input': {
17 | 'display': 'block',
18 | 'width': [{ 'unit': '%H', 'value': NaN }],
19 | 'border': [{ 'unit': 'string', 'value': 'none' }],
20 | 'boxShadow': [{ 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }],
21 | 'borderRadius': '0',
22 | 'padding': [{ 'unit': 'rem', 'value': 1 }, { 'unit': 'rem', 'value': 0.8 }, { 'unit': 'rem', 'value': 1 }, { 'unit': 'rem', 'value': 0.8 }],
23 | 'background': '#fff',
24 | 'lineHeight': [{ 'unit': 'px', 'value': 19 }],
25 | 'color': '#555',
26 | 'outline': 'none'
27 | },
28 | 'group-inputs input-wrapper input:focus': {
29 | 'outline': 'none'
30 | },
31 | 'btm': {
32 | 'width': [{ 'unit': '%H', 'value': 1 }],
33 | 'height': [{ 'unit': 'px', 'value': 41 }],
34 | 'background': '#0f88eb',
35 | 'lineHeight': [{ 'unit': 'px', 'value': 41 }],
36 | 'color': '#fff',
37 | 'textAlign': 'center',
38 | 'borderRadius': '4px',
39 | 'cursor': 'pointer'
40 | },
41 | 'agreement-tip': {
42 | 'fontSize': [{ 'unit': 'px', 'value': 13 }],
43 | 'color': '#999',
44 | 'marginTop': [{ 'unit': 'px', 'value': 21 }],
45 | 'textAlign': 'right'
46 | }
47 | });
48 |
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { SigninComponent } from './signin.component';
4 |
5 | const routes: Routes = [{
6 | path: '',
7 | component: SigninComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class SigninRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin.component.html:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 | 登录
15 |
16 |
17 | 无法登陆?
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin.component.scss:
--------------------------------------------------------------------------------
1 | .group-inputs {
2 | width: 100%;
3 | background: #fff;
4 | border: 1px solid #eee;
5 | border-radius: 6px;
6 | margin-bottom: 18px;
7 | overflow: hidden;
8 | .input-wrapper {
9 | width: 100%;
10 | border-bottom: 1px solid #eee;
11 | input {
12 | display: block;
13 | width: calc(100% - 1.6rem);
14 | border: none;
15 | box-shadow: none;
16 | border-radius: 0;
17 | padding: 1rem 0.8rem;
18 | background: #fff;
19 | line-height: 19px;
20 | color: #555;
21 | outline: none;
22 | }
23 | input:focus {
24 | outline: none;
25 | }
26 | }
27 | }
28 |
29 | .btm {
30 | width: 100%;
31 | height: 41px;
32 | background: #0f88eb;
33 | line-height: 41px;
34 | color: #fff;
35 | text-align: center;
36 | border-radius: 4px;
37 | cursor: pointer;
38 | }
39 |
40 | .agreement-tip {
41 | font-size: 13px;
42 | color: #999;
43 | margin-top: 21px;
44 | text-align: right;
45 | }
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SigninComponent } from './signin.component';
4 |
5 | describe('SigninComponent', () => {
6 | let component: SigninComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SigninComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SigninComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { Router } from '@angular/router';
4 |
5 | @Component({
6 | selector: 'app-signin',
7 | templateUrl: './signin.component.html',
8 | styleUrls: ['./signin.component.scss']
9 | })
10 | export class SigninComponent implements OnInit {
11 |
12 | name: '';
13 | pass: '';
14 |
15 | constructor(public http: Http,public router: Router) { }
16 |
17 | ngOnInit() {
18 | }
19 |
20 | login() {
21 |
22 | if (!this.name || !this.pass) {
23 | alert("兄弟,你在搞笑吗?认真填...");
24 | return true;
25 | }
26 |
27 | let url = "http://www.devonhello.com/chihu2/login";
28 |
29 | var headers = new Headers();
30 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
31 |
32 | this.http.post(url, "name=" + this.name + "&pass=" + this.pass, {
33 | headers: headers
34 | })
35 | .subscribe((res) => {
36 | try {
37 | if (res.json()[0]['_id']) {
38 | localStorage.user = JSON.stringify(res.json()[0]);
39 | this.router.navigate(['index']);
40 | }
41 | } catch (error) {
42 | alert("账户或密码错误...");
43 | }
44 | });
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/app/home/login/signin/signin.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { SigninComponent } from './signin.component';
4 | import { SigninRoutingModule } from './signin-routing.module';
5 | import { FormsModule } from '@angular/forms';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | SigninRoutingModule,
11 | FormsModule
12 | ],
13 | declarations: [SigninComponent]
14 | })
15 | export class SigninModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'group-inputs': {
5 | 'width': [{ 'unit': '%H', 'value': 1 }],
6 | 'background': '#fff',
7 | 'border': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#eee' }],
8 | 'borderRadius': '6px',
9 | 'marginBottom': [{ 'unit': 'px', 'value': 18 }],
10 | 'overflow': 'hidden'
11 | },
12 | 'group-inputs input-wrapper': {
13 | 'width': [{ 'unit': '%H', 'value': 1 }],
14 | 'borderBottom': [{ 'unit': 'px', 'value': 1 }, { 'unit': 'string', 'value': 'solid' }, { 'unit': 'string', 'value': '#eee' }]
15 | },
16 | 'group-inputs input-wrapper input': {
17 | 'display': 'block',
18 | 'width': [{ 'unit': '%H', 'value': NaN }],
19 | 'border': [{ 'unit': 'string', 'value': 'none' }],
20 | 'boxShadow': [{ 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }, { 'unit': 'string', 'value': 'none' }],
21 | 'borderRadius': '0',
22 | 'padding': [{ 'unit': 'rem', 'value': 1 }, { 'unit': 'rem', 'value': 0.8 }, { 'unit': 'rem', 'value': 1 }, { 'unit': 'rem', 'value': 0.8 }],
23 | 'background': '#fff',
24 | 'lineHeight': [{ 'unit': 'px', 'value': 19 }],
25 | 'color': '#555',
26 | 'outline': 'none'
27 | },
28 | 'group-inputs input-wrapper input:focus': {
29 | 'outline': 'none'
30 | },
31 | 'btm': {
32 | 'width': [{ 'unit': '%H', 'value': 1 }],
33 | 'height': [{ 'unit': 'px', 'value': 41 }],
34 | 'background': '#0f88eb',
35 | 'lineHeight': [{ 'unit': 'px', 'value': 41 }],
36 | 'color': '#fff',
37 | 'textAlign': 'center',
38 | 'borderRadius': '4px',
39 | 'cursor': 'pointer'
40 | },
41 | 'agreement-tip': {
42 | 'fontSize': [{ 'unit': 'px', 'value': 13 }],
43 | 'color': '#999',
44 | 'marginTop': [{ 'unit': 'px', 'value': 21 }],
45 | 'textAlign': 'center'
46 | }
47 | });
48 |
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { SignupComponent } from './signup.component';
4 |
5 | const routes: Routes = [
6 | {
7 | path: '',
8 | component: SignupComponent
9 | }
10 | ];
11 |
12 | @NgModule({
13 | imports: [RouterModule.forChild(routes)],
14 | exports: [RouterModule]
15 | })
16 | export class SignupRoutingModule { }
17 |
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup.component.html:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 | 注册吃乎
17 |
18 |
19 | 点击「注册」按钮,即代表你同意《吃乎协议》
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup.component.scss:
--------------------------------------------------------------------------------
1 | .group-inputs {
2 | width: 100%;
3 | background: #fff;
4 | border: 1px solid #eee;
5 | border-radius: 6px;
6 | margin-bottom: 18px;
7 | overflow: hidden;
8 | .input-wrapper {
9 | width: 100%;
10 | border-bottom: 1px solid #eee;
11 | input {
12 | display: block;
13 | width: calc(100% - 1.6rem);
14 | border: none;
15 | box-shadow: none;
16 | border-radius: 0;
17 | padding: 1rem 0.8rem;
18 | background: #fff;
19 | line-height: 19px;
20 | color: #555;
21 | outline: none;
22 | }
23 | input:focus {
24 | outline: none;
25 | }
26 | }
27 | }
28 |
29 | .btm {
30 | width: 100%;
31 | height: 41px;
32 | background: #0f88eb;
33 | line-height: 41px;
34 | color: #fff;
35 | text-align: center;
36 | border-radius: 4px;
37 | cursor: pointer;
38 | }
39 |
40 | .agreement-tip {
41 | font-size: 13px;
42 | color: #999;
43 | margin-top: 21px;
44 | text-align: center;
45 | }
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SignupComponent } from './signup.component';
4 |
5 | describe('SignupComponent', () => {
6 | let component: SignupComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SignupComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SignupComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Headers, Http } from '@angular/http';
3 | import { Router } from '@angular/router';
4 |
5 | @Component({
6 | selector: 'app-signup',
7 | templateUrl: './signup.component.html',
8 | styleUrls: ['./signup.component.scss']
9 | })
10 | export class SignupComponent implements OnInit {
11 |
12 | name: any = '';
13 | nickname: any = '';
14 | pass: any = '';
15 |
16 | constructor(public http: Http,public router: Router) { }
17 |
18 | ngOnInit() {
19 | }
20 |
21 | regist() {
22 | if (this.name.length < 1 || this.pass.length < 1 || this.nickname.length < 1) {
23 | alert("兄弟,你在搞笑吗?认真填...");
24 | return true;
25 | }
26 |
27 | let url = "http://www.devonhello.com/chihu2/register";
28 |
29 | var headers = new Headers();
30 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
31 |
32 | this.http.post(url, "name=" + this.name + "&pass=" + this.pass + "&nickname=" + this.nickname, {
33 | headers: headers
34 | })
35 | .subscribe((res) => {
36 | //console.log(res.json()[0]['_id']);
37 | try {
38 | if (res.json()[0]['_id']) {
39 | localStorage.user = JSON.stringify(res.json()[0]);
40 | this.router.navigate(['index']);
41 | }
42 | } catch (error) {
43 | alert("注册失败,账号可能已存在");
44 | }
45 |
46 | });
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/app/home/login/signup/signup.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { SignupComponent } from './signup.component';
4 | import { SignupRoutingModule } from './signup-routing.module';
5 | import { FormsModule } from '@angular/forms';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | SignupRoutingModule,
11 | FormsModule
12 | ],
13 | declarations: [SignupComponent]
14 | })
15 | export class SignupModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'nofound-page': {
5 | 'position': 'absolute',
6 | 'top': [{ 'unit': 'px', 'value': 0 }],
7 | 'left': [{ 'unit': 'px', 'value': 0 }],
8 | 'right': [{ 'unit': 'px', 'value': 0 }],
9 | 'bottom': [{ 'unit': 'px', 'value': 0 }],
10 | 'overflow': 'auto',
11 | 'background': '#f7fafc'
12 | },
13 | 'nofound-page err': {
14 | 'width': [{ 'unit': 'px', 'value': 1000 }],
15 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'string', 'value': 'auto' }, { 'unit': 'px', 'value': 0 }, { 'unit': 'string', 'value': 'auto' }],
16 | 'textAlign': 'center'
17 | },
18 | 'nofound-page err h1': {
19 | 'fontSize': [{ 'unit': 'px', 'value': 300 }],
20 | 'margin': [{ 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }, { 'unit': 'px', 'value': 0 }],
21 | 'color': '#666',
22 | 'fontWeight': '500'
23 | },
24 | 'nofound-page err a': {
25 | 'color': '#5079d9',
26 | 'cursor': 'pointer',
27 | 'transition': 'all .5s'
28 | },
29 | 'nofound-page err a:hover': {
30 | 'color': '#aaa'
31 | },
32 | 'nofound-page copy-wrap': {
33 | 'position': 'absolute',
34 | 'bottom': [{ 'unit': 'px', 'value': 30 }],
35 | 'width': [{ 'unit': '%H', 'value': 1 }],
36 | 'textAlign': 'center',
37 | 'color': '#777'
38 | },
39 | 'nofound-page copy-wrap copy': {
40 | 'display': 'block'
41 | },
42 | 'nofound-page copy-wrap copy svg': {
43 | 'verticalAlign': 'text-bottom',
44 | 'marginRight': [{ 'unit': 'px', 'value': 10 }],
45 | 'fill': '#777'
46 | },
47 | 'nofound-page copy-wrap copy a': {
48 | 'color': '#777',
49 | 'cursor': 'pointer'
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { NofoundComponent } from './nofound.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:NofoundComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class NofoundRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
404
5 |
抱歉,您输入的地址有误,请稍后再试。
6 |
{{seconds}} 秒后系统会自动转入 首页
7 |
8 |
12 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound.component.scss:
--------------------------------------------------------------------------------
1 | .nofound-page {
2 | position: absolute;
3 | top: 0;
4 | left: 0;
5 | right: 0;
6 | bottom: 0;
7 | overflow: auto;
8 | background: #f7fafc;
9 | .err {
10 | width: 1000px;
11 | margin: 0 auto;
12 | text-align: center;
13 | h1 {
14 | font-size: 300px;
15 | margin: 0;
16 | color: #666;
17 | font-weight: 500;
18 | }
19 | a {
20 | color: #5079d9;
21 | cursor: pointer;
22 | transition: all .5s;
23 | }
24 | a:hover {
25 | color: #aaa;
26 | }
27 | }
28 | .copy-wrap {
29 | position: absolute;
30 | bottom: 30px;
31 | width: 100%;
32 | text-align: center;
33 | color: #777;
34 | .copy {
35 | display: block;
36 | svg {
37 | vertical-align: text-bottom;
38 | margin-right: 10px;
39 | fill: #777;
40 | }
41 | a {
42 | color: #777;
43 | cursor: pointer;
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { NofoundComponent } from './nofound.component';
4 |
5 | describe('NofoundComponent', () => {
6 | let component: NofoundComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ NofoundComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(NofoundComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-nofound',
6 | templateUrl: './nofound.component.html',
7 | styleUrls: ['./nofound.component.scss']
8 | })
9 | export class NofoundComponent implements OnInit {
10 |
11 | seconds = 9;
12 | timer = null;
13 |
14 | constructor( public router: Router ) {
15 | this.timer = setInterval(()=>{
16 | if(this.seconds-- <= 1){
17 | clearInterval(this.timer);
18 | this.router.navigate(['/']);
19 | }
20 | },1000);
21 | }
22 |
23 | ngOnInit() {
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/home/nofound/nofound.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { NofoundComponent } from './nofound.component';
4 | import { NofoundRoutingModule } from './nofound-routing.module';
5 | import { IheaderModule } from '../../components/home/iheader/iheader.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | NofoundRoutingModule,
11 | IheaderModule
12 | ],
13 | declarations: [NofoundComponent]
14 | })
15 | export class NofoundModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/article/article-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ArticleComponent } from './article.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ArticleComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ArticleRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/article/article.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/article/article.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/article/article.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/article/article.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ArticleComponent } from './article.component';
4 |
5 | describe('ArticleComponent', () => {
6 | let component: ArticleComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ArticleComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ArticleComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/article/article.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 |
5 | @Component({
6 | selector: 'app-article',
7 | templateUrl: './article.component.html',
8 | styleUrls: ['./article.component.scss']
9 | })
10 | export class ArticleComponent implements OnInit {
11 |
12 | _id;
13 | data:any = [];
14 |
15 | constructor( public router: Router, public http: Http ) {
16 | this._id = this.router.url.split('/')[2];
17 | this.getdata();
18 | }
19 |
20 | getdata() {
21 |
22 | let url = "http://www.devonhello.com/chihu2/my_answer";
23 |
24 | var headers = new Headers();
25 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
26 |
27 | this.http.post(url, "id=" + this._id, {
28 | headers: headers
29 | })
30 | .subscribe((res) => {
31 |
32 | this.data = this.data.concat(res.json());
33 | });
34 | }
35 |
36 | ngOnInit() {
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/home/people/article/article.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ArticleComponent } from './article.component';
4 | import { ArticleRoutingModule } from './article-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 | import { AnswerCardModule } from '../../../components/home/answer-card/answer-card.module';
7 |
8 | @NgModule({
9 | imports: [
10 | CommonModule,
11 | ArticleRoutingModule,
12 | NoDataModule,
13 | AnswerCardModule
14 | ],
15 | declarations: [ArticleComponent]
16 | })
17 | export class ArticleModule { }
18 |
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { CollectComponent } from './collect.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:CollectComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class CollectRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/collect/collect.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { CollectComponent } from './collect.component';
4 |
5 | describe('CollectComponent', () => {
6 | let component: CollectComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ CollectComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(CollectComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-collect',
6 | templateUrl: './collect.component.html',
7 | styleUrls: ['./collect.component.scss']
8 | })
9 | export class CollectComponent implements OnInit {
10 |
11 | _id;
12 | data:any = [];
13 |
14 | constructor( public router: Router ) {
15 | this._id = this.router.url.split('/')[2];
16 |
17 | }
18 |
19 | ngOnInit() {
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/home/people/collect/collect.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { CollectComponent } from './collect.component';
4 | import { CollectRoutingModule } from './collect-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | CollectRoutingModule,
11 | NoDataModule
12 | ],
13 | declarations: [CollectComponent]
14 | })
15 | export class CollectModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ForkQueComponent } from './fork-que.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ForkQueComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ForkQueRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/fork-que/fork-que.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForkQueComponent } from './fork-que.component';
4 |
5 | describe('ForkQueComponent', () => {
6 | let component: ForkQueComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ForkQueComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForkQueComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-fork-que',
6 | templateUrl: './fork-que.component.html',
7 | styleUrls: ['./fork-que.component.scss']
8 | })
9 | export class ForkQueComponent implements OnInit {
10 |
11 | _id;
12 | data:any = [];
13 |
14 | constructor( public router: Router ) {
15 | this._id = this.router.url.split('/')[2];
16 |
17 | }
18 |
19 | ngOnInit() {
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-que/fork-que.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ForkQueComponent } from './fork-que.component';
4 | import { ForkQueRoutingModule } from './fork-que-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | ForkQueRoutingModule,
11 | NoDataModule
12 | ],
13 | declarations: [ForkQueComponent]
14 | })
15 | export class ForkQueModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ForkUserComponent } from './fork-user.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ForkUserComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ForkUserRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/fork-user/fork-user.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForkUserComponent } from './fork-user.component';
4 |
5 | describe('ForkUserComponent', () => {
6 | let component: ForkUserComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ForkUserComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForkUserComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-fork-user',
6 | templateUrl: './fork-user.component.html',
7 | styleUrls: ['./fork-user.component.scss']
8 | })
9 | export class ForkUserComponent implements OnInit {
10 |
11 | _id;
12 | data:any = [];
13 |
14 | constructor( public router: Router ) {
15 | this._id = this.router.url.split('/')[2];
16 |
17 | }
18 |
19 | ngOnInit() {
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/home/people/fork-user/fork-user.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ForkUserComponent } from './fork-user.component';
4 | import { ForkUserRoutingModule } from './fork-user-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | ForkUserRoutingModule,
11 | NoDataModule
12 | ],
13 | declarations: [ForkUserComponent]
14 | })
15 | export class ForkUserModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/people-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { PeopleComponent } from './people.component';
4 | import { ResolvePeopleService } from '../../app-routes/resolve-people.service';
5 |
6 | const routes: Routes = [
7 | {
8 | path: '',
9 | component: PeopleComponent,
10 | resolve:{
11 | data: ResolvePeopleService
12 | },
13 | children: [
14 | { path: '', loadChildren: 'app/home/people/work/work.module#WorkModule' },
15 | { path: 'work', loadChildren: 'app/home/people/work/work.module#WorkModule' },
16 | { path: 'share', loadChildren: 'app/home/people/share/share.module#ShareModule' },
17 | { path: 'article', loadChildren: 'app/home/people/article/article.module#ArticleModule' },
18 | { path: 'que', loadChildren: 'app/home/people/que/que.module#QueModule' },
19 | { path: 'collect', loadChildren: 'app/home/people/collect/collect.module#CollectModule' },
20 | { path: 'fork-que', loadChildren: 'app/home/people/fork-que/fork-que.module#ForkQueModule' },
21 | { path: 'fork-user', loadChildren: 'app/home/people/fork-user/fork-user.module#ForkUserModule' },
22 | ]
23 | }
24 | ];
25 |
26 | @NgModule({
27 | imports: [RouterModule.forChild(routes)],
28 | exports: [RouterModule]
29 | })
30 | export class PeopleRoutingModule { }
31 |
--------------------------------------------------------------------------------
/src/app/home/people/people.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { PeopleComponent } from './people.component';
4 |
5 | describe('PeopleComponent', () => {
6 | let component: PeopleComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ PeopleComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(PeopleComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/people.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { UserService } from '../../service/user.service';
3 | import { ActivatedRoute } from '@angular/router';
4 |
5 | @Component({
6 | selector: 'app-people',
7 | templateUrl: './people.component.html',
8 | styleUrls: ['./people.component.scss']
9 | })
10 | export class PeopleComponent implements OnInit {
11 |
12 | user:any = {};
13 | _id;
14 |
15 | constructor( public userService: UserService, public activatedRoute: ActivatedRoute ) {
16 | this.user = this.userService._user;
17 | }
18 |
19 | ngOnInit() {
20 | this.activatedRoute.data.subscribe((data)=>{
21 | this.user = data['data'];
22 | //console.log(this.user);
23 | });
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/home/people/people.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { PeopleComponent } from './people.component';
4 | import { PeopleRoutingModule } from './people-routing.module';
5 | import { IheaderModule } from '../../components/home/iheader/iheader.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | PeopleRoutingModule,
11 | IheaderModule
12 | ],
13 | declarations: [PeopleComponent]
14 | })
15 | export class PeopleModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/que/que-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { QueComponent } from './que.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:QueComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class QueRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/que/que.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/que/que.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/que/que.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/que/que.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { QueComponent } from './que.component';
4 |
5 | describe('QueComponent', () => {
6 | let component: QueComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ QueComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(QueComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/que/que.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-que',
6 | templateUrl: './que.component.html',
7 | styleUrls: ['./que.component.scss']
8 | })
9 | export class QueComponent implements OnInit {
10 |
11 | _id;
12 | data:any = [];
13 |
14 | constructor( public router: Router ) {
15 | this._id = this.router.url.split('/')[2];
16 |
17 | }
18 |
19 | ngOnInit() {
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/home/people/que/que.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { QueComponent } from './que.component';
4 | import { QueRoutingModule } from './que-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 |
7 | @NgModule({
8 | imports: [
9 | CommonModule,
10 | QueRoutingModule,
11 | NoDataModule
12 | ],
13 | declarations: [QueComponent]
14 | })
15 | export class QueModule { }
16 |
--------------------------------------------------------------------------------
/src/app/home/people/share/share-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ShareComponent } from './share.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:ShareComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class ShareRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/share/share.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/share/share.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/app/home/people/share/share.component.scss
--------------------------------------------------------------------------------
/src/app/home/people/share/share.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ShareComponent } from './share.component';
4 |
5 | describe('ShareComponent', () => {
6 | let component: ShareComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ShareComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ShareComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/share/share.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 |
5 | @Component({
6 | selector: 'app-share',
7 | templateUrl: './share.component.html',
8 | styleUrls: ['./share.component.scss']
9 | })
10 | export class ShareComponent implements OnInit {
11 |
12 | _id;
13 | data:any = [];
14 |
15 | constructor( public router: Router, public http: Http ) {
16 | this._id = this.router.url.split('/')[2];
17 | this.getdata();
18 | }
19 |
20 | getdata() {
21 |
22 | let url = "http://www.devonhello.com/chihu2/my_share";
23 |
24 | var headers = new Headers();
25 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
26 |
27 | this.http.post(url, "id=" + this._id, {
28 | headers: headers
29 | })
30 | .subscribe((res) => {
31 |
32 | this.data = res.json();
33 | });
34 | }
35 |
36 | ngOnInit() {
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/home/people/share/share.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { ShareComponent } from './share.component';
4 | import { ShareRoutingModule } from './share-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 | import { ShareCardModule } from '../../../components/home/share-card/share-card.module';
7 |
8 | @NgModule({
9 | imports: [
10 | CommonModule,
11 | ShareRoutingModule,
12 | NoDataModule,
13 | ShareCardModule
14 | ],
15 | declarations: [ShareComponent]
16 | })
17 | export class ShareModule { }
18 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work,component.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | export default StyleSheet.create({
4 | 'people-work-page': {
5 | 'width': [{ 'unit': '%H', 'value': 1 }]
6 | }
7 | });
8 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { WorkComponent } from './work.component';
4 |
5 | const routes: Routes = [{
6 | path:'',
7 | component:WorkComponent
8 | }];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forChild(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class WorkRoutingModule { }
15 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work.component.scss:
--------------------------------------------------------------------------------
1 | .people-work-page {
2 | width: 100%;
3 | }
--------------------------------------------------------------------------------
/src/app/home/people/work/work.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { WorkComponent } from './work.component';
4 |
5 | describe('WorkComponent', () => {
6 | let component: WorkComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ WorkComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(WorkComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should be created', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Router } from '@angular/router';
3 | import { Headers, Http } from '@angular/http';
4 |
5 | @Component({
6 | selector: 'app-work',
7 | templateUrl: './work.component.html',
8 | styleUrls: ['./work.component.scss']
9 | })
10 | export class WorkComponent implements OnInit {
11 |
12 | _id;
13 | data:any = [];
14 |
15 | constructor( public router: Router, public http: Http ) {
16 | this._id = this.router.url.split('/')[2];
17 | this.getdata();
18 | }
19 |
20 | getdata() {
21 |
22 | let url = "http://www.devonhello.com/chihu2/my_work";
23 |
24 | var headers = new Headers();
25 | headers.append('Content-Type', 'application/x-www-form-urlencoded');
26 |
27 | this.http.post(url, "id=" + this._id, {
28 | headers: headers
29 | })
30 | .subscribe((res) => {
31 |
32 | this.data = res.json();
33 | });
34 | }
35 |
36 | ngOnInit() {}
37 |
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/home/people/work/work.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { WorkComponent } from './work.component';
4 | import { WorkRoutingModule } from './work-routing.module';
5 | import { NoDataModule } from '../../../components/home/no-data/no-data.module';
6 | import { CardModule } from '../../../components/home/card/card.module';
7 |
8 | @NgModule({
9 | imports: [
10 | CommonModule,
11 | WorkRoutingModule,
12 | NoDataModule,
13 | CardModule
14 | ],
15 | declarations: [WorkComponent]
16 | })
17 | export class WorkModule { }
18 |
--------------------------------------------------------------------------------
/src/app/service/user.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { UserService } from './user.service';
4 |
5 | describe('UserService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [UserService]
9 | });
10 | });
11 |
12 | it('should be created', inject([UserService], (service: UserService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/service/user.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable, EventEmitter } from '@angular/core';
2 |
3 |
4 | @Injectable()
5 | export class UserService {
6 |
7 | //公共事件
8 | home_get_data: EventEmitter;
9 | share_get_data: EventEmitter;
10 | hot_work_get_data: EventEmitter;
11 | show_send_share: EventEmitter;
12 | show_send_que: EventEmitter;
13 |
14 | //scrollToTop
15 | scrollToTop: EventEmitter;
16 |
17 | //用户资料
18 | _user:any = {};
19 |
20 | constructor() {
21 | this.home_get_data = new EventEmitter();
22 | this.share_get_data = new EventEmitter();
23 | this.scrollToTop = new EventEmitter();
24 | this.show_send_share = new EventEmitter();
25 | this.show_send_que = new EventEmitter();
26 | this.hot_work_get_data = new EventEmitter();
27 | this._user = JSON.parse( localStorage.user );
28 | }
29 |
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/default-skin/default-skin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/assets/default-skin/default-skin.png
--------------------------------------------------------------------------------
/src/assets/default-skin/default-skin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/default-skin/preloader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/assets/default-skin/preloader.gif
--------------------------------------------------------------------------------
/src/assets/img/addimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/assets/img/addimg.png
--------------------------------------------------------------------------------
/src/assets/img/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/assets/img/download.png
--------------------------------------------------------------------------------
/src/chihu.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chihu-team/chihu-web-angular/e455d45298cba02da67dfd3923b9a2e1c3254439/src/chihu.ico
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file contents for the current environment will overwrite these during build.
2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do
3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead.
4 | // The list of which env maps to which file can be found in `.angular-cli.json`.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 吃乎-与世界分享你的知识、心情和美食
7 |
8 |
9 |
10 |
11 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule);
12 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** Evergreen browsers require these. **/
41 | import 'core-js/es6/reflect';
42 | import 'core-js/es7/reflect';
43 |
44 |
45 | /**
46 | * Required to support Web Animations `@angular/animation`.
47 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
48 | **/
49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
50 |
51 |
52 |
53 | /***************************************************************************************************
54 | * Zone JS is required by Angular itself.
55 | */
56 | import 'zone.js/dist/zone'; // Included with Angular CLI.
57 |
58 |
59 |
60 | /***************************************************************************************************
61 | * APPLICATION IMPORTS
62 | */
63 |
64 | /**
65 | * Date, currency, decimal and percent pipes.
66 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
67 | */
68 | // import 'intl'; // Run `npm install --save intl`.
69 | /**
70 | * Need to import at least one locale-data with intl.
71 | */
72 | // import 'intl/locale-data/jsonp/en';
73 |
--------------------------------------------------------------------------------
/src/styles.scss:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/long-stack-trace-zone';
4 | import 'zone.js/dist/proxy.js';
5 | import 'zone.js/dist/sync-test';
6 | import 'zone.js/dist/jasmine-patch';
7 | import 'zone.js/dist/async-test';
8 | import 'zone.js/dist/fake-async-test';
9 | import { getTestBed } from '@angular/core/testing';
10 | import {
11 | BrowserDynamicTestingModule,
12 | platformBrowserDynamicTesting
13 | } from '@angular/platform-browser-dynamic/testing';
14 |
15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16 | declare const __karma__: any;
17 | declare const require: any;
18 |
19 | // Prevent Karma from running prematurely.
20 | __karma__.loaded = function () {};
21 |
22 | // First, initialize the Angular testing environment.
23 | getTestBed().initTestEnvironment(
24 | BrowserDynamicTestingModule,
25 | platformBrowserDynamicTesting()
26 | );
27 | // Then we find all the tests.
28 | const context = require.context('./', true, /\.spec\.ts$/);
29 | // And load the modules.
30 | context.keys().map(context);
31 | // Finally, start Karma to run the tests.
32 | __karma__.start();
33 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "baseUrl": "./",
6 | "module": "es2015",
7 | "types": []
8 | },
9 | "exclude": [
10 | "test.ts",
11 | "**/*.spec.ts"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "baseUrl": "./",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": [
9 | "jasmine",
10 | "node"
11 | ]
12 | },
13 | "files": [
14 | "test.ts"
15 | ],
16 | "include": [
17 | "**/*.spec.ts",
18 | "**/*.d.ts"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | /* SystemJS module definition */
2 | declare var module: NodeModule;
3 | interface NodeModule {
4 | id: string;
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "outDir": "./dist/out-tsc",
5 | "sourceMap": true,
6 | "declaration": false,
7 | "moduleResolution": "node",
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "target": "es5",
11 | "typeRoots": [
12 | "node_modules/@types"
13 | ],
14 | "lib": [
15 | "es2016",
16 | "dom"
17 | ]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------