professionalDetails.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!-- 专业详情 -->
  2. <template>
  3. <view class="details">
  4. <u-navbar back-text="" title="" back-icon-color="#FFFFFF" :background="{ background: '#3D5D4C' }" :border-bottom="false"></u-navbar>
  5. <view class="details-name">{{ professionalInfo.professionName }}</view>
  6. <view class="details-code">(专业代码:{{ professionalInfo.professionCode }})</view>
  7. <view class="details-content">
  8. <u-parse v-if="professionalInfo.professionDetail" :html="professionalInfo.professionDetail"></u-parse>
  9. <u-empty v-else text="暂无专业详情" mode="data"></u-empty>
  10. </view>
  11. <view class="details-total" v-if="professionalInfo.browseTimes">浏览{{ professionalInfo.browseTimes }}次</view>
  12. <u-toast ref="uToast" />
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. // 专业id
  20. professionalId: '',
  21. // 专业信息
  22. professionalInfo: ''
  23. }
  24. },
  25. onLoad(page) {
  26. if (page.id) {
  27. this.professionalId = page.id
  28. }
  29. },
  30. onShow() {
  31. if (this.professionalId) {
  32. uni.showLoading({
  33. title: '加载中'
  34. })
  35. this.getProfessionalInfo(this.professionalId)
  36. }
  37. },
  38. methods: {
  39. /**
  40. * 通过本地获取专业信息
  41. */
  42. getProfessionalInfo(id) {
  43. this.$u.api.school.getProfessonDetails({
  44. id: id
  45. }).then(res => {
  46. uni.hideLoading()
  47. if (res.code === 200) {
  48. this.professionalInfo = res.data
  49. }
  50. }).catch(err => {
  51. uni.hideLoading()
  52. this.$refs.uToast.show({
  53. title: '系统错误!',
  54. type: 'error'
  55. })
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .details {
  63. padding: 0 32rpx;
  64. font-family: 'PingFangSC-Medium, PingFang SC';
  65. &-name {
  66. padding-top: 60rpx;
  67. text-align: center;
  68. font-size: 42rpx;
  69. color: #3D5D4C;
  70. font-weight: 600;
  71. }
  72. &-code {
  73. color: #606060;
  74. font-size: 36rpx;
  75. text-align: center;
  76. margin: 30rpx 0;
  77. }
  78. &-content {
  79. color: #545454;
  80. font-size: 24rpx;
  81. line-height: 40rpx;
  82. }
  83. &-total {
  84. color: #9B9B9B;
  85. font-size: 26rpx;
  86. margin-top: 60rpx;
  87. }
  88. }
  89. </style>