Activity.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="activity">
  3. <el-loading></el-loading>
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item>新媒体</el-breadcrumb-item>
  6. <el-breadcrumb-item>重大活动传播数据</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <br />
  9. <el-tabs
  10. tab-position="top"
  11. style="max-height: 100%;"
  12. @tab-click="selectTab"
  13. >
  14. <el-tab-pane :label="item.name" v-for="(item, i) in activitys" :key="i">
  15. <el-scrollbar
  16. height="100%"
  17. always
  18. wrap-class="scorll"
  19. :name="i"
  20. v-if="item.component === select || selectA[item.component]"
  21. >
  22. <component :is="item.component" :item="item"></component>
  23. </el-scrollbar>
  24. </el-tab-pane>
  25. </el-tabs>
  26. </div>
  27. </template>
  28. <script>
  29. // @ is an alias to /src
  30. import { defaultAjax } from "@/api/index";
  31. import derunsanqin from "./views/derunsanqin.vue";
  32. import huashanyunhai from "./views/huashanyunhai.vue";
  33. import mianmianjiedao from "./views/mianmianjiedao.vue";
  34. import zhongqiuzhiye from "./views/zhongqiuzhiye.vue";
  35. import shanxijiaoao1 from "./views/shanxijiaoao1.vue";
  36. import shanxijiaoao2 from "./views/shanxijiaoao2.vue";
  37. export default {
  38. name: "Activity",
  39. data() {
  40. return {
  41. activitys: [],
  42. select: "",
  43. selectA: {},
  44. };
  45. },
  46. mounted() {
  47. defaultAjax({
  48. url: "https://djweb.smcic.net/dj/static/chinaMap.json?t=" + Date.now(),
  49. }).then(map => {
  50. localStorage.setItem("chinaMap", JSON.stringify(map.json));
  51. this.activitys = [
  52. {
  53. name: "德润三秦",
  54. url: ["https://djweb.smcic.net/dj/static/t.json?" + Date.now()],
  55. component: "derunsanqin",
  56. },
  57. {
  58. name: "华山云海音乐会",
  59. component: "huashanyunhai",
  60. },
  61. {
  62. name: "面面皆道",
  63. component: "mianmianjiedao",
  64. },
  65. {
  66. name: "中秋之夜",
  67. component: "zhongqiuzhiye",
  68. },
  69. {
  70. name: "陕西骄傲-第二季",
  71. component: "shanxijiaoao2",
  72. },
  73. {
  74. name: "陕西骄傲-第一季",
  75. component: "shanxijiaoao1",
  76. },
  77. ];
  78. this.select = (this.activitys[0] || {}).component;
  79. this.selectA[this.select] = true;
  80. });
  81. },
  82. computed: {},
  83. methods: {
  84. selectTab(tab) {
  85. try {
  86. this.select = this.activitys[tab.index].component;
  87. this.selectA[this.select] = true;
  88. } catch (err) {
  89. console.log(err);
  90. }
  91. },
  92. },
  93. beforeUnmount: function() {},
  94. components: {
  95. derunsanqin,
  96. huashanyunhai,
  97. mianmianjiedao,
  98. zhongqiuzhiye,
  99. shanxijiaoao1,
  100. shanxijiaoao2,
  101. },
  102. };
  103. </script>
  104. <style>
  105. .activity {
  106. padding: 10px 15px;
  107. box-sizing: border-box;
  108. }
  109. .activity .num {
  110. font-size: 42px;
  111. color: #91afc8;
  112. }
  113. .titleNum {
  114. text-align: center;
  115. }
  116. .chart {
  117. padding: 5px 3px;
  118. }
  119. .subtitle {
  120. font-size: 16px;
  121. font-weight: 600;
  122. }
  123. .wumen {
  124. height: 1.5em;
  125. overflow: hidden;
  126. border-radius: 3px;
  127. background-color: #fc8452;
  128. text-align: right;
  129. }
  130. .men {
  131. width: 50%;
  132. background-color: #566ec6;
  133. height: 100%;
  134. }
  135. </style>