professionalDetails.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. uni.showLoading({
  31. title: '加载中'
  32. })
  33. if (this.professionalId) {
  34. setTimeout(() => {
  35. this.getProfessionalInfo(this.professionalId)
  36. }, 300)
  37. }
  38. },
  39. methods: {
  40. /**
  41. * 通过本地获取专业信息
  42. */
  43. getProfessionalInfo(id) {
  44. this.$u.api.school.getProfessonDetails({
  45. id: id
  46. }).then(res => {
  47. uni.hideLoading()
  48. if (res.code === 200) {
  49. this.professionalInfo = res.data
  50. }
  51. }).catch(err => {
  52. uni.hideLoading()
  53. this.$refs.uToast.show({
  54. title: '系统错误!',
  55. type: 'error'
  56. })
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .details {
  64. padding: 0 32rpx;
  65. font-family: 'PingFangSC-Medium, PingFang SC';
  66. &-name {
  67. padding-top: 60rpx;
  68. text-align: center;
  69. font-size: 42rpx;
  70. color: #3D5D4C;
  71. font-weight: 500;
  72. }
  73. &-code {
  74. color: #606060;
  75. font-size: 36rpx;
  76. text-align: center;
  77. margin: 30rpx 0;
  78. }
  79. &-content {
  80. color: #545454;
  81. font-size: 24rpx;
  82. line-height: 40rpx;
  83. }
  84. &-total {
  85. color: #9B9B9B;
  86. font-size: 24rpx;
  87. margin-top: 60rpx;
  88. }
  89. }
  90. </style>