From 84a57f36fb09d16221d60dd3e5306a19b566b8a9 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Mon, 9 Jan 2023 13:38:15 +0800
Subject: [PATCH] 1
---
.../cms-content-edit.component.html | 149 ----
.../cms-content-edit.component.less | 22 -
.../cms-content-edit.component.ts | 176 -----
.../cms-content/cms-content.component.html | 436 ++++++------
.../cms-content/cms-content.component.less | 27 -
.../cms/cms-content/cms-content.component.ts | 670 ++++--------------
src/app/admin/cms/cms-routing.module.ts | 2 -
src/app/admin/cms/cms.module.ts | 4 +-
.../content-edit/content-edit.component.html | 1 -
.../content-edit/content-edit.component.scss | 0
.../content-edit/content-edit.component.ts | 15 -
src/environments/environment.ts | 2 +-
12 files changed, 373 insertions(+), 1131 deletions(-)
delete mode 100644 src/app/admin/cms/cms-content-edit/cms-content-edit.component.html
delete mode 100644 src/app/admin/cms/cms-content-edit/cms-content-edit.component.less
delete mode 100644 src/app/admin/cms/cms-content-edit/cms-content-edit.component.ts
delete mode 100644 src/app/admin/cms/content-edit/content-edit.component.html
delete mode 100644 src/app/admin/cms/content-edit/content-edit.component.scss
delete mode 100644 src/app/admin/cms/content-edit/content-edit.component.ts
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
deleted file mode 100644
index 0c19708..0000000
--- a/src/app/admin/cms/cms-content-edit/cms-content-edit.component.html
+++ /dev/null
@@ -1,149 +0,0 @@
-
- 内容管理
- 修改内容
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
- 共搜索到 {{total}} 条数据
-
-
-
-
+
+
共计 {{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'}} |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ 分类名称 |
+ 内容标题 |
+ 展示平台 |
+ 状态 |
+ 创建时间 |
+ 操作 |
+
+
+
+
+ {{data.tag}} |
+ {{data.title}} |
+ {{data.platform | showType}} |
+
+ {{data.status == 1 ? '编辑中' : '已发布'}}
+ |
+ {{data.createTime | date:'yyyy-MM-dd' }} |
+
+ 更多操作
+
+
+
+ |
+
+
+
+
+
+
+
+
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..408578c 100644
--- a/src/app/admin/cms/cms-content/cms-content.component.ts
+++ b/src/app/admin/cms/cms-content/cms-content.component.ts
@@ -1,11 +1,20 @@
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, 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({
@@ -14,247 +23,90 @@ 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;
- /** 定义附件表单 **/
+
+ 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;
- /** 是否弹出添加 **/
- 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'
- ];
+ imgFile = [];
+ previewImage: string | undefined = '';
+ previewVisible = false;
+ id: number;
- 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;
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],
});
+ const roleType = 1;
+ this.findCategoryTree(roleType);
+ this.getRequest(true, this.searchForm.value);
- // 获取登录人 角色类型,查询分类树
- 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;
- }*/
this.findCategoryTree(roleType);
- this.getRequest();
}
- // 重置搜索
- 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 = '';
+ this.pageNum = 1;
}
- if (this.searchCategoryId == null) {
- this.searchCategoryId = '';
- }
- 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) {
@@ -272,23 +124,19 @@ export class CmsContentComponent implements OnInit {
generateComment(data) {
for (const i in data) {
if (data[i].nodes == null) {
- const item = {
- /** 重新赋值 **/
+ data[i] = {
isLeaf: true,
title: data[i].text,
key: data[i].id,
children: data[i].nodes,
};
- data[i] = item;
} else {
- const item = {
- /** 重新赋值 **/
+ data[i] = {
isLeaf: false,
title: data[i].text,
key: data[i].id,
children: data[i].nodes,
};
- data[i] = item;
this.generateComment(data[i].children);
}
}
@@ -296,337 +144,115 @@ export class CmsContentComponent implements OnInit {
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-routing.module.ts b/src/app/admin/cms/cms-routing.module.ts
index 29c6da4..5a6318e 100644
--- a/src/app/admin/cms/cms-routing.module.ts
+++ b/src/app/admin/cms/cms-routing.module.ts
@@ -4,7 +4,6 @@ import {CmsCategoryComponent} from './cms-category/cms-category.component';
import {CmsCategoryModuleComponent} from './cms-category-module/cms-category-module.component';
import {CmsContentComponent} from './cms-content/cms-content.component';
import {CmsContentAddComponent} from './cms-content-add/cms-content-add.component';
-import {CmsContentEditComponent} from './cms-content-edit/cms-content-edit.component';
import {CmsContentViewComponent} from './cms-content-view/cms-content-view.component';
@@ -13,7 +12,6 @@ const routes: Routes = [
{path: 'cmscategorymodule', component: CmsCategoryModuleComponent},
{path: 'cmscontent', component: CmsContentComponent},
{path: 'cmscontentadd', component: CmsContentAddComponent},
- {path: 'cmscontentedit', component: CmsContentEditComponent},
{path: 'cmscontentview', component: CmsContentViewComponent}
];
diff --git a/src/app/admin/cms/cms.module.ts b/src/app/admin/cms/cms.module.ts
index 94cb919..2c732dc 100644
--- a/src/app/admin/cms/cms.module.ts
+++ b/src/app/admin/cms/cms.module.ts
@@ -6,17 +6,15 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {NgxNeditorModule} from '@notadd/ngx-neditor';
import {CmsCategoryComponent} from './cms-category/cms-category.component';
-import {CmsContentEditComponent} from './cms-content-edit/cms-content-edit.component';
import {CmsContentViewComponent} from './cms-content-view/cms-content-view.component';
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, ContentEditComponent],
+ declarations: [CmsCategoryComponent, CmsCategoryModuleComponent, CmsContentComponent, CmsContentAddComponent, CmsContentViewComponent],
imports: [
CommonModule,
CmsRoutingModule,
diff --git a/src/app/admin/cms/content-edit/content-edit.component.html b/src/app/admin/cms/content-edit/content-edit.component.html
deleted file mode 100644
index 9723747..0000000
--- a/src/app/admin/cms/content-edit/content-edit.component.html
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/admin/cms/content-edit/content-edit.component.ts b/src/app/admin/cms/content-edit/content-edit.component.ts
deleted file mode 100644
index f8e4bf2..0000000
--- a/src/app/admin/cms/content-edit/content-edit.component.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-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/environments/environment.ts b/src/environments/environment.ts
index 6d6c8c2..b3ab509 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -6,7 +6,7 @@ export const environment = {
production: false,
baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
// orderUrl: 'http://localhost:9304/order/',
- // imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
+ imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
// baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
orderUrl: 'https://hsgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址)
// imageUrl: 'https://hsgcs.dctpay.com/filesystem/',