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.

resource_desc.tmpl 2.6 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {{template "base/head_home" .}}
  2. <style>
  3. .resource-desc td ul {
  4. margin: 0em;
  5. padding-inline-start: 20px;
  6. padding-right: 10px;
  7. }
  8. </style>
  9. <div class="ui resource-desc" style="width: 90%; margin: 0 auto">
  10. <h1 class="ui center am-pt-30 am-pb-20">平台资源说明</h1>
  11. <div class="ui divider am-pb-10"></div>
  12. <table class="ui celled structured table">
  13. <thead>
  14. <tr>
  15. <th>集群</th>
  16. <th>计算资源</th>
  17. <th>任务类型</th>
  18. <th>卡类型</th>
  19. <th>可用镜像</th>
  20. <th>网络类型</th>
  21. <th>数据集处理方式</th>
  22. <th>容器目录说明</th>
  23. <th>示例代码仓</th>
  24. <th>备注</th>
  25. </tr>
  26. </thead>
  27. <tbody id="resource-desc"></tbody>
  28. </table>
  29. </div>
  30. {{template "base/footer" .}}
  31. <script>
  32. (function () {
  33. $.ajax({
  34. url: "/dashboard/invitation",
  35. type: "get",
  36. data: { filename: "resource/resource_desc.json" },
  37. contentType: "application/json; charset=utf-8",
  38. success(res) {
  39. const fragment = document.createDocumentFragment();
  40. const data = JSON.parse(res);
  41. console.log("data", data);
  42. let html = "";
  43. let reourceLength;
  44. data.forEach((resource) => {
  45. Object.keys(resource).forEach((cardType, index) => {
  46. let reourceLength = 0;
  47. let html1 = "";
  48. resource[cardType].forEach((card) => {
  49. console.log("card", card);
  50. Object.keys(card).forEach((item) => {
  51. let html2 = "";
  52. reourceLength += card[item].length;
  53. let cardLength = 0;
  54. card[item].forEach((el) => {
  55. cardLength += 1;
  56. console.log("el", el, cardLength);
  57. html2 += `<tr class="wrap"><td class="single line">${el.taskType}</td>
  58. <td class="single line">${el.cardType}</td>
  59. <td>
  60. ${el.imageDesc}
  61. </td>
  62. <td class="single line">${el.net}</td>
  63. <td >${el.dataset}</td>
  64. <td>
  65. ${el.dockerDir}
  66. </td>
  67. <td><a href="${el.example_repo}">${el.example_repo}</a></td>
  68. <td>${el.note}</td></tr>`;
  69. });
  70. html2 = html2.replace(
  71. /^<tr class="wrap">/,
  72. `<tr class="wrap"><td class="single line" rowspan="${cardLength}">${item}</td>`
  73. );
  74. html1 += html2;
  75. });
  76. });
  77. html1 = html1.replace(
  78. /^<tr class="wrap">/,
  79. `<tr class="wrap"><td class="single line" rowspan="${reourceLength}">${cardType}</td>`
  80. );
  81. html += html1;
  82. });
  83. });
  84. document.querySelector("tbody#resource-desc").innerHTML = html;
  85. },
  86. error(err) {
  87. console.log(err);
  88. },
  89. });
  90. })();
  91. </script>