diff --git a/src/app/routes/partner/knowledge/banner/components/add/add.component.html b/src/app/routes/partner/knowledge/banner/components/add/add.component.html new file mode 100644 index 00000000..6760c1a0 --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/components/add/add.component.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/routes/partner/knowledge/banner/components/add/add.component.spec.ts b/src/app/routes/partner/knowledge/banner/components/add/add.component.spec.ts new file mode 100644 index 00000000..64562645 --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/components/add/add.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { BannerComponentsAddComponent } from './add.component'; + +describe('BannerComponentsAddComponent', () => { + let component: BannerComponentsAddComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BannerComponentsAddComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BannerComponentsAddComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/partner/ad/components/add/add.component.ts b/src/app/routes/partner/knowledge/banner/components/add/add.component.ts similarity index 63% rename from src/app/routes/partner/ad/components/add/add.component.ts rename to src/app/routes/partner/knowledge/banner/components/add/add.component.ts index f719a83a..132e6bb2 100644 --- a/src/app/routes/partner/ad/components/add/add.component.ts +++ b/src/app/routes/partner/knowledge/banner/components/add/add.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; +import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { ModalHelper, _HttpClient } from '@delon/theme'; import { EAEnvironmentService } from '@shared'; import differenceInCalendarDays from 'date-fns/differenceInCalendarDays'; @@ -9,7 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalService } from 'ng-zorro-antd/modal'; import { NzUploadFile } from 'ng-zorro-antd/upload'; import { Observable, Observer, of } from 'rxjs'; -import { ScrollImgService } from '../../services/scrollimg.service'; +import { BannerService } from '../../services/banner.service'; import { apiConf } from '@conf/api.conf'; @Component({ @@ -17,7 +17,7 @@ import { apiConf } from '@conf/api.conf'; templateUrl: './add.component.html', styleUrls: ['./add.less'] }) -export class ScrollimgComponentsAddComponent implements OnInit { +export class BannerComponentsAddComponent implements OnInit { @ViewChild('sf', { static: false }) sf!: SFComponent; record: any = {}; i: any; @@ -51,11 +51,9 @@ export class ScrollimgComponentsAddComponent implements OnInit { constructor( public msgSrv: NzMessageService, public http: _HttpClient, - public service: ScrollImgService, + public service: BannerService, private route: ActivatedRoute, private router: Router, - private modal: ModalHelper, - private modalSrv: NzModalService, private cdr: ChangeDetectorRef, private envSrv: EAEnvironmentService, ) { } @@ -76,25 +74,16 @@ export class ScrollimgComponentsAddComponent implements OnInit { properties: { name: { type: 'string', - title: '轮播图名称', + title: 'banner名称', maxLength: 10, ui: { showRequired: true, placeholder: '请不要超过10个字', } }, - style: { - type: 'string', - title: '轮播图', - ui: { - showRequired: true, - widget: 'custom', - placeholder: '请选择轮播图', - } - }, licensePhotoWatermark: { type: 'string', - title: '轮播图', + title: 'banner图', ui: { action: apiConf.fileUpload, accept: 'image/png,image/jpeg,image/jpg,image/gif', @@ -103,7 +92,7 @@ export class ScrollimgComponentsAddComponent implements OnInit { resReName: 'data.fullFileWatermarkPath', urlReName: 'data.fullFileWatermarkPath', widget: 'upload', - descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过4M', + descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 700px * 286px)。', data: { appId: this.envSrv.env.appId, }, @@ -117,9 +106,9 @@ export class ScrollimgComponentsAddComponent implements OnInit { }, beforeUpload: (file: any, _fileList: any) => { return new Observable((observer: Observer) => { - const isLt4M = file.size / 1024 / 1024 < 4; + const isLt4M = file.size / 1024 / 1024 < 2; if (!isLt4M) { - this.service.msgSrv.warning('图片大小超过4M!'); + this.service.msgSrv.warning('图片大小超过2M!'); observer.complete(); return; } @@ -130,96 +119,43 @@ export class ScrollimgComponentsAddComponent implements OnInit { previewFile: (file: NzUploadFile) => of(file.url), }, }, - takeEffectType: { - type: 'string', - title: '生效类型', - ui: { - showRequired: true, - widget: 'custom', - }, - default: 1 - }, - mainTitle: { - type: 'string', - title: '主标题', - maxLength: 20, - ui: { - visibleIf: { style: [1, 2, 3, 4, 5] }, - placeholder: '请输入主标题,不超过20个字', - change: (id: any) => { - this.validFalg = !this.sf?.valid; - } - } - }, - withTitle: { - type: 'string', - title: '副标题', - maxLength: 20, - ui: { - visibleIf: { style: [1, 2, 3, 4, 5] }, - placeholder: '请输入主标题,不超过20个字', - } - }, sortId: { type: 'string', - title: '显示顺序', + title: '顺序', ui: { showRequired: true, - widget: 'select', + widget: '=', + placeholder: '请输入0~99,数字越大,排序越靠前', serverSearch: true, } as SFSelectWidgetSchema, + }, + linkType: { + type: 'string', + title: '跳转路径', + ui: { + widget: 'radio', + showRequired: true, + } as SFRadioWidgetSchema, enum: [ - { label: 1, value: '1' }, - { label: 2, value: '2' }, - { label: 3, value: '3' }, - { label: 4, value: '4' }, - { label: 5, value: '5' }, - { label: 6, value: '6' }, - { label: 7, value: '7' }, - { label: 8, value: '8' }, - { label: 9, value: '9' }, - { label: 10, value: '10' }, - ] + { label: '文章ID', value: 1 }, + { label: '分类ID', value: 2 }, + { label: '自编辑', value: 3 }, + ], }, - cooperationHotline: { + content: { type: 'string', - title: '合作热线', - maxLength: 13, + title: '内容', ui: { - showRequired: true, - placeholder: '请输入电话号码', - visibleIf: { style: [6] }, - validator: val => { - const reg = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/g; - let isValid: any; - isValid = reg.test(val); - if (!isValid) { - return [{ keyword: 'required', message: '格式不正确' }]; - } - return []; + widget: 'tinymce', + loadingTip: 'loading...', + config: { + height: 450 }, + visibleIf: { name5: (value: string) => value === '1' } }, }, - companyAddress: { - type: 'string', - title: '公司选址', - ui: { - widget: 'custom', - showRequired: true, - visibleIf: { style: [6] }, - }, - }, - advertisementContentDTOList: { - type: 'string', - title: '内容设置', - ui: { - widget: 'custom', - showRequired: true, - visibleIf: { style: [1, 2, 3, 4, 5] }, - }, - } }, - required: ['name', 'navigationId', 'style', 'takeEffectType', 'cooperationHotline', 'companyAddress', 'advertisementContentDTOList'], + required: [], }; if (this.queryParams.type === 'add'){ setTimeout(() => { @@ -302,8 +238,4 @@ export class ScrollimgComponentsAddComponent implements OnInit { handleCancel(): void { this.isVisible = false; } - outputPointAddress(data: any){ - this.sf.setValue('/companyAddress', data.address); - this.inputPoint = data.inputPoint; - } } diff --git a/src/app/routes/partner/ad/components/add/add.less b/src/app/routes/partner/knowledge/banner/components/add/add.less similarity index 100% rename from src/app/routes/partner/ad/components/add/add.less rename to src/app/routes/partner/knowledge/banner/components/add/add.less diff --git a/src/app/routes/partner/knowledge/banner/components/list/list.component.html b/src/app/routes/partner/knowledge/banner/components/list/list.component.html new file mode 100644 index 00000000..c8ac5ec4 --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/components/list/list.component.html @@ -0,0 +1,62 @@ + + + + +
+ +
+ +
+ + + +
+ +
+
+ + + +
+
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + + +
diff --git a/src/app/routes/partner/ad/components/list/list.component.less b/src/app/routes/partner/knowledge/banner/components/list/list.component.less similarity index 100% rename from src/app/routes/partner/ad/components/list/list.component.less rename to src/app/routes/partner/knowledge/banner/components/list/list.component.less diff --git a/src/app/routes/partner/knowledge/banner/components/list/list.component.spec.ts b/src/app/routes/partner/knowledge/banner/components/list/list.component.spec.ts new file mode 100644 index 00000000..3bd8060c --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/components/list/list.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { BannerComponentsListComponent } from './list.component'; + +describe('BannerComponentsListComponent', () => { + let component: BannerComponentsListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BannerComponentsListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BannerComponentsListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/partner/knowledge/banner/components/list/list.component.ts b/src/app/routes/partner/knowledge/banner/components/list/list.component.ts new file mode 100644 index 00000000..e1b86f66 --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/components/list/list.component.ts @@ -0,0 +1,237 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { STColumn, STComponent, STData } from '@delon/abc/st'; +import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; +import { ModalHelper } from '@delon/theme'; +import { NzMessageService } from 'ng-zorro-antd/message'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { BannerService } from '../../services/banner.service'; + +@Component({ + selector: 'app-banner-components-list', + templateUrl: './list.component.html', + styleUrls: ['./list.component.less'] +}) + +export class BannerComponentsListComponent implements OnInit { + schema: SFSchema = {}; + columns: STColumn[] = []; + ui: SFUISchema = {}; + appList: any[] = []; + _$expand = false; + selectApp = { + appName: '', + appId: '' + }; + + @ViewChild('st', { static: false }) st!: STComponent; + @ViewChild('sf', { static: false }) sf!: SFComponent; + constructor(public service: BannerService, private modal: ModalHelper, private msg: NzMessageService, private router: Router, private modalSrv: NzModalService, private ar: ActivatedRoute) { } + + /** + * 查询字段个数 + */ + get queryFieldCount(): number { + return Object.keys(this.schema?.properties || {}).length; + } + + /** + * 查询参数 + */ + get reqParams() { + const params = Object.assign({}, this.sf?.value || {}); + delete params._$expand; + if (params.status === '') { + delete params.status; + } + if (params.style === '') { + delete params.style; + } + if (params.navigationId === '') { + delete params.navigationId; + } + return { ...params}; + } + + /** + * 选中行 + */ + get selectedRows() { + return this.st?.list.filter((item) => item.checked) || []; + } + ngOnInit() { + this.initSF(); + this.initST(); + } + selectAppFun(item: any) { + this.selectApp = item; + this.st.load(1); + } + dataProcess(data: STData[]): STData[] { + return data.map((i, index) => { + i.showSortFlag = false; + return i; + }); + } + initSF() { + this.schema = { + properties: { + _$expand: { + type: 'boolean', + ui: { + hidden: true, + }, + }, + name: { + type: 'string', + title: 'banner名称', + maxLength: 10, + ui: { + widget: '', + placeholder: '请输入', + } + }, + status: { + type: 'string', + title: '状态', + ui: { + widget: 'select', + placeholder: '请选择', + allowClear: true, + } as SFSelectWidgetSchema, + enum: [ + { label: '全部', value: 1 }, + { label: '正常', value: 2 }, + { label: '禁用', value: 3 } + ] + }, + }, + }; + this.ui = { + '*': { + spanLabelFixed: 110, + grid: { span: 8 }, + }, + }; + } + + initST() { + this.columns = [ + { + title: 'banner名称', // 位:px + index: 'name', + className: 'text-center' + }, + { + title: 'banner', + index: 'navigationName', + className: 'text-center' + }, + { + title: '排序', // 位 px + index: 'sortId', + className: 'text-center' + }, + { + title: '状态', // 位 px + index: 'style', + className: 'text-center', + type: 'enum', + enum: { + 1: '正常', + 2: '禁用', + } + }, + { + title: '最后修改时间', // 位 px + index: 'createTime', + className: 'text-center' + }, + { + title: '操作', + fixed: 'right', + className: 'text-center', + width: 280, + buttons: [ + { + text: '修改', + click: (item) => { + this.router.navigate(['../detail'], { queryParams: { id: item.id, type: 'edit' }, relativeTo: this.ar }); + } + }, + { + text: '禁用', + pop: { + title: `确定禁用此banner图吗??`, + okType: 'danger', + icon: 'alert', + }, + click: (item) => { + this.changeStatus(item.id); + }, + iif: (item) => item.status === 1 + }, + { + text: '启用', + pop: { + title: `确定启用此banner图吗?`, + okType: 'danger', + icon: 'success', + }, + click: (item) => { + this.changeStatus(item); + }, + iif: (item) => item.status === 2 + }, + ], + }, + ]; + } + changeStatus(item: any) { + const params = { + status, + idList: [item.id] + }; + // this.service.request(this.service.$api_openOrClose, params).subscribe(res => { + // if (res) { + // this.st.reload(); + // } + // }); + } + /** + * 伸缩查询条件 + */ + expandToggle() { + this._$expand = !this._$expand; + this.sf?.setValue('/_$expand', this._$expand); + } + + /** + * 重置表单 + */ + resetSF() { + this.sf.reset(); + this._$expand = false; + } + + /** + * 新增单个实例 + */ + add() { + this.router.navigate(['../banner/detail'], { queryParams: { id: 0, type: 'add' }, relativeTo: this.ar }); + } + + /** + * 删除单个实例 + */ + del(item: any) { + const ids = []; + ids.push(item.id); + this.service.request(this.service.$api_del_many, ids).subscribe(res => { + if (res) { + this.service.msgSrv.success('删除成功'); + this.st.reload(); + } + }); + } +} diff --git a/src/app/routes/partner/ad/components/list/list.less b/src/app/routes/partner/knowledge/banner/components/list/list.less similarity index 100% rename from src/app/routes/partner/ad/components/list/list.less rename to src/app/routes/partner/knowledge/banner/components/list/list.less diff --git a/src/app/routes/partner/knowledge/banner/services/banner.service.ts b/src/app/routes/partner/knowledge/banner/services/banner.service.ts new file mode 100644 index 00000000..6710ef04 --- /dev/null +++ b/src/app/routes/partner/knowledge/banner/services/banner.service.ts @@ -0,0 +1,12 @@ +import { Injectable, Injector } from '@angular/core'; +import { BaseService } from '@shared'; + +@Injectable({ + providedIn: 'root', +}) +export class BannerService extends BaseService { + + constructor(public injector: Injector) { + super(injector); + } +} diff --git a/src/app/routes/partner/partner-routing.module.ts b/src/app/routes/partner/partner-routing.module.ts index 2c25d6d6..6f0e0cc6 100644 --- a/src/app/routes/partner/partner-routing.module.ts +++ b/src/app/routes/partner/partner-routing.module.ts @@ -38,10 +38,13 @@ 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 { ScrollImgComponentsListComponent } from './ad/components/list/list.component'; import { PartnerKnowledgeClassificationListComponent } from './knowledge/classification/components/list/list.component'; import { ParterArticleManagementListComponent } from './article-management/components/list/list.component'; import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component'; +import { ScrollImgComponentsListComponent } from './scrollimg/components/list/list.component'; +import { BannerComponentsListComponent } from './knowledge/banner/components/list/list.component'; +import { ScrollimgComponentsAddComponent } from './scrollimg/components/add/add.component'; +import { BannerComponentsAddComponent } from './knowledge/banner/components/add/add.component'; const routes: Routes = [ { @@ -122,6 +125,14 @@ const routes: Routes = [ { path: 'partner-detail', component: ParterClaimAuditListPartnerDetailComponent } ] }, + { + path: 'scroll-img', + children: [ + { path: '', component: ScrollImgComponentsListComponent }, + { path: 'list', component: ScrollImgComponentsListComponent }, + { path: 'detail', component: ScrollimgComponentsAddComponent }, + ] + }, { path: 'recorded', children: [ @@ -133,9 +144,11 @@ const routes: Routes = [ path: 'knowledge', children: [ { path: 'classification', component: PartnerKnowledgeClassificationListComponent }, - { path: 'article-management-list', component: ParterArticleManagementListComponent}, - { path: 'article-management-add', component: ParterArticleManagementEditComponent}, - { path: 'article-management-edit', component: ParterArticleManagementEditComponent}, + { path: 'article-management-list', component: ParterArticleManagementListComponent }, + { path: 'article-management-add', component: ParterArticleManagementEditComponent }, + { path: 'article-management-edit', component: ParterArticleManagementEditComponent }, + { path: 'banner', component: BannerComponentsListComponent}, + { path: 'banner/detail', component: BannerComponentsAddComponent }, ] }, ]; diff --git a/src/app/routes/partner/partner.module.ts b/src/app/routes/partner/partner.module.ts index aee0c691..3ce63eef 100644 --- a/src/app/routes/partner/partner.module.ts +++ b/src/app/routes/partner/partner.module.ts @@ -50,12 +50,14 @@ 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 { ScrollImgComponentsListComponent } from './ad/components/list/list.component'; -import { ScrollimgComponentsAddComponent } from './ad/components/add/add.component'; import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component'; import { ParterArticleManagementListComponent } from './article-management/components/list/list.component'; import { PartnerKnowledgeClassificationListComponent } from './knowledge/classification/components/list/list.component'; import { PartnerEditComponent } from './knowledge/classification/components/edit/edit.component'; +import { ScrollimgComponentsAddComponent } from './scrollimg/components/add/add.component'; +import { ScrollImgComponentsListComponent } from './scrollimg/components/list/list.component'; +import { BannerComponentsListComponent } from './knowledge/banner/components/list/list.component'; +import { BannerComponentsAddComponent } from './knowledge/banner/components/add/add.component'; const COMPONENTS: any[] = [ PartnerBusinessStatisticsIndexComponent, @@ -101,7 +103,9 @@ const COMPONENTS: any[] = [ ParterArticleManagementEditComponent, ParterArticleManagementListComponent, PartnerKnowledgeClassificationListComponent, - PartnerEditComponent + PartnerEditComponent, + BannerComponentsListComponent, + BannerComponentsAddComponent ]; @NgModule({ diff --git a/src/app/routes/partner/ad/components/add/add.component.html b/src/app/routes/partner/scrollimg/components/add/add.component.html similarity index 100% rename from src/app/routes/partner/ad/components/add/add.component.html rename to src/app/routes/partner/scrollimg/components/add/add.component.html diff --git a/src/app/routes/partner/ad/components/add/add.component.spec.ts b/src/app/routes/partner/scrollimg/components/add/add.component.spec.ts similarity index 100% rename from src/app/routes/partner/ad/components/add/add.component.spec.ts rename to src/app/routes/partner/scrollimg/components/add/add.component.spec.ts diff --git a/src/app/routes/partner/scrollimg/components/add/add.component.ts b/src/app/routes/partner/scrollimg/components/add/add.component.ts new file mode 100644 index 00000000..e8345d9e --- /dev/null +++ b/src/app/routes/partner/scrollimg/components/add/add.component.ts @@ -0,0 +1,243 @@ +import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; +import { _HttpClient } from '@delon/theme'; +import { EAEnvironmentService } from '@shared'; +import differenceInCalendarDays from 'date-fns/differenceInCalendarDays'; +import format from 'date-fns/format'; +import { NzMessageService } from 'ng-zorro-antd/message'; +import { NzUploadFile } from 'ng-zorro-antd/upload'; +import { Observable, Observer, of } from 'rxjs'; +import { apiConf } from '@conf/api.conf'; +import { ScrollImgService } from '../../services/scrollimg.service'; + +@Component({ + selector: 'app-ad-components-add', + templateUrl: './add.component.html', + styleUrls: ['./add.less'] +}) +export class ScrollimgComponentsAddComponent implements OnInit { + @ViewChild('sf', { static: false }) sf!: SFComponent; + record: any = {}; + i: any; + schema: SFSchema = {}; + contentListData = []; + queryParams: any = {}; + oldTakeEffectTime = ''; + maxSort = 0; + isVisible = false; + validFalg = true; + detailData: any = { + advertisementContentDTOList: [] + }; + changeTimeFlag = false; + currentIndex = 0; + addFlag = true; + addId = 1; + inputPoint: any = { + lng: 0, + lat: 0 + }; + today = new Date(); + navData: any = []; + navigationName = ''; + ui: SFUISchema = { + '*': { + spanLabelFixed: 200, + grid: { span: 24 }, + }, + }; + constructor( + public msgSrv: NzMessageService, + public http: _HttpClient, + public service: ScrollImgService, + private route: ActivatedRoute, + private router: Router, + private envSrv: EAEnvironmentService, + ) { } + + + ngOnInit(): void { + this.queryParams = this.route.snapshot.queryParams; + if (this.queryParams.type !== 'add') { + this.initDetailData(); + } + this.initSF(); + } + initDetailData() { + + } + initSF() { + this.schema = { + properties: { + name: { + type: 'string', + title: '轮播图名称', + maxLength: 10, + ui: { + showRequired: true, + placeholder: '请不要超过10个字', + } + }, + licensePhotoWatermark: { + type: 'string', + title: '轮播图', + ui: { + action: apiConf.fileUpload, + accept: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持JPG、PNG格式,文件小于2M(建议尺寸 702px * 280px)', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args: any) => { + if (args.type === 'success') { + this.detailData.enterpriseBaseDTO.licensePhoto = args.file.response.data.fullFilePath + } + }, + beforeUpload: (file: any, _fileList: any) => { + return new Observable((observer: Observer) => { + const isLt4M = file.size / 1024 / 1024 < 2; + if (!isLt4M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt4M); + observer.complete(); + }); + }, + previewFile: (file: NzUploadFile) => of(file.url), + }, + }, + linkType: { + type: 'string', + title: '可见范围', + ui: { + widget: 'radio', + showRequired: true, + } as SFRadioWidgetSchema, + enum: [ + { label: '全部可见', value: 1 }, + { label: '合伙人可见', value: 2 }, + { label: '销售渠道可见', value: 3 }, + ], + }, + sortId: { + type: 'string', + title: '顺序', + ui: { + showRequired: true, + widget: '=', + placeholder: '请输入0~99,数字越大,排序越靠前', + serverSearch: true, + } as SFSelectWidgetSchema, + }, + content: { + type: 'string', + title: '内容', + ui: { + widget: 'tinymce', + loadingTip: 'loading...', + config: { + height: 450 + }, + visibleIf: { name5: (value: string) => value === '1' } + }, + }, + }, + required: [], + }; + if (this.queryParams.type === 'add') { + setTimeout(() => { + this.sf.setValue('/takeEffectType', 1); + this.sf.setValue('/style', 1); + }, 500); + } + } + get reqParams() { + return {}; + } + disabledDate = (current: Date): boolean => { + // Can not select days before today and today + return differenceInCalendarDays(current, this.today) < 0; + } + changeTime() { + this.changeTimeFlag = true; + } + + + checkSort() { + const params: any = { + navigationId: this.sf?.value.navigationId, + sortId: this.sf?.value.sortId, + takeEffectType: this.sf?.value.takeEffectType, + }; + if (this.queryParams.id !== '0') { + params.advertisementId = this.queryParams.id; + } + if (this.sf.value.takeEffectType === 2) { + if (this.changeTimeFlag) { + params.takeEffectTime = format(this.detailData.takeEffectTime, 'yyyy-MM-dd HH:mm'); + } else { + params.takeEffectTime = this.detailData.takeEffectTime; + } + } + + } + save() { + const params: any = { + ...this.sf?.value, + latitude: this.inputPoint.lat, + longitude: this.inputPoint.lng, + id: this.queryParams.id + }; + this.detailData.advertisementContentDTOList.forEach((item: any) => { + delete item.addId; + }); + if (this.queryParams.type === 'add') { + delete params.id; + } + if (this.sf.value.takeEffectType === 2) { + if (this.changeTimeFlag) { + params.takeEffectTime = format(this.detailData.takeEffectTime, 'yyyy-MM-dd HH:mm'); + } else { + params.takeEffectTime = this.detailData.takeEffectTime; + } + } else { + delete params.takeEffectTime; + } + this.service.request(this.service.$api_add_one, params).subscribe(res => { + if (res) { + this.service.msgSrv.success('保存成功'); + this.router.navigate(['../list'], { relativeTo: this.route }); + } + }); + } + + goBack() { + window.history.go(-1); + } + gotoMap() { + this.isVisible = true; + } + + handleOk(): void { + this.isVisible = false; + } + + handleCancel(): void { + this.isVisible = false; + } + outputPointAddress(data: any) { + this.sf.setValue('/companyAddress', data.address); + this.inputPoint = data.inputPoint; + } +} diff --git a/src/app/routes/partner/scrollimg/components/add/add.less b/src/app/routes/partner/scrollimg/components/add/add.less new file mode 100644 index 00000000..0a6adacb --- /dev/null +++ b/src/app/routes/partner/scrollimg/components/add/add.less @@ -0,0 +1,119 @@ +:host { + .styleBox { + display: flex; + align-items: flex-end; + margin: 10px 0 0 0; + } + .imgBox { + position: relative; + width: 200px; + padding: 6px 0; + text-align: center; + border: solid 1px #eee; + .leftBox, + .rightBox { + position: absolute; + top: 50%; + transform: translate(0, -50%); + } + img { + width: 170px; + height: 40px; + } + .leftBox { + left: 3px; + } + .rightBox { + right: 3px; + } + } + .imgBox_two { + width: 200px; + padding: 6px; + text-align: center; + border: solid 1px #eee; + img { + width: 100%; + height: 40px; + } + } + .imgBox_three { + width: 200px; + padding: 6px 0; + text-align: center; + border: solid 1px #eee; + img { + width: 25%; + height: 40px; + margin: 0 6% 0 0; + &:first-child { + margin: 0 6%; + } + } + } + .imgBox_four { + width: 200px; + padding: 6px 0; + text-align: center; + border: solid 1px #eee; + img { + width: 22%; + height: 40px; + margin: 0 2% 0 0; + &:first-child { + margin: 0 2%; + } + } + } + .imgBox_one { + width: 60px; + padding: 6px; + text-align: center; + border: solid 1px #eee; + img { + width: 100%; + height: 40px; + } + } + .imgBox_info { + width: 200px; + padding: 6px; + overflow: hidden; + border: solid 1px #eee; + .title { + width: 100%; + line-height: 30px; + text-align: center; + } + .infoBox { + .name { + line-height: 28px; + } + .map { + width: 100%; + text-align: center; + img { + width: 90%; + } + } + } + } + .hint { + margin: 0 0 0 10px; + color: #f00; + } + .addBtn { + margin: 0 0 10px 0; + } + } + .overflowText { + display: -webkit-box; + max-width: 200px; + overflow: hidden; + text-align: left; + text-overflow: -o-ellipsis-lastline; + text-overflow: ellipsis; + -webkit-line-clamp: 1; + line-clamp: 1; + -webkit-box-orient: vertical; + } \ No newline at end of file diff --git a/src/app/routes/partner/ad/components/list/list.component.html b/src/app/routes/partner/scrollimg/components/list/list.component.html similarity index 94% rename from src/app/routes/partner/ad/components/list/list.component.html rename to src/app/routes/partner/scrollimg/components/list/list.component.html index caedd311..216788b4 100644 --- a/src/app/routes/partner/ad/components/list/list.component.html +++ b/src/app/routes/partner/scrollimg/components/list/list.component.html @@ -5,7 +5,7 @@
- +
@@ -14,7 +14,7 @@
- +