Commit fe2dbc64 by Sweet Zhang

保存

parent f20e21c2
import { Component } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {CommonService} from "./common.service";
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'] styleUrls: ['./app.component.css']
}) })
export class AppComponent { export class AppComponent implements OnInit {
constructor(private commonService: CommonService) {
}
ngOnInit() {
const customerId = this.commonService.getQueryString('customerId');
const orderId = this.commonService.getQueryString('orderId');
sessionStorage.setItem('customerId', customerId);
sessionStorage.setItem('orderId', orderId);
}
} }
import { BrowserModule } from '@angular/platform-browser'; import {BrowserModule} from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import {NgModule} from '@angular/core';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import { AppRoutingModule } from './app-routing.module'; import {AppRoutingModule} from './app-routing.module';
import { AppComponent } from './app.component'; import {AppComponent} from './app.component';
import { FamilyComponent } from './family/family.component'; import {FamilyComponent} from './family/family.component';
import { AgeComponent } from './age/age.component'; import {AgeComponent} from './age/age.component';
import { JobComponent } from './job/job.component'; import {JobComponent} from './job/job.component';
import { IncomeComponent } from './income/income.component'; import {IncomeComponent} from './income/income.component';
import { LoanComponent } from './loan/loan.component'; import {LoanComponent} from './loan/loan.component';
import { SocialSecurityComponent } from './social-security/social-security.component'; import {SocialSecurityComponent} from './social-security/social-security.component';
import { HealthComponent } from './health/health.component'; import {HealthComponent} from './health/health.component';
import { ChildrenHealthComponent } from './children-health/children-health.component'; import {ChildrenHealthComponent} from './children-health/children-health.component';
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 { TransitComponent } from './transit/transit.component'; import {TransitComponent} from './transit/transit.component';
import { Transit1Component } from './transit1/transit1.component'; import {Transit1Component} from './transit1/transit1.component';
import { Transit2Component } from './transit2/transit2.component'; import {Transit2Component} from './transit2/transit2.component';
import { Transit3Component } from './transit3/transit3.component'; import {Transit3Component} from './transit3/transit3.component';
import { HttpClientModule } from '@angular/common/http' import {HttpClientModule} from '@angular/common/http'
import { CommonService } from './common.service' import {CommonService} from './common.service'
import { LocalStorage } from './local.storage' import {LocalStorage} from './local.storage'
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
...@@ -46,7 +47,8 @@ import { LocalStorage } from './local.storage' ...@@ -46,7 +47,8 @@ import { LocalStorage } from './local.storage'
AppRoutingModule AppRoutingModule
, HttpClientModule , HttpClientModule
], ],
providers: [CommonService ,LocalStorage,], providers: [CommonService, LocalStorage, {provide: LocationStrategy, useClass: HashLocationStrategy}],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule {
}
...@@ -24,6 +24,7 @@ export class LiveComponent implements OnInit { ...@@ -24,6 +24,7 @@ export class LiveComponent implements OnInit {
type: any; type: any;
nextBtn: boolean; nextBtn: boolean;
lastQuestions: Array<any>; lastQuestions: Array<any>;
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
...@@ -41,53 +42,53 @@ export class LiveComponent implements OnInit { ...@@ -41,53 +42,53 @@ export class LiveComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.nextBtn = false; this.nextBtn = false;
this.showAddress = false; this.showAddress = false;
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 16).pop(); this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 16).pop();
// 获取省份 // 获取省份
this.commonService.provinceqry({insurerId: 11}).then(res => { this.commonService.provinceqry({insurerId: 11}).then(res => {
if (res['success']) { if (res['success']) {
this.provinceList = res['data'].provinceList; this.provinceList = res['data'].provinceList;
} }
}) })
setTimeout(()=>{ setTimeout(() => {
this.surveyInfo() this.surveyInfo()
},200) }, 200)
} }
surveyInfo() { surveyInfo() {
// 获取问题 // 获取问题
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
if (res['success']) { if (res['success']) {
this.curPageData = res['data']['survey'].pages['15']; this.curPageData = res['data']['survey'].pages['15'];
if(this.lastQuestions){ if (this.lastQuestions) {
let customerInput = this.lastQuestions['questions'][0]['options'][0]['customerInput'] let customerInput = this.lastQuestions['questions'][0]['options'][0]['customerInput']
customerInput = customerInput.split(',') customerInput = customerInput.split(',')
const left = customerInput[0] const left = customerInput[0]
const right = customerInput[1] const right = customerInput[1]
if(this.provinceList.length>0){ if (this.provinceList.length > 0) {
for(let i=0;i<this.provinceList.length;i++){ for (let i = 0; i < this.provinceList.length; i++) {
if(this.provinceList[i].provinceName == left) { if (this.provinceList[i].provinceName == left) {
// console.log(this.provinceList[i]) // console.log(this.provinceList[i])
this.selectProvince(this.provinceList[i]) this.selectProvince(this.provinceList[i])
} }
} }
} }
setTimeout(()=>{ setTimeout(() => {
for(let j=0;j<this.cityList.length;j++){ for (let j = 0; j < this.cityList.length; j++) {
if(this.cityList[j].cityName == right){ if (this.cityList[j].cityName == right) {
this.selectCity(this.cityList[j]) this.selectCity(this.cityList[j])
} }
} }
},200) }, 200)
} }
} }
}) })
} }
showToast() { showToast() {
...@@ -149,16 +150,18 @@ export class LiveComponent implements OnInit { ...@@ -149,16 +150,18 @@ export class LiveComponent implements OnInit {
next() { next() {
if (this.nextBtn == true) { if (this.nextBtn == true) {
const param = { const param = {
survey:{ survey: {
// customerId:, customerId: sessionStorage.getItem('customerId'),
// orderId:, orderId: sessionStorage.getItem('orderId'),
pages:this.commonService.todosCopy pages: this.commonService.todosCopy
} }
} };
// this.commonService.saveCustomerAnwers(param).then(res=>{ this.commonService.saveCustomerAnwers(param).then(res => {
if (res['success']) {
// }) this.router.navigate(['/transit3']);
this.router.navigate(['/transit3']); } else {
}
});
} else { } else {
return; return;
} }
......
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