Commit ae45e3b9 by bert

学习自动构建

parent 38da07fa
......@@ -7,7 +7,9 @@
"babel-plugin-antd": "0.4.x",
"babel-plugin-transform-runtime": "^6.8.0",
"babel-runtime": "^6.6.1",
"bce-sdk-js": "^0.1.8",
"classnames": "^2.2.3",
"echarts-for-react": "^1.1.2",
"es3ify-loader": "^0.2.0",
"fetch-ie8": "^1.4.0",
"history": "^2.0.1",
......
/**
* [Config description]
* @type {Object}
*
* header 管理后台头部配置
* title String 标题
* icon String 标题图标
* style Object 自定义样式
*
* sider 管理后台侧栏配置
* menu Array sider列表
* openKeys Array 默认展开的sider区
* selectedKey String 默认打开的功能区
* style Object 自定义样式
*
* main 功能区域配置
* components Object 配置sider对应功能区域组件
* Feature1 Object 对应sider menu 中的功能key对 应功能组件
* style Object 配置样式
*/
const Config = {
header: {
title: "测试配置管理后台",
icon: "appstore",
style: {
padding: "15px 15px 15px 25px",
borderBottom: "1px solid #E9E9E9",
backgroundColor: "#F5F5F5"
}
},
sider: {
menu: [
{
title: "数据展示项",
key: "dataShow",
icon: "bars",
items: [
{title: "table数据展示项", key: "Feature1-1"},
{title: "simple对象数据展示项", key: "Feature1-2"},
{title: "数据可视化展示项", key: "Feature1-3"},
{title: "综合数据展示", key: "Feature1-4"}
]
},
{
title: "数据操作项目",
key: "dataOperate",
icon: "bars",
items: [
{title: "table数据搜索操作", key: "Feature2-1"},
{title: "table数据增删改操作", key: "Feature2-2"},
{title: "simple对象数据修改操作", key: "Feature2-3"}
]
},
{
title: "自定义操作项目",
key: "customOperate",
icon: "bars",
items: [
{title: "富文本编辑功能", key: "Feature3-1"}
]
},
{
title: "导航1",
key: "subTitle1",
icon: "setting",
items: [
{title: "选项1", key: "Feature1"},
{title: "选项2", key: "Feature2"},
{title: "选项3", key: "Feature3"},
{
title: "导航3",
key: "subTitle3",
icon: "",
items: [
{title: "选项6", key: "Feature6"},
{title: "选项7", key: "Feature7"},
{title: "选项8", key: "Feature8"}
]
}
]
},{
title: "导航2",
key: "subTitle2",
icon: "delete",
items: [
{title: "选项4", key: "Feature4"}
]
},{
title: "选项5",
key: "Feature5"
}
],
openKeys:['dataShow','dataOperate'],
selectedKey: "Feature1",
style: {}
},
main: {
components: {
"Feature1-1": {
title: 'table 数据展示',
component: require('../feature/Feature1-1')
},
"Feature1-2": {
title: 'simple对象 数据展示',
component: require('../feature/Feature1-2')
},
"Feature1-3": {
title: '数据可视化 数据展示',
component: require('../feature/Feature1-3')
},
"Feature1-4": {
title: '综合数据展示',
component: require('../feature/Feature1-4')
},
"Feature2-1": {
title: 'table 数据搜索操作',
component: require('../feature/Feature2-1')
},
"Feature2-2": {
title: 'table 数据增删改操作',
component: require('../feature/Feature2-2')
},
"Feature2-3": {
title: 'simple对象数据修改操作',
component: require('../feature/Feature2-3')
},
"Feature3-1": {
title: '富文本编辑区域',
component: require('../feature/Feature3-1')
},
"Feature1": {
title: '这是功能区域标题1',
component: require('../feature/Feature1')
}, // 纯数据展示
"Feature2": {
title: '这是功能区域标题2',
component: require('../feature/Feature2')
}, // 添加操作
"Feature3": {
title: '这是功能区域标题3',
component: require('../feature/Feature3')
},
"Feature4": {
title: '这是功能区域标题4',
component: require('../feature/Feature4')
},
"Feature5": {
title: '这是功能区域标题5',
component: require('../feature/Feature5')
},
"Feature6": {
title: '这是功能区域标题6',
component: require('../feature/Feature6')
},
"Feature7": {
title: '这是功能区域标题7',
component: require('../feature/Feature7')
},
"Feature8": {
title: '这是功能区域标题8',
component: require('../feature/Feature2')
}
},
style: {}
},
permission: BaiduInfo.permission,
loginUrl: BaiduInfo.loginUrl
}
export default Config;
\ No newline at end of file
const tableList = [
{
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 10:27:00",
docid: "16112285443883430307",
images: [{
height: "533",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/1/7/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
width: "400"
}, {
height: "300",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/8/e/6/8e62b06541d752bd3719107a1f5f0496.jpg",
imgsize: "400,300",
width: "400"
}, {
height: "533",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/f/9/2/f92664dedc81ce5c2d83c28aeff66eed.jpg",
imgsize: "400,533",
width: "400"
}],
images_bos: [{
height: "533",
img: "http://image.cbs.baidu.com/news_topic/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
width: "400"
}, {
height: "300",
img: "http://image.cbs.baidu.com/news_topic/8e62b06541d752bd3719107a1f5f0496.jpg",
imgsize: "400,300",
width: "400"
}, {
height: "533",
img: "http://image.cbs.baidu.com/news_topic/f92664dedc81ce5c2d83c28aeff66eed.jpg",
imgsize: "400,533",
width: "400"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/1/7/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49259851_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: " 在谅解协议中,北青报记者看到,“鉴于被告人周凌俊在案发时有精神分裂症,控制能力差,并且开庭前积极赔偿给我全部损失(略),我对被告人周凌俊的行为表示谅解,请求法院对被告人周凌俊从轻、减轻、免除死刑刑事处罚…",
title: "男子砍伤9人被判死刑 8受害人请求免除死刑(图)",
topic_keyword: [{
tag: "周凌俊",
weight: 1
}, {
tag: "老周",
weight: 0.52631578947368
}, {
tag: "北青报记者",
weight: 0.50877192982456
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 4
}, {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 10:35:00",
docid: "15788188560275870714",
images: [{
height: "450",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/c/3/cc3678d2917d866635649c0134d61aa7.jpg",
imgsize: "600,450",
width: "600"
}, {
height: "450",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/0/f/5/0f5f5dfcb1b2408b610c0736fe252505.jpg",
imgsize: "600,450",
width: "600"
}],
images_bos: [{
height: "338",
img: "http://image.cbs.baidu.com/news_topic/cc3678d2917d866635649c0134d61aa7.jpg",
imgsize: "450,338",
width: "450"
}, {
height: "338",
img: "http://image.cbs.baidu.com/news_topic/0f5f5dfcb1b2408b610c0736fe252505.jpg",
imgsize: "450,338",
width: "450"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/c/3/cc3678d2917d866635649c0134d61aa7.jpg",
imgsize: "600,450",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49262944_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "2015年11月2日,上海,中国商飞举行国产C919大飞机下线盛大仪式,这一历史性突破正式宣告中国可以自主生产大型客机,标志着中国高端装备制造发展到一个全新高度。",
title: "俄媒:中俄合研C929宽体客机 正面对决波音、空客",
topic_keyword: [{
tag: "中国",
weight: 1
}, {
tag: "俄罗斯",
weight: 0.85
}, {
tag: "发动机",
weight: 0.55
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050007",
categoryid: "1",
date: "2016-06-29 10:52:00",
docid: "1732528765762091310",
images: [{
height: "516",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/e/7/3/e73c14ca4401563154cfe1f64a2cf28a.jpg",
imgsize: "640,516",
width: "640"
}, {
height: "354",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/b/a/3/ba37c914dca4489a54a9575e28c1211b.jpg",
imgsize: "640,354",
width: "640"
}, {
height: "485",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/2/0/4/20493818c0b17639f5dc0950bd5f0bdb.jpg",
imgsize: "640,485",
width: "640"
}],
images_bos: [{
height: "516",
img: "http://image.cbs.baidu.com/news_topic/e73c14ca4401563154cfe1f64a2cf28a.jpg",
imgsize: "640,516",
width: "640"
}, {
height: "354",
img: "http://image.cbs.baidu.com/news_topic/ba37c914dca4489a54a9575e28c1211b.jpg",
imgsize: "640,354",
width: "640"
}, {
height: "485",
img: "http://image.cbs.baidu.com/news_topic/20493818c0b17639f5dc0950bd5f0bdb.jpg",
imgsize: "640,485",
width: "640"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/e/7/3/e73c14ca4401563154cfe1f64a2cf28a.jpg",
imgsize: "640,516",
keyword: "",
link: "http://tech.qq.com/a/20160629/022080.htm",
mark: "0",
score: 89.52380952381,
source: "腾讯新闻",
src_type: "video",
srctype: "0",
summary: "[摘要]近日,中加英美等国科学家在缅甸的一块琥珀中发现了恐龙时代鸟类翅膀标本,这是人类首次亲眼目睹恐龙时代鸟类的真面目。",
title: "科学家首次在琥珀中发现恐龙时代古鸟 侏罗纪公园将成真?",
topic_keyword: [{
tag: "人类首次",
weight: 1
}, {
tag: "万年",
weight: 0.86666666666667
}, {
tag: "天使之翼标本",
weight: 0.8
}, {
tag: "恐龙时代鸟类",
weight: 0.8
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050004",
categoryid: "1",
date: "2016-06-29 10:51:00",
docid: "15863271834245197970",
images: [{
height: "1151",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/2/4/c/24c177a72c3fc089a9111433de69eaf1.jpg",
imgsize: "432,1151",
width: "432"
}],
images_bos: [{
height: "1151",
img: "http://image.cbs.baidu.com/news_topic/24c177a72c3fc089a9111433de69eaf1.jpg",
imgsize: "432,1151",
width: "432"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/2/4/c/24c177a72c3fc089a9111433de69eaf1.jpg",
imgsize: "432,1151",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263816_0.shtml",
mark: "0",
score: 87.317073170732,
source: "凤凰网",
src_type: "text",
srctype: "0",
summary: "@湖北日报:#湖北人事#【王国生离开湖北工作 就任其它省省委书记】6月29日上午,湖北省庆祝中国共产党成立95周年大会在洪山礼堂召开。",
title: "湖北省长王国生离开湖北 就任其它省省委书记",
topic_keyword: [{
tag: "湖北工作",
weight: 1
}, {
tag: "王国生",
weight: 1
}, {
tag: "省省委书记",
weight: 0.93333333333333
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 10:51:00",
docid: "15858160071550440048",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263707_0.shtml",
mark: "0",
score: 80,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "另一方面,进行田野工作的民族志学者要么是男性,要么是被一个由男性主导的学科话语体系训练而成的女性,这两个原因造成了以男性视角表达的学术观点成了通用语,便于所有民族志学者的理解,因而这导致了更便于理解的男性话语体系的田野信息被更多地记录和书写。",
title: "为什么公共领域女性普遍失语?",
topic_keyword: [{
tag: "话语体系",
weight: 1
}, {
tag: "父权社会",
weight: 0.63888888888889
}, {
tag: "也是人类社会",
weight: 0.27777777777778
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050013",
categoryid: "1",
date: "2016-06-29 10:25:00",
docid: "2561260641347014152",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.youth.cn/sh/201606/t20160629_8203731.htm",
mark: "0",
score: 80,
source: "青文天下",
src_type: "text",
srctype: "0",
summary: "  有人专门销售氰化物、琥珀胆碱、呋喃丹等高毒药品,有人专门购买这些药品用于毒狗、毒鸟,有人专门收购被毒死的狗和鸟,最终,1.4万余斤含有剧毒的狗肉、11万余只毒鸟流向了安徽、山东、江苏、上海、天津、广东等地。",
title: "1.4万余斤毒狗肉11万只毒鸟流向餐桌 22人获刑",
topic_keyword: [{
tag: "氰化物",
weight: 1
}, {
tag: "侦查人员",
weight: 0.90909090909091
}, {
tag: "猫队长",
weight: 0.90909090909091
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 09:27:00",
docid: "3127119229359255953",
images: [{
height: "372",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/0/e/c0e828800066a8d9c84f472506597881.jpg",
imgsize: "620,372",
width: "620"
}, {
height: "279",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/6/1/c61b06a980206aea4c2872e755570f15.jpg",
imgsize: "355,279",
width: "355"
}, {
height: "486",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/1/5/0/1506d108045a7477677903adcd6b5ea9.jpg",
imgsize: "300,486",
width: "300"
}],
images_bos: [{
height: "372",
img: "http://image.cbs.baidu.com/news_topic/c0e828800066a8d9c84f472506597881.jpg",
imgsize: "620,372",
width: "620"
}, {
height: "279",
img: "http://image.cbs.baidu.com/news_topic/c61b06a980206aea4c2872e755570f15.jpg",
imgsize: "355,279",
width: "355"
}, {
height: "486",
img: "http://image.cbs.baidu.com/news_topic/1506d108045a7477677903adcd6b5ea9.jpg",
imgsize: "300,486",
width: "300"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/0/e/c0e828800066a8d9c84f472506597881.jpg",
imgsize: "620,372",
keyword: "",
link: "http://finance.ifeng.com/a/20160629/14538920_0.shtml",
mark: "0",
score: 89.52380952381,
source: "finance.ifeng.com",
src_type: "text",
srctype: "0",
summary: " 在28日欧洲议会首次就英国全民公投决定退出欧盟举行辩论,尽管欧盟首脑敦促英国尽快启动退欧程序,但按照卡梅伦宣布的程序,启动“里斯本条约”第50条款,开启脱欧正式法律程序的工作要留给下一任英国首相。",
title: "英国官员答凤凰用什么方式脱欧:跟中国学 两条腿走路",
topic_keyword: [{
tag: "英国",
weight: 1
}, {
tag: "卡梅伦",
weight: 0.20224719101124
}, {
tag: "英国首相卡梅伦",
weight: 0.13483146067416
}, {
tag: "鲍里斯",
weight: 0.13483146067416
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 2
}, {
bdsourceid: "309050007",
categoryid: "1",
date: "2016-06-29 09:44:00",
docid: "11225159263224006488",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://finance.qq.com/a/20160629/010127.htm",
mark: "0",
score: 80,
source: "腾讯新闻",
src_type: "text",
srctype: "0",
summary: " 对于远大所说的审查,望城区政府办公室2015年5月25日通过官网回复民众提问时说,天空城市项目结构体系,已获全国超限高层建筑工程抗震设防审查专家委员会的审查通过,项目的消防等其他相关内容正在进行设计,“待所有设计完成并获得审批通过后便会开工建设”。",
title: "长沙世界第1高楼命悬半空:3年只挖了坑",
topic_keyword: [{
tag: "天空城市",
weight: 1
}, {
tag: "张跃",
weight: 0.2972972972973
}, {
tag: "魏春雨",
weight: 0.16216216216216
}, {
tag: "城区",
weight: 0.16216216216216
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 10:30:00",
docid: "15466955015426540148",
images: [{
height: "541",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/e/9/5e91bee86491f2a5d4d2a971972303ba.jpg",
imgsize: "800,541",
width: "800"
}],
images_bos: [{
height: "372",
img: "http://image.cbs.baidu.com/news_topic/5e91bee86491f2a5d4d2a971972303ba.jpg",
imgsize: "550,372",
width: "550"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/e/9/5e91bee86491f2a5d4d2a971972303ba.jpg",
imgsize: "800,541",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263202_0.shtml",
mark: "0",
score: 84.761904761905,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "新华社天津6月28日电(记者白洁、李鲲)国务院总理李克强28日上午在天津梅江会展中心同出席2016年夏季达沃斯论坛的300多名各国企业家代表举行对话会。",
title: "李克强与企业家代表对话(图)",
topic_keyword: [{
tag: "达沃斯论坛",
weight: 1
}, {
tag: "李克强",
weight: 1
}, {
tag: "企业家代表",
weight: 0.94117647058824
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "316010432",
categoryid: "1",
date: "2016-06-29 11:16:00",
docid: "8047497231603379186",
images: [{
height: "239",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/b/e/5/be54e2183fa925c44040726543fc3aaf.jpg",
imgsize: "319,239",
width: "319"
}],
images_bos: [{
height: "239",
img: "http://image.cbs.baidu.com/news_topic/be54e2183fa925c44040726543fc3aaf.jpg",
imgsize: "319,239",
width: "319"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/b/e/5/be54e2183fa925c44040726543fc3aaf.jpg",
imgsize: "319,239",
keyword: "",
link: "http://m.people.cn/n4/2016/0629/c203-7121139.html",
mark: "0",
score: 87.317073170732,
source: "人民网",
src_type: "text",
srctype: "0",
summary: " 国务院台湾事务办公室29日举行发布会,发言人安峰山表示,台湾方面始终在两岸同胞最为关切的两岸关系性质这一根本性问题上采取模糊的态度,没有明确承认“九二共识”及其核心意涵。",
title: "国台办:两岸联系停摆责任在台方",
topic_keyword: [{
tag: "台湾方面",
weight: 1
}, {
tag: "峰山",
weight: 0.94444444444444
}, {
tag: "两岸同胞",
weight: 0.77777777777778
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 10:01:00",
docid: "15716091035949707057",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263374_0.shtml",
mark: "0",
score: 80,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "仅仅因为大众参与了政治决策,而自己对决策结果不赞同就给对方扣上一顶民粹的帽子,显然是思辩上的偷懒:以概念自身强烈的负面态度和模糊内涵,模糊了讨论实质,并且在民众冲动无知的假设之上,轻易剥夺了脱欧派平等参与决策和讨论的资格——给脱欧扣上民粹帽子的批评者,似乎并不认为接近半数的留欧支持者也是冲动无知的。",
title: "公投脱欧是民主的失败?",
topic_keyword: [{
tag: "英国",
weight: 1
}, {
tag: "英国民众",
weight: 0.26666666666667
}, {
tag: "国家决策",
weight: 0.2
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 09:43:00",
docid: "15454156060116847950",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263301_0.shtml",
mark: "0",
score: 80,
source: "学习时报",
src_type: "text",
srctype: "0",
summary: "中国同美国及南海争端国虽然有利益冲突,甚至激烈的外交斗争,并且看上去危机重重,但是也要看到,美国及东盟国家也不愿意看到南海起战端,它们同中国在经济、安全、全球治理等层面都存在着深厚的共同利益,都不希望为了南海的局部利益而牺牲更大范围的利益,中美之间合作仍然是主流。",
title: "南海问题对中国外交战略布局的影响",
topic_keyword: [{
tag: "中国",
weight: 1
}, {
tag: "南海问题",
weight: 0.97058823529412
}, {
tag: "南海",
weight: 0.88235294117647
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 09:25:00",
docid: "15557994981961012326",
images: [{
height: "390",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/5/1/c516bb95471fbaf09c6267f8667e03f8.jpg",
imgsize: "690,390",
width: "690"
}, {
height: "396",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/8/0/d/80d08c03ea7856ecfc5434fcac190d64.jpg",
imgsize: "638,396",
width: "638"
}, {
height: "228",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/d/f/f/dffdd71307fde1317b2dfab49487a940.jpg",
imgsize: "400,228",
width: "400"
}],
images_bos: [{
height: "311",
img: "http://image.cbs.baidu.com/news_topic/c516bb95471fbaf09c6267f8667e03f8.jpg",
imgsize: "550,311",
width: "550"
}, {
height: "341",
img: "http://image.cbs.baidu.com/news_topic/80d08c03ea7856ecfc5434fcac190d64.jpg",
imgsize: "550,341",
width: "550"
}, {
height: "228",
img: "http://image.cbs.baidu.com/news_topic/dffdd71307fde1317b2dfab49487a940.jpg",
imgsize: "400,228",
width: "400"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/c/5/1/c516bb95471fbaf09c6267f8667e03f8.jpg",
imgsize: "690,390",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263204_0.shtml",
mark: "0",
score: 89.52380952381,
source: "news.ifeng.com",
src_type: "text",
srctype: "0",
summary: "近年来,许多落马官员在忏悔中都说“忘记了入党誓词”“忘记了党员责任”,因此,学习党章、重温入党志愿书和入党誓词就是帮助他们找回入党初心的首要方式。",
title: "中纪委用了这一招,落马官员都哭了",
topic_keyword: [{
tag: "入党志愿书",
weight: 1
}, {
tag: "忏悔录",
weight: 0.72222222222222
}, {
tag: "入党誓词",
weight: 0.38888888888889
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 13
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 10:01:00",
docid: "15943690952285887502",
images: [{
height: "343",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/7/3/9/7394d7a38e0ec74f263e58868aa8e310.jpg",
imgsize: "620,343",
width: "620"
}],
images_bos: [{
height: "304",
img: "http://image.cbs.baidu.com/news_topic/7394d7a38e0ec74f263e58868aa8e310.jpg",
imgsize: "550,304",
width: "550"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/7/3/9/7394d7a38e0ec74f263e58868aa8e310.jpg",
imgsize: "620,343",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263379_0.shtml",
mark: "0",
score: 84.761904761905,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "新安晚报安徽网(www.ahwang.cn)讯为进一步鼓励公众积极参与道路交通秩序管理,及时消除高速公路交通安全隐患,安徽省公安厅交警总队决定从7月1日起,在保留原有对“占用高速公路应急车道交通违法行为” 举报的基础上,扩大对高速交通违法行为的举报范围,同时提高举报奖励标准。",
title: "安徽提高举报占用应急车道奖励标准:每条100元(图)",
topic_keyword: [{
tag: "安徽",
weight: 1
}, {
tag: "车道奖励标准",
weight: 0.80769230769231
}, {
tag: "举报占用应急",
weight: 0.76923076923077
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 1
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 10:01:00",
docid: "15441357104807155752",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263400_0.shtml",
mark: "0",
score: 80,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "该书很好地论述了这些欧陆知识分子们所念兹在兹的“团结”的价值含义,其中第一篇文章由哈贝马斯与德里达联合署名,就叫做“2月15日,欧洲人民的团结日:以核心欧洲为起点缔结共同外交政策”。",
title: "团结欧洲的理想破灭了吗?",
topic_keyword: [{
tag: "欧洲",
weight: 1
}, {
tag: "理想主义",
weight: 0.32258064516129
}, {
tag: "哈贝马斯",
weight: 0.30645161290323
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 1
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 09:42:00",
docid: "15516100384876312581",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263360_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰网",
src_type: "video",
srctype: "0",
summary: "法制晚报6月28日消息 微博网友@Lunay阅读爆料:今天地铁5号线惠新西街北口一上车,有人发现手机丢了,结果小偷就在身边儿,偷的手机还没来得急装,然后被暴揍了!",
title: "小偷在北京地铁偷手机被打 喊:快帮我打110救我",
topic_keyword: [{
tag: "惠新西街北口",
weight: 1
}, {
tag: "Lunay",
weight: 0.75
}, {
tag: "塔塔Yoyo",
weight: 0.75
}, {
tag: "手机丢了",
weight: 0.75
}, {
tag: "结果小偷就在身边",
weight: 0.75
}, {
tag: "网友评论",
weight: 0.75
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 3
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 09:24:00",
docid: "15450658328961224799",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263160_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰网",
src_type: "text",
srctype: "0",
summary: "待父母离开宿舍后,小龙用打火机点燃宿舍床铺,随后将门反锁,自己跳窗离开。 汉川一名初三学生,只因未要到零花钱,一天之中在家中两次纵火。",
title: "初中生一天内两次放火烧屋 因未向父母要到零花钱",
topic_keyword: [{
tag: "零花钱",
weight: 1
}, {
tag: "父母离开宿舍",
weight: 0.58333333333333
}, {
tag: "汉川一名初三学生",
weight: 0.45833333333333
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 0
}, {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 09:20:00",
docid: "15496178312228460888",
images: [],
images_bos: [],
img: "",
imgsize: "0,0",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263161_0.shtml",
mark: "0",
score: 80,
source: "凤凰新闻",
src_type: "video",
srctype: "0",
summary: " 日本媒体连日报道前首相鸠山由纪夫计划就任中国主导的亚投行顾问,有执政党议员激烈批评鸠山这么做会损害日本的国家利益。",
title: "鸠山接受凤凰专访:日本不加入亚投行将被孤立",
topic_keyword: [{
tag: "日本",
weight: 1
}, {
tag: "首相鸠山由纪夫",
weight: 0.72
}, {
tag: "鸠山",
weight: 0.68
}, {
tag: "亚投行顾问",
weight: 0.68
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 1
}, {
bdsourceid: "309050003",
categoryid: "1",
date: "2016-06-29 09:41:00",
docid: "15837840675798321553",
images: [{
height: "500",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/d/8/5d89d56273abd8b105ca287cf7d18c9b.jpg",
imgsize: "500,500",
width: "500"
}, {
height: "466",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/2/e/4/2e434a7ff254da1bb0d3ace3797507da.jpg",
imgsize: "500,466",
width: "500"
}, {
height: "376",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/b/8/4/b841e5805d1f7d1cc25f3f522dc84091.jpg",
imgsize: "500,376",
width: "500"
}],
images_bos: [{
height: "500",
img: "http://image.cbs.baidu.com/news_topic/5d89d56273abd8b105ca287cf7d18c9b.jpg",
imgsize: "500,500",
width: "500"
}, {
height: "466",
img: "http://image.cbs.baidu.com/news_topic/2e434a7ff254da1bb0d3ace3797507da.jpg",
imgsize: "500,466",
width: "500"
}, {
height: "376",
img: "http://image.cbs.baidu.com/news_topic/b841e5805d1f7d1cc25f3f522dc84091.jpg",
imgsize: "500,376",
width: "500"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/d/8/5d89d56273abd8b105ca287cf7d18c9b.jpg",
imgsize: "500,500",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49263287_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰江苏",
src_type: "text",
srctype: "0",
summary: "6月28日0时,经过不间断抢修,江苏盐城6.23特大风雹灾害中与居民供电相关的10千伏,400伏供电设施全部抢修完毕,恢复供电。",
title: "阜宁电网基本恢复正常运行 受灾居民全部恢复供电(图)",
topic_keyword: [{
tag: "线路跳闸",
weight: 1
}, {
tag: "国网",
weight: 0.5
}, {
tag: "应急抢修车辆",
weight: 0.5
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 1
}, {
bdsourceid: "316010034",
categoryid: "1",
date: "2016-06-29 07:56:00",
docid: "15585661576427894670",
images: [{
height: "275",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/a/9/5a9987398922470c4c023cbb2ebd0651.jpg",
imgsize: "183,275",
width: "183"
}],
images_bos: [{
height: "275",
img: "http://image.cbs.baidu.com/news_topic/5a9987398922470c4c023cbb2ebd0651.jpg",
imgsize: "183,275",
width: "183"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/a/9/5a9987398922470c4c023cbb2ebd0651.jpg",
imgsize: "183,275",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49262504_0.shtml",
mark: "0",
score: 84.761904761905,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: "计划使用探空火箭将发动机发射到70公里高空,在6马赫速度时尝试点燃超燃冲压发动机,ISRO表示,预计发动机能够工作5秒钟,通过这次测试他们希望能够测量这种发动机的实际推力。",
title: "印度宣布将测试超燃冲压发动机 冲击世界第三",
topic_keyword: [{
tag: "冲压发动机",
weight: 1
}, {
tag: "ISRO",
weight: 0.35294117647059
}, {
tag: "据报道",
weight: 0.26470588235294
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 2
}
];
const graphList = [
{
name:'邮件营销',
data:[120, 132, 101, 134, 90, 230, 210]
},
{
name:'联盟广告',
data:[220, 182, 191, 234, 290, 330, 310]
},
{
name:'视频广告',
data:[150, 232, 201, 154, 190, 330, 410]
}
];
const simpleObject = {
bdsourceid: "316010032",
categoryid: "1",
date: "2016-06-29 10:27:00",
docid: "16112285443883430307",
images: [{
height: "533",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/1/7/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
width: "400"
}, {
height: "300",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/8/e/6/8e62b06541d752bd3719107a1f5f0496.jpg",
imgsize: "400,300",
width: "400"
}, {
height: "533",
img: "http://img.cbs.baidu.com/imagecache/reader/mid/f/9/2/f92664dedc81ce5c2d83c28aeff66eed.jpg",
imgsize: "400,533",
width: "400"
}],
images_bos: [{
height: "533",
img: "http://image.cbs.baidu.com/news_topic/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
width: "400"
}, {
height: "300",
img: "http://image.cbs.baidu.com/news_topic/8e62b06541d752bd3719107a1f5f0496.jpg",
imgsize: "400,300",
width: "400"
}, {
height: "533",
img: "http://image.cbs.baidu.com/news_topic/f92664dedc81ce5c2d83c28aeff66eed.jpg",
imgsize: "400,533",
width: "400"
}],
img: "http://img.cbs.baidu.com/imagecache/reader/mid/5/1/7/5170f148dbd81ecb680dd385cfd0c333.jpg",
imgsize: "400,533",
keyword: "",
link: "http://news.ifeng.com/a/20160629/49259851_0.shtml",
mark: "0",
score: 89.52380952381,
source: "凤凰新闻",
src_type: "text",
srctype: "0",
summary: " 在谅解协议中,北青报记者看到,“鉴于被告人周凌俊在案发时有精神分裂症,控制能力差,并且开庭前积极赔偿给我全部损失(略),我对被告人周凌俊的行为表示谅解,请求法院对被告人周凌俊从轻、减轻、免除死刑刑事处罚…",
title: "男子砍伤9人被判死刑 8受害人请求免除死刑(图)",
topic_keyword: [{
tag: "周凌俊",
weight: 1
}, {
tag: "老周",
weight: 0.52631578947368
}, {
tag: "北青报记者",
weight: 0.50877192982456
}],
weight: "99",
index: "1020",
groupbegin: "0",
listcount: 4
};
export default {
tableList: tableList,
graphList: graphList,
simpleObject: simpleObject
};
\ No newline at end of file
// 自定义的配置数据
const DateFormat = function(date, fmt) {
let o = {
"M+" : date.getMonth()+1, //月份
"d+" : date.getDate(), //日
"h+" : date.getHours()%12 == 0 ? 12 : date.getHours()%12, //小时
"H+" : date.getHours(), //小时
"m+" : date.getMinutes(), //分
"s+" : date.getSeconds(), //秒
"q+" : Math.floor((date.getMonth()+3)/3), //季度
"S" : date.getMilliseconds() //毫秒
};
let week = {
"0" : "/u65e5",
"1" : "/u4e00",
"2" : "/u4e8c",
"3" : "/u4e09",
"4" : "/u56db",
"5" : "/u4e94",
"6" : "/u516d"
};
if(/(y+)/.test(fmt)){
fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length));
}
if(/(E+)/.test(fmt)){
fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "/u661f/u671f" : "/u5468") : "")+week[date.getDay()+""]);
}
for(let k in o){
if(new RegExp("("+ k +")").test(fmt)){
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
}
}
return fmt;
}
export default {
DateFormat : DateFormat
};
\ No newline at end of file
import React from 'react';
import { Button, Icon, message } from 'antd';
import baidubce from 'bce-sdk-js';
let config = {
endpoint: 'http://bj.bcebos.com', //传入Bucket所在区域域名
credentials: {
ak: 'e4a6dcc47a3b46f3a5ebf0f81d0e4928', //您的AccessKey
sk: '8d26035b87e14989a4343f0e43c0ce71' //您的SecretAccessKey
}
};
let client = new baidubce.BosClient(config);
const createKey = function(ext){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
month = (month < 10) ? '0' + month: month;
let day = date.getDate();
day = (day < 10) ? '0' + day: day;
return year + '/' + month + '/' + day + '/' + (+new Date())+ '.'+ext;
}
// 百度浏览器特定文件上传组件
let BDUploader = React.createClass({
getInitialState: function() {
return {
};
},
render: function() {
return <div>
<Button type="ghost" onClick={this.openFileInput}>
<Icon type="upload" /> 文件上传
</Button>
<input type="file" ref="fileInput" style={{display:"none"}} onChange={this.uploadImg} />
</div>;
},
openFileInput: function(e){
this.refs.fileInput.click();
},
uploadImg: function(e){
let self = this;
let file = e.target.files[0]; // 获取要上传的文件
let ext = file.name.split(/\./g).pop();
let key = createKey(ext); // 保存到bos时的key,您可更改,默认以文件名作为key
let mimeType = baidubce.MimeType.guess(ext);
client.putObjectFromBlob("mbrowser", key, file, {
'Content-Type': /^text\//.test(mimeType)? mimeType+'; charset=UTF-8': mimeType
}).then(function (res) {
// 上传完成,添加您的代码
let imgUrl = config.endpoint+'/v1/mbrowser/'+key;
console.log('上传成功', imgUrl);
self.props.success&&self.props.success(imgUrl);
}).catch(function (err) {
// 上传失败,添加您的代码
self.props.error&&self.props.error(error);
});
}
});
export default BDUploader;
import React from 'react';
import { Form, Modal, Button } from 'antd';
import CFormItem from './CreateFormItem';
let CForm = React.createClass({
getInitialState: function() {
return { visible: false };
},
render: function() {
const self = this;
const CType = this.props.CType;
const { getFieldProps } = this.props.form;
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
return CType ?
<div className="f-create">
<Button type="primary" icon="plus-circle-o" onClick={this.showModal}>添加</Button>
<Modal title="添加新对象" visible={this.state.visible} onOk={this.handleCreate} onCancel={this.hideModal}>
<Form horizontal form={this.props.form}>
{
CType.map(function(item){
//return self.dealConfigCType(item);
return <CFormItem key={item.name} getFieldProps={getFieldProps} formItemLayout={formItemLayout} item={item}/>
})
}
</Form>
</Modal>
</div>:
<div></div>
},
handleCreate: function(){
console.log('收到表单值:', this.props.form.getFieldsValue());
this.props.form.validateFields((errors, values) => {
if (!!errors) {
console.log('Errors in form!!!');
return;
}else{
console.log('Submit!!!');
this.props.submit(values);
this.hideModal();
}
});
//this.props.submit(this.props.form.getFieldsValue());
},
handleReset: function() {
this.props.form.resetFields();
},
showModal: function() {
this.setState({ visible: true });
},
hideModal: function() {
this.setState({ visible: false });
this.handleReset();
}
});
CForm = Form.create()(CForm);
export default CForm;
import React from 'react';
import { Form, Select, Input, Button, Icon , DatePicker, TimePicker, Radio, Switch} from 'antd';
import { Upload, Modal, message } from 'antd';
import BDUploader from './BDUploader';
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
let CFormItem = React.createClass({
getInitialState: function() {
return {
img_url:''
};
},
render: function() {
const getFieldProps = this.props.getFieldProps;
const formItemLayout = this.props.formItemLayout || {};
const item = this.props.item || {};
const defaultValue = item.defaultValue || '';
const defaultTimeValue = item.defaultValue || new Date();
const defaultImgValue = this.state.img_url || item.defaultValue || '';
switch (item.type){
case 'string':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<Input placeholder={item.placeholder||''}
{...getFieldProps(item.name, {rules:item.rules, initialValue:defaultValue})} />
</FormItem>
break;
case 'date':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<DatePicker showTime format="yyyy-MM-dd HH:mm:ss" {...getFieldProps(item.name, { initialValue:defaultTimeValue})} />
</FormItem>
break;
case 'select':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<Select {...getFieldProps(item.name, { initialValue: defaultValue })} >
{
item.options.map(function(item){
return <Option key={item.value} value={item.value}>{item.text}</Option>
})
}
</Select>
</FormItem>
break;
case 'radio':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<RadioGroup {...getFieldProps(item.name, { initialValue: defaultValue })}>
{
item.options.map(function(item){
return <Radio key={item.value} value={item.value}>{item.text}</Radio>
})
}
</RadioGroup>
</FormItem>
break;
case 'switch':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<Switch {...getFieldProps(item.name, { initialValue: defaultValue})} />
</FormItem>
break;
case 'imageUpload':
return <FormItem
label={item.label}
key={item.name}
{...formItemLayout}>
<Input
{...getFieldProps(item.name, { initialValue:defaultImgValue})} />
<img className="uploadImg" src={defaultImgValue} />
<BDUploader success={this.uploadSuccess} />
</FormItem>
break;
default:
return '';
break;
}
},
uploadSuccess: function(url){
console.log(url)
this.setState({
img_url: url
})
}
});
export default CFormItem;
// 纯数据展现情况列表
import React from 'react';
import ReactEcharts from 'echarts-for-react';
import { Table, Form, Select, Input, Row, Col, Button, Icon } from 'antd';
import { DatePicker, TimePicker, Radio, Switch} from 'antd';
import { Upload, Modal, message, Spin} from 'antd';
import { Link } from 'react-router';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import CFormItem from './CreateFormItem';
// 搜索查询栏form 创建新item-form 更新form
import UForm from './UpdateForm';
import CForm from './CreateForm';
import RForm from './RetrieveForm';
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// 依赖 config 主题生成react 组件函数
const FeatureSet = (config) => {
let tableFeature = React.createClass({
getInitialState: function(){
return {
columns: [],
resultList: [],
loading: false,
updateFromShow: false,
updateFromItem: {}
}
},
componentWillMount: function(){
this.setState({
loading: true,
columns: this.dealConfigColumns(config.columns)
});
},
render: function() {
const self = this;
return <div className="featureItem">
<RForm RType={config.RType} submit={self.handleRetrieve}/>
<CForm CType={config.CType} submit={self.handleCreate}/>
<UForm UType={config.UType} submit={self.handleUpdate} isShow={this.state.updateFromShow} updateItem={this.state.updateFromItem} hideForm={this.hideUpdateForm}/>
<Table dataSource={this.state.resultList} columns={this.state.columns} loading={this.state.loading} bordered/>
</div>
},
// 预处理配置显示中的 colums 数据 用于anted的table配置
dealConfigColumns: function(lists){
const self = this;
let columns = [];
lists.forEach((item) => {
let column = {
title: item.title,
dataIndex: item.dataIndex,
key: item.dataIndex,
width: item.width
}
if( item.type === 'operate' ){
// 兼容单一形式与数组形式
let btns = Array.isArray(item.btns)?item.btns:[item.btns];
// 处理表单 操作 栏目以及回调函数
column.render = item.render || function(txt, record){
return <span>
{
btns.map(function(btn,i) {
return (
<span key={i}>
<a href="javascript:void 0;" onClick={self.operateCallbacks.bind(self, record, btn)}>{btn.text}</a>
{i!==btns.length-1?<span className="ant-divider"></span>:''}
</span>
);
})
}
</span>
};
}else{
column.render = item.render || self.renderFunc[item.type] || ((text) => (<span>{text}</span>));
}
if(item.sort){
column.sorter = item.sorter || ((a, b) => a[item.dataIndex] - b[item.dataIndex]);
}
columns.push(column);
});
return columns;
},
// columns 类型对应的通用痛render
renderFunc: {
link: (text) => (
<span>
<a href={text}>{text}</a>
</span>),
image: (url) => (
<span>
<img src={url} />
</span>)
},
handleCreate: function(info){
const self = this;
self.setState({
loading: true
});
config.Create(info, function(item){
// 初级接口的坑
if(!item){
config.initData(function(list){
self.setState({
loading: false,
resultList: list
});
});
return;
}
let lists = self.state.resultList;
lists.unshift(item);
self.setState({
loading: false,
resultList: lists
});
});
},
handleUpdate: function(info){
const self = this;
let result = Immutable.fromJS(self.state.resultList);
config.Update(info, function(item){
let resultList = result.map(function(v, i){
if(v.get('key') === item.key){
return Immutable.fromJS(item);
}else{
return v;
}
});
message.success('更新成功');
self.setState({
loading: false,
updateFromShow: false,
resultList: resultList.toJS()
});
});
},
hideUpdateForm: function(){
this.setState({
updateFromShow: false,
updateFromItem: {}
});
},
// 搜索更新处理
handleRetrieve: function(info){
const self = this;
self.setState({
loading: true
});
config.Retrieve(info, function(list){
self.setState({
loading: false,
resultList: list
});
});
},
// table 操作列回调处理
operateCallbacks: function(item, btn){
const self = this;
if(btn.type){
let resultList;
let type = btn.type;
let itemI = Immutable.fromJS(item);
let result = Immutable.fromJS(self.state.resultList);
// table 操作栏目通用设定为 更新与删除 两项
if(type === 'update'){
this.setState({
updateFromShow: true,
updateFromItem: itemI.toJS()
});
}else if(type === 'delete'){
this.setState({
loading: true
});
config.Delete(itemI.toJS(), function(){
resultList = result.filter(function(v, i){
if(v.get('key') !== itemI.get('key')){
return true;
}
});
message.success('删除成功');
self.setState({
loading: false,
resultList: resultList.toJS()
});
});
}
}else if(btn.callback){
btn.callback(item);
}
},
componentDidMount: function(){
const self = this;
config.initData(function(list){
self.setState({
loading: false,
resultList: list
});
});
}
});
let simpleFeature = React.createClass({
getInitialState: function(){
return {
item:{},
loading: false,
updateFromShow: false,
updateFromItem: {}
}
},
componentWillMount: function(){
},
render: function() {
const self = this;
const itemInfo = this.state.item;
const { getFieldProps } = this.props.form;
const formItemLayout = {
labelCol: { span: 3 },
wrapperCol: { span: 18 },
};
const operate = config.operate || [];
return <div className="featureItem">
<Form horizontal className='p-relative'>
{
this.state.loading?
<div className="formLayout">
<Spin size="large" />
</div>:
''
}
{
config.UType.map(function(item){
item.defaultValue = itemInfo[item.name]||'';
return <CFormItem key={item.name} getFieldProps={getFieldProps} formItemLayout={formItemLayout} item={item}/>
})
}
</Form>
{
operate.map(function(btn){
return <Button key={btn.text} type="primary" size="large" onClick={self.operateCallbacks.bind(self, btn)} style={btn.style}>{btn.text}</Button>
})
}
</div>
},
componentDidMount: function(){
const self = this;
self.setState({
loading: true
});
config.initData(function(item){
self.setState({
item: item,
loading: false
});
});
},
operateCallbacks: function(btn){
const self = this;
let itemI = Immutable.fromJS(this.props.form.getFieldsValue());
if(btn.type === 'update'){
const self = this;
config.Update(itemI.toJS(), function(item){
message.success('更新成功');
self.setState({
item: item
});
});
}else if(btn.callback){
btn.callback(itemI.toJS());
}
}
});
simpleFeature = Form.create()(simpleFeature);
let graphFeature = React.createClass({
getInitialState: function(){
return {
option: config.option
}
},
componentWillMount: function(){
},
render: function() {
const self = this;
const itemInfo = this.state.item;
const operate = config.operate || [];
return <div className="featureItem">
<ReactEcharts
option={this.state.option}
style={config.EchartStyle}
className='react_for_echarts' />
</div>
},
componentDidMount: function(){
const self = this;
let option = Immutable.fromJS(self.state.option).toJS();
config.initData(function(series){
option.series = series;
self.setState({
option: option
});
});
}
});
switch (config.type){
case 'tableList':
return tableFeature;
break;
case 'graphList':
return graphFeature;
break;
case 'simpleObject':
return simpleFeature;
break;
case 'complexObject':
return complexFeature;
break;
default:
return tableFeature;
break;
}
}
export default FeatureSet;
import React from 'react';
import { Form, Select, Input, Button, Icon , DatePicker, TimePicker, Radio, Switch} from 'antd';
import { Upload, Modal, message } from 'antd';
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
let RForm = React.createClass({
render: function() {
const self = this;
const RType = this.props.RType;
return RType ?
(<div className="f-search">
<Form inline>
{
RType.map(function(item){
return self.dealConfigRType(item);
})
}
<FormItem key="search-btn">
<Button type="primary" onClick={this.handleRetrieve}>查询</Button>
</FormItem>
</Form>
</div>):
<div></div>;
},
dealConfigRType: function(item){
const { getFieldProps } = this.props.form;
switch (item.type){
case 'string':
return <FormItem
label={item.label}
key={item.name}>
<Input placeholder={item.placeholder||''}
{...getFieldProps(item.name)} />
</FormItem>
break;
case 'date':
return <FormItem
label={item.label}
key={item.name}>
<DatePicker showTime format="yyyy-MM-dd HH:mm:ss" {...getFieldProps(item.name)} />
</FormItem>
break;
case 'select':
return <FormItem
label={item.label}
key={item.name}>
<Select {...getFieldProps(item.name, { initialValue: item.defaultValue||item.options[0].value })} >
{
item.options.map(function(item){
return <Option key={item.value} value={item.value}>{item.text}</Option>
})
}
</Select>
</FormItem>
break;
case 'radio':
return <FormItem
label={item.label}
key={item.name}>
<RadioGroup {...getFieldProps(item.name, { initialValue: item.defaultValue||item.options[0].value })}>
{
item.options.map(function(item){
return <Radio key={item.value} value={item.value}>{item.text}</Radio>
})
}
</RadioGroup>
</FormItem>
break;
case 'switch':
return <FormItem
label={item.label}
key={item.name}>
<Switch {...getFieldProps(item.name, { initialValue: item.defaultValue|| false })} />
</FormItem>
break;
default:
return '';
break;
}
},
handleRetrieve: function(){
console.log('收到表单值:', this.props.form.getFieldsValue());
this.props.submit(this.props.form.getFieldsValue());
}
});
RForm = Form.create()(RForm);
export default RForm;
import React from 'react';
import { Form, Modal, message } from 'antd';
import CFormItem from './CreateFormItem';
let UForm = React.createClass({
getInitialState: function() {
return {
};
},
render: function() {
const self = this;
const UType = this.props.UType;
const updateItem = this.props.updateItem;
// 详情见antd form 文档
const { getFieldProps } = this.props.form;
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
return UType ?
<div className="f-update">
<Modal title="更新对象" visible={this.props.isShow} onOk={this.handleUpdate} onCancel={this.hideModal}>
<Form horizontal form={this.props.form}>
{
UType.map(function(item){
item.defaultValue = updateItem[item.name]||'';
//return self.dealConfigUType(item, defaultValue);
return <CFormItem key={item.name} getFieldProps={getFieldProps} formItemLayout={formItemLayout} item={item}/>
})
}
</Form>
</Modal>
</div>:
<div></div>
},
handleUpdate: function(){
this.props.submit(this.props.form.getFieldsValue());
},
handleReset: function() {
this.props.form.resetFields();
},
hideModal: function() {
this.props.hideForm();
this.handleReset();
}
});
UForm = Form.create()(UForm);
export default UForm;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
// 增加(Create)、重新取得数据(Retrieve)、更新(Update)和删除(Delete)
const table_conf = {
type: 'tableList', // tableList graphList simpleObject complexObject
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 接口调用数据形式
/*
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
*/
// 模拟数据
setTimeout(function(){
let list = testData.tableList;
list.forEach(function(ele) {
ele.key = ele.docid;
});
callback(list);
}, 1000)
},
// table 列表展现配置
// {
// title table显示表题
// dataIndex 显示数据中的key
// type 展现形式 (string image link)
// render 自定义展现形式 参数 (当前数据,当前对象数据)
// sort 是否需要排序功能
// width 自定义该列宽度 否则等分
// }
//
// table 列表头标题
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link',
render: (text) => ( <span>
<a href={text}>链接</a>
</span>),
width: 50
},{
title: '日期',
dataIndex: 'date',
type: 'string',
width: 150
},{
title: '图片',
dataIndex: 'img',
type: 'image'
}
]
};
const Feature1 = FeatureSetConfig(table_conf);
export default Feature1;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
const simple_conf = {
type: 'simpleObject',
initData: function(callback){
// 模拟数据
setTimeout(function(){
let object = testData.simpleObject;
object.key = object.docid;
callback(object);
}, 1000)
},
operate:[
{
text: '确认数据',
style: {
'marginRight': '30px'
},
callback: function(item){
console.log(item)
}
}, {
text: '展示数据',
callback: function(item){
console.log(item)
}
}
],
UType:[
{
name: 'docid',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'title',
label: '标题',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'link',
label: '链接',
type: 'string'
},{
name: 'date',
label: '日期',
type: 'date'
},{
name: 'img',
label: '图片',
type: 'imageUpload'
}
]
}
const Feature1 = FeatureSetConfig(simple_conf);
export default Feature1;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
const graph_conf = {
type: 'graphList', // tableList graphList simpleObject complexObject
EchartStyle: {
width: '100%',
height: '450px'
},
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 模拟数据
setTimeout(function(){
let series = testData.graphList;
series.forEach(function(item) {
item.type = 'line';
item.stack = '总量'
});
callback(series);
}, 1000)
},
// 参考echarts 参数
option : {
title: {
text: '堆叠区域图'
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['邮件营销','联盟广告','视频广告']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['周一','周二','周三','周四','周五','周六','周日']
}
],
yAxis : [
{
type : 'value'
}
]
}
};
const graph_conf2 = {
type: 'graphList', // tableList graphList simpleObject complexObject
style: {
width: '100%',
height: '450px'
},
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 模拟数据
setTimeout(function(){
let series = [
{
name: '访问来源',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:335, name:'直接访问'},
{value:310, name:'邮件营销'},
{value:234, name:'联盟广告'},
{value:135, name:'视频广告'},
{value:1548, name:'搜索引擎'}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
callback(series);
}, 1000)
},
// 参考echarts 参数
option : {
title : {
text: '某站点用户访问来源',
subtext: '纯属虚构',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
}
}
};
const Feature = FeatureSetConfig(graph_conf2);
export default Feature;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
const graph_conf = {
type: 'graphList', // tableList graphList simpleObject complexObject
EchartStyle: {
width: '100%',
height: '450px'
},
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 模拟数据
setTimeout(function(){
let series = testData.graphList;
series.forEach(function(item) {
item.type = 'line';
item.stack = '总量'
});
callback(series);
}, 1000)
},
// 参考echarts 参数
option : {
title: {
text: '堆叠区域图'
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['邮件营销','联盟广告','视频广告']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['周一','周二','周三','周四','周五','周六','周日']
}
],
yAxis : [
{
type : 'value'
}
]
}
};
const graph_conf2 = {
type: 'graphList', // tableList graphList simpleObject complexObject
EchartStyle: {
width: '100%',
height: '450px'
},
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 模拟数据
setTimeout(function(){
let series = [
{
name: '访问来源',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:335, name:'直接访问'},
{value:310, name:'邮件营销'},
{value:234, name:'联盟广告'},
{value:135, name:'视频广告'},
{value:1548, name:'搜索引擎'}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
callback(series);
}, 1000)
},
// 参考echarts 参数
option : {
title : {
text: '某站点用户访问来源',
subtext: '纯属虚构',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
}
}
};
const table_conf = {
type: 'tableList', // tableList graphList simpleObject complexObject
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 模拟数据
setTimeout(function(){
let list = testData.tableList;
list.forEach(function(ele) {
ele.key = ele.docid;
});
callback(list);
}, 1000)
},
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link',
render: (text) => ( <span>
<a href={text}>链接</a>
</span>),
width: 50
},{
title: '日期',
dataIndex: 'date',
type: 'string',
width: 150
},{
title: '图片',
dataIndex: 'img',
type: 'image'
}
]
};
const Feature1 = FeatureSetConfig(graph_conf2);
const Feature2 = FeatureSetConfig(graph_conf);
const Feature3 = FeatureSetConfig(table_conf);
const Feature = React.createClass({
render: function() {
return <div>
<Feature1 />
<Feature2 />
<Feature3 />
</div>
}
});
export default Feature;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
// 增加(Create)、重新取得数据(Retrieve)、更新(Update)和删除(Delete)
const table_conf = {
type: 'tableList', // tableList graphList simpleObject complexObject
// 初始化展现的数据,使用callback 回传列表数据
// 需要手动添加唯一id key
// callback 组件数据的回调函数(接受列表数据参数)
initData: function(callback){
// 接口调用数据形式
/*
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
*/
// 模拟数据
setTimeout(function(){
let list = testData.tableList;
list.forEach(function(ele) {
ele.key = ele.docid;
});
callback(list);
}, 1000)
},
// table 列表展现配置
// {
// title table显示表题
// dataIndex 显示数据中的key
// type 展现形式 (string image link)
// render 自定义展现形式 参数 (当前数据,当前对象数据)
// sort 是否需要排序功能
// width 自定义该列宽度 否则等分
// }
//
columns: [
{
title: 'DOCID',
dataIndex: 'docid',
type: 'string'
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link',
render: (text, item) => (<span><a href={text}>{item.title}</a></span>) // 可自定义
}
]
};
const simple_conf = {
type: 'simpleObject',
initData: function(callback){
// 模拟数据
setTimeout(function(){
let object = testData.simpleObject;
object.key = object.docid;
callback(object);
}, 1000)
},
operate:[
{
text: '确认数据',
style: {
'marginRight': '30px',
'marginLeft': '80px'
},
callback: function(item){
console.log(item)
}
}, {
text: '展示数据',
callback: function(item){
console.log(item)
}
}
],
UType:[
{
name: 'docid',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'title',
label: '标题',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'link',
label: '链接',
type: 'string'
},{
name: 'date',
label: '日期',
type: 'date'
},{
name: 'img',
label: '图片',
type: 'imageUpload'
}
]
}
const Feature1 = FeatureSetConfig(simple_conf);
export default Feature1;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(){},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(){},
Retrieve: function(data, callback){
console.log(data);
let dataI = Immutable.fromJS({
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}).merge(data);
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: dataI.toJS(),
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 可设置的查询字段
// RType 查询字段
// CType 创建字段
// UType 更新字段
RType:[
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'date',
label: '项目开始时间',
type: 'date'
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch',
defaultValue: false
}
],
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 80,
btns: [{
text: '删除',
type: 'delete'
}, {
text: '展示',
callback: function(item){
console.log(item)
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
],
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
let CUTpye = [
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, min: 5, message: '用户名至少为 5 个字符' }]
},{
name: 'id2',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, type: 'email', message: '请输入正确的邮箱地址' }]
},{
name: 'date',
label: '项目开始时间',
type: 'date',
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch'
},{
name: 'image',
label: '背景图片',
type: 'imageUpload'
}
];
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作添加数据的请求
console.log(dataI.toJS());
let item = {
docid: (Math.random()*10000000000)|0,
title: '院依法对原省安监局局长陈炎生决定逮捕',
link: 'sdfghjcvbnmertfheiuwfhsdh'
}
// 需要设置key
item.key = item.docid;
// 模拟请求创建成功的回调
setTimeout(function(){
callback(item);
}, 1000);
},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(data, callback){
console.log(data);
},
// 创建项目所需的字段 与 更新项目所需的字段
// rules 规范可见 https://github.com/yiminghe/async-validator
CType: Immutable.fromJS(CUTpye).toJS(),
UType: Immutable.fromJS(CUTpye).toJS(),
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 120,
btns: [{
text: '更新',
type: 'update'
},{
text: '删除',
type: 'delete'
},{
text: '展示',
callback: function(item){
console.log(item)
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
],
uploadfile: function(data){
}
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 纯数据展现情况列表
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
import Reqwest from 'reqwest';
import testData from '../common/test-data';
const simple_conf = {
type: 'simpleObject',
initData: function(callback){
// 模拟数据
setTimeout(function(){
let object = testData.simpleObject;
object.key = object.docid;
callback(object);
}, 1000)
},
Update:function(data, callback){
console.log(data);
callback(data);
},
operate:[
{
text: '确认修改',
type: 'update',
style: {
'marginRight': '30px',
'marginLight': '80px'
}
}, {
text: '展示数据',
callback: function(item){
console.log(item)
}
}
],
UType:[
{
name: 'docid',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'title',
label: '标题',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'link',
label: '链接',
type: 'string'
},{
name: 'date',
label: '日期',
type: 'date'
},{
name: 'img',
label: '图片',
type: 'imageUpload'
}
]
}
const Feature1 = FeatureSetConfig(simple_conf);
export default Feature1;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200 // 列宽 可选 不填为默认均分
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 80,
btns: [{
text: '删除',
type: 'delete'
}, {
text: '展示',
callback: function(item){
alert(JSON.stringify(item));
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
]
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 含有可操作 table 栏的数据展示
import React from 'react';
import Immutable from 'immutable';
import TinyMCE from 'react-tinymce';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const Feature = React.createClass({
getInitialState: function(){
return {
value: ''
}
},
render: function() {
let config = {
content: "<p>This is the initial content of the editor</p>",
config: {
height: '250',
plugins: [
"advlist autolink lists charmap print preview hr anchor pagebreak spellchecker",
"searchreplace wordcount visualblocks visualchars fullscreen insertdatetime nonbreaking",
"save table contextmenu directionality emoticons paste textcolor"
],
toolbar: "insertfile undo redo | styleselect fontselect fontsizeselect| bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l | print preview fullpage | forecolor backcolor",
},
onChange: this.handleEditorChange
}
return <div>
<p style={{margin:'10px'}}>html文本:{this.state.value}</p>
<TinyMCE className="editor" {...config} />
</div>
},
handleEditorChange(e) {
window.e = e;
this.setState({
value: e.target.getContent()
});
},
});
export default Feature;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(){},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(){},
Retrieve: function(data, callback){
console.log(data);
let dataI = Immutable.fromJS({
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}).merge(data);
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: dataI.toJS(),
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 可设置的查询字段
RType:[
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'date',
label: '项目开始时间',
type: 'date'
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch',
defaultValue: false
}
],
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 80,
btns: [{
text: '删除',
type: 'delete'
}, {
text: '展示',
callback: function(item){
console.log(item)
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
],
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作添加数据的请求
console.log(dataI.toJS());
let item = {
docid: (Math.random()*10000000000)|0,
title: '院依法对原省安监局局长陈炎生决定逮捕',
link: 'sdfghjcvbnmertfheiuwfhsdh'
}
// 需要设置key
item.key = item.docid;
// 模拟请求创建成功的回调
setTimeout(function(){
callback(item);
}, 1000);
},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(data, callback){
console.log(data);
},
Retrieve: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}).merge(data);
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: dataI.toJS(),
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 创建项目所需的字段
// rules 规范可见 https://github.com/yiminghe/async-validator
CType:[
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, min: 5, message: '用户名至少为 5 个字符' }]
},{
name: 'id2',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, type: 'email', message: '请输入正确的邮箱地址' }]
},{
name: 'date',
label: '项目开始时间',
type: 'date',
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch'
},{
name: 'image',
label: '背景图片',
type: 'imageUpload'
}
],
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 120,
btns: [{
text: '删除',
type: 'delete'
}, {
text: '展示',
callback: function(item){
console.log(item)
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
]
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(data, callback){
console.log(data);
data.key = data.docid;
callback(data);
},
Retrieve: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}).merge(data);
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: dataI.toJS(),
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 更新项目所需的字段
UType:[
{
name: 'docid',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'title',
label: '标题',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'link',
label: '链接',
type: 'string'
},{
name: 'date',
label: '日期',
type: 'date'
},{
name: 'img',
label: '图片',
type: 'imageUpload'
}
],
// table 列表头标题
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link',
render: (text) => ( <span>
<a href={text}>链接</a>
</span>),
width: 50
},{
title: '日期',
dataIndex: 'date',
type: 'string',
width: 150
},{
title: '图片',
dataIndex: 'img',
type: 'image'
},{
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 120,
btns: [{
text: '更新',
type: 'update'
},{
text: '删除',
type: 'delete'
}, {
text: '展示',
callback: function(item){
console.log(item)
}
}] // 可选
}
],
uploadfile: '/umis/pushc/uploadfile'
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 含有可操作 table 栏的数据展示
import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig';
import Immutable from 'immutable';
//https://github.com/ded/reqwest
import Reqwest from 'reqwest';
const conf = {
// 初始化页面的数据 回调函数传入 items 列表
initData: function(callback){
let data = {
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: data,
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 功能模块需要时 添加 CRUD 4方法
Create: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作添加数据的请求
console.log(dataI.toJS());
let item = {
docid: (Math.random()*10000000000)|0,
title: '院依法对原省安监局局长陈炎生决定逮捕',
link: 'sdfghjcvbnmertfheiuwfhsdh'
}
// 需要设置key
item.key = item.docid;
// 模拟请求创建成功的回调
setTimeout(function(){
callback(item);
}, 1000);
},
Delete: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list'
}).merge({id: data.key});
// ... 操作删除请求
console.log(dataI.toJS());
// 模拟请求删除成功的回调
setTimeout(function(){
callback();
}, 1000)
},
Update:function(data, callback){
console.log(data);
},
Retrieve: function(data, callback){
let dataI = Immutable.fromJS({
type: 'entry_list',
num: 20,
ua: 'bd_1_1_1_5-5-0-0_1',
cuid: '00000000000000000000000000000000%7C0000000000000000',
channel: 'AA_0',
dir: 'up'
}).merge(data);
Reqwest({
url: 'http://uil.cbs.baidu.com/rssfeed/fetch?fn=?',
data: dataI.toJS(),
type: 'jsonp',
jsonpCallback: 'fn',
success: function (data) {
let lists = data.data.stream_data;
// 必须要向数据中 添加唯一的 key
lists.forEach(function(ele) {
ele.key = ele.docid;
});
callback(lists);
}
});
},
// 可设置的查询字段
RType:[
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'date',
label: '项目开始时间',
type: 'date'
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch',
defaultValue: false
}
],
// 创建项目所需的字段
// rules 规范可见 https://github.com/yiminghe/async-validator
CType:[
{
name: 'id',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, min: 5, message: '用户名至少为 5 个字符' }]
},{
name: 'id2',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称',
rules: [{ required: true, type: 'email', message: '请输入正确的邮箱地址' }]
},{
name: 'date',
label: '项目开始时间',
type: 'date',
},{
name: 'stype',
label: '项目类型Select',
type: 'select',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'rtype',
label: '项目类型Radio',
type: 'radio',
defaultValue: 'one',
options:[{
text: '选项一',
value: 'one'
},{
text: '选项二',
value: 'two'
},{
text: '选项三',
value: 'three'
}]
},{
name: 'ischange',
label: '是否过滤',
type: 'switch'
},{
name: 'image',
label: '背景图片',
type: 'imageUpload'
}
],
// 更新项目所需的字段
UType:[
{
name: 'docid',
label: '唯一标识',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'title',
label: '标题',
type: 'string',
placeholder: '请输入标示名称'
},{
name: 'link',
label: '链接',
type: 'string'
},{
name: 'date',
label: '日期',
type: 'date'
},{
name: 'img',
label: '图片',
type: 'imageUpload'
}
],
columns: [
{
title: 'DOCID', // table header 文案
dataIndex: 'docid', // 数据对象内的属性,也做react vdom 的key
type: 'string', // table 内显示的类型
sort: true, // 是否需要排序
width:200
}, {
title: '标题',
dataIndex: 'title',
type: 'string'
}, {
title: '链接',
dataIndex: 'link',
type: 'link'
}, {
title: '操作',
type: 'operate', // 操作的类型必须为 operate
width: 120,
btns: [{
text: '更新',
type: 'update'
},{
text: '删除',
type: 'delete'
},{
text: '展示',
callback: function(item){
console.log(item)
}
}], // 可选
// 对应btns 的回调函数
// item为操作的单一数据对象
// callback 为组件的回调函数,将处理之后的数据回传 删除则传undefined
// callbacks: [function(item, callback){
// item.docid = 0;
// callback(item, 'update');
// },function(item, callback){
// callback(item, 'delete');
// }]
}
],
uploadfile: function(data){
}
};
const Feature2 = FeatureSetConfig(conf);
export default Feature2;
// 纯数据展现情况列表
import React from 'react';
import { Upload, Icon } from 'antd';
import baidubce from 'bce-sdk-js';
import BDUploader from '../component/BDUploader';
const Feature7 = React.createClass({
getInitialState: function() {
return {
img_url:''
};
},
render: function() {
const self = this;
return <div>
<h3 className="f-title">{this.props.title}</h3>
<input type="text" value={this.state.img_url} />
<img src={this.state.img_url} />
<BDUploader success={this.uploadSuccess} />
</div>;
},
uploadSuccess: function(url){
console.log(url)
this.setState({
img_url: url
})
}
});
export default Feature7;
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