Default Changelist

pull/1/head
袁野 3 years ago
parent 7ee96fa41a
commit 209459d4de
  1. 76
      src/app/admin/cms/cms-content/cms-content.component.ts
  2. 8
      src/environments/environment.ts

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {HttpClient, HttpEvent, HttpEventType, HttpRequest, HttpResponse} from '@angular/common/http'; import {HttpClient, HttpEvent, HttpEventType, HttpRequest, HttpResponse} from '@angular/common/http';
import {NzMessageService, NzModalService, UploadXHRArgs} from 'ng-zorro-antd'; import {NzMessageService, NzModalService, UploadXHRArgs} from 'ng-zorro-antd';
@ -52,8 +52,10 @@ export class CmsContentComponent implements OnInit {
// 附件返回地址 // 附件返回地址
patchPath = ''; patchPath = '';
// 允许上传的文件类型 // 允许上传的文件类型
annexForm: FormGroup; /** 定义附件表单 **/ annexForm: FormGroup;
isVisible = false; /** 是否弹出添加 **/ /** 定义附件表单 **/
isVisible = false;
/** 是否弹出添加 **/
fileList = []; fileList = [];
// 上传的后缀名 // 上传的后缀名
suffix = ''; suffix = '';
@ -150,30 +152,35 @@ export class CmsContentComponent implements OnInit {
BTN_cmscontent_delete = 0; BTN_cmscontent_delete = 0;
BTN_cmscontent_patch = 0; BTN_cmscontent_patch = 0;
BTN_cmscontent_up_down = 0; BTN_cmscontent_up_down = 0;
constructor( constructor(
private fb: FormBuilder, private fb: FormBuilder,
private http: HttpClient, // http请求 private http: HttpClient, // http请求
private message: NzMessageService, // 信息提示 private message: NzMessageService, // 信息提示
private router: Router, private router: Router,
private modalService: NzModalService, // 对话框 private modalService: NzModalService, // 对话框
private store: LocalStorageService , // 请求缓存 private store: LocalStorageService, // 请求缓存
) { ) {
this.WEB_SERVE_URL = environment.imageUrl; this.WEB_SERVE_URL = environment.baseUrl;
this.searchCompanyId = this.store.get(ADMIN_INFO_OBJECT)['secUser']['companyId']; this.searchCompanyId = this.store.get(ADMIN_INFO_OBJECT)['secUser']['companyId'];
} }
ngOnInit() { ngOnInit() {
/** 循环查询 按钮权限 **/ /** 循环查询 按钮权限 **/
for (let i = 0; i < this.store.get(ADMIN_INFO_OBJECT)['buttonList'] .length; i++) { 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' ) { if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_add') {
this.BTN_cmscontent_add = 1; this.BTN_cmscontent_add = 1;
}if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_edit' ) { }
if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_edit') {
this.BTN_cmscontent_edit = 1; this.BTN_cmscontent_edit = 1;
}if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_delete' ) { }
if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_delete') {
this.BTN_cmscontent_delete = 1; this.BTN_cmscontent_delete = 1;
}if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_patch' ) { }
if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_patch') {
this.BTN_cmscontent_patch = 1; this.BTN_cmscontent_patch = 1;
}if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_up_down' ) { }
if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_up_down') {
this.BTN_cmscontent_up_down = 1; this.BTN_cmscontent_up_down = 1;
} }
} }
@ -204,6 +211,7 @@ export class CmsContentComponent implements OnInit {
this.findCategoryTree(roleType); this.findCategoryTree(roleType);
this.getRequest(); this.getRequest();
} }
// 重置搜索 // 重置搜索
resetSearch() { resetSearch() {
// 搜索内容标题 // 搜索内容标题
@ -213,6 +221,7 @@ export class CmsContentComponent implements OnInit {
// 分类搜索 // 分类搜索
this.searchCategoryId = ''; this.searchCategoryId = '';
} }
// 请求列表 // 请求列表
getRequest(reset: boolean = false) { getRequest(reset: boolean = false) {
this.showPatch = 0; this.showPatch = 0;
@ -237,12 +246,14 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 搜索 // 搜索
getSearch() { getSearch() {
this.getRequest(); this.getRequest();
} }
// 查询分类树 // 查询分类树
findCategoryTree (roleType) { findCategoryTree(roleType) {
this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => { this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.nodes = data['return_data']; this.nodes = data['return_data'];
@ -256,11 +267,13 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 递归分类树 // 递归分类树
generateComment (data) { generateComment(data) {
for (const i in data) { for (const i in data) {
if (data[i].nodes == null) { if (data[i].nodes == null) {
const item = { /** 重新赋值 **/ const item = {
/** 重新赋值 **/
isLeaf: true, isLeaf: true,
title: data[i].text, title: data[i].text,
key: data[i].id, key: data[i].id,
@ -268,7 +281,8 @@ export class CmsContentComponent implements OnInit {
}; };
data[i] = item; data[i] = item;
} else { } else {
const item = { /** 重新赋值 **/ const item = {
/** 重新赋值 **/
isLeaf: false, isLeaf: false,
title: data[i].text, title: data[i].text,
key: data[i].id, key: data[i].id,
@ -281,6 +295,7 @@ export class CmsContentComponent implements OnInit {
this.nodes = data; this.nodes = data;
console.log(this.nodes); console.log(this.nodes);
} }
// 跳转添加 // 跳转添加
getAdd() { getAdd() {
this.router.navigate(['/admin/cms/cmscontentadd'], { this.router.navigate(['/admin/cms/cmscontentadd'], {
@ -289,6 +304,7 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 跳转修改 // 跳转修改
getEdit(id) { getEdit(id) {
this.router.navigate(['/admin/cms/cmscontentedit'], { this.router.navigate(['/admin/cms/cmscontentedit'], {
@ -297,6 +313,7 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 跳转详情 // 跳转详情
getContentView(id) { getContentView(id) {
this.router.navigate(['/admin/cms/cmscontentview'], { this.router.navigate(['/admin/cms/cmscontentview'], {
@ -305,6 +322,7 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 对话框删除 // 对话框删除
showDeleteConfirmDelete(id): void { showDeleteConfirmDelete(id): void {
this.modalService.confirm({ this.modalService.confirm({
@ -314,16 +332,19 @@ export class CmsContentComponent implements OnInit {
nzCancelText: '否', nzCancelText: '否',
}); });
} }
// 删除内容 // 删除内容
deleteContent(id) { deleteContent(id) {
if (id === undefined) { if (id === undefined) {
return; return;
}if (id === null) { }
if (id === null) {
return; return;
}if (id === '') { }
if (id === '') {
return; return;
} }
this.http.get(this.WEB_SERVE_URL + '/cmsContent/delContent?id=' + id).subscribe( data => { this.http.get(this.WEB_SERVE_URL + '/cmsContent/delContent?id=' + id).subscribe(data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`); this.message.create('success', `删除成功!`);
this.getRequest(); this.getRequest();
@ -332,10 +353,11 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 查询附件列表 // 查询附件列表
findPatchByContent(id) { findPatchByContent(id) {
this.contentSelect = id; this.contentSelect = id;
this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListPatches?pageNum=1&pageSize=100&contentId=' + id).subscribe( data => { this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListPatches?pageNum=1&pageSize=100&contentId=' + id).subscribe(data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.showPatch = 1; this.showPatch = 1;
this.patchList = data['return_data'].list; this.patchList = data['return_data'].list;
@ -345,10 +367,12 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 弹出添加附件 // 弹出添加附件
addPatch() { addPatch() {
this.isVisible = true; this.isVisible = true;
} }
// 删除附件确认 // 删除附件确认
showDeletePatch(id) { showDeletePatch(id) {
this.modalService.confirm({ this.modalService.confirm({
@ -358,12 +382,13 @@ export class CmsContentComponent implements OnInit {
nzCancelText: '否', nzCancelText: '否',
}); });
} }
// 删除附件 // 删除附件
deletePatch(id) { deletePatch(id) {
if (id === undefined || id === null || id === '') { if (id === undefined || id === null || id === '') {
return; return;
} }
this.http.get(this.WEB_SERVE_URL + '/cmsPatch/delPatch?id=' + id).subscribe( data => { this.http.get(this.WEB_SERVE_URL + '/cmsPatch/delPatch?id=' + id).subscribe(data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`); this.message.create('success', `删除成功!`);
this.findPatchByContent(this.contentSelect); this.findPatchByContent(this.contentSelect);
@ -372,6 +397,7 @@ export class CmsContentComponent implements OnInit {
} }
}); });
} }
// 取消按钮 // 取消按钮
handleCancel(): void { handleCancel(): void {
this.isVisible = false; this.isVisible = false;
@ -379,6 +405,7 @@ export class CmsContentComponent implements OnInit {
this.fileList = []; this.fileList = [];
/** 隐藏弹框 **/ /** 隐藏弹框 **/
} }
// 附件类型选择 // 附件类型选择
getChange(event) { getChange(event) {
if (event != null) { if (event != null) {
@ -386,6 +413,7 @@ export class CmsContentComponent implements OnInit {
console.log(event); console.log(event);
} }
} }
// 附件上传设置 // 附件上传设置
customReq = (item: UploadXHRArgs) => { customReq = (item: UploadXHRArgs) => {
this.patchPath = ''; // 置空路径 this.patchPath = ''; // 置空路径
@ -418,6 +446,7 @@ export class CmsContentComponent implements OnInit {
} }
); );
} }
/** 清空 **/ /** 清空 **/
emptyForm(e: MouseEvent): void { emptyForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
@ -427,6 +456,7 @@ export class CmsContentComponent implements OnInit {
this.annexForm.controls[key].updateValueAndValidity(); this.annexForm.controls[key].updateValueAndValidity();
} }
} }
// 附件弹窗确定添加按钮 // 附件弹窗确定添加按钮
handlePatchOk(value: any): void { handlePatchOk(value: any): void {
// 校验类型选择与必填 // 校验类型选择与必填
@ -495,6 +525,7 @@ export class CmsContentComponent implements OnInit {
this.message.create('error', `未知错误!`); this.message.create('error', `未知错误!`);
}); });
} }
// 弹出发布附件 // 弹出发布附件
addPush(id, categoryId) { addPush(id, categoryId) {
this.findModuleByCategory(categoryId); this.findModuleByCategory(categoryId);
@ -502,6 +533,7 @@ export class CmsContentComponent implements OnInit {
// document.getElementById('resetPush').click(); // document.getElementById('resetPush').click();
this.isPublish = true; this.isPublish = true;
} }
// 取消发布 // 取消发布
handleCancelPush(): void { handleCancelPush(): void {
this.isPublish = false; this.isPublish = false;
@ -509,6 +541,7 @@ export class CmsContentComponent implements OnInit {
this.pushId = ''; this.pushId = '';
/** 隐藏弹框 **/ /** 隐藏弹框 **/
} }
// 附件弹窗确定添加按钮 // 附件弹窗确定添加按钮
handlePushOk(value: any): void { handlePushOk(value: any): void {
console.log('发布'); console.log('发布');
@ -545,6 +578,7 @@ export class CmsContentComponent implements OnInit {
this.message.create('error', `未知错误!`); this.message.create('error', `未知错误!`);
}); });
} }
/** 清空模板 **/ /** 清空模板 **/
emptyPushForm(e: MouseEvent): void { emptyPushForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
@ -554,6 +588,7 @@ export class CmsContentComponent implements OnInit {
this.pushForm.controls[key].updateValueAndValidity(); this.pushForm.controls[key].updateValueAndValidity();
} }
} }
// 根据内容分类查询可使用的模板列表 // 根据内容分类查询可使用的模板列表
findModuleByCategory(categoryId) { findModuleByCategory(categoryId) {
this.http.get(this.WEB_SERVE_URL + '/cmsCategoryModule/getModuleByCategoryId?categoryId=' + categoryId).subscribe(data => { this.http.get(this.WEB_SERVE_URL + '/cmsCategoryModule/getModuleByCategoryId?categoryId=' + categoryId).subscribe(data => {
@ -574,6 +609,7 @@ export class CmsContentComponent implements OnInit {
nzCancelText: '否', nzCancelText: '否',
}); });
} }
// 下线 // 下线
DownContent(id) { DownContent(id) {
// 定义附件数据 // 定义附件数据

@ -4,10 +4,10 @@
export const environment = { export const environment = {
production: false, production: false,
// baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
// imageUrl: 'http://localhost:9302/filesystem/', imageUrl: 'http://localhost:9302/filesystem/',
baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsgcs.dctpay.com/filesystem/', // imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
}; };

Loading…
Cancel
Save