Commit 9a830047 by sunchao

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

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