用户中心

This commit is contained in:
wangshiming
2021-11-29 20:03:45 +08:00
parent 8530a23707
commit c5eaff493d
24 changed files with 2511 additions and 262 deletions

View File

@ -9,7 +9,6 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AccountComponentsCenterComponent } from './components/center/center.component';
import { AccountComponentsEditInfoComponent } from './components/edit-info/edit-info.component';
const routes: Routes = [
{ path: '', redirectTo: 'center', pathMatch: 'full' },
@ -21,7 +20,6 @@ const routes: Routes = [
titleI18n: 'app.my.center',
},
},
{ path: 'editInfo', component: AccountComponentsEditInfoComponent },
];
@NgModule({

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-11-29 11:06:01
* @LastEditTime: 2021-11-29 15:04:25
* @LastEditTime: 2021-11-29 15:42:10
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\account\account.module.ts
@ -10,14 +10,12 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '@shared';
import { AccountRoutingModule } from './account-routing.module';
import { AccountComponentsCenterComponent } from './components/center/center.component';
import { AccountComponentsEditInfoComponent } from './components/edit-info/edit-info.component';
import { AccountComponentsEditNameComponent } from './components/edit-name/edit-name.component';
import { AccountComponentsCenterEditComponent } from './components/edit-password/edit-password.component';
const COMPONENTS = [
AccountComponentsCenterComponent,
AccountComponentsEditNameComponent,
AccountComponentsEditInfoComponent,
AccountComponentsCenterEditComponent
];
const COMPONENTS_NOROUNT = [AccountComponentsEditNameComponent];

View File

@ -1,15 +0,0 @@
<div class="main">
<nz-card nzTitle="修改账户信息" style="margin-top: 20px">
<div class="myForm">
<sf #sf [compact]="true" [ui]="ui" [schema]="schema" [button]="'none'" [formData]="formData"></sf>
<form nz-form>
<nz-form-item>
<nz-form-control [nzSpan]="24" [nzOffset]="5">
<button nz-button type="button" nzType="primary" (click)="formSubmit()">保存</button>
<button nz-button type="button" (click)="goBack()">取消</button>
</nz-form-control>
</nz-form-item>
</form>
</div>
</nz-card>
</div>

View File

@ -1,6 +0,0 @@
:host {
.myForm {
width: 600px;
margin: 5rem auto;
}
}

View File

@ -1,23 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OfficialWebsiteComponentsMemberEditInfoComponent } from './edit-info.component';
describe('OfficialWebsiteComponentsMemberEditInfoComponent', () => {
let component: OfficialWebsiteComponentsMemberEditInfoComponent;
let fixture: ComponentFixture<OfficialWebsiteComponentsMemberEditInfoComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [OfficialWebsiteComponentsMemberEditInfoComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OfficialWebsiteComponentsMemberEditInfoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,207 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { environment } from '@env/environment';
import { Observable, Observer } from 'rxjs';
import { AccountService } from '../../services/account.service';
@Component({
selector: 'app-account-components-edit-info',
templateUrl: './edit-info.component.html',
styleUrls: ['./edit-info.component.less'],
})
export class AccountComponentsEditInfoComponent implements OnInit {
@ViewChild('sf', { static: false })
sf!: SFComponent;
i: any;
schema!: SFSchema;
ui!: SFUISchema;
formData: any = {
// avatar:[
// {
// uid: -1,
// name: 'LOGO',
// status: 'done',
// url: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
// response: {
// url: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
// },
// },
// ],
// name:'西四'
};
constructor(public service: AccountService, private modal: ModalHelper, private route: ActivatedRoute) {
const { realName, identity } = route.snapshot?.queryParams;
Object.assign(this.formData, { realName, certificateNumber: identity });
}
ngOnInit() {
this.initSF();
this.getInfo();
}
initSF() {
this.schema = {
properties: {
avatar: {
type: 'string',
title: '头像',
ui: {
// action: environment.UPLOAD_URL,
fileType: 'image/png,image/jpeg,image/jpg,image/png,image/gif,image/bmp',
limit: 1,
limitFileCount: 1,
resReName: 'url',
urlReName: 'url',
widget: 'upload',
descriptionI18n: '支持JPG、GIF、PNG、JPEG、BMP格式文件小于2M',
data: {
// appId: environment.appId,
},
name: 'multipartFile',
multiple: false,
listType: 'picture-card',
change: (args) => {
if (args.type === 'success') {
const avatar = [
{
uid: -1,
name: 'LOGO',
status: 'done',
url: args.fileList[0].response.url,
response: {
url: args.fileList[0].response.url,
},
},
];
this.sf?.setValue('/avatar', avatar);
}
},
beforeUpload: (file: any, _fileList) => {
return new Observable((observer: Observer<boolean>) => {
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.service.msgSrv.warning('图片大小超过2M!');
observer.complete();
return;
}
observer.next(isLt2M);
observer.complete();
});
},
} as SFUploadWidgetSchema,
},
name: {
title: '用户名',
type: 'string',
ui: {
widget: 'text',
},
},
phone: {
title: '手机号',
type: 'string',
ui: {
widget: 'text',
},
},
nickName: {
title: '昵称',
type: 'string',
minLength: 1,
maxLength: 18,
ui: {
placeholder: '请输入昵称',
errors: {
required: '请输入昵称',
},
},
},
sex: {
title: '性别',
type: 'string',
default: 0,
enum: [
{ label: '未知', value: 0 },
{ label: '男', value: 1 },
{ label: '女', value: 2 },
{ label: '保密', value: 3 },
],
ui: {
widget: 'select',
} as SFSelectWidgetSchema,
},
birthday: {
title: '生日',
type: 'string',
format: 'date',
},
realName: {
title: '真实姓名',
type: 'string',
ui: {
widget: 'text',
optionalHelp: '实名认证渠道来自供应商入驻,仅在用户同意的情况下,合理用于相关业务,且平台有义务保障您的信息安全。',
},
},
certificateNumber: {
title: '身份证号码',
type: 'string',
ui: {
widget: 'text',
},
},
},
required: ['nickName', 'sex', 'avatar'],
};
this.ui = {
'*': {
spanLabel: 5,
grid: { span: 24 },
},
};
}
getInfo() {
const params = {
// id: this.i.id,
};
// this.service.http.post(this.service.$api_get_current_user_detail, params).subscribe((res) => {
// this.formData = res.data;
// if (!res.data.birthday) {
// this.formData.birthday = Date;
// }
// this.formData.avatar = [
// {
// uid: -1,
// name: 'LOGO',
// status: 'done',
// url: res.data.avatar,
// response: {
// url: res.data.avatar,
// },
// },
// ];
// this.formData.realName = this.route.snapshot.queryParams.realName;
// // this.formData.phone = this.route.snapshot.queryParams.phone;
// this.formData.certificateNumber = this.route.snapshot.queryParams.certificateNumber;
// this.initSF();
// });
}
formSubmit() {
const params: any = {
...this.sf.value,
};
delete params.realName;
delete params.certificateNumber;
// this.service.http.post(this.service.$api_updateUserInfo, params).subscribe((res) => {
// if (res.data) {
// this.service.msgSrv.success('修改成功');
// this.goBack();
// }
// });
}
goBack() {
history.go(-1);
}
}

View File

@ -14,6 +14,7 @@ import { AccountService } from '../../services/account.service';
})
export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit {
// @ViewChild('dun', { static: false })
url = `/rule?_allow_anonymous=true`;
// private dun!: CaptchaComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
record: any = {};