Commit a48001b9 by Chao Sun

job

parent b1734854
...@@ -8,7 +8,6 @@ import {LocalStorage} from './local.storage'; ...@@ -8,7 +8,6 @@ import {LocalStorage} from './local.storage';
export class CommonService { export class CommonService {
private USER_API_URL = ''; private USER_API_URL = '';
private httpOptions; private httpOptions;
questionList:Array<any>;
constructor(private http: HttpClient, constructor(private http: HttpClient,
private ls: LocalStorage private ls: LocalStorage
) { ) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
.ageContent {
display: flex;
flex-wrap: wrap;
}
.ageContent li {
width: 100%;
height: 60px;
line-height: 60px;
border-bottom: 1px solid #dcdcdc;
display: flex;
justify-content: space-between;
}
.ageContent li span b {
margin-left: 10px;
}
.addChild {
/* display: flex;
justify-content: space-around;
align-items: center; */
width: 72%;
margin: 10% auto 0 auto;
text-align: center;
height: 70px;
line-height: 70px;
border: 1px #ff0000 solid;
border-radius: 40px;
position: relative;
}
.addChild div {
float: left;
color: #ec2d37;
font-size: 22px;
}
.addChild div.icon {
font-weight: bold;
width: 50px;
height: 50px;
border: 2px #ec2d37 solid;
border-radius: 50%;
font-size: 45px;
line-height: 38px;
margin: 3% 10% 0 10%;
}
\ No newline at end of file
<p> <div class="layout">
age works! <div class="content">
</p> <div class="questionTitle">{{ this.curPageData?.pageName }}</div>
<ul class="ageContent">
<li *ngFor="let optionsList of this.curPageData?.questions; index as i">
<div>{{ optionsList.questionName }}</div>
<b (click)="showToast(optionsList, i)" style="width:35%;text-align: center;float: right">
<span style="width:20%;text-align: center;">{{ optionsList.name }}</span
>
<span style="width:10%;text-align: center;float: right">&gt;</span>
</b>
</li>
</ul>
</div>
<div class="addChild"
(click)="addChild()">
<div class="icon">+</div>
<div data-toggle="modal">增加孩子年龄</div>
</div>
<div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div>
</div>
<div class="toastWrapper toast" *ngIf="isShow" (click)="closeToast()">
</div>
</div>
<div class="toastContent" *ngIf="isShow">
<ul>
<li
[ngClass]="{ selected: this.curQuestionSelecte === options.optionName}"
*ngFor="let options of curQues.options"
(click)="
closeToast();
"
>
{{ options.optionName }}
</li>
</ul>
</div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service';
@Component({ @Component({
selector: 'app-age', selector: 'app-age',
...@@ -6,10 +7,34 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +7,34 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./age.component.css'] styleUrls: ['./age.component.css']
}) })
export class AgeComponent implements OnInit { export class AgeComponent implements OnInit {
curPageData:Array<any>;
constructor() { } isShow: boolean;
curQues: Object;
curQuesIndex: number;
curQuestionSelecte: string;
constructor(private commonService: CommonService) { }
ngOnInit() { ngOnInit() {
this.surveyInfo()
}
surveyInfo() {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['2']
console.log(this.curPageData)
} }
})
}
showToast(question, idx) {
this.isShow = true
this.curQues = question
this.curQuesIndex = idx
this.curQuestionSelecte = question.name
}
closeToast() {
this.isShow = false
}
} }
import {NgModule} from '@angular/core'; import {NgModule, Component} from '@angular/core';
import {Routes, RouterModule} from '@angular/router'; import {Routes, RouterModule} from '@angular/router';
import {TransitComponent} from './transit/transit.component'; import {TransitComponent} from './transit/transit.component';
import {FamilyComponent} from './family/family.component'; import {FamilyComponent} from './family/family.component';
...@@ -12,6 +12,11 @@ import {ChildrenHealthComponent} from './children-health/children-health.compone ...@@ -12,6 +12,11 @@ import {ChildrenHealthComponent} from './children-health/children-health.compone
import {DiseaseComponent} from './disease/disease.component'; import {DiseaseComponent} from './disease/disease.component';
import {SmokingComponent} from './smoking/smoking.component'; import {SmokingComponent} from './smoking/smoking.component';
import {LiveComponent} from './live/live.component'; import {LiveComponent} from './live/live.component';
import {Transit1Component} from './transit1/transit1.component';
import {Transit2Component} from './transit2/transit2.component';
import {Transit3Component} from './transit3/transit3.component';
import { CommonModule } from '@angular/common'
const routes: Routes = [ const routes: Routes = [
{ {
...@@ -68,14 +73,24 @@ const routes: Routes = [ ...@@ -68,14 +73,24 @@ const routes: Routes = [
}, { }, {
path: 'live', path: 'live',
component: LiveComponent component: LiveComponent
}, { },{
path: '*', path:'transit1',
component: 'TransitComponent' component:Transit1Component
} },{
path:'transit2',
component:Transit2Component
},{
path:'transit3',
component:Transit3Component
},
// {
// path: '*',
// component: 'TransitComponent'
// }
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes)], imports: [CommonModule,RouterModule.forRoot(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class AppRoutingModule { export class AppRoutingModule {
......
...@@ -15,7 +15,13 @@ import { DiseaseComponent } from './disease/disease.component'; ...@@ -15,7 +15,13 @@ import { DiseaseComponent } from './disease/disease.component';
import { SmokingComponent } from './smoking/smoking.component'; import { SmokingComponent } from './smoking/smoking.component';
import { LiveComponent } from './live/live.component'; import { LiveComponent } from './live/live.component';
import { TransitComponent } from './transit/transit.component'; import { TransitComponent } from './transit/transit.component';
import { Transit1Component } from './transit1/transit1.component';
import { Transit2Component } from './transit2/transit2.component';
import { Transit3Component } from './transit3/transit3.component';
import { HttpClientModule } from '@angular/common/http'
import { CommonService } from './common.service'
import { LocalStorage } from './local.storage'
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
...@@ -30,13 +36,17 @@ import { TransitComponent } from './transit/transit.component'; ...@@ -30,13 +36,17 @@ import { TransitComponent } from './transit/transit.component';
DiseaseComponent, DiseaseComponent,
SmokingComponent, SmokingComponent,
LiveComponent, LiveComponent,
TransitComponent TransitComponent,
Transit1Component,
Transit2Component,
Transit3Component
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
AppRoutingModule AppRoutingModule
, HttpClientModule
], ],
providers: [], providers: [CommonService ,LocalStorage,],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }
import { TestBed } from '@angular/core/testing';
import { CommonService } from './common.service';
describe('CommonService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: CommonService = TestBed.get(CommonService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import {environment} from './../environments/environment';
import {HttpClient, HttpHeaders} from '@angular/common/http';
// import {LocalStorage} from './local.storage';
@Injectable({
providedIn: 'root'
})
export class CommonService {
private USER_API_URL = '';
private httpOptions;
constructor(private http: HttpClient,
// private ls: LocalStorage
) {
this.USER_API_URL = environment.apiUrl;
this.httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'X-Authorization': ''
})
};
}
async surveyInfo() {
const url = this.USER_API_URL + '/survey/surveyInfo';
const res = await this.obtainToken();
this.httpOptions.headers = this.httpOptions.headers.set('X-Authorization', res['data']['token']);
return this.http
.post(url, JSON.stringify({}),this.httpOptions).toPromise().then(response => {
return response;
});
}
async saveCustomerAnwers(objParam){
const url = this.USER_API_URL + '/survey/saveCustomerAnwers';
const res = await this.obtainToken();
this.httpOptions.headers = this.httpOptions.headers.set('X-Authorization', res['data']['token']);
return this.http
.post(url, JSON.stringify(objParam),this.httpOptions).toPromise().then(response => {
return response;
});
}
/**
* 获取TOKEN
*/
obtainToken() {
const url = this.USER_API_URL + '/authorize/obtainToken';
const ticketObj = {
ticket: 'questionnair'
};
return this.http.post(url, JSON.stringify(ticketObj), this.httpOptions).toPromise();
}
async provinceqry(objParam){
const url = this.USER_API_URL + '/partner/provinceqry';
const res = await this.obtainToken();
this.httpOptions.headers = this.httpOptions.headers.set('X-Authorization', res['data']['token']);
return this.http.post(url,JSON.stringify(objParam),this.httpOptions).toPromise().then(res => {
return res;
})
}
async getCityqry(objParam){
const url = this.USER_API_URL + '/partner/cityqry';
const res = await this.obtainToken();
this.httpOptions.headers = this.httpOptions.headers.set('X-Authorization', res['data']['token']);
return this.http
.post(url,JSON.stringify(objParam),this.httpOptions)
.toPromise().then(res => {
return res;
})
}
getQueryString(name) {
const after = window.location.hash.split('?')[1];
if (after) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = after.match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
} else {
return null;
}
}
}
}
.option_item {
display: flex;
flex-wrap: wrap;
}
.option_item li {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 0 0 50%;
margin-bottom: 20%;
}
.option_item li img {
max-width: 55%;
}
.option_item li img.selected {
border: 1px solid #ff0000;
border-radius: 50%;
}
\ No newline at end of file
<p> <div class="layout">
family works! <div class="content">
</p> <div class="questionTitle">{{ this.curPageData?.pageName }}</div>
<ul class="option_item" style="margin-top: 20%;">
<li
*ngFor="let options of curPageData?.questions[0]['options']"
>
<img
[ngClass]="{ selected: options['selected'] == true }"
src="assets/images/icon{{ options.optionId }}.png"
alt="{{ options.optionName }}"
/>
<span>{{ options.optionName }}</span>
</li>
</ul>
</div>
</div>
<div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div>
</div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service';
@Component({ @Component({
selector: 'app-family', selector: 'app-family',
templateUrl: './family.component.html', templateUrl: './family.component.html',
styleUrls: ['./family.component.css'] styleUrls: ['./family.component.css']
}) })
export class FamilyComponent implements OnInit { export class FamilyComponent implements OnInit {
curPageData:Array<any>;
constructor() { } constructor(private commonService: CommonService) { }
ngOnInit() { ngOnInit() {
this.surveyInfo()
} }
surveyInfo() {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['1']
console.log(this.curPageData)
}
})
}
} }
<p> <div class="container">
job works! <div class="layout">
</p> <div class="content">
<div class="questionTitle">{{ this.curPageData?.pageName }}</div>
<ul class="jobContent">
<li
[ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData?.questions[0].options"
>
{{ options.optionName }}
</li>
</ul>
</div>
</div>
</div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service';
@Component({ @Component({
selector: 'app-job', selector: 'app-job',
templateUrl: './job.component.html', templateUrl: './job.component.html',
styleUrls: ['./job.component.css'] styleUrls: ['./job.component.css']
}) })
export class JobComponent implements OnInit { export class JobComponent implements OnInit {
curPageData:Array<any>;
constructor() { } constructor(
private commonService: CommonService
) { }
ngOnInit() { ngOnInit() {
this.surveyInfo()
} }
surveyInfo() {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['3']
console.log(this.curPageData)
}
})
}
} }
/**
* Created by Jerold Chen on 2018/4/13.
*/
export class LocalStorage {
public localStorage: any;
constructor() {
if (!localStorage) {
throw new Error('Current browser does not support Local Storage');
}
this.localStorage = localStorage;
}
public set(key: string, value: string): void {
this.localStorage[key] = value;
}
public get(key: string): string {
return this.localStorage[key] || false;
}
public setObject(key: string, value: any): void {
this.localStorage[key] = JSON.stringify(value);
}
public getObject(key: string): any {
return JSON.parse(this.localStorage[key] || '{}');
}
public remove(key: string): any {
this.localStorage.removeItem(key);
}
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<span style="color:red;">*</span> <span style="color:red;">*</span>
<span>本测试大约需要1分钟</span> <span>本测试大约需要1分钟</span>
</div> </div>
<!-- <div class="footer" routerLink="/question1"> <div class="footer" routerLink="/family">
<div>获取家庭分析报告</div> <div>获取家庭分析报告</div>
</div> --> </div>
</div> </div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Transit1Component } from './transit1.component';
describe('Transit1Component', () => {
let component: Transit1Component;
let fixture: ComponentFixture<Transit1Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ Transit1Component ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(Transit1Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transit1',
templateUrl: './transit1.component.html',
styleUrls: ['./transit1.component.css']
})
export class Transit1Component implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Transit2Component } from './transit2.component';
describe('Transit2Component', () => {
let component: Transit2Component;
let fixture: ComponentFixture<Transit2Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ Transit2Component ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(Transit2Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transit2',
templateUrl: './transit2.component.html',
styleUrls: ['./transit2.component.css']
})
export class Transit2Component implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Transit3Component } from './transit3.component';
describe('Transit3Component', () => {
let component: Transit3Component;
let fixture: ComponentFixture<Transit3Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ Transit3Component ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(Transit3Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transit3',
templateUrl: './transit3.component.html',
styleUrls: ['./transit3.component.css']
})
export class Transit3Component implements OnInit {
constructor() { }
ngOnInit() {
}
}
export const environment = { export const environment = {
production: true production: true,
apiUrl: 'https://m.zuihuibi.cn/api'
}; };
/**
* Created by Sweet on 2019/3/22.
*/
export const environment = {
production: false,
apiUrl: 'https://mstage.zuihuibi.cn/api'
};
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`. // The list of file replacements can be found in `angular.json`.
export const environment = { export const environment = {
production: false production: false,
apiUrl: 'https://mdev.zuihuibi.cn/api'
}; };
/* /*
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Questionnaire</title> <title>银盾保险在线</title>
<base href="/"> <base href="/">
<link rel="shortcut icon" href="https://www.ydinsurance.cn/wp-content/uploads/2018/04/favicon.gif">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
</body> </body>
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?36b1eb7eec3b5dac9f97d887092b5b27";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</html> </html>
/* You can add global styles to this file, and also import other style files */ /* You can add global styles to this file, and also import other style files */
*{
margin: 0;padding:0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
position: relative;
height:100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
/* overflow: hidden; */
}
img{
max-width: 100%;
}
ul li,ol li{
list-style: none;
}
.container{
padding: 0;
height: 100%;
}
.wrapper{
display: flex;
flex-direction: column;
}
.layout{
display: flex;
flex-direction: column;
padding:0 10px;
height:100%;
}
.layout.wrapper{
padding:0;
}
.tips{
display: flex;
justify-content: center;
align-items: center;
padding:20px 0px;
}
.footer{
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
padding: 20px 0;
width: 90%;
margin: 0 auto;
background: #ec2d37;
color: #fff;
border-radius: 10px;
box-shadow: 0px 15px 16px -8px #f4bbbe;
}
/* .layout.cityLayout{
padding:10px 0;
} */
.content{
/* max-height: 525px; */
overflow: auto;
-webkit-overflow-scrolling: touch;
padding-bottom: 75px;
}
/* .layout.cityLayout .questionTitle{
margin:0 10px;
} */
.questionTitle{
color:#ec2d37;
font-size: 22px;
height: 60px;
line-height: 60px;
width: 100%;
display: flex;
}
.questionTitle span{
color: rgba(3,177, 153)
}
.questionTitle.hospitalTitle{
line-height: unset;
margin: 25px auto 15px auto;
}
.questionTitle.smokeTitle{
line-height: unset;
margin: 25px auto 55px auto;
}
.content_footer{
display: flex;
width: 100%;
position: fixed;
bottom: 0;
background-color: #fff;
padding-bottom:15px;
}
.content_footer div{
text-align: center;
color: #ec2d37;
font-size: 20px;
height: 60px;
line-height: 60px;
font-weight: bold;
}
.content_footer div.next{
color: #8a8a8a;
}
.content_footer div:nth-child(1){
font-size: 20px;
width: 10%;
}
.content_footer div:nth-child(2){
font-weight: 500;
width: 50%;
margin-left:15%;
}
.twoContent{
height: 100%;
}
.jobContent,.income,.cityContent{
width: 100%;
}
.jobContent li,.income li,.cityContent li{
width: 100%;
height: 55px;
line-height: 55px;
border: 1px #8a8a8a solid;
margin-bottom: 15px;
border-radius: 4px;
box-sizing: border-box;
padding-left: 5%;
}
.jobContent li.selected,.income li.selected{
border: 2px #ff0000 solid;
}
.cityContent{
display: flex;
flex-wrap: wrap;
margin-top: 10%;
margin-bottom: 0px;
}
.income{
display: flex;
flex-wrap: wrap;
margin-bottom: 0;
}
.income li{
width: 49%;
float: left;
margin-right: 2%;
text-align: center;
padding-left: 0;
}
.income li:nth-child(2),.income li:nth-child(4),.income li:nth-child(6){
margin-right: 0;
}
.cityContent li{
width:12%;
height: 46px;
line-height: 46px;
text-align: center;
padding-left: 0;
margin-left: 1%;
margin-right: 1%;
border:none;
-moz-box-shadow:0px 3px 7px rgb(206, 208, 210);
-webkit-box-shadow:0px 3px 7px rgb(206, 208, 210);
box-shadow:0px 3px 7px rgb(206, 208, 210);
}
.cityContent li:nth-child(7),.cityContent li:nth-child(14),.cityContent li:nth-child(21),.cityContent li:nth-child(28){
margin-right: 0;
}
.cityContent li.selected{
background: rgba(148,209, 204)
}
.toastWrapper{
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
top: 0;
}
.toast{
position: fixed;
left: 0;
right: 0;
min-width: 320px;
max-width: 640px;
width: 100%;
margin: 0 auto;
z-index: 1;
}
.toastContent{
position: fixed;
bottom: 0;
width: 100%;
height: 50%;
background-color: #fff;
z-index: 20;
}
.toastContent.city{
margin: 0;
}
.toastContent .live{
display: flex;
height: 40px;
line-height: 40px;
text-align: center;
justify-content: center;
border-bottom: 1px rgb(220, 220, 220) solid;
font-size: 16px;
}
.toastContent .province{
display: flex;
height: 40px;
line-height:40px;
}
.toastContent .province span{
width: 45%;
font-size:16px;
text-align: center;
}
/* .toastContent .province span.selected{
border-bottom:2px solid #ff0000;
} */
.toastContent ul{
width: 100%;
margin: 5% 0%;
}
.toastContent ul li{
width: 46%;
float: left;
text-align: center;
margin: 2%;
border: 1px #8a8a8a solid;
border-radius: 4px;
box-sizing: border-box;
height: 40px;
line-height: 40px;
}
.toastContent ul li.selected{
border: 1px #ff0000 solid;
}
.toastContent ul.city {
margin: 0;
overflow: scroll;
max-height: 240px;
-webkit-overflow-scrolling: touch;
}
.toastContent ul.city li{
width: 100%;
border:none;
border-bottom: 1px rgb(220, 220, 220) solid;
border-radius: 0;
margin: 0;
height:35px;
line-height:35px;
}
.address{
width: 80%;
margin:15% auto;
text-align: center;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment