professionalDetails.vue 1.8 KB

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