Commit bacfb039 by Chao Sun

双12活动跳转

parent a756c433
......@@ -47,7 +47,7 @@
<div class="inputBox">
<!--获取手机号 -->
<div class="mobileNoSection inputControl">
<input id="phone" type="number" maxlength="11" placeholder="手机号" />
<input id="phone" type="tel" maxlength="11" placeholder="手机号" />
<div class="autoGet">
<button class="getPhoneNumber commonBtn" id="codeBtn">
获取验证码
......@@ -56,7 +56,7 @@
</div>
<!--获取验证码 -->
<div class="codeSection inputControl">
<input style="width:100%" id="code" type="number" maxlength="4" placeholder="短信验证码" />
<input style="width:100%" id="code" type="tel" maxlength="4" placeholder="短信验证码" />
</div>
<!--姓名 -->
<div class="codeSection inputControl">
......@@ -82,7 +82,7 @@
<div class="inputBox">
<!--获取手机号 -->
<div class="mobileNoSection inputControl">
<input id="loginPhone" type="number" maxlength="11" placeholder="手机号" />
<input id="loginPhone" type="tel" maxlength="11" placeholder="手机号" />
<div class="autoGet">
<button class="getPhoneNumber commonBtn" id="loginCodeBtn">
获取验证码
......@@ -91,7 +91,7 @@
</div>
<!--获取验证码 -->
<div class="codeSection inputControl">
<input id="loginCode" type="number" maxlength="4" placeholder="短信验证码" />
<input id="loginCode" type="tel" maxlength="4" placeholder="短信验证码" />
</div>
<!--登录 -->
<button class="goBuyBtn commonBtn" id="loginIn">登录</button>
......
$(function () {
// var api = 'https://' + window.location.host;
var api = 'https://mdev.zuihuibi.cn';
var api = 'https://' + window.location.host;
// var api = 'https://mdev.zuihuibi.cn';
var gitUrlParam = window.location.search;
const shareInfo = {
shareCode: null,
......@@ -27,13 +27,13 @@ $(function () {
window.scrollTo(0, 0);
})
$(".right").click(function () {
if (getQueryString('source')) {
if (getQueryString('campaign') && getQueryString('campaign') != 'double12') {
$('.modalBox').hide();
goTopay()
goTopay();
} else {
$("#phone").val('')
$("#code").val('')
$("#name").val('')
$("#phone").val('');
$("#code").val('');
$("#name").val('');
$('.modalBox').show();
}
......@@ -42,10 +42,10 @@ $(function () {
$('.modalBox').hide();
})
if (getQueryString('hmsr') || getQueryString('hmpl') || getQueryString('hmkw') || getQueryString('hmci')) {
window.localStorage.setItem('hmsr', getQueryString('hmsr'))
window.localStorage.setItem('hmpl', getQueryString('hmpl'))
window.localStorage.setItem('hmkw', getQueryString('hmkw'))
window.localStorage.setItem('hmci', getQueryString('hmci'))
window.sessionStorage.setItem('hmsr', getQueryString('hmsr'))
window.sessionStorage.setItem('hmpl', getQueryString('hmpl'))
window.sessionStorage.setItem('hmkw', getQueryString('hmkw'))
window.sessionStorage.setItem('hmci', getQueryString('hmci'))
}
function getToken() {
$.ajax({
......@@ -67,25 +67,31 @@ $(function () {
//解密来源
getChannel()
function getChannel() {
if (getQueryString('source')) {
if (getQueryString('campaign') && getQueryString('campaign') != 'double12') {
$.ajax({
type: "POST",
url: api + '/api/activity/getActivityOrderInfo',
url: api + '/api/data/security/desEncrypt',
contentType: "application/json",
data: JSON.stringify({ encryptData: getQueryString('source') }),
data: JSON.stringify({ encryptString: getQueryString('campaign'), type: "decrypt" }),
async: false,
headers: { "X-Authorization": token },
success: function (res) {
if (res['success']) {
res = res['data'];
window.localStorage.setItem('hmsr', res['channelLaunchAD']['hmsr'])
window.localStorage.setItem('hmpl', res['channelLaunchAD']['hmpl'])
window.localStorage.setItem('hmkw', res['channelLaunchAD']['hmkw'])
window.localStorage.setItem('hmci', res['channelLaunchAD']['hmci'])
if (res['data']['encryptResult']) {
res = JSON.parse(res['data']['encryptResult']);
if (res['campaignInfo'] && res['campaignInfo']['campaignCode']) {
window.sessionStorage.setItem('campaignCode', res['campaignInfo']['campaignCode']);
}
if (getQueryString('task')) {
window.sessionStorage.setItem('campaignTaskCode', getQueryString('task'));
}
param.name = res['name'];
param.phone = res['mobileNo'];
param.customerId = res['customerId'];
}
} else {
console.log(res['message'])
}
}
})
}
......@@ -135,7 +141,7 @@ $(function () {
}
sendPhone()
//发送验证码
function sendPhone(type) {
function sendPhone() {
$("#codeBtn").click(function () {
if (!$("#phone").val()) {
layer.open({
......@@ -310,19 +316,23 @@ $(function () {
}
getPay();
function getPay() {
$("#pay").click(function () {
goTopay()
goTopay();
})
}
function goTopay() {
if (getQueryString('source')) {
if (getQueryString('campaign') && getQueryString('campaign') != 'double12') {
param.verificationCodeValider = true;
} else {
param.name = $("#name").val();
param.phone = $("#phone").val();
param.name = $("#name").val();
if (getQueryString('campaign') == 'double12') {
window.sessionStorage.setItem('campaignCode', getQueryString('campaign'))
window.sessionStorage.setItem('campaignTaskCode', getQueryString('task'))
}
}
if (!REG_CODE.test(param.phone)) {
layer.open({
......@@ -332,7 +342,6 @@ $(function () {
});
return;
}
if (!param.verificationCodeValider) {
layer.open({
content: '请检查您的验证码是否正确',
......@@ -363,10 +372,14 @@ $(function () {
mobileNo: param.phone
},
channelLaunchAD: {
hmsr: window.localStorage.getItem('hmsr'),
hmpl: window.localStorage.getItem('hmpl'),
hmkw: window.localStorage.getItem('hmkw'),
hmci: window.localStorage.getItem('hmci')
hmsr: window.sessionStorage.getItem('hmsr'),
hmpl: window.sessionStorage.getItem('hmpl'),
hmkw: window.sessionStorage.getItem('hmkw'),
hmci: window.sessionStorage.getItem('hmci')
},
campaignInfo: {
campaignCode: window.sessionStorage.getItem('campaignCode'),
campaignTaskCode: window.sessionStorage.getItem('campaignTaskCode')
},
deviceType: param.deviceType,
paymentMethod: '1',
......@@ -504,11 +517,11 @@ $(function () {
function wxShare() {
$('.share').click(function () {
if (!localStorage.getItem('customerInfo')) {
if (!localStorage.getItem('consultCustomerInfo')) {
$('.loginInBox').show();
} else {
$('.markbox').show()
var customerInfo = localStorage.getItem('customerInfo')
var customerInfo = localStorage.getItem('consultCustomerInfo')
customerInfo = JSON.parse(customerInfo).customerId;
shareInfo.customerId = customerInfo;
shareInfo.shareCode = Math.random().toString(36).substr(2, 15)
......@@ -611,7 +624,7 @@ $(function () {
totalFortune: res.data.totalFortune,
mobileNo: $("#phone").val()
};
localStorage.setItem('customerInfo', JSON.stringify(customerInfo));
localStorage.setItem('consultCustomerInfo', JSON.stringify(customerInfo));
if (!res.success) {
layer.open({
content: res.message,
......@@ -657,9 +670,7 @@ $(function () {
url: api + '/api/login',
type: 'POST',
contentType: "application/json",
data: JSON.stringify({
mobileNo: $("#loginPhone").val()
}),
data: JSON.stringify({ mobileNo: $("#loginPhone").val() }),
headers: {
"X-Authorization": token
},
......
import {Component, OnInit} from '@angular/core';
import {CommonService} from "./common.service";
import { Component, OnInit } from '@angular/core';
import { CommonService } from "./common.service";
@Component({
selector: 'app-root',
......@@ -14,13 +14,17 @@ export class AppComponent implements OnInit {
ngOnInit() {
const customerId = this.commonService.getQueryString('customerId');
const orderId = this.commonService.getQueryString('orderId');
if (customerId) {
sessionStorage.setItem('customerId', customerId);
}
if (orderId) {
sessionStorage.setItem('orderId', orderId);
}
if (this.commonService.getQueryString('campaign') && this.commonService.getQueryString('task')) {
const campaignInfo = {
campaignCode: this.commonService.getQueryString('campaign'),
campaignTaskCode: this.commonService.getQueryString('task'),
} || null;
sessionStorage.setItem('customerId', customerId);
sessionStorage.setItem('orderId', orderId);
if (!campaignInfo) {
};
sessionStorage.setItem('campaignInfo', JSON.stringify(campaignInfo));
}
}
......
import {Injectable} from '@angular/core';
import {environment} from './../environments/environment';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Subject} from "rxjs/index";
import { Injectable } from '@angular/core';
import { environment } from './../environments/environment';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Subject } from "rxjs/index";
@Injectable({
providedIn: 'root'
})
......@@ -200,4 +200,15 @@ export class CommonService {
return this.todos;
}
//获取orderId
async createActivityOrder(objParam) {
const url = this.USER_API_URL + '/activity/createActivityOrder';
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;
});
}
}
......@@ -43,7 +43,7 @@
<div class='inputBox'>
<!--获取手机号 -->
<div class="mobileNoSection inputControl">
<input type='tel' maxlength="11" name="mobileNo" placeholder="您的手机号" [(ngModel)]="loginData.mobileNo"/>
<input type='tel' maxlength="11" name="mobileNo" placeholder="您的手机号" [(ngModel)]="loginData.mobileNo" />
<div class='autoGet'>
<button class='getPhoneNumber' (click)="sendCode()" [disabled]="sendBtnFlag">
{{timeHtml}}
......@@ -56,7 +56,7 @@
</div>
<!--姓名-->
<div class="inputControl">
<input type="text" name="name" placeholder="您的姓名">
<input type="text" name="name" placeholder="您的姓名" [(ngModel)]="loginData.name">
</div>
<!--登录 -->
<div style="text-align: center;">
......
import {Component, OnInit} from '@angular/core';
import {CommonService} from '../common.service'
import {ActivatedRoute, Router} from "@angular/router";
import { Component, OnInit } from '@angular/core';
import { CommonService } from '../common.service'
import { ActivatedRoute, Router } from "@angular/router";
@Component({
selector: 'app-live',
......@@ -46,12 +46,13 @@ export class LiveComponent implements OnInit {
questions: [{
questionId: '',
questionName: '',
options: [{optionId: '', optionName: '', optionOrder: '', selected: ''}]
options: [{ optionId: '', optionName: '', optionOrder: '', selected: '' }]
}],
};
this.loginData = {
mobileNo: null,
code: null
code: null,
name: null
};
}
......@@ -61,7 +62,7 @@ export class LiveComponent implements OnInit {
this.tipsFlag = false;
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']) {
this.provinceList = res['data'].provinceList;
}
......@@ -69,8 +70,7 @@ export class LiveComponent implements OnInit {
setTimeout(() => {
this.surveyInfo()
}, 200)
this.hasDisease(this.commonService.todosCopy);
}
surveyInfo() {
......@@ -172,8 +172,8 @@ export class LiveComponent implements OnInit {
pages: this.commonService.todosCopy
}
};
// questionnaireSource 为 1 表示 自动评测
if (!sessionStorage.getItem('campaignInfo')) {
// 有campaignInfo表示 自动评测
if (sessionStorage.getItem('campaignInfo')) {
if (!param || !param.survey.customerId || param.survey.customerId === 'null' || param.survey.customerId === 'undefined') {
this.loginModalFlag = true;
return;
......@@ -181,8 +181,28 @@ export class LiveComponent implements OnInit {
}
this.commonService.saveCustomerAnwers(param).then(res => {
if (res['success']) {
if (!sessionStorage.getItem('campaignInfo')) {
this.router.navigate(['/transit3']);
} else {
//判断有无疾病
if (this.isDisease) {
//双12活动有疾病出弹框,确定后跳活动首页
this.autoEvaluationModal = true;
} else {
//无疾病判断如果是任务二或者任务三跳活动首页否则条查看方案
const task = JSON.parse(sessionStorage.getItem('campaignInfo'))['campaignTaskCode']
if (task == '12task2' || task == '12task3') {
setTimeout(() => {
window.location.href = `https://${window.location.host}/2019Double12/index.html?customerId=${sessionStorage.getItem('customerId')}`;
}, 2000)
} else {
// 跳转到方案详情页面
window.location.href = `https://${window.location.host}/customizedPlanList/3?orderId=${sessionStorage.getItem('orderId')}&customerId=${sessionStorage.getItem('customerId')}&leftTimes=1`;
}
}
}
} else {
this.tipsFlag = true;
this.errorModal('提交失败,请稍后重试');
setTimeout(() => {
......@@ -211,7 +231,7 @@ export class LiveComponent implements OnInit {
this.errorModal('手机号码输入有误');
return;
} else if (this.loginData.mobileNo) {
this.commonService.verificationCode({mobileNo: this.loginData.mobileNo, type: '1'}).then(res => {
this.commonService.verificationCode({ mobileNo: this.loginData.mobileNo, type: '1' }).then(res => {
if (res['success']) {
this.sendBtnFlag = true;
this.errorModal('发送成功');
......@@ -234,6 +254,20 @@ export class LiveComponent implements OnInit {
// 获取结果时登录
loginIn() {
if (!this.loginData.mobileNo) {
this.errorModal('请输入手机号');
return;
} else {
const MOBILE_REGEXP = /^(1)\d{10}$/;
if (!MOBILE_REGEXP.test(this.loginData.mobileNo)) {
this.errorModal('手机号码输入有误');
return;
}
}
if (!this.loginData.code) {
this.errorModal('请输入短信验证码');
return;
}
this.commonService.compare({
'mobileNo': this.loginData.mobileNo,
'verificationCode': this.loginData.code,
......@@ -241,17 +275,15 @@ export class LiveComponent implements OnInit {
}).then(res => {
if (res['success']) {
// 登录
this.commonService.login({'mobileNo': this.loginData.mobileNo}).then(response => {
this.commonService.login({ 'mobileNo': this.loginData.mobileNo }).then(response => {
if (response['success']) {
// 登录成功
this.loginModalFlag = false;
this.hasDisease(this.commonService.todosCopy);
if (this.isDisease) {
this.autoEvaluationModal = true;
} else {
// 跳转到方案详情页面
// window.location.href = `http://localhost:4200/customizedPlanList/3?orderId=14793&customerId=16`;
//获取customerId后调用获取orderId接口
if (response['data']['customerId']) {
sessionStorage.setItem('customerId', response['data']['customerId']);
}
this.getOrderId();
} else {
// 登录失败
this.errorModal(res['message']);
......@@ -264,6 +296,27 @@ export class LiveComponent implements OnInit {
})
}
//获取orderId后调用保存问卷
getOrderId() {
const orderIdParam = {
name: this.loginData.name,
customerId: sessionStorage.getItem('customerId'),
campaignInfo: {
"campaignCode": JSON.parse(sessionStorage.getItem('campaignInfo'))['campaignCode'],
"campaignTaskCode": JSON.parse(sessionStorage.getItem('campaignInfo'))['campaignTaskCode']
}
}
this.commonService.createActivityOrder(orderIdParam).then(res => {
if (res['success']) {
sessionStorage.setItem('orderId', res['data']['orderId']);
this.next();
} else {
this.errorModal(res['message']);
}
})
}
// 判断家庭是否存在疾病
hasDisease(arr) {
const selfArr = arr.filter(item => item.pageId === 11).pop();
......@@ -273,7 +326,7 @@ export class LiveComponent implements OnInit {
const childrenArr = arr.filter(item => item.pageId === 13).pop();
const childrenQuestionsArr = childrenArr ? childrenArr.questions : [];
this.diseaseQuestions(selfQuestionsArr, 13, 67);
this.diseaseQuestions(spouseQuestionsArr, 14, 84);
this.diseaseQuestions(spouseQuestionsArr, 14, 83);
this.diseaseQuestions(childrenQuestionsArr, 15, 99);
}
......@@ -298,6 +351,7 @@ export class LiveComponent implements OnInit {
// 不能进行自动评测
confirm() {
this.autoEvaluationModal = false;
window.location.href = `https://${window.location.host}/2019Double12/index.html?customerId=${sessionStorage.getItem('customerId')}`;
}
// 报错信息弹窗
......
......@@ -30,6 +30,9 @@ ol li {
.container {
padding: 0;
height: 100%;
min-width: 320px;
max-width: 640px;
margin: 0 auto;
}
.title {
......@@ -294,6 +297,9 @@ ol li {
background-color: #fff;
z-index: 20;
animation: slowUp .5s ease both;
min-width: 320px;
max-width: 640px;
margin: 0 auto;
}
.toastContent.city {
......
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