Commit 6d69f634 by 牛晓林

Merge branch 'master' of gitlab.juicestime.com:yangyuqiang/luqiao-admin-mobile

parents a180aee6 aba9e965
import { Injectable } from '@angular/core';
import { Injectable, Inject } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { DA_SERVICE_TOKEN, ITokenService } from '@delon/auth';
@Injectable({
providedIn: 'root',
})
export class ListService {
constructor(private http: _HttpClient) {}
constructor(@Inject(DA_SERVICE_TOKEN) private tokenService: ITokenService, private http: _HttpClient) {}
private url = `asset/a/asset/assets/data;JSESSIONID=${this.tokenService.get().token}?_ajax=true&mobileLogin=true`;
/**
*获取资产台账列表
*
......@@ -15,7 +16,6 @@ export class ListService {
* @memberof ListService
*/
getKindAssetList(kindAsset: number) {
const url = 'asset/a/asset/assets/data?kindAsset=' + kindAsset;
return this.http.get(url);
return this.http.get(this.url, { kindAsset }, { responseType: 'json' });
}
}
......@@ -53,10 +53,7 @@ export function fnDelonAuthConfig(): DelonAuthConfig {
...new DelonAuthConfig(),
...({
login_url: '/passport/login',
token_send_key: 'JSESSIONID',
token_send_place: 'url',
token_send_template: '${token}',
ignores: [/\/login/, /^assets\//, /passport\//],
ignores: [/\/login/, /assets\//, /passport\//],
} as DelonAuthConfig),
};
}
......
......@@ -21,7 +21,7 @@ export class UserLoginComponent implements OnDestroy {
type = 0;
constructor(
private httpClient:HttpClient,
private httpClient: HttpClient,
fb: FormBuilder,
modalSrv: NzModalService,
private router: Router,
......@@ -104,9 +104,12 @@ export class UserLoginComponent implements OnDestroy {
// 默认配置中对所有HTTP请求都会强制 [校验](https://ng-alain.com/auth/getting-started) 用户 Token
// 然一般来说登录请求不需要校验,因此可以在请求URL加上:`/login?_allow_anonymous=true` 表示不触发用户 Token 校验
this.http
.post(`asset/a/login?__ajax=true&username=${this.userName.value}&password=${this.password.value}&mobileLogin=true`,{})
.post(
`asset/a/login?__ajax=true&username=${this.userName.value}&password=${this.password.value}&mobileLogin=true`,
{},
)
.subscribe((res: any) => {
if (res.success !== true) {
this.error = res.msg;
......@@ -115,7 +118,7 @@ export class UserLoginComponent implements OnDestroy {
// 清空路由复用信息
this.reuseTabService.clear();
// 设置用户Token信息
res.body.token=res.body.JSESSIONID;
res.body.token = res.body.JSESSIONID;
this.tokenService.set(res.body);
// 重新获取 StartupService 内容,我们始终认为应用信息一般都会受当前用户授权范围而影响
this.startupSrv.load().then(() => {
......
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