Commit bacfb039 by Chao Sun

双12活动跳转

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