new-major-lib.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="app-container majorlib" ref="vocation">
  3. <el-card style="height:158px;margin: 10px auto;">
  4. <div :style="{'background-image':backimg}" class="back">
  5. <p style="color:#A6A6A6;font-size:24px;font-weight:bold;">MAJOR LIBRARY</p>
  6. <p style="color:#414141;font-size:24px;font-weight:bold;">专业库</p>
  7. <hr class="layui-bg-orange" style="width:40px;height:4px;margin-top:10px;" />
  8. </div>
  9. </el-card>
  10. <el-card class="box-card" >
  11. <div slot="header" >
  12. <span class="tabs-item" @click="type = '本科'" :class="{'bg-primary':type == '本科'}">本科</span>
  13. <span class="tabs-item" @click="type = '专科'" :class="{'bg-primary':type == '专科'}">专科</span>
  14. <p class="line"></p>
  15. <div class="tags-wrap">
  16. <a @click="returnTop(item.code)" class="tag" v-for="item in levelOne">{{ item.name }}</a>
  17. </div>
  18. </div>
  19. <div class="list-wrap">
  20. <!-- 一级 -->
  21. <div class="levelOne" v-for="item in majorList" :id="`#${item.code}`">
  22. <!-- 一级专业title-->
  23. <p class="voca-title mt10 mb10" > <span class="primaryColor bold">{{`${item.name} (${item.code}) `}} </span><span class="f14 f-666">{{ `${item.childCount}4个专业类,${item.grandchildCount}个专科专业` }}</span></p>
  24. <div class="last-level" v-for="subLevel in item.children">
  25. <!-- 二级专业 -->
  26. <p class="sub-title">{{`${subLevel.name} (${subLevel.code}) `}}</p>
  27. <!-- 三级专业 -->
  28. <div class="last-children-wrap" v-if="subLevel.children.length > 0">
  29. <span @click="goDetail(vocation.code)" class="last-children" v-for="vocation in subLevel.children">{{vocation.name}}</span>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </el-card>
  35. </div>
  36. </template>
  37. <script>
  38. import {mapState} from 'vuex';
  39. import MxMajorTreeTranslateMixin from '@/components/Cache/modules/mx-major-tree-translate-mixin'
  40. export default {
  41. name: "index",
  42. mixins:[MxMajorTreeTranslateMixin],
  43. data(){
  44. return {
  45. backimg:'url('+require('@/assets/images/icon_pro.png')+')',
  46. type: '本科',
  47. }
  48. },
  49. computed:{
  50. ...mapState({theme: state => state.settings.theme}),
  51. levelOne() {
  52. return this.majorList.map(item=>{
  53. return {
  54. code: item.code,
  55. name: item.name,
  56. }
  57. })
  58. },
  59. majorList() {
  60. if(this.type == '本科') return this.masterMajorList
  61. if(this.type == '专科') return this.specialtyMajorList
  62. }
  63. },
  64. watch:{
  65. theme:{
  66. immediate:true,
  67. handler(val){
  68. this.$nextTick(()=>{
  69. this.$refs.vocation.style.setProperty('--themeColor', val)
  70. })
  71. }
  72. },
  73. },
  74. methods:{
  75. goDetail(code){
  76. this.$router.push({path:'/career/plan/MajorDetail',query:{type:this.type,code:code}})
  77. },
  78. returnTop(id){
  79. document.getElementById(`#${id}`).scrollIntoView(true);
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .majorlib{
  86. .levelOne{
  87. padding-top:100px;
  88. margin-top:-100px;
  89. }
  90. .layui-bg-orange{
  91. background-color: var(--themeColor);
  92. margin-left:0;
  93. }
  94. .back{
  95. padding:30px;
  96. margin-top: 10px;background-color:white;background-repeat: no-repeat;background-position: bottom right;
  97. }
  98. .title{
  99. background-color: var(--themeColor);
  100. width: 162px;
  101. height: 37px;
  102. color: #fff;
  103. font-size: 16px;
  104. line-height: 37px;
  105. text-align: center;
  106. }
  107. .line {
  108. background-color: var(--themeColor);
  109. height: 4px;
  110. }
  111. .last-children-wrap{
  112. flex-wrap: wrap;
  113. display: flex;
  114. .last-children{
  115. flex: 25%;
  116. flex-grow: 0;
  117. margin-bottom: 10px;
  118. color: var(--themeColor);
  119. &:hover{
  120. text-decoration: underline;
  121. cursor: pointer;
  122. }
  123. }
  124. }
  125. .tabs-item{
  126. cursor: pointer;
  127. padding: 0 33px;
  128. border: 1px solid #f2f2f2;
  129. border-bottom: 0px;
  130. display: inline-block;
  131. line-height: 40px;
  132. &:hover{
  133. color:#47C6A2;
  134. }
  135. &.bg-primary{
  136. background: #47C6A2 ;
  137. color: white;
  138. border: 0px;
  139. }
  140. }
  141. .tags-wrap {
  142. overflow: hidden;
  143. box-sizing: border-box;
  144. border-top: 1px solid #e1e1e1;
  145. border-left: 1px solid #e1e1e1;
  146. display: flex;
  147. flex-flow: row wrap;
  148. justify-content: start;
  149. .tag{
  150. border-bottom: 1px solid #e1e1e1;
  151. border-right: 1px solid #e1e1e1;
  152. font-size: 12px;
  153. text-align: center;
  154. flex: 10%;
  155. text-align: center;
  156. flex-grow: 0;
  157. color: #555;
  158. height: 40px;
  159. line-height: 40px;
  160. cursor: pointer;
  161. &:hover{
  162. text-decoration: underline;
  163. cursor: pointer;
  164. }
  165. }
  166. }
  167. .sub-title{
  168. color: #333;
  169. line-height: 26px;
  170. padding: 5px 10px;
  171. background: #f3f3f3;
  172. margin-bottom: 2px;
  173. }
  174. .voca-title{
  175. border-left:4px solid var(--themeColor);
  176. padding:0px 5px;
  177. }
  178. .primaryColor{
  179. color: var(--themeColor);
  180. }
  181. .row{
  182. .rowHead{
  183. background-color:#a7e6d4;
  184. &:hover{
  185. background-color: var(--themeColor);
  186. hr{
  187. background-color: #ffffff;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. </style>