Commit 6de655ab by lixinming

no message

parent be2b30d8
/**
* 文字资料
* 文字资料 1.5改成【图片视频】,可以上传图片和视频
*/
import { ARTICLEPOSITION } from "../../../config/enum";
import { ARTICLEPOSITION, VIDEOANDIMGTYPEENUM } from "../../../config/enum";
import { ERRORENUM } from "../../../config/errorEnum";
import { addManyData } from "../../../data/add";
import { TABLEENUM } from "../../../data/models/model";
......@@ -12,6 +12,7 @@ import { generateSystemId, successResult } from "../../../tools/system";
import { BizError } from "../../../util/bizError";
import { extractData } from "../../../util/piecemeal";
import { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
import { eccReqParamater } from "../../../util/verificationParam";
/**
......@@ -20,6 +21,7 @@ import { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
* @returns
*/
export async function list({userId, type}) {
eccEnumValue("图片视频列表", "类型", VIDEOANDIMGTYPEENUM, type);
let dbList = await find(TABLEENUM.文字资料, {type});
let dataList = [];
......@@ -27,20 +29,15 @@ export async function list({userId, type}) {
let addList = [];
for (let i = 1; i <= 8; i++) {
let id = generateSystemId(TABLEENUM.文字资料, userId);
addList.push({id, rank:i, title:'', articleUrl:'', type, imgUrl:"", position:0, articleTitle:'', updateTime:0});
dataList.push({id, rank:i, title:'', articleUrl:'', type, imgUrl:"", position:0, articleTitle:'', updateTime:0});
addList.push({id, rank:i, title:'', type:0, imgUrl:"", coverUrl:"" });
dataList.push({id, rank:i, title:'', type:0, imgUrl:"", coverUrl:"" });
}
await addManyData(TABLEENUM.文字资料, addList);
}
dataList.sort((a:any, b:any) => {return a.rank - b.rank });
for (let i =0; i < dbList.length; i++) {
let info= dbList[i];
let item:any = extractData(info, ["id", "title", "rank", "position", "articleTitle" ]);
if (!item.position) item.position = "未选择";
else item.position = changeEnumValue(ARTICLEPOSITION, item.position);
let articleInfo = await findOnce(TABLEENUM.文章管理, {id:item.articleTitle}, ["id", "title"]);
item.articleTitle = articleInfo && articleInfo.id ? articleInfo.title : '';
let item:any = extractData(info, [ "id", "title", "rank", "type", "imgUrl", "coverUrl" ]);
dataList.push(item);
}
......@@ -53,6 +50,7 @@ export async function list({userId, type}) {
* 预览
*/
export async function preview({userId, type}) {
eccEnumValue("图片视频列表", "类型", VIDEOANDIMGTYPEENUM, type);
let dbList = await find(TABLEENUM.文字资料, {type});
let dataList = [];
......@@ -60,14 +58,14 @@ export async function preview({userId, type}) {
let addList = [];
for (let i = 1; i <= 8; i++) {
let id = generateSystemId(TABLEENUM.文字资料, userId);
addList.push({id, rank:i, title:'', articleUrl:'', type, imgUrl:"", position:0, articleTitle:'', updateTime:0});
dataList.push({id, rank:i, title:'', articleUrl:'', type, imgUrl:"", position:0, articleTitle:'', updateTime:0});
addList.push({id, rank:i, title:'', type:0, imgUrl:"", coverUrl:"" });
dataList.push({id, rank:i, title:'', type:0, imgUrl:"", coverUrl:"" });
}
await addManyData(TABLEENUM.文字资料, addList);
}
dataList.sort((a:any, b:any) => {return a.rank - b.rank });
dbList.forEach(info => {
let item = extractData(info, ["id", "title", "rank", "imgUrl", "updateTime"]);
let item = extractData(info, ["id", "title", "rank", "type", "imgUrl", "coverUrl"]);
dataList.push(item);
});
......@@ -82,12 +80,18 @@ export async function preview({userId, type}) {
* @param updateParam
* @returns
*/
export async function update({userId, id, title, imgUrl, position, articleTitle, articleUrl, updateTime}) {
eccEnumValue('修改文字资料', '位置', ARTICLEPOSITION, position );
export async function update({userId, id, title, imgUrl,type, updateTime, coverUrl}) {
eccEnumValue("图片视频修改", "类型", VIDEOANDIMGTYPEENUM, type);
if (type == VIDEOANDIMGTYPEENUM.图片) {
coverUrl = "";
} else {
if (!coverUrl) throw new BizError(ERRORENUM.参数错误, "修改图片视频时 缺少视频封面");
eccReqParamater("修改图片视频", {"coverUrl":"String"}, {coverUrl} );
}
let oldInfo = await findOnce(TABLEENUM.文字资料, {id});
if (!oldInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
await updateOneData(TABLEENUM.文字资料, {id}, {title, imgUrl, position, articleTitle, articleUrl, updateTime});
await updateOneData(TABLEENUM.文字资料, {id}, {title, imgUrl, type, coverUrl, updateTime});
return successResult();
}
......@@ -108,6 +112,6 @@ export async function del({userId, id}) {
export async function info({id}) {
let oldInfo = await findOnce(TABLEENUM.文字资料, {id});
if (!oldInfo || !oldInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
let dataInfo = extractData(oldInfo, ["id", "title", "imgUrl", "position", "articleTitle", "articleUrl", "updateTime"]);
let dataInfo = extractData(oldInfo, ["id", "title", "rank", "type", "imgUrl", "coverUrl"]);
return { dataInfo };
}
\ No newline at end of file
/**
* 学习园地
* 学习园地 1.5版本已去除
*
*
*/
......
/**
* 主题教育
*/
import { PARTYBUILDTYPEENUM, STATE } from "../../../config/enum";
import { ERRORENUM } from "../../../config/errorEnum";
import { addManyData } from "../../../data/add";
......
......@@ -61,11 +61,11 @@ export async function filePosition() {
dataList.push({key:keyStr, value});
}
}
let wenZiDBList = await find(TABLEENUM.党建, {type:PARTYBUILDTYPEENUM.学习园地, subType:PARTYBUILDSUBTYPEENUM.文字资料});
wenZiDBList.forEach(info => {
let {id, name} = info;
dataList.push({key:`学习园地-${name}`, value:id});
});
// let wenZiDBList = await find(TABLEENUM.党建, {type:PARTYBUILDTYPEENUM.学习园地, subType:PARTYBUILDSUBTYPEENUM.文字资料});
// wenZiDBList.forEach(info => {
// let {id, name} = info;
// dataList.push({key:`学习园地-${name}`, value:id});
// });
let zhuTiDBList = await find(TABLEENUM.党建, {type:PARTYBUILDTYPEENUM.主题教育});
zhuTiDBList.forEach(info => {
let {id, name} = info;
......
......@@ -45,6 +45,14 @@ export enum INFORMATIONTYPEENUM {
/**
* 图片视频类型
*/
export enum VIDEOANDIMGTYPEENUM {
图片 = 1,
视频 = 2
}
/**
* 通知公告
*/
export enum TONGZHIGONGGAO {
......@@ -133,6 +141,7 @@ export enum ARTICLEPOSITION {
品牌项目_hgh社会服务,
品牌项目_hgh学术研究,
品牌项目_hgh展演竞赛,
学习园地_文字资料
// 党建工作_hgh主题教育
}
......@@ -142,9 +151,9 @@ export enum ARTICLEPOSITION {
*/
export enum VIDEOPOSITION {
首页_hgh热点视频 = 1,
党建工作_hgh主题教育,
党建工作_hgh工作动态,
党建工作_hgh学习交流
// 党建工作_hgh主题教育, 1.5版本去除
// 党建工作_hgh工作动态,
// 党建工作_hgh学习交流
}
......
......@@ -168,11 +168,12 @@ const ModelArray = [
id:{ type:'String', index:true },
title:'String',//展示标题
rank:'Number',//排序
imgUrl:'String',//图片地址
position:'Number',//位置
articleTitle:'String',//文章标题
articleUrl:'String',//链接 前端生成
type:'Number',//分类 参考党建表>学习园地>文字资料
coverUrl:'String',//封面地址 1.5新加
imgUrl:'String',//视频图片地址
position:'Number',//位置 1.5弃用
articleTitle:'String',//文章标题 1.5弃用
articleUrl:'String',//链接 前端生成 1.5弃用
type:'Number',//分类 参考党建表>学习园地>文字资料 1.5改成枚举 VIDEOANDIMGTYPEENUM
updateTime:'Number',//更新时间
}
},
......
......@@ -840,30 +840,30 @@ export const Config = {
},
],
"党建工作_学习园地":[
{
apiName:"列表",
subUrl:'/dangjiangonzuo/xuexiyuandi/list',
param:[
],
bindBiz:xueXiYuanDiBiz.list
},
{
apiName:"修改",
subUrl:'/dangjiangonzuo/xuexiyuandi/update',
param:[
{key:"id", type:"Number", desc:"标识"},
{key:"typeName", type:"String", desc:"分类名称"}
],
bindBiz:xueXiYuanDiBiz.update
},
{
apiName:"修改状态",
subUrl:'/dangjiangonzuo/xuexiyuandi/changestate',
param:[
{key:"id", type:"Number", desc:"标识"}
],
bindBiz:xueXiYuanDiBiz.changeState
}
// {
// apiName:"列表",
// subUrl:'/dangjiangonzuo/xuexiyuandi/list',
// param:[
// ],
// bindBiz:xueXiYuanDiBiz.list
// },
// {
// apiName:"修改",
// subUrl:'/dangjiangonzuo/xuexiyuandi/update',
// param:[
// {key:"id", type:"Number", desc:"标识"},
// {key:"typeName", type:"String", desc:"分类名称"}
// ],
// bindBiz:xueXiYuanDiBiz.update
// },
// {
// apiName:"修改状态",
// subUrl:'/dangjiangonzuo/xuexiyuandi/changestate',
// param:[
// {key:"id", type:"Number", desc:"标识"}
// ],
// bindBiz:xueXiYuanDiBiz.changeState
// }
],
"党建工作_主题教育":[
{
......@@ -930,11 +930,9 @@ export const Config = {
param:[
{key:"id", type:"String", desc:"标识"},
{key:"title", type:"String", desc:"展示标题"},
{key:"imgUrl", type:"String", desc:"图片地址"},
{key:"articleUrl", type:"String", desc:"文字链接"},
{key:"position", type:"Number", desc:"位置"},
{key:"articleTitle", type:"String", desc:"文章标题"},
{key:"updateTime", type:"Number", desc:"更新时间"}
{key:"imgUrl", type:"String", desc:"图片or视频地址"},
{key:"type", type:"Number", desc:"类型 参考公用接口videoimgtype"},
{key:"coverUrl", type:"Number", desc:"视频封面地址 当类型为图片时可以不传", notMustHave:true},
],
bindBiz:wenZiZiLiaoBiz.update
},
......
......@@ -225,6 +225,13 @@ export const Config = {
param:[],
defaultParam:enumConfig.OOSCODE,
bindBiz:publicBiz.setEnumInterface
},
{
apiName:"视频图片类型",
subUrl:'/videoimgtype',
param:[],
defaultParam:enumConfig.VIDEOANDIMGTYPEENUM,
bindBiz:publicBiz.setEnumInterface
}
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment