Commit 50375234 by Sweet Zhang

获取版本号的时候增加是否需要清空缓存信息

parent 931a34aa
......@@ -88,6 +88,7 @@ export class AppComponent implements OnInit, OnDestroy {
const Version = localStorage.getItem('Version');
//如果缓存有版本号对比本地和接口版本
if (Version != this.currentVersion) {
localStorage.clear();
this.isNeedAlert = true;
this.dialogInfo = {
title: null,
......
......@@ -43,9 +43,9 @@ export class AuthService {
/**
* 获取TOKEN
*/
obtainToken(loginId) {
obtainToken(loginId,customerId=JSON.parse(localStorage.getItem('lifeCustomerInfo')).customerId) {
const url = this.API + '/authorize/obtainToken';
return this.http.post(url, JSON.stringify({ ticket: "life",loginId:loginId,customerId:localStorage.getItem('lifeCustomerInfo') ? JSON.parse(localStorage.getItem('lifeCustomerInfo')).customerId : null}));
return this.http.post(url, JSON.stringify({ ticket: "life",loginId:loginId,customerId:customerId}));
}
//获取微信配置ydLife公众号
......
......@@ -90,7 +90,7 @@ 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)=>{
this.authService.obtainToken(this.userInfo.mobileNo,response['data']['customerId']).subscribe((res)=>{
if (res['success']) {
localStorage.setItem('lifeToken', res['data']['token']);
}
......
......@@ -91,7 +91,8 @@
contentType: "application/json",
data: JSON.stringify({
ticket: 'life',
loginId:loginId
loginId:loginId,
customerId:localStorage.getItem('lifeCustomerInfo') ? JSON.parse(localStorage.getItem('lifeCustomerInfo')).customerId : null
}),
async: false,
success: function (res) {
......@@ -101,7 +102,7 @@
return token;
}
var token = getToken();
var token = setTimeout(()=>{getToken()});
function getQueryString(name) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
......
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