Home.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="home">
  3. <div class="part-box part-box-pad part-box-flex">
  4. <div></div>
  5. <div>
  6. <el-button type="primary" icon="el-icon-refresh" @click="toAdd"
  7. >新增标准题卡</el-button
  8. >
  9. <el-button type="success" icon="el-icon-refresh" @click="toFreeAdd"
  10. >新增自由题卡</el-button
  11. >
  12. </div>
  13. </div>
  14. <div class="part-box part-box-pad">
  15. <el-table ref="TableList" :data="cards">
  16. <el-table-column type="index" label="序号" width="70"></el-table-column>
  17. <el-table-column prop="name" label="名称"></el-table-column>
  18. <el-table-column class-name="action-column" label="操作" width="200px">
  19. <template slot-scope="scope">
  20. <el-button
  21. class="btn-primary"
  22. type="text"
  23. @click="toEdit(scope.row)"
  24. >编辑</el-button
  25. >
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <div class="part-page">
  30. <el-pagination
  31. background
  32. layout="total,prev, pager, next"
  33. :current-page="current"
  34. :total="total"
  35. :page-size="size"
  36. @current-change="toPage"
  37. >
  38. </el-pagination>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. name: "home",
  46. data() {
  47. return {
  48. current: 1,
  49. size: 10,
  50. total: 10,
  51. cards: []
  52. };
  53. },
  54. mounted() {
  55. this.getList();
  56. },
  57. methods: {
  58. getList() {
  59. this.cards = [
  60. {
  61. id: "1111",
  62. name: "题卡001"
  63. },
  64. {
  65. id: "2222",
  66. name: "题卡002"
  67. }
  68. ];
  69. this.total = this.cards.length;
  70. },
  71. toPage(page) {
  72. this.current = page;
  73. this.getList();
  74. },
  75. toEdit(row) {
  76. this.$ls.set("prepareTcPCard", {
  77. examTaskId: "1111",
  78. courseCode: "数学",
  79. courseName: "sx001",
  80. makeMethod: "SELF",
  81. cardRuleId: "1"
  82. });
  83. this.$router.push({
  84. name: "CardFreeEdit",
  85. params: {
  86. cardId: row.id
  87. }
  88. });
  89. },
  90. toAdd() {
  91. this.$ls.set("prepareTcPCard", {
  92. examTaskId: "1111",
  93. courseCode: "数学",
  94. courseName: "sx001",
  95. makeMethod: "SELF",
  96. cardRuleId: "1"
  97. });
  98. this.$router.push({
  99. name: "CardEdit"
  100. });
  101. },
  102. toFreeAdd() {
  103. this.$ls.set("prepareTcPCard", {
  104. examTaskId: "1111",
  105. courseCode: "数学",
  106. courseName: "sx001",
  107. makeMethod: "SELF",
  108. cardRuleId: "1"
  109. });
  110. this.$router.push({
  111. name: "CardFreeEdit"
  112. });
  113. }
  114. }
  115. };
  116. </script>
  117. <style scoped>
  118. .home {
  119. background: #eff0f5;
  120. padding: 20px;
  121. }
  122. </style>