|
|
|
@@ -50,6 +50,14 @@ export default { |
|
|
|
if (res.Code == 0) { |
|
|
|
const list = res.Data.Repos || []; |
|
|
|
this.list = list.map((item) => { |
|
|
|
item.Contributors = (item.Contributors || []).map((_item) => { |
|
|
|
return { |
|
|
|
..._item, |
|
|
|
bgColor: this.randomColor(_item.Email[0].toLocaleUpperCase()), |
|
|
|
} |
|
|
|
}); |
|
|
|
const contributors = item.Contributors || []; |
|
|
|
const contributorsCnt = item.TotalContributorCount <= 6 ? Math.min(contributors.length, item.TotalContributorCount) : item.TotalContributorCount; |
|
|
|
return { |
|
|
|
...item, |
|
|
|
NameShow: this.handlerSearchStr(item.Name, this.q), |
|
|
|
@@ -60,6 +68,7 @@ export default { |
|
|
|
topicShow: this.handlerSearchStr(_item, this.q) |
|
|
|
} |
|
|
|
}), |
|
|
|
TotalContributorCountShow: contributorsCnt <= 10 ? contributorsCnt.toString() : '10+', |
|
|
|
} |
|
|
|
}); |
|
|
|
this.total = res.Data.Total; |
|
|
|
@@ -89,6 +98,12 @@ export default { |
|
|
|
handlerSearchStr(oStr, searchKey) { |
|
|
|
if (!searchKey) return oStr; |
|
|
|
return oStr.replace(new RegExp(`(${searchKey})`, 'ig'), `<font color="red">$1</font>`); |
|
|
|
}, |
|
|
|
randomColor(t) { |
|
|
|
const tIndex = t.charCodeAt(0); |
|
|
|
const colorList = ["#1abc9c", "#2ecc71", "#3498db", "#9b59b6", "#34495e", "#16a085", "#27ae60", "#2980b9", "#8e44ad", |
|
|
|
"#2c3e50", "#f1c40f", "#e67e22", "#e74c3c", "#00bcd4", "#95a5a6", "#f39c12", "#d35400", "#c0392b", "#bdc3c7", "#7f8c8d"]; |
|
|
|
return colorList[tIndex % colorList.length]; |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: {}, |
|
|
|
|