Commit 9a830047 by sunchao

获取token接口添加loginId&验证码6位

parent 4de97899
...@@ -18,6 +18,7 @@ export class AppComponent implements OnInit, OnDestroy { ...@@ -18,6 +18,7 @@ export class AppComponent implements OnInit, OnDestroy {
dialogInfo: any; dialogInfo: any;
// 是否显示首页浮标 // 是否显示首页浮标
isShowIndexBtn: boolean; isShowIndexBtn: boolean;
loginId:any;
constructor(private router: Router,private authService: AuthService, private lifeCommonService: LifeCommonService) { constructor(private router: Router,private authService: AuthService, private lifeCommonService: LifeCommonService) {
this.subscription = lifeCommonService.shareStatus$.subscribe(status => { this.subscription = lifeCommonService.shareStatus$.subscribe(status => {
this.shareGuidePageEnable = status == '1'; this.shareGuidePageEnable = status == '1';
...@@ -25,7 +26,8 @@ export class AppComponent implements OnInit, OnDestroy { ...@@ -25,7 +26,8 @@ export class AppComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.authService.obtainToken().subscribe(res => { this.loginId = localStorage.getItem('lifeCustomerInfo')?JSON.parse(localStorage.getItem('lifeCustomerInfo')).mobileNo:null;
this.authService.obtainToken(this.loginId).subscribe(res => {
if (res['success']) { if (res['success']) {
localStorage.setItem('lifeToken', res['data']['token']); localStorage.setItem('lifeToken', res['data']['token']);
this.ydWxConfig(); this.ydWxConfig();
......
...@@ -43,12 +43,9 @@ export class AuthService { ...@@ -43,12 +43,9 @@ export class AuthService {
/** /**
* 获取TOKEN * 获取TOKEN
*/ */
obtainToken() { obtainToken(loginId) {
const url = this.API + '/authorize/obtainToken'; const url = this.API + '/authorize/obtainToken';
const ticketObj = { return this.http.post(url, JSON.stringify({ ticket: "life",loginId:loginId}));
ticket: 'life'
};
return this.http.post(url, JSON.stringify(ticketObj));
} }
//获取微信配置ydLife公众号 //获取微信配置ydLife公众号
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div class="weui-cell weui-cell_vcode" style="padding:12px 0px"> <div class="weui-cell weui-cell_vcode" style="padding:12px 0px">
<!-- <div class="weui-cell__hd"><label class="weui-label">验证码</label></div> --> <!-- <div class="weui-cell__hd"><label class="weui-label">验证码</label></div> -->
<div class="weui-cell__bd"> <div class="weui-cell__bd">
<input class="weui-input" type="tel" pattern="[0-9]*" id="js_input" placeholder="请输入验证码" maxlength="4" <input class="weui-input" type="tel" pattern="[0-9]*" id="js_input" placeholder="请输入验证码" maxlength="6"
name="verificationCode" [(ngModel)]="userInfo.verificationCode" (blur)="inputBlur()"> name="verificationCode" [(ngModel)]="userInfo.verificationCode" (blur)="inputBlur()">
</div> </div>
<div class="weui-cell__ft"> <div class="weui-cell__ft">
......
...@@ -52,6 +52,11 @@ export class LoginComponent implements OnInit, OnDestroy { ...@@ -52,6 +52,11 @@ export class LoginComponent implements OnInit, OnDestroy {
sessionStorage.setItem('subordinateSystemName', response['data']['practitionerBasicInfo']['subordinateName']) sessionStorage.setItem('subordinateSystemName', response['data']['practitionerBasicInfo']['subordinateName'])
} }
const lifeCustomerInfo = { ...response.data, mobileNo: this.userInfo.mobileNo, commonResult: null }; const lifeCustomerInfo = { ...response.data, mobileNo: this.userInfo.mobileNo, commonResult: null };
this.authService.obtainToken(this.userInfo.mobileNo).subscribe((res)=>{
if (res['success']) {
localStorage.setItem('lifeToken', res['data']['token']);
}
})
if (lifeCustomerInfo['customerId'] && lifeCustomerInfo['practitionerId']) { if (lifeCustomerInfo['customerId'] && lifeCustomerInfo['practitionerId']) {
// if (response['data']['practitionerTypeId'] == 28) { // if (response['data']['practitionerTypeId'] == 28) {
localStorage.setItem('lifeCustomerInfo', JSON.stringify(lifeCustomerInfo)); localStorage.setItem('lifeCustomerInfo', JSON.stringify(lifeCustomerInfo));
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<script src="./assets/laydate/laydate.js"></script> <script src="./assets/laydate/laydate.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var api = 'https://' + window.location.host; var api = 'https://' + window.location.host;
var loginId = localStorage.getItem('lifeCustomerInfo')?JSON.parse(localStorage.getItem('lifeCustomerInfo')).mobileNo:null;
// var api = 'https://mdev.zuihuibi.cn'; // var api = 'https://mdev.zuihuibi.cn';
function getToken() { function getToken() {
$.ajax({ $.ajax({
...@@ -80,7 +81,8 @@ ...@@ -80,7 +81,8 @@
url: api + '/api/authorize/obtainToken', url: api + '/api/authorize/obtainToken',
contentType: "application/json", contentType: "application/json",
data: JSON.stringify({ data: JSON.stringify({
ticket: 'life' ticket: 'life',
loginId:loginId
}), }),
async: false, async: false,
success: function (res) { success: function (res) {
......
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