columnsMap.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. import React from 'react';
  2. import { Icon } from 'antd';
  3. import {
  4. genAbsolutePicUrl,
  5. renderProductType,
  6. renderVideoQuality,
  7. renderCategory,
  8. renderStatus,
  9. getResourceTypeName,
  10. } from '../../utils/utils';
  11. import { Hotax } from '../../utils/config';
  12. import styles from './columnsMap.less';
  13. function renderPicture(path) {
  14. return (
  15. <div className={styles.thumb}>
  16. <img src={genAbsolutePicUrl(path)} alt="" />
  17. </div>
  18. );
  19. }
  20. function renderPictureData(record) {
  21. const { code, name } = record;
  22. return (
  23. <div className={styles.data}>
  24. <p>{code}</p>
  25. <p>{name}</p>
  26. </div>
  27. );
  28. }
  29. const clMap = {
  30. Resource: {
  31. columns: [{
  32. title: '缩略图',
  33. key: 1,
  34. render: (_, record) => {
  35. const { type } = record;
  36. if (type === Hotax.RESOURCE_IMAGE) {
  37. const { path } = record;
  38. return (
  39. <div className={styles.thumb}>
  40. <img src={genAbsolutePicUrl(path)} alt="" />
  41. </div>
  42. );
  43. } else if (type === Hotax.RESOURCE_AUDIOBOOK) {
  44. const { img } = record;
  45. const { path } = img || {};
  46. return (
  47. <div className={styles.thumb}>
  48. <img src={genAbsolutePicUrl(path)} alt="" />
  49. </div>
  50. );
  51. } else {
  52. return (
  53. <Icon style={{ fontSize: 50 }} type="video-camera" />
  54. );
  55. }
  56. },
  57. width: '25%',
  58. align: 'center',
  59. }, {
  60. title: '编号/名称',
  61. key: 2,
  62. render: (_, record) => renderPictureData(record),
  63. width: '40%',
  64. }, {
  65. title: '资源类型',
  66. key: 3,
  67. dataIndex: 'type',
  68. render: text => getResourceTypeName(text),
  69. align: 'center',
  70. }],
  71. },
  72. Picture: {
  73. columns: [{
  74. title: '图片',
  75. key: 1,
  76. dataIndex: 'path',
  77. render: path => renderPicture(path),
  78. width: '25%',
  79. align: 'center',
  80. }, {
  81. title: '编号/名称',
  82. key: 2,
  83. dataIndex: 'record',
  84. render: (_, record) => renderPictureData(record),
  85. }],
  86. },
  87. PictureSingle: {
  88. columns: [{
  89. title: '图片',
  90. key: 1,
  91. dataIndex: 'path',
  92. render: path => renderPicture(path),
  93. width: '12%',
  94. align: 'center',
  95. }, {
  96. title: '图片编号',
  97. key: 2,
  98. dataIndex: 'code',
  99. width: '25%',
  100. }, {
  101. title: '图片名称',
  102. dataIndex: 'name',
  103. key: 3,
  104. width: '35%',
  105. }, {
  106. title: '图片格式',
  107. dataIndex: 'format',
  108. key: 4,
  109. width: '12%',
  110. }, {
  111. title: '图片大小',
  112. dataIndex: 'size',
  113. key: 5,
  114. }],
  115. },
  116. Video: {
  117. columns: [{
  118. title: '视频编号',
  119. key: 1,
  120. dataIndex: 'code',
  121. width: '30%',
  122. }, {
  123. title: '视频名称',
  124. key: 2,
  125. dataIndex: 'name',
  126. width: '40%',
  127. }, {
  128. title: '视频格式',
  129. key: 3,
  130. dataIndex: 'format',
  131. width: '15%',
  132. }, {
  133. title: '视频品质',
  134. key: 4,
  135. dataIndex: 'quality',
  136. render: text => renderVideoQuality(text),
  137. }],
  138. },
  139. AudioBook: {
  140. columns: [{
  141. title: '有声读物编号',
  142. key: 1,
  143. dataIndex: 'code',
  144. width: '40%',
  145. }, {
  146. title: '有声读物名称',
  147. key: 2,
  148. dataIndex: 'name',
  149. }],
  150. },
  151. Courseware: {
  152. columns: [{
  153. title: '课件编号',
  154. key: 1,
  155. dataIndex: 'code',
  156. width: '40%',
  157. }, {
  158. title: '课件名称',
  159. key: 2,
  160. dataIndex: 'title',
  161. }],
  162. },
  163. Lesson: {
  164. columns: [{
  165. title: '课编号',
  166. key: 1,
  167. dataIndex: 'code',
  168. width: '40%',
  169. }, {
  170. title: '课名称',
  171. key: 2,
  172. dataIndex: 'title',
  173. }],
  174. },
  175. Course: {
  176. columns: [{
  177. title: '课程编号',
  178. key: 1,
  179. dataIndex: 'code',
  180. width: '40%',
  181. }, {
  182. title: '课程名称',
  183. key: 2,
  184. dataIndex: 'name',
  185. }],
  186. },
  187. Support: {
  188. columns: [{
  189. title: '配套编号',
  190. key: 1,
  191. dataIndex: 'code',
  192. width: '40%',
  193. }, {
  194. title: '配套名称',
  195. key: 2,
  196. dataIndex: 'name',
  197. }],
  198. },
  199. Training: {
  200. columns: [{
  201. title: '师训编号',
  202. key: 1,
  203. dataIndex: 'code',
  204. width: '40%',
  205. }, {
  206. title: '师训主题',
  207. key: 2,
  208. dataIndex: 'name',
  209. }],
  210. },
  211. Package: {
  212. columns: [{
  213. title: '套餐包编号',
  214. key: 1,
  215. dataIndex: 'code',
  216. width: '40%',
  217. }, {
  218. title: '套餐包名称',
  219. key: 2,
  220. dataIndex: 'name',
  221. }],
  222. },
  223. Product: {
  224. columns: [{
  225. title: '产品编号',
  226. key: 1,
  227. dataIndex: 'code',
  228. width: '25%',
  229. }, {
  230. title: '产品名称',
  231. key: 2,
  232. dataIndex: 'name',
  233. width: '45%',
  234. }, {
  235. title: '产品类型',
  236. key: 3,
  237. dataIndex: 'type',
  238. render: text => renderProductType(text),
  239. }],
  240. },
  241. Merchant: {
  242. columns: [{
  243. title: '厂商编号',
  244. key: 1,
  245. dataIndex: 'code',
  246. width: '30%',
  247. }, {
  248. title: '厂商名称',
  249. key: 2,
  250. dataIndex: 'name',
  251. width: '30%',
  252. }, {
  253. title: '厂商类型',
  254. key: 3,
  255. dataIndex: 'domain',
  256. render: text => renderCategory(text),
  257. }],
  258. },
  259. Campus: {
  260. columns: [{
  261. title: '校区编号',
  262. key: 1,
  263. dataIndex: 'code',
  264. width: '20%',
  265. }, {
  266. title: '校区名称',
  267. key: 2,
  268. dataIndex: 'name',
  269. width: '40%',
  270. }, {
  271. title: '所属厂商',
  272. key: 3,
  273. dataIndex: 'merchantName',
  274. }],
  275. },
  276. Terminal: {
  277. columns: [{
  278. title: '终端编号',
  279. key: 1,
  280. dataIndex: 'code',
  281. width: '15%',
  282. }, {
  283. title: '终端名称',
  284. key: 2,
  285. dataIndex: 'name',
  286. width: '15%',
  287. }, {
  288. title: '所属校区',
  289. key: 3,
  290. dataIndex: 'campusName',
  291. width: '40%',
  292. }, {
  293. title: '所属渠道',
  294. key: 4,
  295. dataIndex: 'merchantName',
  296. }],
  297. },
  298. TagGroup: {
  299. columns: [{
  300. title: '标签组编号',
  301. key: 1,
  302. dataIndex: 'code',
  303. width: '45%',
  304. }, {
  305. title: '标签组名称',
  306. key: 2,
  307. dataIndex: 'name',
  308. width: '20%',
  309. }, {
  310. title: '所属渠道名称',
  311. key: 3,
  312. dataIndex: 'merchantName',
  313. }],
  314. },
  315. TagType: {
  316. columns: [{
  317. title: '标签类型编号',
  318. key: 1,
  319. dataIndex: 'code',
  320. width: '40%',
  321. }, {
  322. title: '标签类型名称',
  323. key: 2,
  324. dataIndex: 'name',
  325. }],
  326. },
  327. allTag: {
  328. columns: [{
  329. title: '标签名称',
  330. key: 1,
  331. dataIndex: 'name',
  332. width: '30%',
  333. }, {
  334. title: '标签类型',
  335. key: 2,
  336. dataIndex: 'typeCode',
  337. width: '15%',
  338. }, {
  339. title: '所属标签组',
  340. key: 3,
  341. dataIndex: 'groupName',
  342. width: '40',
  343. }, {
  344. title: '所属渠道',
  345. key: 4,
  346. dataIndex: 'merchantName',
  347. width: '15%',
  348. }],
  349. },
  350. Tag: {
  351. columns: [{
  352. title: '标签名称',
  353. key: 1,
  354. dataIndex: 'name',
  355. width: '25%',
  356. }, {
  357. title: '标签类型',
  358. key: 2,
  359. dataIndex: 'typeCode',
  360. width: '25%',
  361. }, {
  362. title: '所属厂商',
  363. key: 3,
  364. dataIndex: 'merchantName',
  365. width: '25%',
  366. }, {
  367. title: '标签状态',
  368. key: 4,
  369. dataIndex: 'status',
  370. render: text => renderStatus(text),
  371. }],
  372. },
  373. };
  374. export function getSelectorColumns(name) {
  375. return clMap[name].columns;
  376. }