MiniGameThreshold.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="minigame-threshold admin-page">
  3. <el-card>
  4. <PageHeader slot="header" title="小游戏维度阈值显隐配置">
  5. <el-select
  6. v-model="selectedGameId"
  7. placeholder="选择小游戏"
  8. filterable
  9. clearable
  10. class="game-select"
  11. @change="onGameChange"
  12. >
  13. <el-option
  14. v-for="g in games"
  15. :key="g.id"
  16. :label="(g.gameName || '') + '(' + (g.gameCode || '') + ')'"
  17. :value="g.id"
  18. />
  19. </el-select>
  20. </PageHeader>
  21. <div class="game-body">
  22. <div v-if="!selectedGameId" class="game-empty">
  23. <el-empty description="请先选择一个小游戏,再配置维度阈值显隐" />
  24. </div>
  25. <content-dimension-threshold-editor
  26. v-else
  27. content-type="MINIGAME"
  28. :content-id="selectedGameId"
  29. />
  30. </div>
  31. </el-card>
  32. </div>
  33. </template>
  34. <script>
  35. import ContentDimensionThresholdEditor from '@/components/ContentDimensionThresholdEditor.vue'
  36. import { getAllMiniGames } from '@/api/content-dimension-threshold'
  37. export default {
  38. name: 'MiniGameThreshold',
  39. components: { ContentDimensionThresholdEditor },
  40. data() {
  41. return {
  42. games: [],
  43. selectedGameId: null,
  44. loading: false
  45. }
  46. },
  47. created() {
  48. this.loadGames()
  49. },
  50. methods: {
  51. async loadGames() {
  52. this.loading = true
  53. try {
  54. const res = await getAllMiniGames()
  55. if (res.code === 200 && Array.isArray(res.data)) {
  56. this.games = res.data
  57. }
  58. } catch (e) {
  59. this.$message.error('加载小游戏列表失败')
  60. } finally {
  61. this.loading = false
  62. }
  63. },
  64. onGameChange(val) {
  65. this.selectedGameId = val || null
  66. }
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. .minigame-threshold {
  72. padding: 24px;
  73. flex: 1;
  74. display: flex;
  75. flex-direction: column;
  76. min-height: 0;
  77. }
  78. .minigame-threshold > .el-card {
  79. flex: 1;
  80. display: flex;
  81. flex-direction: column;
  82. min-height: 0;
  83. }
  84. .minigame-threshold > .el-card /deep/ .el-card__body {
  85. flex: 1;
  86. display: flex;
  87. flex-direction: column;
  88. min-height: 0;
  89. }
  90. .game-select {
  91. width: 320px;
  92. }
  93. .game-body {
  94. flex: 1;
  95. min-height: 0;
  96. overflow-y: auto;
  97. }
  98. .game-empty {
  99. padding: 40px 0;
  100. }
  101. </style>