wheel/utils/text.js
2019-11-29 13:52:16 +08:00

22 lines
391 B
JavaScript

module.exports = function formOpt(opts) {
const result = {
id: 0,
awards: [],
}
const colors = ['#17BEBB', '#2E282A', '#CD5334']
const colorNum = opts.length % 2 === 1 ? 3 : 2
opts.map((item, index) => {
result.awards.push({
name: item.title,
content: item.content,
color: colors[index % colorNum],
idx: index,
})
})
return result
}