Commit 0268c947 by 牛晓林

添加正常跳转功能login

parent baf79236
......@@ -18,7 +18,7 @@
],
"scripts": {
"ng": "ng",
"start": "npm run color-less && ng serve -o",
"start": "npm run color-less && ng serve -o --proxy-config src/proxy.config.json ",
"hmr": "npm run color-less && ng serve -c=hmr",
"build": "npm run color-less && ng build --prod --build-optimizer",
"analyze": "ng build --prod --build-optimizer --stats-json",
......
......@@ -75,7 +75,9 @@ const GLOBAL_CONFIG_PROVIDES = [
// #endregion
@NgModule({
imports: [AlainThemeModule.forRoot(), ...MOCK_MODULES],
imports: [
AlainThemeModule.forRoot()
],
})
export class DelonModule {
constructor(@Optional() @SkipSelf() parentModule: DelonModule) {
......
......@@ -4,15 +4,15 @@
<div class="top">
<div class="head">
<img class="logo" src="./assets/logo-color.svg">
<span class="title">ng-alain</span>
<span class="title">路桥资产管理系统</span>
</div>
<div class="desc">武林中最有影响力的《葵花宝典》;欲练神功,挥刀自宫</div>
<div class="desc"></div>
</div>
<router-outlet></router-outlet>
<global-footer [links]="links">
Copyright
<i class="anticon anticon-copyright"></i> 2017
<a href="//github.com/cipchk" target="_blank">卡色</a>出品
<i class="anticon anticon-copyright"></i> 2019
<a href="//github.com/cipchk" target="_blank">山西盈众科技有限公司</a>出品
</global-footer>
</div>
</div>
......@@ -23,42 +23,7 @@
</nz-form-control>
</nz-form-item>
</nz-tab>
<nz-tab [nzTitle]="'app.login.tab-login-mobile' | translate">
<nz-form-item>
<nz-form-control>
<nz-input-group nzSize="large" nzPrefixIcon="anticon anticon-user">
<input nz-input formControlName="mobile" placeholder="mobile number">
</nz-input-group>
<nz-form-explain *ngIf="mobile.dirty && mobile.errors">
<ng-container *ngIf="mobile.errors.required">
{{ 'validation.phone-number.required' | translate }}
</ng-container>
<ng-container *ngIf="mobile.errors.pattern">
{{ 'validation.phone-number.wrong-format' | translate }}
</ng-container>
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-row [nzGutter]="8">
<nz-col [nzSpan]="16">
<nz-input-group nzSize="large" nzPrefixIcon="anticon anticon-mail">
<input nz-input formControlName="captcha" placeholder="captcha">
</nz-input-group>
<nz-form-explain *ngIf="captcha.dirty && captcha.errors">
{{ 'validation.verification-code.required' | translate }}
</nz-form-explain>
</nz-col>
<nz-col [nzSpan]="8">
<button type="button" nz-button nzSize="large" (click)="getCaptcha()" [disabled]="count" nzBlock [nzLoading]="http.loading">
{{ count ? count + 's' : 'app.register.get-verification-code' | translate }}
</button>
</nz-col>
</nz-row>
</nz-form-control>
</nz-form-item>
</nz-tab>
</nz-tabset>
<nz-form-item>
<nz-col [nzSpan]="12">
......
......@@ -7,6 +7,7 @@ import { SocialService, SocialOpenType, ITokenService, DA_SERVICE_TOKEN } from '
import { ReuseTabService } from '@delon/abc';
import { environment } from '@env/environment';
import { StartupService } from '@core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'passport-login',
......@@ -20,6 +21,7 @@ export class UserLoginComponent implements OnDestroy {
type = 0;
constructor(
private httpClient:HttpClient,
fb: FormBuilder,
modalSrv: NzModalService,
private router: Router,
......@@ -102,21 +104,19 @@ export class UserLoginComponent implements OnDestroy {
// 默认配置中对所有HTTP请求都会强制 [校验](https://ng-alain.com/auth/getting-started) 用户 Token
// 然一般来说登录请求不需要校验,因此可以在请求URL加上:`/login?_allow_anonymous=true` 表示不触发用户 Token 校验
this.http
.post('/login/account?_allow_anonymous=true', {
type: this.type,
userName: this.userName.value,
password: this.password.value,
})
.post(`asset/a/login?__ajax=true&username=${this.userName.value}&password=${this.password.value}&mobileLogin=true`,{})
.subscribe((res: any) => {
if (res.msg !== 'ok') {
if (res.success !== true) {
this.error = res.msg;
return;
}
// 清空路由复用信息
this.reuseTabService.clear();
// 设置用户Token信息
this.tokenService.set(res.user);
res.body.token=res.body.JSESSIONID;
this.tokenService.set(res.body);
// 重新获取 StartupService 内容,我们始终认为应用信息一般都会受当前用户授权范围而影响
this.startupSrv.load().then(() => {
let url = this.tokenService.referrer!.url || '/';
......
......@@ -73,7 +73,6 @@
"text": "文件资料",
"link": "/dashboard/v1",
"children":[
]
},{
"text": "系统设置",
......
{
"/asset/*": {
"target": "http://localhost:8081/",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}
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