diff --git a/src/app/admin/agent/agent-list/agent-list.component.ts b/src/app/admin/agent/agent-list/agent-list.component.ts index e6fa6d0..3a57bc7 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.ts +++ b/src/app/admin/agent/agent-list/agent-list.component.ts @@ -251,9 +251,11 @@ export class AgentListComponent implements OnInit { } this.isOkLoading = true; + console.log(this.couponList); + console.log(this.distributeList); this.validateFormDistribute.value['agentName'] = this.requestData.find(data => data.id == this.agentId).agentName; - this.validateFormDistribute.value['couponName'] = this.couponList.find(data => data.id == this.validateFormDistribute.value['couponId']).couponName; + this.validateFormDistribute.value['couponName'] = this.distributeList.find(data => data.id == this.validateFormDistribute.value['couponId']).couponName; this.validateFormDistribute.value['agentId'] = this.agentId; const whereObject = { diff --git a/src/app/admin/audit/refund-audit/refund-audit.component.html b/src/app/admin/audit/refund-audit/refund-audit.component.html index 5d8fc46..a12fce8 100644 --- a/src/app/admin/audit/refund-audit/refund-audit.component.html +++ b/src/app/admin/audit/refund-audit/refund-audit.component.html @@ -155,4 +155,3 @@ {{data['orderStatus'] | orderCouponStatus}} - diff --git a/src/app/admin/cms/cms-category/cms-category.component.html b/src/app/admin/cms/cms-category/cms-category.component.html index eba2cc6..f3e6b34 100644 --- a/src/app/admin/cms/cms-category/cms-category.component.html +++ b/src/app/admin/cms/cms-category/cms-category.component.html @@ -1,327 +1,347 @@
-
-
-
- - - - -
+
+
+
+ + + + +
-
-
- 分类详情 +
+
+ 分类详情 +
+
+
+ + 分类名称 + + + + +
+
+ + 分类编码 + + + + +
+
+ + 排序 + + + + +
+
+ + 封面图 + + + + +
+
+ + 备注 + + + + +
+
+ + 公司名称 + + + + +
+
+ + 公司地址 + + + + +
+
+ + 联系方式 + + + + +
+
+
-
-
- - 分类名称 - - - - -
-
- - 分类编码 - - - - -
-
- - 排序 - - - - -
-
- - 封面图 - - - - - -
-
- - 备注 - - - - -
- -
- - 公司名称 - - - - -
-
- - 公司地址 - - - - -
-
- - 联系方式 - - - - -
+
+ + + + + + + + +
-
-
-
- - - - - - - - -
-
+ - -
- - - - 分类名称 - - - - - - - + + + + + + 分类名称 + + + + + + + + + 分类编码 + + + + + + + + + 排序 + + + + + + + + + 展示类型 + + + + + + + + + + + + + + + + + + + 封面图 + + + + +
上传封面图
+ + + + + +
+
+
+ + + + 备注 + + + + + + + + + - - 分类编码 - - - - - + + 公司名称 + + + + - + + - - 排序 - - - - + + 公司地址 + + + + - - - - 封面图 - - - - -
上传封面图
- - - - - -
-
-
- + + - - 备注 - - - - + + 联系方式 + + + + - - - - - - - - 公司名称 - - - - - - - - - - 公司地址 - - - - - - - - - - 联系方式 - - - - -
- -
- - - - 分类名称 - - - - - - - - - 分类编码 - - - - - - - + + + + + + 分类名称 + + + + + + + + 分类编码 + + + + + + + + + 排序 + + + + + + + + + 类型 + + + + + + + + + + + + + 封面图 + + + + +
上传封面图
+ + + + + +
+
+
+ + + + 备注 + + + + + + + + - - 排序 - - - - + + 公司名称 + + + + - + + - - 封面图 - - - - -
上传封面图
- - - - - -
-
+ + 公司地址 + + + +
- + + - - 备注 - - - - + + 联系方式 + + + + - - - - - - - 公司名称 - - - - - - - - - - 公司地址 - - - - - - - - - - 联系方式 - - - - -
diff --git a/src/app/admin/cms/cms-category/cms-category.component.ts b/src/app/admin/cms/cms-category/cms-category.component.ts index 1ba26db..4333b05 100644 --- a/src/app/admin/cms/cms-category/cms-category.component.ts +++ b/src/app/admin/cms/cms-category/cms-category.component.ts @@ -34,25 +34,12 @@ export class CmsCategoryComponent implements OnInit { FILE_URL; nodes = []; roles = []; -/* checkOptions = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 5, checked: false} - ]; - showCheck = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ];*/ cmsCategory = { id: '', parentId: '', name: '', code: '', + type: '', sort: '', coverImg: '', status: '', @@ -108,10 +95,8 @@ export class CmsCategoryComponent implements OnInit { name: [null, [Validators.required]], code: [null, [Validators.required]], sort: [null, [Validators.required]], + type: [null], coverImg: [null], - /*hasImage: [null, [Validators.required]], - imageWidth: [null], - imageHeight: [null],*/ remark: [null], }); this.goRequest(); @@ -165,18 +150,13 @@ export class CmsCategoryComponent implements OnInit { name: '', code: '', sort: '', + type: '', coverImg: '', status: '', remark: '', }; this.id = ''; - /* this.showCheck = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ];*/ + this.ext1 = { unitName: '', address: '', @@ -217,26 +197,11 @@ export class CmsCategoryComponent implements OnInit { }; } if (this.cmsCategory.parentId == null || this.cmsCategory.parentId === '' || this.cmsCategory.parentId === undefined || this.cmsCategory.parentId.length === 0) { - /* this.showCheck = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ];*/ + // 查询自己已分配的权限,然后勾选 this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getRolesOfCategory?id=' + id).subscribe(allot => { if (allot['return_code'] === '000000') { - // tslint:disable-next-line:forin - /* for (const i in allot['return_data']) { - for (const j in this.showCheck) { - if (allot['return_data'][i] === this.showCheck[j].value) { - this.showCheck[j].checked = true; - this.roles.push(this.showCheck[j].value); - console.log(this.roles); - } - } - }*/ + } else { this.message.create('warning', allot['return_msg']); } @@ -244,59 +209,11 @@ export class CmsCategoryComponent implements OnInit { } else { this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getRolesOfCategory?id=' + this.cmsCategory.parentId).subscribe(parent => { if (parent['return_code'] === '000000') { - /* this.showCheck = []; - // tslint:disable-next-line:forin - for (const i in parent['return_data']) { - if (parent['return_data'][i] === 1) { - const params = { - label: '中心平台', - value: 1, - disabled: true, - checked: false - }; - this.showCheck.push(params); - } - if (parent['return_data'][i] === 2) { - const params = { - label: '企业', - value: 2, - disabled: true, - checked: false - }; - this.showCheck.push(params); - } - if (parent['return_data'][i] === 3) { - const params = { - label: '服务机构', - value: 3, - disabled: true, - checked: false - }; - this.showCheck.push(params); - } - if (parent['return_data'][i] === 4) { - const params = { - label: '行政部门', - value: 4, - disabled: true, - checked: false - }; - this.showCheck.push(params); - } - }*/ + // 查询自己已分配的权限,然后勾选 this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getRolesOfCategory?id=' + id).subscribe(allot2 => { if (allot2['return_code'] === '000000') { - // tslint:disable-next-line:forin - /*for (const i in allot2['return_data']) { - for (const j in this.showCheck) { - if (allot2['return_data'][i] === this.showCheck[j].value) { - this.showCheck[j].checked = true; - this.roles.push(this.showCheck[j].value); - console.log(this.roles); - } - } - }*/ + } else { this.message.create('warning', allot2['return_msg']); } @@ -320,6 +237,7 @@ export class CmsCategoryComponent implements OnInit { parentId: '', name: '', code: '', + type: '', sort: '5', coverImg: '', status: '', @@ -330,19 +248,14 @@ export class CmsCategoryComponent implements OnInit { address: '', contact: '', }; - // this.checkOptions = [ - // {label: '中心平台', value: 1, checked: false}, - // {label: '企业', value: 2, checked: false}, - // {label: '服务机构', value: 3, checked: false}, - // {label: '行政部门', value: 4, checked: false} - // ]; + } else { - this.findAddRoleType(this.id); this.cmsCategory = { id: '', parentId: '', name: '', code: '', + type: '', sort: '5', coverImg: '', status: '', @@ -371,10 +284,7 @@ export class CmsCategoryComponent implements OnInit { this.message.create('error', `请选择输入排序序号!`); return; } -/* if (this.roles.length === 0) { - this.message.create('error', `请选择分类权限!`); - return; - }*/ + let coverImgStr = null; for (let i = 0; i < this.coverImgArray.length; i++) { if (this.coverImgArray[i].response != null && this.coverImgArray[i].response != '') { @@ -390,6 +300,7 @@ export class CmsCategoryComponent implements OnInit { code: value.code, parentId: this.id, sort: value.sort, + type: value.type, coverImg: coverImgStr, remark: value.remark, ext1: JSON.stringify(this.ext1) @@ -409,6 +320,7 @@ export class CmsCategoryComponent implements OnInit { name: '', code: '', sort: '', + type: '', coverImg: '', status: '', remark: '', @@ -418,12 +330,6 @@ export class CmsCategoryComponent implements OnInit { address: '', contact: '', }; - /* this.checkOptions = [ - {label: '中心平台', value: 1, checked: false}, - {label: '企业', value: 2, checked: false}, - {label: '服务机构', value: 3, checked: false}, - {label: '行政部门', value: 4, checked: false} - ];*/ this.id = ''; } else { this.message.create('warning', data['return_msg']); @@ -460,9 +366,6 @@ export class CmsCategoryComponent implements OnInit { return; } // tslint:disable-next-line:forin - /* for (const i in this.showCheck) { - this.showCheck[i].disabled = false; - }*/ this.isVisibleEdit = true; } @@ -485,10 +388,6 @@ export class CmsCategoryComponent implements OnInit { this.message.create('error', `请选择输入排序序号!`); return; } -/* if (this.roles.length === 0) { - this.message.create('error', `请选择分类权限!`); - return; - }*/ let coverImgStr = null; for (let i = 0; i < this.coverImgArray.length; i++) { if (this.coverImgArray[i].response != null && this.coverImgArray[i].response != '') { @@ -505,6 +404,7 @@ export class CmsCategoryComponent implements OnInit { code: value.code, parentId: this.cmsCategory.parentId, sort: value.sort, + type: value.type, coverImg: coverImgStr, status: this.cmsCategory.status, remark: value.remark, @@ -524,6 +424,7 @@ export class CmsCategoryComponent implements OnInit { parentId: '', name: '', code: '', + type: '', sort: '', coverImg: '', status: '', @@ -534,13 +435,6 @@ export class CmsCategoryComponent implements OnInit { address: '', contact: '', }; - /* this.showCheck = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ];*/ } else { this.message.create('warning', data['return_msg']); } @@ -590,6 +484,7 @@ export class CmsCategoryComponent implements OnInit { name: '', code: '', sort: '', + type: '', coverImg: '', status: '', remark: '', @@ -599,20 +494,6 @@ export class CmsCategoryComponent implements OnInit { address: '', contact: '', }; - /*this.checkOptions = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ]; - this.showCheck = [ - {label: '房管局', value: 1, checked: false}, - {label: '街道办', value: 2, checked: false}, - {label: '物业', value: 3, checked: false}, - {label: '小区', value: 4, checked: false}, - {label: '业委会', value: 4, checked: false} - ];*/ this.id = ''; this.goRequest(); } else { @@ -621,51 +502,6 @@ export class CmsCategoryComponent implements OnInit { }); } - // 查询能分配的角色(上级已分配角色) - findAddRoleType(id) { - /*this.http.get(WEB_SERVE_URL + '/cmsCategory/getRolesOfCategory?id=' + id).subscribe(data => { - if (data['return_code'] === '000000') { - this.checkOptions = []; - // tslint:disable-next-line:forin - for (const i in data['return_data']) { - if (data['return_data'][i] === 1) { - const params = { - label: '中心平台', - value: 1, - checked: false - }; - this.checkOptions.push(params); - } - if (data['return_data'][i] === 2) { - const params = { - label: '企业', - value: 2, - checked: false - }; - this.checkOptions.push(params); - } - if (data['return_data'][i] === 3) { - const params = { - label: '服务机构', - value: 3, - checked: false - }; - this.checkOptions.push(params); - } - if (data['return_data'][i] === 4) { - const params = { - label: '行政部门', - value: 4, - checked: false - }; - this.checkOptions.push(params); - } - } - } else { - this.message.create('warning', data['return_msg']); - } - });*/ - } // 是否包含图片 getChange(event) { diff --git a/src/app/admin/cms/cms-content-edit/cms-content-edit.component.html b/src/app/admin/cms/cms-content-edit/cms-content-edit.component.html index 5a9a0dd..0c19708 100644 --- a/src/app/admin/cms/cms-content-edit/cms-content-edit.component.html +++ b/src/app/admin/cms/cms-content-edit/cms-content-edit.component.html @@ -40,7 +40,19 @@ - + + + + 展示平台 + + + + + + + + + @@ -61,7 +73,7 @@ 跳转链接 - + diff --git a/src/app/admin/cms/cms-content/cms-content.component.html b/src/app/admin/cms/cms-content/cms-content.component.html index d32c7b7..3cecfd1 100644 --- a/src/app/admin/cms/cms-content/cms-content.component.html +++ b/src/app/admin/cms/cms-content/cms-content.component.html @@ -8,221 +8,206 @@ -
- -
- - - - - - - - - - - - -
+ +
+
+
+
+ + 内容分类 + + + + + +
+
+ + 内容标题 + + + + +
+
+ + 内容状态 + + + + + + + + +
+
+ + 展示平台 + + + + + + + + + +
+ +
+ +
+
+ + +
+
+
-
- -
共搜索到 {{total}} 条数据
- - - -
- - - - - 序号 - 分类名称 - 内容标题 - 简要描述 - 访问总量 - 是否推荐 - 状态 - 创建时间 - 操作 - - - - - {{i+ 1}} - {{data.categoryName}} - {{data.title}} - {{data.description}} - {{data.visitCount}} - - - - - - 编辑中 - 已发布 - - {{data.createTime | date:'yyyy-MM-dd' }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 附件名称 - 附件类型 - 附件描述 - 排序 - 添加时间 - 操作 - - - - - {{ data.patchName }} - 图片 - 音频 - 视频 - 文档 - 其他 - {{data.patchDesc}} - {{data.sort}} - {{data.addTime | date:'yyyy-MM-dd'}} - - - - - - +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 序号 + 分类名称 + 内容标题 + 展示平台 + 状态 + 创建时间 + 操作 + + + + + {{i+1}} + {{data.tag}} + {{data.title}} + {{data.platform | showType}} + + {{data.status == 1 ? '编辑中': '已发布'}} + + {{data.createTime | date:'yyyy-MM-dd hh:mm:ss' }} + + 更多操作 + + + + + +
- - -
- - - - 附件名称 - - - - - - - - - - 附件描述 - - - - - - - - - - 附件排序 - - - - - - - - - - 附件类型 - - - - - - - - - - - - - - - 附件上传 - - - - - - - - -
-
- - -
- - - - 发布模板 - - - - - - - - - -
+ + + + diff --git a/src/app/admin/cms/cms-content/cms-content.component.less b/src/app/admin/cms/cms-content/cms-content.component.less index 3562ef1..e69de29 100644 --- a/src/app/admin/cms/cms-content/cms-content.component.less +++ b/src/app/admin/cms/cms-content/cms-content.component.less @@ -1,27 +0,0 @@ -.width_input { - width: 200px; -} -.width_input_chlid { - width: 200px; - margin-left: 10px; -} -[nz-form] { - max-width: 600px; -} -button { - margin-left: 8px; -} -:host ::ng-deep .upload-list-inline .ant-upload-list-item { - float: left; - width: 200px; - margin-right: 8px; -} -.search-result-list { - margin-top: 16px; - border: 1px dashed #e9e9e9; - border-radius: 6px; - background-color: #fafafa; - min-height: 200px; - text-align: center; - padding-top: 80px; -} diff --git a/src/app/admin/cms/cms-content/cms-content.component.ts b/src/app/admin/cms/cms-content/cms-content.component.ts index 6ef0cc3..32edbf1 100644 --- a/src/app/admin/cms/cms-content/cms-content.component.ts +++ b/src/app/admin/cms/cms-content/cms-content.component.ts @@ -1,12 +1,22 @@ import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {HttpClient, HttpEvent, HttpEventType, HttpRequest, HttpResponse} from '@angular/common/http'; -import {NzMessageService, NzModalService, UploadXHRArgs} from 'ng-zorro-antd'; +import {HttpClient} from '@angular/common/http'; +import {NzMessageService, NzModalService, NzUploadFile} from 'ng-zorro-antd'; import {Router} from '@angular/router'; import {LocalStorageService} from '../../../services/local-storage.service'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {environment} from '../../../../environments/environment'; - +import {CmsService} from '../../../services/cms.service'; +import {CommonsService} from '../../../services/commons.service'; + +function getBase64(file: File): Promise { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); +} @Component({ selector: 'app-cms-content', @@ -14,247 +24,93 @@ import {environment} from '../../../../environments/environment'; styleUrls: ['./cms-content.component.less'] }) export class CmsContentComponent implements OnInit { -// 搜索按钮等待特效 - isLoadingSearch = false; - // 搜索内容标题 - searchTitle = ''; - // 状态搜索 - searchStatus = ''; - // 分类搜索 - searchCategoryId = ''; - // 公司id - searchCompanyId = ''; - // 查询数组 - requestData = []; - // 查询数组等待特效 - loading = true; - // 请求页码 - pageIndex = 1; - // 请求条数 - pageSize = 10; - // 查询总条数 - total = 0; - /** 分类树数据 **/ - nodes = []; - WEB_SERVE_URL; - // 选中的内容id - contentSelect = ''; - // 是否显示附件列表 - showPatch = 0; - // 根据内容查询附件列表 - patchList = []; - - // 添加附件相关 - // 提交等待 - isOkLoading = false; - // 附件类型 - patchTypeCheck = '0'; - // 附件返回地址 - patchPath = ''; - // 允许上传的文件类型 - annexForm: FormGroup; - /** 定义附件表单 **/ - isVisible = false; - /** 是否弹出添加 **/ - fileList = []; - // 上传的后缀名 - suffix = ''; - // 允许上传的文件类型 - imageSuffix = [ - 'jpg', - 'jpeg', - 'png', - 'jif', - 'dwg', - 'dxf', - 'jp2', - 'jpe', - 'svf', - 'tif', - 'tiff', - ]; - audioSuffix = [ - '3gpp', - 'ac3', - 'mp2', - 'mp3', - 'asf', - 'cda', - 'wav', - 'wma', - 'mid', - 'ra', - 'rma', - 'mod', - ]; - videoSuffix = [ - '3gpp', - 'mp2', - 'mp4', - 'mpeg', - 'mpg', - 'avi', - 'rmvb', - 'flv', - '3pg', - 'rm', - 'mov', - 'wmv', - 'mkv', - 'f4v', - 'm4v', - ]; - applicationSuffix = [ - 'asf', - 'doc', - 'dot', - 'dtd', - 'htm', - 'html', - 'css', - 'csv', - 'js', - 'json', - 'mpp', - 'ogg', - 'pdf', - 'pot', - 'pps', - 'ppt', - 'rtf', - 'txt', - 'wdb', - 'wps', - 'xhtml', - 'xlc', - 'xlm', - 'xls', - 'xlt', - 'xlw', - 'xml', - 'zip', - 'docx', - 'xlsx', - 'pptx', - 'sql' - ]; - isPublish = false; - isPushOkLoading = false; - moduleId = ''; - pushId = ''; - pushForm: FormGroup; - // 可选择的模板列表 - selectModule = []; - /** 按钮数据权限 **/ - BTN_cmscontent_add = 0; - BTN_cmscontent_edit = 0; - BTN_cmscontent_delete = 0; - BTN_cmscontent_patch = 0; - BTN_cmscontent_up_down = 0; + WEB_SERVE_URL = environment.imageUrl; + POST_URL = environment.baseUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 添加框 + requestData = []; // 列表数据 + nodes = []; // 类型树 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + editFlag = false; + isVisible = false; + imgFile = []; + previewImage: string | undefined = ''; + previewVisible = false; + id: number; constructor( private fb: FormBuilder, private http: HttpClient, // http请求 private message: NzMessageService, // 信息提示 private router: Router, - private modalService: NzModalService, // 对话框 - private store: LocalStorageService, // 请求缓存 + private common: CommonsService, + private cms: CmsService, ) { this.WEB_SERVE_URL = environment.baseUrl; - this.searchCompanyId = this.store.get(ADMIN_INFO_OBJECT)['secUser']['companyId']; } ngOnInit() { - /** 循环查询 按钮权限 **/ - for (let i = 0; i < this.store.get(ADMIN_INFO_OBJECT)['buttonList'].length; i++) { - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_add') { - this.BTN_cmscontent_add = 1; - } - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_edit') { - this.BTN_cmscontent_edit = 1; - } - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_delete') { - this.BTN_cmscontent_delete = 1; - } - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_patch') { - this.BTN_cmscontent_patch = 1; - } - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_up_down') { - this.BTN_cmscontent_up_down = 1; - } - } - this.annexForm = this.fb.group({ - patchName: [null, [Validators.required]], - patchDesc: [null], - patchType: [null, [Validators.required]], - sort: [null, [Validators.required]], + + this.searchForm = this.fb.group({ + title: [null], + categoryId: [null], + platform: [null], + status: [null], }); - this.pushForm = this.fb.group({ - moduleId: [null] + + this.validateForm = this.fb.group({ + categoryId: [null, [Validators.required]], + title: [null, [Validators.required]], + platform: [null], + platformArray: [null], + sortId: [null, [Validators.required]], + description: [null, [Validators.required]], + jumpType: [null], + jumpUrl: [null], + }); - // 获取登录人 角色类型,查询分类树 - console.log(this.store.get(ADMIN_INFO_OBJECT)); - let roleType = 1; - /* if (0 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - roleType = 1; - } else if (1 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - if (this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['isService'] == true) { - roleType = 3; - } else { - roleType = 2; - } - } else if (2 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - roleType = 3; - }*/ + const roleType = 1; this.findCategoryTree(roleType); - this.getRequest(); - } + this.getRequest(true, this.searchForm.value); - // 重置搜索 - resetSearch() { - // 搜索内容标题 - this.searchTitle = ''; - // 状态搜索 - this.searchStatus = ''; - // 分类搜索 - this.searchCategoryId = ''; } - // 请求列表 - getRequest(reset: boolean = false) { - this.showPatch = 0; - this.loading = false; + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + if (reset) { - this.pageIndex = 1; - } - if (this.searchStatus == null) { - this.searchStatus = ''; - } - if (this.searchCategoryId == null) { - this.searchCategoryId = ''; + this.pageNum = 1; } - this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListContent?pageNum=' + this.pageIndex + '&pageSize=' + this.pageSize + '&title=' + this.searchTitle + '&category=' + this.searchCategoryId + '&status=' + this.searchStatus + '&companyId=' + this.searchCompanyId).subscribe(data => { + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.cms.getListContent(whereObject, data => { console.log(data); + this.loading = false; if (data['return_code'] === '000000') { this.requestData = data['return_data'].list; this.total = data['return_data'].total; - this.isLoadingSearch = false; } else { - this.message.create('error', data['return_msg']); + this.message.error(data['return_msg']); } }); } - // 搜索 - getSearch() { - this.getRequest(); + // 重置 + public resetForm(): void { + this.searchForm.reset(); } + // 查询分类树 findCategoryTree(roleType) { - this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => { + this.cms.getOwnCategoryTree(roleType , data => { if (data['return_code'] === '000000') { this.nodes = data['return_data']; if (this.nodes.length !== 0) { @@ -273,7 +129,6 @@ export class CmsContentComponent implements OnInit { for (const i in data) { if (data[i].nodes == null) { const item = { - /** 重新赋值 **/ isLeaf: true, title: data[i].text, key: data[i].id, @@ -282,7 +137,6 @@ export class CmsContentComponent implements OnInit { data[i] = item; } else { const item = { - /** 重新赋值 **/ isLeaf: false, title: data[i].text, key: data[i].id, @@ -293,340 +147,119 @@ export class CmsContentComponent implements OnInit { } } this.nodes = data; - console.log(this.nodes); } - // 跳转添加 + // 新增 getAdd() { - this.router.navigate(['/admin/cms/cmscontentadd'], { - queryParams: { - editFlag: 0 - } - }); - } - - // 跳转修改 - getEdit(id) { - this.router.navigate(['/admin/cms/cmscontentedit'], { - queryParams: { - id: id - } - }); - } - - // 跳转详情 - getContentView(id) { - this.router.navigate(['/admin/cms/cmscontentview'], { - queryParams: { - id: id - } - }); - } - - // 对话框删除 - showDeleteConfirmDelete(id): void { - this.modalService.confirm({ - nzTitle: '是否确定删除', - nzOkText: '是', - nzOnOk: () => this.deleteContent(id), - nzCancelText: '否', - }); - } - - // 删除内容 - deleteContent(id) { - if (id === undefined) { - return; - } - if (id === null) { - return; - } - if (id === '') { - return; - } - this.http.get(this.WEB_SERVE_URL + '/cmsContent/delContent?id=' + id).subscribe(data => { - if (data['return_code'] === '000000') { - this.message.create('success', `删除成功!`); - this.getRequest(); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - - // 查询附件列表 - findPatchByContent(id) { - this.contentSelect = id; - this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListPatches?pageNum=1&pageSize=100&contentId=' + id).subscribe(data => { - if (data['return_code'] === '000000') { - this.showPatch = 1; - this.patchList = data['return_data'].list; - console.log(this.patchList); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - - // 弹出添加附件 - addPatch() { this.isVisible = true; + this.editFlag = false; } - // 删除附件确认 - showDeletePatch(id) { - this.modalService.confirm({ - nzTitle: '是否确定删除', - nzOkText: '是', - nzOnOk: () => this.deletePatch(id), - nzCancelText: '否', - }); - } - - // 删除附件 - deletePatch(id) { - if (id === undefined || id === null || id === '') { - return; - } - this.http.get(this.WEB_SERVE_URL + '/cmsPatch/delPatch?id=' + id).subscribe(data => { - if (data['return_code'] === '000000') { - this.message.create('success', `删除成功!`); - this.findPatchByContent(this.contentSelect); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - - // 取消按钮 - handleCancel(): void { - this.isVisible = false; - this.patchPath = ''; - this.fileList = []; - /** 隐藏弹框 **/ - } - - // 附件类型选择 - getChange(event) { - if (event != null) { - this.patchTypeCheck = event; - console.log(event); - } - } - - // 附件上传设置 - customReq = (item: UploadXHRArgs) => { - this.patchPath = ''; // 置空路径 - const formData = new FormData(); - formData.append('requestFile', item.file as any); - formData.append('uploadType', 'cmsPatch'); - console.log(item); - const req = new HttpRequest('POST', item.action!, formData, { - reportProgress: true, - }); - console.log(req); - return this.http.request(req).subscribe( - (event: HttpEvent) => { - console.log(event); - if (event.type === HttpEventType.UploadProgress) { - if (event.total! > 0) { - (event as any).percent = (event.loaded / event.total!) * 100; - } - item.onProgress!(event, item.file!); - } else if (event instanceof HttpResponse) { - item.onSuccess!(event.body, item.file!, event); - if (event.body.return_code === '000000') { - this.patchPath = event.body.return_data[item.file.name]; - this.suffix = this.patchPath.split('.')[this.patchPath.split('.').length - 1]; - } - } - }, - err => { - item.onError!(err, item.file!); - } - ); - } - - /** 清空 **/ - emptyForm(e: MouseEvent): void { - e.preventDefault(); - this.annexForm.reset(); - for (const key in this.annexForm.controls) { - this.annexForm.controls[key].markAsPristine(); - this.annexForm.controls[key].updateValueAndValidity(); + // 编辑 + getEdit(data: object) { + console.log(data); + if (data['imgData'] != null && data['imgData'] !== '') { + const logo = String(data['imgData']); + const logoArray = []; + logoArray.push( + { + uid: 1, + name: logo, + status: 'done', + url: environment.imageUrl + logo + }); + this.imgFile = logoArray; } + this.id = data['id']; + this.validateForm.patchValue(data); + this.editFlag = true; + this.isVisible = true; } - // 附件弹窗确定添加按钮 - handlePatchOk(value: any): void { - // 校验类型选择与必填 - if (value.patchName == null || value.patchName == '') { - this.message.create('error', `请填写附件名称!`); - return; - } - if (value.sort == null || value.sort == '') { - this.message.create('error', `请填写附件排序,越小越靠前!`); - return; - } - if (value.patchType == '1') { - if (this.imageSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传图片类型的附件!`); - return; - } - } else if (value.patchType == '2') { - if (this.audioSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传音频类型的附件!`); - return; - } - } else if (value.patchType == '3') { - if (this.videoSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传视频类型的附件!`); + // 提交内容 + handleOk() { + // tslint:disable-next-line:forin + for (const i in this.validateForm.controls) { + this.validateForm.controls[i].markAsDirty(); + this.validateForm.controls[i].updateValueAndValidity(); + if (this.validateForm.controls[i].errors != null) { + this.message.error('必填项不能为空'); return; } - } else if (value.patchType == '4') { - if (this.applicationSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传文档类型的附件!`); - return; - } - } else if (value.patchType == '5') { - } else { - this.message.create('error', `请选择附件类型!`); - return; - } - if (this.patchPath == null || this.patchPath == '') { - this.message.create('error', `请上传附件!`); - return; } - // 定义附件数据 - const params = { - 'contentId': this.contentSelect, - 'patchName': value.patchName, - 'patchDesc': value.patchDesc, - 'patchType': value.patchType, - 'patchPath': this.patchPath, - 'source': 1, - 'sort': value.sort, - 'suffixName': this.suffix, - 'addTime': new Date() - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsPatch/addPatch', params).subscribe(data => { - if (data['return_code'] === '000000') { - this.isVisible = false; - this.isOkLoading = false; - this.fileList = []; - this.patchTypeCheck = '0'; - this.findPatchByContent(this.contentSelect); - this.message.create('success', `新增成功!`); + if (this.imgFile.length !== 0) { + if (this.imgFile[0]['response'] != null) { + this.validateForm.value.imgData = this.imgFile[0]['response']['return_data'][0]; } else { - this.message.create('warning', data['return_msg']); + this.validateForm.value.imgData = this.imgFile[0].name; } - }, error => { - this.message.create('error', `未知错误!`); - }); - } - - // 弹出发布附件 - addPush(id, categoryId) { - this.findModuleByCategory(categoryId); - this.pushId = id; - // document.getElementById('resetPush').click(); - this.isPublish = true; - } - - // 取消发布 - handleCancelPush(): void { - this.isPublish = false; - this.moduleId = ''; - this.pushId = ''; - /** 隐藏弹框 **/ - } - - // 附件弹窗确定添加按钮 - handlePushOk(value: any): void { - console.log('发布'); - console.log(this.pushId); - console.log(this.moduleId); - console.log(value.moduleId); - if (this.pushId == null || this.pushId == '') { - this.message.create('error', '请重新选择发布的内容!'); - return; } - if (this.moduleId == null || this.moduleId == undefined) { - this.moduleId = ''; + if (this.editFlag) { + this.validateForm.value.id = this.id; + this.cms.updateCmsContent(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + this.isVisible = false; + this.getRequest(false, this.searchForm.value); + this.message.success('修改成功'); + } else { + this.message.create('error', '修改失败'); + } + }); + } else { + this.cms.insertCmsContent(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + this.isVisible = false; + this.getRequest(false, this.searchForm.value); + this.message.success('新增成功'); + } else { + this.message.create('error', '修改失败'); + } + }); } - - // 定义附件数据 - const params = { - 'id': this.pushId, - 'status': 2, - 'moduleId': this.moduleId - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { - if (data['return_code'] === '000000') { - this.isPublish = false; - this.isPushOkLoading = false; - this.moduleId = ''; - this.pushId = ''; - this.getRequest(); - this.message.create('success', `发布成功!`); - } else { - this.message.create('warning', data['return_msg']); - } - }, error => { - this.message.create('error', `未知错误!`); - }); } - /** 清空模板 **/ - emptyPushForm(e: MouseEvent): void { - e.preventDefault(); - this.pushForm.reset(); - for (const key in this.pushForm.controls) { - this.pushForm.controls[key].markAsPristine(); - this.pushForm.controls[key].updateValueAndValidity(); + // 图片查看 + handlePreview = async (file: NzUploadFile) => { + if (!file.url && !file.preview) { + // tslint:disable-next-line:no-non-null-assertion + file.preview = await getBase64(file.originFileObj!); } + this.previewImage = file.url || file.preview; + this.previewVisible = true; } - // 根据内容分类查询可使用的模板列表 - findModuleByCategory(categoryId) { - this.http.get(this.WEB_SERVE_URL + '/cmsCategoryModule/getModuleByCategoryId?categoryId=' + categoryId).subscribe(data => { - if (data['return_code'] === '000000') { - this.selectModule = data['return_data']; - console.log(this.selectModule); - } else { - this.message.create('error', data['return_msg']); + showDeleteConfirmDelete(id: number): void { + this.common.showConfirm('是否确定删除!' , dataR => { + if (dataR) { + this.cms.deleteById(id, data => { + if (data['return_code'] === '000000') { + this.getRequest(true, this.searchForm.value); + this.message.success(data['return_data']); + } else { + this.message.error(data['return_msg']); + } + }); } }); } - showDown(id): void { - this.modalService.confirm({ - nzTitle: '是否确定下线', - nzOkText: '是', - nzOnOk: () => this.DownContent(id), - nzCancelText: '否', - }); - } - // 下线 - DownContent(id) { - // 定义附件数据 - const params = { - 'id': id, - 'status': 1 - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { - if (data['return_code'] === '000000') { - this.getRequest(); - this.message.create('success', `下线成功!`); - } else { - this.message.create('warning', data['return_msg']); + + public getForbiddenUser(id, status: any): void { + const message = (status === 2 ? '是否下架当前内容' : '是否上架当前内容'); + const s = status === 2 ? 1 : 2; + this.common.showConfirm(message, data => { + if (data) { + this.cms.updateContentStatus(id, s , dataUser => { + if (dataUser['return_code'] === '000000') { + this.message.success(dataUser['return_data']); + } else { + this.message.error(dataUser['return_msg']); + } + this.getRequest(false , this.searchForm.value); + }); } - }, error => { - this.message.create('error', `未知错误!`); }); } + } diff --git a/src/app/admin/cms/cms.module.ts b/src/app/admin/cms/cms.module.ts index 563cc10..94cb919 100644 --- a/src/app/admin/cms/cms.module.ts +++ b/src/app/admin/cms/cms.module.ts @@ -11,17 +11,20 @@ import {CmsContentViewComponent} from './cms-content-view/cms-content-view.compo import {CmsCategoryModuleComponent} from './cms-category-module/cms-category-module.component'; import {CmsContentAddComponent} from './cms-content-add/cms-content-add.component'; import {CmsContentComponent} from './cms-content/cms-content.component'; +import { ContentEditComponent } from './content-edit/content-edit.component'; +import {AppCommonModule} from "../../app-common.module"; @NgModule({ - declarations: [CmsCategoryComponent, CmsCategoryModuleComponent, CmsContentComponent, CmsContentAddComponent, CmsContentEditComponent, CmsContentViewComponent], - imports: [ - CommonModule, - CmsRoutingModule, - FormsModule, - NgZorroAntdModule, - ReactiveFormsModule, - NgxNeditorModule - ] + declarations: [CmsCategoryComponent, CmsCategoryModuleComponent, CmsContentComponent, CmsContentAddComponent, CmsContentEditComponent, CmsContentViewComponent, ContentEditComponent], + imports: [ + CommonModule, + CmsRoutingModule, + FormsModule, + NgZorroAntdModule, + ReactiveFormsModule, + NgxNeditorModule, + AppCommonModule + ] }) export class CmsModule { } diff --git a/src/app/admin/cms/content-edit/content-edit.component.html b/src/app/admin/cms/content-edit/content-edit.component.html new file mode 100644 index 0000000..9723747 --- /dev/null +++ b/src/app/admin/cms/content-edit/content-edit.component.html @@ -0,0 +1 @@ +

content-edit works!

diff --git a/src/app/admin/cms/content-edit/content-edit.component.scss b/src/app/admin/cms/content-edit/content-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/cms/content-edit/content-edit.component.ts b/src/app/admin/cms/content-edit/content-edit.component.ts new file mode 100644 index 0000000..f8e4bf2 --- /dev/null +++ b/src/app/admin/cms/content-edit/content-edit.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-content-edit', + templateUrl: './content-edit.component.html', + styleUrls: ['./content-edit.component.scss'] +}) +export class ContentEditComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html index b35ff48..d43eb2a 100644 --- a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html +++ b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html @@ -180,8 +180,8 @@ - 第三方产品 - + 有效期 + diff --git a/src/app/admin/config-manage/third-product/third-product.component.html b/src/app/admin/config-manage/third-product/third-product.component.html index e78c2d2..ba87b74 100644 --- a/src/app/admin/config-manage/third-product/third-product.component.html +++ b/src/app/admin/config-manage/third-product/third-product.component.html @@ -62,6 +62,7 @@ 编号 + 产品类型 产品名称 利润比例 积分抵扣比例 @@ -76,8 +77,9 @@ {{i + 1}} {{data.productName}} - {{data.discount + "%"}} - {{data.integralDiscount + "%"}} + {{data.productType | productType : data.productId}} + {{data.discount == null ? '暂未配置' : data.discount + "%"}} + {{data.integralDiscount == null ? '0' : data.integralDiscount + "%"}} {{data.productPayTypeString.substring(0 , data.productPayTypeString.length - 1)}} {{data.productPlatformString.substring(0 , data.productPlatformString.length - 1)}} {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} @@ -103,6 +105,16 @@ + + + + + + + 卡券来源 + + + @@ -130,7 +142,7 @@ - + 利润比例 { this.productPlatformArray = data['return_data']; }); - + this.common.getDictionary('COUPON_SOURCE', data => { + this.couponSource = data['return_data']; + }); } @@ -85,11 +88,12 @@ export class ThirdProductComponent implements OnInit { productName: [null], }); this.validateForm = this.form.group({ - discount: [null, [Validators.required]], + discount: [null], integralDiscount: [0], productPlatform: [null, [Validators.required]], payType: [null, [Validators.required]], productType: [null, [Validators.required]], + productId: [null], productName: [null], }); diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html index cacf739..353fd46 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html @@ -44,11 +44,7 @@ 卡券来源 - - - - - + diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts index 8705880..89ca8f4 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts @@ -49,11 +49,13 @@ export class CouponEditComponent implements OnInit { content: string; goodsTypeData; brandData; + couponSource; constructor( private fb: FormBuilder, private merchant: MerchantService, private coupon: CouponService, private common: CommonsService, + private commonsService: CommonsService, private config: ConfigService, private message: NzMessageService, // 信息提示 private activatedRoute: ActivatedRoute, @@ -104,7 +106,9 @@ export class CouponEditComponent implements OnInit { this.config.getListGoodsType(params , data => { this.goodsTypeData = data['return_data'].list; }); - + this.commonsService.getDictionary('COUPON_SOURCE', data => { + this.couponSource = data['return_data']; + }); } // 查询商户 @@ -183,6 +187,7 @@ export class CouponEditComponent implements OnInit { this.config.getBrandByList(params , data => { this.brandData = data['return_data'].list; }); + } // 查询卡券 diff --git a/src/app/admin/index/test/test.component.html b/src/app/admin/index/test/test.component.html index 559660c..4648a19 100644 --- a/src/app/admin/index/test/test.component.html +++ b/src/app/admin/index/test/test.component.html @@ -1,30 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ 大家好!我是:{{currentUser}} +
+
+
{{msg}}
+
+
+ 当前登录用户:{{users}} +
+
+ +
+
+ +
+

{{error | json}}

+

completed!

+ + diff --git a/src/app/admin/index/test/test.component.ts b/src/app/admin/index/test/test.component.ts index 0d030bd..61d6934 100644 --- a/src/app/admin/index/test/test.component.ts +++ b/src/app/admin/index/test/test.component.ts @@ -37,7 +37,7 @@ export class TestComponent implements OnInit { ngOnInit(): void { console.log(this.currentUser); // 连接websocket - // this.webSocketService.connect(`ws://139.159.177.244:9302/brest/WebSocket/` + this.currentUser); + this.webSocketService.connect(`ws://139.159.177.244:9302/brest/WebSocket/` + this.currentUser); // 接收消息 this.webSocketService.messageSubject.subscribe( data => { @@ -54,18 +54,18 @@ export class TestComponent implements OnInit { ); } - // send() { - // // 创建消息对象 - // const msg = { - // msg: this.message, // 消息内容 - // type: this.type === SEND_TYPE.ALL ? SEND_TYPE.ALL : SEND_TYPE.SINGLE, // 类型 - // to: this.type === SEND_TYPE.SINGLE ? this.sendToUser : undefined // 要发送的对象 - // }; - // // 发送 - // this.webSocketService.sendMessage(JSON.stringify(msg)); - // // 发送完成,情况message内容 - // this.message = ''; - // } + send() { + // 创建消息对象 + const msg = { + msg: this.message, // 消息内容 + type: this.type === SEND_TYPE.ALL ? SEND_TYPE.ALL : SEND_TYPE.SINGLE, // 类型 + to: this.type === SEND_TYPE.SINGLE ? this.sendToUser : undefined // 要发送的对象 + }; + // 发送 + this.webSocketService.sendMessage(JSON.stringify(msg)); + // 发送完成,情况message内容 + this.message = ''; + } } diff --git a/src/app/admin/system/system-msg/system-msg.component.html b/src/app/admin/system/system-msg/system-msg.component.html new file mode 100644 index 0000000..eec2646 --- /dev/null +++ b/src/app/admin/system/system-msg/system-msg.component.html @@ -0,0 +1,179 @@ + + + + 内容管理 + + + 内容发布 + + + + +
+
+
+
+ + 站内信标题 + + + + +
+
+ + 站内信类型 + + + + + + + + + +
+
+ + 跳转类型 + + + + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 序号 + 标题 + 类型 + 跳转类型 + 消息类型 + 内容 + 状态 + 创建时间 + 操作 + + + + + {{i+1}} + {{data.title}} + {{data.type | msgType : 1 }} + {{data.jumpType | msgType : 2 }} + {{data.msgType | msgType : 3 }} + {{data.content}} + {{data.status == 1? '编辑中': '已发布'}} + {{data.createTime | date:'yyyy-MM-dd hh:mm:ss' }} + + 更多操作 + + + + + + + +
+ + + + + + + + + diff --git a/src/app/admin/system/system-msg/system-msg.component.scss b/src/app/admin/system/system-msg/system-msg.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/system/system-msg/system-msg.component.ts b/src/app/admin/system/system-msg/system-msg.component.ts new file mode 100644 index 0000000..b376b15 --- /dev/null +++ b/src/app/admin/system/system-msg/system-msg.component.ts @@ -0,0 +1,180 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {NzMessageService, NzUploadFile} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {MsgService} from '../../../services/msg.service'; + +function getBase64(file: File): Promise { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); +} + +@Component({ + selector: 'app-system-msg', + templateUrl: './system-msg.component.html', + styleUrls: ['./system-msg.component.scss'] +}) +export class SystemMsgComponent implements OnInit { + + + WEB_SERVE_URL = environment.imageUrl; + POST_URL = environment.baseUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 添加框 + requestData = []; // 列表数据 + nodes = []; // 类型树 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + editFlag = false; + isVisible = false; + imgFile = []; + previewImage: string | undefined = ''; + previewVisible = false; + id: number; + constructor( + private fb: FormBuilder, + private http: HttpClient, // http请求 + private message: NzMessageService, // 信息提示 + private router: Router, + private common: CommonsService, + private msg: MsgService + ) { + this.WEB_SERVE_URL = environment.baseUrl; + } + + ngOnInit() { + + this.searchForm = this.fb.group({ + type: [null], + jumpType: [null], + title: [null], + }); + + this.validateForm = this.fb.group({ + type: [null, [Validators.required]], + title: [null, [Validators.required]], + jumpType: [null, [Validators.required]], + content: [null, [Validators.required]], + }); + + this.getRequest(true, this.searchForm.value); + + } + + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.msg.getMsgByList(whereObject, data => { + console.log(data); + this.loading = false; + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + // 新增 + getAdd() { + this.isVisible = true; + this.editFlag = false; + } + + // 编辑 + getEdit(data: object) { + console.log(data); + if (data['image'] != null && data['image'] !== '') { + const logo = String(data['image']); + const logoArray = []; + logoArray.push( + { + uid: 1, + name: logo, + status: 'done', + url: environment.imageUrl + logo + }); + this.imgFile = logoArray; + } + this.id = data['id']; + this.validateForm.patchValue(data); + this.editFlag = true; + this.isVisible = true; + } + + // 提交内容 + handleOk() { + // tslint:disable-next-line:forin + for (const i in this.validateForm.controls) { + this.validateForm.controls[i].markAsDirty(); + this.validateForm.controls[i].updateValueAndValidity(); + if (this.validateForm.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + if (this.imgFile.length !== 0) { + if (this.imgFile[0]['response'] != null) { + this.validateForm.value.image = this.imgFile[0]['response']['return_data'][0]; + } else { + this.validateForm.value.image = this.imgFile[0].name; + } + } + this.msg.insertMsg(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + this.isVisible = false; + this.getRequest(false, this.searchForm.value); + this.message.success('新增成功'); + } else { + this.message.create('error', '修改失败'); + } + }); + } + + // 图片查看 + handlePreview = async (file: NzUploadFile) => { + if (!file.url && !file.preview) { + // tslint:disable-next-line:no-non-null-assertion + file.preview = await getBase64(file.originFileObj!); + } + this.previewImage = file.url || file.preview; + this.previewVisible = true; + } + + public getForbiddenUser(id): void { + const message = '是否发布'; + this.common.showConfirm(message, data => { + if (data) { + this.msg.pushMsg(id, dataUser => { + if (dataUser['return_code'] === '000000') { + this.message.success(dataUser['return_data']); + } else { + this.message.error(dataUser['return_msg']); + } + this.getRequest(false , this.searchForm.value); + }); + } + }); + } +} diff --git a/src/app/admin/system/system-routing.module.ts b/src/app/admin/system/system-routing.module.ts index f687099..927257a 100644 --- a/src/app/admin/system/system-routing.module.ts +++ b/src/app/admin/system/system-routing.module.ts @@ -10,12 +10,14 @@ import {PositionRelComponent} from './position-rel/position-rel.component'; import {SinopecConfigComponent} from './sinopec-config/sinopec-config.component'; import {SinopecEditComponent} from './sinopec-edit/sinopec-edit.component'; import {OilsDiscountComponent} from './oils-discount/oils-discount.component'; +import {SystemMsgComponent} from './system-msg/system-msg.component'; const routes: Routes = [ { path: 'systemorganization', component: SystemOrganizationComponent}, { path: 'systemrole', component: SystemRoleComponent}, { path: 'systemrole-show', component: SystemRoleShowComponent}, { path: 'systemuser', component: SystemUserComponent }, + { path: 'msg', component: SystemMsgComponent }, { path: 'menu', component: MenuComponent }, { path: 'permission', component: PermissionComponent }, { path: 'positionrel', component: PositionRelComponent }, diff --git a/src/app/admin/system/system.module.ts b/src/app/admin/system/system.module.ts index 1cafd5d..a4cd1bf 100644 --- a/src/app/admin/system/system.module.ts +++ b/src/app/admin/system/system.module.ts @@ -19,8 +19,9 @@ import {AppCommonModule} from '../../app-common.module'; import { SinopecConfigComponent } from './sinopec-config/sinopec-config.component'; import { SinopecEditComponent } from './sinopec-edit/sinopec-edit.component'; import { OilsDiscountComponent } from './oils-discount/oils-discount.component'; +import { SystemMsgComponent } from './system-msg/system-msg.component'; @NgModule({ - declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, PositionRelComponent, SinopecConfigComponent, SinopecEditComponent, OilsDiscountComponent], + declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, PositionRelComponent, SinopecConfigComponent, SinopecEditComponent, OilsDiscountComponent, SystemMsgComponent], imports: [ CommonModule, SystemRoutingModule, diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 8cd1865..22a6456 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -58,6 +58,8 @@ import {OilPriceTaskPriceTypePipe} from './pipes/gas-oil-price/oil-price-task-pr import { PlatformPipe } from './pipes/recharge-pipe/platform.pipe'; import { IntegralTypePipe } from './pipes/integral/integral-type.pipe'; import { IntegralProductPipe } from './pipes/integral/integral-product.pipe'; +import { MsgTypePipe } from './pipes/msg/msg-type.pipe'; +import { ProductTypePipe } from './pipes/third-product/product-type.pipe'; const PIPES = [ TimesPipe, @@ -108,6 +110,10 @@ const PIPES = [ GasClassGroupTaskStatusPipe, GasOrderStatusPipe, PlatformPipe, + IntegralTypePipe, + IntegralProductPipe, + MsgTypePipe, + ProductTypePipe, ]; @@ -120,15 +126,11 @@ const PIPES = [ NgxNeditorModule ], declarations: [ - ...PIPES, - IntegralTypePipe, - IntegralProductPipe, + ...PIPES ], exports: [ ...PIPES, - IntegralTypePipe, - IntegralProductPipe, ], }) diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 5956d41..b648dac 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -41,3 +41,4 @@ export * from './apiMerchant/source-type.pipe'; export * from './gas-class-group-task/gas-class-group-task-status.pipe'; export * from './gas-order/gas-order-status.pipe'; export * from './recharge-pipe/platform.pipe'; +export * from './third-product/product-type.pipe'; diff --git a/src/app/pipes/msg/msg-type.pipe.ts b/src/app/pipes/msg/msg-type.pipe.ts new file mode 100644 index 0000000..60156f9 --- /dev/null +++ b/src/app/pipes/msg/msg-type.pipe.ts @@ -0,0 +1,30 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'msgType' +}) +export class MsgTypePipe implements PipeTransform { + + array = { + 1: ['服务通知', '支付信息', '客服信息'], + 2: ['订单详情' , '外部链接' , '内部链接' , '客服信息'], + 3: ['个人信息' , '全局信息'] + }; + + transform(type: number , product: number): string { + return this.array[product][type - 1]; + } + + // transform(object: string , objectName: string): string { + // + // console.log(object); + // + // const o = JSON.parse(object); + // if (typeof o == 'object') { + // return o[objectName]; + // } + // return null; + // } + + +} diff --git a/src/app/services/cms.service.ts b/src/app/services/cms.service.ts index 3558b66..4a9aaa0 100644 --- a/src/app/services/cms.service.ts +++ b/src/app/services/cms.service.ts @@ -13,15 +13,102 @@ export class CmsService { private commonsService: CommonsService ) { } + /** + * 获取cms内容 + * @param paramObject 内容 + * @param callBack 回调 + */ + getListContent(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'cmsContent/getListContent?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + /** * 获取cms内容 - * @param paramObject - * @param callBack + * @param paramObject 内容 + * @param callBack 回调 */ - getListContent(paramObject: object, callBack) { - this.http.get(environment.baseUrl + 'cmsContent/getListContent?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + getListCmsContent(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'cmsContent/getListCmsContent?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { callBack(data); }); } + /** + * 根据id查询详情 + * + * @param roleType 公司id + * @param callBack 回调 + */ + public getOwnCategoryTree(roleType: number, callBack) { + this.http.get(environment.baseUrl + 'cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增cms内容 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertCmsContent(params: object, callBack) { + this.http.post(environment.baseUrl + 'cmsContent/insertCmsContent', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改cms内容 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public updateCmsContent(params: object, callBack) { + this.http.post(environment.baseUrl + 'cmsContent/updateCmsContent', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param id id + * @param callBack 回调 + */ + public findById(id: number, callBack) { + this.http.get(environment.baseUrl + 'cmsContent/findById?id=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id删除内容 + * + * @param id id + * @param callBack 回调 + */ + public deleteById(id: number, callBack) { + this.http.get(environment.baseUrl + 'cmsContent/deleteById?id=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改公司状态 + * + * @param id 用户id + * @param status status + * @param callBack 返回参数 + */ + public updateContentStatus(id: number, status: number, callBack) { + this.http.get(environment.baseUrl + 'cmsContent/updateContentStatus?id=' + id + '&status=' + status ).subscribe(data => { + callBack(data); + }); + } + } diff --git a/src/app/services/msg.service.ts b/src/app/services/msg.service.ts new file mode 100644 index 0000000..d9a59aa --- /dev/null +++ b/src/app/services/msg.service.ts @@ -0,0 +1,52 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class MsgService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询站内信消息 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getMsgByList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'bsMsg/getMsgByList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增站内信内容内容 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertMsg(params: object, callBack) { + this.http.post(environment.baseUrl + 'bsMsg/insertMsg', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 发布站内信 + * + * @param iId id + * @param callBack 回调 + */ + public pushMsg(id: number, callBack) { + this.http.get(environment.baseUrl + 'bsMsg/pushMsg?id=' + id).subscribe(data => { + callBack(data); + }); + } +}