home.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="home">
  3. <el-container style="height: 100%;">
  4. <el-aside width="300px" style="background-color: rgb(238, 241, 246);height: 100%;">
  5. <el-menu :default-openeds="['1', '3']" @select="handleSelect">
  6. <el-submenu index="1">
  7. <template slot="title"><i class="el-icon-message"></i>专业课列表</template>
  8. <el-menu-item index="1" >数据结构与算法</el-menu-item>
  9. <el-menu-item index="2">数据库原理与应用</el-menu-item>
  10. </el-submenu>
  11. </el-menu>
  12. </el-aside>
  13. <el-container>
  14. <el-main>
  15. <div id="knowmap"></div>
  16. </el-main>
  17. </el-container>
  18. </el-container>
  19. </div>
  20. </template>
  21. <script>
  22. import { swiper, swiperSlide } from 'vue-awesome-swiper'
  23. import 'swiper/dist/css/swiper.css'
  24. import { mapGetters } from 'vuex'
  25. import { getData} from '../mock/knowmap'
  26. export default {
  27. components: {
  28. },
  29. data() {
  30. return {
  31. echarts: null,
  32. option: {
  33. title: {
  34. text: '数据结构与算法知识图谱',
  35. subtext: 'Default layout',
  36. top: 'bottom',
  37. left: 'right'
  38. },
  39. tooltip: {},
  40. legend: [
  41. ],
  42. animationDuration: 1500,
  43. animationEasingUpdate: 'quinticInOut',
  44. series: [
  45. {
  46. name: '知识点',
  47. type: 'graph',
  48. legendHoverLink: false,
  49. layout: 'force',
  50. data: [],
  51. links: [],
  52. categories: [],
  53. roam: true,
  54. label: {
  55. show: true,
  56. position: 'right',
  57. formatter: '{b}'
  58. },
  59. edgeSymbol: ['circle', 'arrow'],
  60. labelLayout: {
  61. hideOverlap: true
  62. },
  63. scaleLimit: {
  64. min: 0.4,
  65. max: 2
  66. },
  67. lineStyle: {
  68. color: 'source',
  69. curveness: 0.3
  70. }
  71. }
  72. ]
  73. }
  74. }
  75. },
  76. mounted() {
  77. this.initECharts();
  78. },
  79. methods: {
  80. initECharts() {
  81. //
  82. this.echarts = this.$echarts.init(document.getElementById("knowmap"))
  83. this.echarts.setOption(this.option)
  84. },
  85. handleSelect(obj) {
  86. //科目的知识图谱数据
  87. const knows = getData(obj)
  88. this.option.series[0].data = knows.nodes
  89. this.option.series[0].links = knows.links
  90. this.option.series[0].categories = knows.categories
  91. this.echarts.setOption(this.option)
  92. }
  93. },
  94. }
  95. </script>
  96. <style lang='scss' scoped>
  97. #knowmap {
  98. height: 100%;
  99. }
  100. h2 {
  101. font-size: 36px;
  102. text-align: center;
  103. margin: 40px 0;
  104. font-weight: normal;
  105. }
  106. h3 {
  107. font-size: 18px;
  108. text-align: center;
  109. color: #737373;
  110. margin: 40px 0;
  111. font-weight: normal;
  112. }
  113. .el-divider__text,
  114. .el-link {
  115. font-weight: 500;
  116. font-size: 45px;
  117. }
  118. .demoList ul {
  119. width: 100%;
  120. box-sizing: border-box;
  121. margin-bottom: 100px;
  122. }
  123. .demoList {
  124. margin: 0 auto;
  125. padding-top: 30px;
  126. }
  127. .course_detail {
  128. padding-top: 6px;
  129. max-height: 48px;
  130. line-height: 20px;
  131. display: -webkit-box;
  132. -webkit-line-clamp: 2;
  133. -webkit-box-orient: vertical;
  134. overflow: hidden;
  135. font-size: 14px;
  136. color: #93999f
  137. }
  138. .demoList li {
  139. box-sizing: border-box;
  140. width: 192px;
  141. min-height: 160px;
  142. float: left;
  143. margin-right: 40px;
  144. margin-bottom: 30px;
  145. text-align: left;
  146. img {
  147. cursor: pointer;
  148. width: 100%;
  149. height: 108px;
  150. display: block;
  151. border-radius: 8px;
  152. &:hover {
  153. opacity: 0.7;
  154. /* .course_title{
  155. color:#ca0000;
  156. }*/
  157. }
  158. }
  159. }
  160. .typeitem {
  161. cursor: pointer;
  162. width: 300px;
  163. .title {
  164. padding-top: 8px;
  165. font-weight: bold;
  166. &:hover {
  167. cursor: pointer;
  168. color: red;
  169. }
  170. }
  171. }
  172. .demoList li {
  173. width: 30%;
  174. }
  175. .demoList .page {
  176. position: relative;
  177. left: 0;
  178. bottom: 50px;
  179. width: 100%;
  180. text-align: center;
  181. }
  182. .demoList li .image {
  183. height: 199px;
  184. width: 100%;
  185. display: block;
  186. }
  187. @keyframes turn-over {
  188. to {
  189. transform: rotateX(-180deg);
  190. }
  191. }
  192. .home {
  193. overflow: hidden;
  194. height: 100%;
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. }
  199. </style>