666
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
<page-header-wrapper [title]="''"></page-header-wrapper>
|
||||
<nz-card>
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'">
|
||||
</sf>
|
||||
|
||||
<div *nzModalFooter>
|
||||
<button nz-button nzType="default" (click)="close()">取消</button>
|
||||
<button nz-button nzType="primary" (click)="save()">确认</button>
|
||||
</div>
|
||||
</nz-card>
|
||||
<nz-card>
|
||||
<div class="align-center" style="display: flex; justify-content: center;">
|
||||
<button nz-button nzType="default" (click)="close()">取消</button>
|
||||
<button nz-button nzType="primary" (click)="save()" style="margin-left: 48px">确认</button>
|
||||
</div>
|
||||
</nz-card>
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnumType, SFSelectWidgetSchema, SFTextareaWidgetSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AmapPoiPickerComponent } from 'src/app/shared/components/amap';
|
||||
import { ChannelSalesService } from '../../services/channel-sales.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-parter-article-management-edit',
|
||||
templateUrl: './edit.component.html'
|
||||
})
|
||||
export class ParterArticleManagementEditComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
schema!: SFSchema;
|
||||
ui!: SFUISchema;
|
||||
i: any;
|
||||
type: any;
|
||||
|
||||
constructor(
|
||||
public http: _HttpClient,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private route: ActivatedRoute,
|
||||
public service: ChannelSalesService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initSF();
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: { hidden: true }
|
||||
},
|
||||
name1: {
|
||||
type: 'string',
|
||||
title: '文章标题',
|
||||
maxLength: 50,
|
||||
ui: {
|
||||
widget: 'textarea',
|
||||
autosize: { minRows: 3, maxRows: 6 },
|
||||
placeholder:'请输入50字符'
|
||||
} as SFTextareaWidgetSchema,
|
||||
},
|
||||
name2: {
|
||||
type: 'string',
|
||||
title: '文章简介',
|
||||
maxLength: 50,
|
||||
ui: {
|
||||
widget: 'textarea',
|
||||
autosize: { minRows: 3, maxRows: 6 },
|
||||
placeholder:'请输入50字符'
|
||||
} as SFTextareaWidgetSchema,
|
||||
},
|
||||
name3: {
|
||||
type: 'string',
|
||||
title: '封面图',
|
||||
ui: {
|
||||
action: apiConf.fileUpload,
|
||||
accept: 'image/png,image/jpeg,image/jpg',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFilePath',
|
||||
urlReName: 'data.fullFilePath',
|
||||
widget: 'upload',
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 280px * 180 px)',
|
||||
name: 'multipartFile',
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
beforeUpload: (file: any, _fileList: any) => {
|
||||
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',
|
||||
enum: [
|
||||
{ label: '管理员', value: '1'},
|
||||
],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
} as SFSelectWidgetSchema,
|
||||
},
|
||||
name4: {
|
||||
type: 'number',
|
||||
title: '排序',
|
||||
minimum: 0,
|
||||
maximum: 99,
|
||||
ui: {
|
||||
widgetWidth: 300 ,
|
||||
placeholder:'请输入0~99,数字越大,排序越靠前'
|
||||
}
|
||||
},
|
||||
name5: {
|
||||
type: 'string',
|
||||
title: '跳转路径',
|
||||
enum: [
|
||||
{ label: '图文', value: '1'},
|
||||
{ label: '视频', value: '2'},
|
||||
],
|
||||
ui: {
|
||||
widget: 'radio',
|
||||
} as SFRadioWidgetSchema,
|
||||
default: '1',
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
title: '正文',
|
||||
ui: {
|
||||
widget: 'tinymce',
|
||||
loadingTip: 'loading...',
|
||||
config: {
|
||||
height: 450
|
||||
},
|
||||
visibleIf: { name5: (value: string) => value === '1' }
|
||||
},
|
||||
},
|
||||
name6: {
|
||||
type: 'string',
|
||||
title: '视频',
|
||||
ui: {
|
||||
action: apiConf.fileUpload,
|
||||
accept: 'video/mp4,video/avi,video/mkv,video/vob',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFilePath',
|
||||
urlReName: 'data.fullFilePath',
|
||||
widget: 'upload',
|
||||
descriptionI18n: '支持MP4、AVI、DAT、MKV、FLV、VOB格式,文件小于20M。',
|
||||
name: 'multipartFile',
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
beforeUpload: (file: any, _fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt2M = file.size / 1024 / 1024 < 20;
|
||||
if (!isLt2M) {
|
||||
this.service.msgSrv.warning('视频大小超过20M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt2M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
visibleIf: { name5: (value: string) => value === '2' }
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
},
|
||||
required: ['name1', 'name2']
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
spanLabelFixed: 150,
|
||||
grid: { span: 20 }
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
}
|
||||
save() {
|
||||
this.sf.validator({ emitError: true });
|
||||
if(!this.sf.valid) return;
|
||||
// this.service.request('', { ...this.sf.value }).subscribe(res => {
|
||||
// if (res) {
|
||||
// this.modalRef.destroy(true);
|
||||
// } else {
|
||||
// this.service.msgSrv.error(res.msg);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
<page-header-wrapper [title]="''"></page-header-wrapper>
|
||||
<!-- 搜索表单 -->
|
||||
<nz-card>
|
||||
<div nz-row nzGutter="8">
|
||||
<!-- 查询字段小于或等于3个时,不显示伸缩按钮 -->
|
||||
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
|
||||
<sf
|
||||
#sf
|
||||
[schema]="schema"
|
||||
[ui]="ui"
|
||||
[mode]="'search'"
|
||||
[loading]="service.http.loading"
|
||||
(formSubmit)="search()"
|
||||
(formReset)="resetSF()"
|
||||
></sf>
|
||||
</div>
|
||||
|
||||
<!-- 查询字段大于3个时,根据展开状态调整布局 -->
|
||||
<ng-container *ngIf="queryFieldCount > 4">
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 18">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
|
||||
<button nz-button nzType="primary" [disabled]="!sf.valid" (click)="search()" >查询</button>
|
||||
<button nz-button (click)="resetSF()" >重置</button>
|
||||
<button nz-button nzType="link" (click)="expandToggle()">
|
||||
{{ !_$expand ? '展开' : '收起' }}
|
||||
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</nz-card>
|
||||
|
||||
<nz-card>
|
||||
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()">新增文章</button>
|
||||
<!-- 数据列表 -->
|
||||
<st
|
||||
#st
|
||||
[data]="data"
|
||||
[columns]="columns"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500"
|
||||
[loading]="service.http.loading"
|
||||
>
|
||||
</st>
|
||||
</nz-card>
|
||||
@ -0,0 +1,200 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { processSingleSort } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { ChannelSalesService } from '../../services/channel-sales.service';
|
||||
import { ParterArticleManagementEditComponent } from '../edit/edit.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-parter-article-management-list',
|
||||
templateUrl: './list.component.html'
|
||||
})
|
||||
export class ParterArticleManagementListComponent implements OnInit {
|
||||
schema: SFSchema = {};
|
||||
columns!: STColumn[];
|
||||
ui!: SFUISchema;
|
||||
@ViewChild('st', { static: false })
|
||||
st!: STComponent;
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
spuStatus = '1';
|
||||
_$expand = false;
|
||||
|
||||
data=[{name1:1111}]
|
||||
constructor(
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
public service: ChannelSalesService,
|
||||
private modalService: NzModalService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
get reqParams() {
|
||||
return { ...this.sf?.value };
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
this.st.load(1);
|
||||
}
|
||||
|
||||
search() {
|
||||
// this.st1?.load(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字段个数
|
||||
*/
|
||||
get queryFieldCount(): number {
|
||||
return Object.keys(this.schema?.properties || {}).length;
|
||||
}
|
||||
/**
|
||||
* 伸缩查询条件
|
||||
*/
|
||||
expandToggle(): void {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/_$expand', this._$expand);
|
||||
}
|
||||
ngOnInit() {
|
||||
this.initSF();
|
||||
this.initST();
|
||||
}
|
||||
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: { type: 'boolean', ui: { hidden: true } },
|
||||
name: {
|
||||
type: 'string',
|
||||
title: '文章标题'
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
title: '分类'
|
||||
},
|
||||
phone1: {
|
||||
type: 'string',
|
||||
title: '状态'
|
||||
},
|
||||
phone2: {
|
||||
type: 'string',
|
||||
title: '推荐到首页',
|
||||
ui: {
|
||||
visibleIf: {
|
||||
_$expand: (value: boolean) => value
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
grid: { span: 8, gutter: 4 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
initST() {
|
||||
this.columns = [
|
||||
{
|
||||
title: '销售渠道姓名',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '所属组织',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '职级',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '等级',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '省市',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '邀请码',
|
||||
index: 'name1'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
className: 'text-center',
|
||||
buttons: [
|
||||
{
|
||||
text: '修改',
|
||||
click: (_record, _modal, _instance) => this.edit(_record),
|
||||
},
|
||||
{
|
||||
text: '禁用',
|
||||
click: (_record, _modal, _instance) => this.stop(_record),
|
||||
},
|
||||
{
|
||||
text: '启用',
|
||||
click: (_record, _modal, _instance) => this.start(_record.id),
|
||||
},
|
||||
{
|
||||
text: '推荐到首页',
|
||||
click: (_record, _modal, _instance) => this.recommend(_record.id),
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
// 新增
|
||||
add() {
|
||||
this.router.navigate(['/partner/article-management/add'], { queryParams: {} });
|
||||
}
|
||||
|
||||
// 编辑
|
||||
edit(record: STData) {
|
||||
this.router.navigate(['/partner/article-management/edit'], { queryParams: {} });
|
||||
}
|
||||
|
||||
|
||||
stop(record: STData) {
|
||||
this.modalService.confirm({
|
||||
nzTitle: '<i>禁用确认</i>',
|
||||
nzContent: `<b>确定禁用此文章吗?</br>`,
|
||||
// nzOnOk: () =>
|
||||
// this.service.request('', '').subscribe(res => {
|
||||
// if (res) {
|
||||
// this.service.msgSrv.success('冻结成功!');
|
||||
// this.st.reload();
|
||||
// }
|
||||
// })
|
||||
});
|
||||
}
|
||||
start(record: STData) {
|
||||
this.modalService.confirm({
|
||||
nzTitle: '<i>启用确认</i>',
|
||||
nzContent: `<b>确定启用此文章吗?</br>`,
|
||||
// nzOnOk: () =>
|
||||
// this.service.request('', '').subscribe(res => {
|
||||
// if (res) {
|
||||
// this.service.msgSrv.success('冻结成功!');
|
||||
// this.st.reload();
|
||||
// }
|
||||
// })
|
||||
});
|
||||
}
|
||||
recommend(record: STData) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ChannelSalesService extends BaseService {
|
||||
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,8 @@ import { AddPersonalPartnerComponent } from './partner-list/components/add-perso
|
||||
import { PartnerDetailComponent } from './partner-list/components/partner-detail/partner-detail.component';
|
||||
import { PartnerListComponent } from './partner-list/components/index/partner-list.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
import { ParterArticleManagementListComponent } from './article-management/components/list/list.component';
|
||||
import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -125,6 +127,15 @@ const routes: Routes = [
|
||||
{ path: 'record/detail/:id', component: PartnerRecordedDetailComponent }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'article-management',
|
||||
children: [
|
||||
{ path: '', component: ParterArticleManagementListComponent },
|
||||
{ path: 'list', component: ParterArticleManagementListComponent},
|
||||
{ path: 'add', component: ParterArticleManagementEditComponent},
|
||||
{ path: 'edit', component: ParterArticleManagementEditComponent},
|
||||
]
|
||||
},
|
||||
|
||||
];
|
||||
@NgModule({
|
||||
|
||||
@ -50,6 +50,8 @@ import { ParterRebateManageMenAbnormalFeedbackComponent } from './rebate-managem
|
||||
import { PartnerRecordedDetailComponent } from './recorded/components/detail/detail.component';
|
||||
import { PartnerRecordedRecordComponent } from './recorded/components/record/record.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component';
|
||||
import { ParterArticleManagementListComponent } from './article-management/components/list/list.component';
|
||||
|
||||
const COMPONENTS: any[] = [
|
||||
PartnerBusinessStatisticsIndexComponent,
|
||||
@ -90,7 +92,8 @@ const COMPONENTS: any[] = [
|
||||
ParterRebateManageMentAddComponent,
|
||||
AddEtpPartnerComponent,
|
||||
AddPersonalPartnerComponent,
|
||||
|
||||
ParterArticleManagementEditComponent,
|
||||
ParterArticleManagementListComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -604,7 +604,22 @@
|
||||
"children": [{
|
||||
"text": "banner管理",
|
||||
"link": "/knowledge/banner"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"text": "文章管理",
|
||||
"link": "/partner/article-management/list"
|
||||
},
|
||||
{
|
||||
"text": "新增文章",
|
||||
"link": "/partner/article-management/add",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"text": "编辑文章",
|
||||
"link": "/partner/article-management/edit",
|
||||
"hide": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user