new-major-detail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="app-container professDetail">
  3. <el-row :gutter="20">
  4. <el-col :span="6">
  5. <el-tabs type="border-card" @tab-click="tabClick" :value="type" stretch>
  6. <el-tab-pane label="本科" name="本科"></el-tab-pane>
  7. <el-tab-pane label="专科" name="专科"></el-tab-pane>
  8. <el-tree
  9. ref="tree"
  10. :data="majorList"
  11. node-key="code"
  12. :default-checked-keys="[code]"
  13. :default-expanded-keys="[code]"
  14. :props="defaultProps"
  15. :current-node-key="code"
  16. @node-click="handleNodeClick"
  17. :isLeaf="isLeaf"
  18. >
  19. <p class="custom-tree-node text-ellipsis" :title="node.label" slot-scope="{node, data}">
  20. <span>{{ node.label }}</span>
  21. <span>{{ data.children ? data.children.length : '' }}</span>
  22. </p>
  23. </el-tree>
  24. </el-tabs>
  25. </el-col>
  26. <el-col :span="18">
  27. <div>
  28. <el-card style="color: #5E5E5E;" ref="navBar">
  29. <div class="fx-row jc-between ai-center">
  30. <el-breadcrumb separator-class="el-icon-arrow-right">
  31. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  32. <el-breadcrumb-item :to="{ path: '/new-gaokao/three/ProfessLib'}">专业库</el-breadcrumb-item>
  33. <el-breadcrumb-item>专业详情</el-breadcrumb-item>
  34. </el-breadcrumb>
  35. <el-button plain round @click="$router.go(-1)">返回</el-button>
  36. </div>
  37. </el-card>
  38. <div class="mt20 header-content pd20">
  39. <div class="mb20 fx-row jc-between ai-center">
  40. <p class="f28 f-333">{{ majorDetail.name || '' }}</p>
  41. <el-button type="primary" round plain v-if="majorDetail.isCollect" @click="toUnCollect"><i
  42. class="iconfont icon-yiguanzhu"></i> 已收藏
  43. </el-button>
  44. <el-button type="primary" round plain v-else @click="toCollect"><i class="iconfont icon-guanzhu"></i> 收藏
  45. </el-button>
  46. </div>
  47. <p class="f14 f-666">{{ `国标代码${majorDetail.code}(不可用于填报)` }}</p>
  48. </div>
  49. <div class="tabs-wrap">
  50. <span class="tabs-item" @click="tabActive = 0" :class="{'bg-primary':tabActive == 0}">专业概况</span>
  51. <span class="tabs-item" @click="tabActive = 1" :class="{'bg-primary':tabActive == 1}">就业前景</span>
  52. <span class="tabs-item" v-if="majorDetail.eduLevel == 'ben'" @click="tabActive = 2"
  53. :class="{'bg-primary':tabActive == 2}">开设院校</span>
  54. </div>
  55. <p class="line"></p>
  56. <div
  57. v-show="loading"
  58. class="loading-div"
  59. v-loading="loading"
  60. :style="{height:windowHeight + 'px'}"
  61. >
  62. </div>
  63. <div class="content-wrap mt20">
  64. <!-- 专业概况 -->
  65. <major-introduce-info v-if="tabActive==0" :major-detail="majorDetail"/>
  66. <!-- 就业岗位-->
  67. <major-introduce-job v-if="tabActive==1&&prospects" :prospects="prospects"></major-introduce-job>
  68. <!-- 开设院校-->
  69. <open-college :code="code" v-if="tabActive == 2 "></open-college>
  70. <div v-if="tabActive == 1 && !prospects">
  71. {{ desc }}
  72. </div>
  73. </div>
  74. </div>
  75. </el-col>
  76. </el-row>
  77. </div>
  78. </template>
  79. <script>
  80. import MxChart from '@/components/MxChart/index'
  81. import { getMajorCareerProspectsByCode, getMajorOverviewByCode } from '@/api/webApi/professlib'
  82. import MxMajorTreeTranslateMixin from '@/components/Cache/modules/mx-major-tree-translate-mixin'
  83. import OpenCollege from '@/views/career/plan/components/OpenCollege'
  84. import { addConcernMajor, removeConcernedMajor } from '@/api/webApi/career-other'
  85. import MajorIntroduceInfo from '@/views/career/plan/components/major-introduce-info'
  86. import MajorIntroduceJob from '@/views/career/plan/components/major-introduce-job'
  87. export default {
  88. name: 'ProfessLibDetails',
  89. components: {
  90. MajorIntroduceJob,
  91. MajorIntroduceInfo,
  92. MxChart,
  93. OpenCollege
  94. },
  95. mixins: [MxMajorTreeTranslateMixin],
  96. data() {
  97. return {
  98. desc: '',
  99. loading: false,
  100. code: '',
  101. tabActive: 0,
  102. defaultProps: {
  103. children: 'children',
  104. label: 'name'
  105. },
  106. type: '本科',
  107. majorDetail: {}, // 概况
  108. prospects: {
  109. vocationalDistribution: [],
  110. industryDistribution: [],
  111. jobRegionDistribution: [],
  112. description: []
  113. }, // 前景
  114. windowHeight: document.documentElement.clientHeight
  115. }
  116. },
  117. computed: {
  118. majorList() {
  119. if (this.type == '本科') return this.masterMajorList
  120. if (this.type == '专科') return this.specialtyMajorList
  121. }
  122. },
  123. watch: {
  124. tabActive: {
  125. handler(newVal) {
  126. // 2 院校 1 前景 0 概览
  127. if (newVal == 0) this.getOverView()
  128. if (newVal == 1) this.getCareerProspects()
  129. }
  130. }
  131. },
  132. created() {
  133. this.code = this.$route.query.code
  134. this.type = this.$route.query.type || '本科'
  135. if (this.$route.query.code) {
  136. this.getOverView()
  137. }
  138. },
  139. mounted() {
  140. this.$refs.tree.setCurrentKey(this.code)
  141. },
  142. methods: {
  143. toCollect() {
  144. addConcernMajor({ code: this.majorDetail.code }).then(res => {
  145. this.$message.success('收藏成功')
  146. this.majorDetail.isCollect = true
  147. })
  148. },
  149. toUnCollect() {
  150. removeConcernedMajor({ code: this.majorDetail.code }).then(res => {
  151. this.$message.success('移除收藏成功')
  152. this.majorDetail.isCollect = false
  153. })
  154. },
  155. handleNodeClick(data, node) {
  156. if (!node.isLeaf || this.code == node.data.code) return
  157. // 跳转
  158. this.code = node.data.code
  159. this.tabActive = 0
  160. this.getOverView()
  161. },
  162. isLeaf(data, node) {
  163. return node.childCount == 0
  164. },
  165. tabClick(type) {
  166. this.type = type.name
  167. },
  168. getCareerProspects() {
  169. this.loading = true
  170. getMajorCareerProspectsByCode({
  171. code: this.code
  172. }).then(res => {
  173. this.prospects = res.data
  174. this.desc = res.msg
  175. }).finally(_ => {
  176. this.loading = false
  177. })
  178. },
  179. getOverView() {
  180. this.loading = true
  181. getMajorOverviewByCode({
  182. code: this.code
  183. }).then(res => {
  184. this.majorDetail = res.data
  185. }).finally(_ => {
  186. this.loading = false
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .header-content {
  194. top: 0;
  195. left: 0;
  196. width: 100%;
  197. height: 100%;
  198. background: rgba(66, 185, 131, 0.1);
  199. }
  200. .custom-tree-node {
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. width: 100%;
  205. overflow: hidden;
  206. }
  207. .tabs-wrap {
  208. margin-top: 20px;
  209. height: 40px;
  210. .tabs-item {
  211. cursor: pointer;
  212. padding: 0 33px;
  213. border-radius: 4px 4px 0 0;
  214. display: inline-block;
  215. line-height: 40px;
  216. &:hover {
  217. color: #47C6A2;
  218. }
  219. &.bg-primary {
  220. background: #47C6A2;
  221. color: white;
  222. }
  223. }
  224. }
  225. .bg-primary {
  226. background: #47C6A2 !important;
  227. color: white;
  228. }
  229. .el-tabs--border-card ::v-deep .el-tabs__content {
  230. height: calc(100vh - 176px);
  231. overflow: hidden;
  232. overflow-y: auto;
  233. }
  234. ::v-deep .el-tree-node.is-current > .el-tree-node__content {
  235. background: rgba(22, 119, 255, 0.1);
  236. color: #47C6A2;
  237. ::v-deep .is-leaf {
  238. color: rgba(0, 0, 0, 0);
  239. }
  240. }
  241. </style>