You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

course_list.tmpl 10 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <style>
  2. .text-right{
  3. float:right !important;
  4. }
  5. .header{
  6. font-weight:bold;
  7. font-size: 18px;
  8. font-family: SourceHanSansSC-medium;
  9. }
  10. .cor{
  11. color:#0366D6 !important;
  12. }
  13. .header_card{
  14. /* color:#003A8C !important; */
  15. color:#101010 !important;
  16. margin: 10px 0 0px 0;
  17. height: 25px;
  18. font-size: 18px;
  19. }
  20. .marg{
  21. margin: 0 5px !important;
  22. }
  23. .content_list{
  24. max-height: 130px;
  25. overflow: auto;
  26. }
  27. .Relist{
  28. color:#0366D6 !important;
  29. }
  30. .descript_height{
  31. color: #999999 !important;
  32. margin: 10px 0;
  33. height: 40px !important;
  34. word-break:break-all;
  35. line-height: 20px;
  36. overflow: hidden;
  37. /* overflow: hidden!important;
  38. word-wrap:break-word!important; */
  39. }
  40. .tags_height{
  41. height: 30px !important;
  42. }
  43. .full_height{
  44. height: 100%;
  45. }
  46. .omit{
  47. overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  48. }
  49. /deep/ ui.checkbox input[type=checkbox]::after{
  50. border: 1px solid #0366D6 !important;
  51. }
  52. .nowrap-2 {
  53. /* height: 2.837em; */
  54. /* line-height: 1.4285em; */
  55. overflow: hidden;
  56. overflow: hidden;
  57. display: -webkit-box;
  58. -webkit-line-clamp: 2;
  59. -webkit-box-orient: vertical;
  60. }
  61. .ui.label{
  62. color:#0366D6 !important;
  63. background-color: #B3DBDB !important;
  64. font-weight:normal !important
  65. }
  66. .tag_text{
  67. /* margin-top: 2px; */
  68. /* margin-left: 0.5em; */
  69. font-size: 14px;
  70. }
  71. .card{
  72. box-shadow: 0px 4px 4px 0px rgba(232, 232, 232, 60) !important;
  73. border-radius: 5px;
  74. border: 1px solid #E8E8E8 !important;
  75. }
  76. </style>
  77. <div style="width: 100%;">
  78. <div class="ui three cards" style="margin-bottom: 10px;">
  79. {{range .Repos}}
  80. <div class="card " >
  81. <div class="extra full_height cor" >
  82. <div class="content " >
  83. {{if .Topics }}
  84. <div class=" tags " style="position: relative;">
  85. {{range .Topics}}
  86. {{if ne . "" }}<a style="max-width:100%;margin: 5px 0;display:inline-flex;" ><span class="ui small label topic omit" >{{.}}</span></a>{{end}}
  87. {{end}}
  88. </div>
  89. {{end}}
  90. </div>
  91. <div class=" header header_card omit" >
  92. <a class="header_card image poping up " href="{{.Link}}" data-content="{{.Alias}}" data-position="top left" data-variation="tiny inverted"> {{.Alias}}</a>
  93. </div>
  94. <div class='content descript_height nowrap-2'>
  95. {{.Description}}
  96. </div>
  97. </div>
  98. <div class=" extra content" style="color:#888888;border-top: none !important;padding-top: 0px;margin-bottom: 15px;">
  99. <div class="left aligned author">
  100. <!-- <span > -->
  101. {{if .Creator }}
  102. <a href="{{.Creator.Name}}" title="{{.Creator.Name}}">
  103. <img class="ui avatar image" style="width: 22px;height:22px;margin-top:-5px" src="{{.Creator.RelAvatarLink}}">
  104. </a>
  105. {{else}}
  106. <a href="{{.Owner.Name}}" title="{{.Owner.Name}}">
  107. <img class="ui avatar image" style="width: 22px;height:22px;margin-top:-5px" src="{{.Owner.RelAvatarLink}}">
  108. </a>
  109. {{end}}
  110. {{$.i18n.Tr "org.repo_released"}}&nbsp;: &nbsp; {{TimeSinceUnixShort .CreatedUnix}}
  111. <!-- </span> -->
  112. </div>
  113. </div>
  114. </div>
  115. {{end}}
  116. </div>
  117. </div>
  118. <script>
  119. console.log({{.Repos}})
  120. var data;
  121. var filterData=[];
  122. var num=0;
  123. function showcreate(obj){
  124. document.getElementById("search_selectPro").value=''
  125. $('.ui.modal')
  126. .modal({
  127. centered: false,
  128. onShow:function(){
  129. $("#org_list").empty()
  130. getPro(1)
  131. },
  132. onHide:function(){
  133. }
  134. })
  135. .modal('show')
  136. }
  137. function getPro(typeTag){
  138. $.ajax({
  139. type:"GET",
  140. url:"/org/{{.Org.Name}}/org_tag/repo_list?tagId="+typeTag,
  141. dataType:"json",
  142. async:false,
  143. success:function(json){
  144. data = json.data;
  145. var n_length = data.length
  146. pro_html = getHTML(data)
  147. $("#org_list").append(pro_html)
  148. // console.log('原始',data)
  149. checkedNum(0)
  150. }
  151. });
  152. }
  153. function getHTML(data){
  154. let pro_html=''
  155. for (let i=0;i<data.length;i++){
  156. if (data[i].Selected==true){
  157. console.log("data[i]:",data[i])
  158. pro_html += `<div class="ui checkbox" style="width: 33%;margin-bottom:10px" > <input type="checkbox" id = " ${i}" checked="" onclick="checkedNum(${i})" class="Relist" name ='select_pro_name' data-repoid="${data[i].RepoID}" data-reponame="${data[i].RepoName}" data-selected=${data[i].Selected} > <label class='omit image poping up' data-content=${data[i].RepoName}  data-position="top left " data-variation="mini"> ${data[i].RepoName}</label></div>`
  159. pro_html += '</div>'
  160. }
  161. else{
  162. pro_html += `<div class="ui checkbox" style="width: 33%;margin-bottom:10px" > <input type="checkbox" id = "${i}" onclick="checkedNum(${i})" class="Relist" name ='select_pro_name' data-repoid="${data[i].RepoID}" data-reponame="${data[i].RepoName}" data-selected= ${data[i].Selected}> <label class='omit image poping up' data-content=${data[i].RepoName}  data-position="top left " data-variation="mini"> ${data[i].RepoName} </label></div>`
  163. pro_html += '</div>'
  164. }
  165. }
  166. return pro_html
  167. }
  168. function saveSeletedPro(typeTag){
  169. var saveData=[];
  170. $('input[name="select_pro_name"]:checked').each(function(){
  171. // console.log('值',this.dataset.repoid)
  172. saveData.push(parseInt(this.dataset.repoid));
  173. })
  174. if(saveData.length>9){
  175. alert("最多可选9个,保存失败")
  176. return
  177. }
  178. // saveData = getSelecteDataID();
  179. // console.log("数据:",saveData)
  180. $.ajax({
  181. type:"POST",
  182. url:"/org/{{.Org.Name}}/org_tag/repo_submit?tagId="+typeTag,
  183. contentType:'application/json',
  184. dataType:"json",
  185. async:false,
  186. data:JSON.stringify({'repoList':saveData
  187. }),
  188. success:function(res){
  189. console.log('保存成功');
  190. location.reload()
  191. }
  192. });
  193. }
  194. function getSelecteData(){
  195. var selectedData=[];
  196. $('input[name="select_pro_name"]:checked').each(function(){
  197. // console.log(this)
  198. // console.log('值',this.dataset.selected)
  199. selectedData.push({"RepoID":parseInt(this.dataset.repoid),"RepoName":this.dataset.reponame,"Selected":JSON.parse(this.dataset.selected)});
  200. })
  201. return selectedData
  202. }
  203. function search(){
  204. var selectedData = getSelecteData();
  205. var searchValue = document.getElementById("search_selectPro").value;
  206. filterData=[];
  207. console.log("searchValue:",searchValue)
  208. for (let i=0;i<data.length;i++){
  209. var isInclude=false;
  210. if(data[i].RepoName.toLowerCase().includes(searchValue.toLowerCase())){
  211. filterData.push(data[i])
  212. }
  213. }
  214. // console.log("选中的值:",selectedData)
  215. // console.log("筛选包括选中的值:",filterData)
  216. var showData=[];
  217. for(i=0;i<selectedData.length;i++){
  218. filterData =filterData.filter((item)=>{
  219. return item.RepoID!=selectedData[i].RepoID
  220. });
  221. }
  222. console.log("筛选后不包括选中的值:",filterData)
  223. $("#org_list").empty()
  224. if(searchValue!=""){
  225. if (filterData.length!=0){
  226. var pro_html = getHTML(selectedData);
  227. console.log("selectedData_pro_html:",pro_html)
  228. $("#org_list").append(pro_html)
  229. pro_html= getHTML(filterData);
  230. $("#org_list").append(pro_html)
  231. }else{
  232. var pro_html = getHTML(selectedData);
  233. $("#org_list").append(pro_html)
  234. }
  235. }else{
  236. var pro_html = getHTML(data);
  237. $("#org_list").append(pro_html)
  238. }
  239. }
  240. function checkedNum(id){
  241. num=0;
  242. var inputs = document.getElementsByName("select_pro_name")
  243. for (var i=0;i<inputs.length;i++){
  244. if(inputs[i].checked){
  245. num++
  246. if(num>9){
  247. document.getElementById(id).checked=false
  248. alert("选择超过9个,请重新选择!")
  249. return
  250. }
  251. }
  252. }
  253. var show_num = 9-num;
  254. document.getElementById("recommend").innerHTML="还能推荐"+show_num+"个"
  255. }
  256. </script>