You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.4 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="content">
  3. <up-navbar leftText=" " :leftIconColor="'#fff'" :safeAreaInsetTop="true" :autoBack="true" :fixed="false"
  4. :bgColor="'transparent'" title="考试" :titleStyle="{color: '#fff'}"></up-navbar>
  5. <view class="padding">
  6. <view class="tabs flex-b">
  7. <view class="btn" @click="changeNav(item, index)" :class="{active: currentNav==index}"
  8. v-for="(item,index) in tabData" :key="index">{{ item.name }}</view>
  9. </view>
  10. <view class="card">
  11. <view class="title">
  12. <view class="titlebg">{{ tabData[currentNav]?.name }}</view>
  13. </view>
  14. <!-- <tab1 v-if="currentNav=='考试简介'"/>
  15. <tab2 v-if="currentNav=='考试流程'"/>
  16. <tab3 v-if="currentNav=='考试准备'"/>
  17. <tab4 v-if="currentNav=='注意事项'"/> -->
  18. <!-- <rich-text :nodes="nodes"></rich-text> -->
  19. <u-parse :content="nodes" :tagStyle="style"></u-parse>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script setup>
  25. import carStore from '@/store/modules/car.js'
  26. let usecarStore = carStore()
  27. import { examProcessInfo } from '@/config/api.js'
  28. import {
  29. ref
  30. } from 'vue'
  31. import {
  32. onLoad,
  33. } from '@dcloudio/uni-app'
  34. import tab1 from './comp/tab1.vue'
  35. import tab2 from './comp/tab2.vue'
  36. import tab3 from './comp/tab3.vue'
  37. import tab4 from './comp/tab4.vue'
  38. const value = ref(false)
  39. const currentNav = ref(0)
  40. const nodes = ref('')
  41. function changeNav(val, index) {
  42. currentNav.value = index
  43. console.log(index)
  44. console.log(dataList.value[index])
  45. nodes.value = dataList.value[index]?dataList.value[index].content: '<p>暂无内容</p>'
  46. }
  47. let style = {
  48. img: 'max-width:100%;height:auto',
  49. p: 'font-size:32rpx',
  50. }
  51. onLoad((option) => {
  52. if (option.tab) currentNav.value = option.tab
  53. examProcessInfoFn()
  54. })
  55. const tabData = ref([{
  56. name: '考试简介',
  57. id: 0
  58. },
  59. {
  60. name: '考试准备',
  61. id: 1
  62. },
  63. {
  64. name: '考试流程',
  65. id: 2
  66. },
  67. {
  68. name: '注意事项',
  69. id: 3
  70. },
  71. ])
  72. const dataList = ref([])
  73. async function examProcessInfoFn() {
  74. const {data:res} = await examProcessInfo( usecarStore.carInfo.stepType)
  75. if(!res.length) return
  76. dataList.value = res
  77. nodes.value = res[currentNav.value]?res[currentNav.value].content: '<p>暂无内容</p>'
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .tabs {
  82. display: flex;
  83. padding: 20rpx 0 10rpx 0;
  84. .btn {
  85. color: #fff;
  86. position: relative;
  87. // padding: 0 20rpx;
  88. &.active {
  89. &::before {
  90. content: '';
  91. position: absolute;
  92. left: 50%;
  93. bottom: -20rpx;
  94. width: 40rpx;
  95. height: 6rpx;
  96. background: #F6F7F8;
  97. border-radius: 3rpx;
  98. transform: translateX(-50%);
  99. }
  100. }
  101. }
  102. }
  103. .content {
  104. width: 100%;
  105. // background-color: #F6F7FA;
  106. min-height: 100vh;
  107. // padding: 0rpx 30rpx 30rpx 30rpx;
  108. padding-bottom: 30rpx;
  109. background: url('../../../static/images/bigImg/exambg.png') #F6F7FA no-repeat;
  110. background-size: 100% 800rpx;
  111. .card {
  112. background: #FFFFFF;
  113. border-radius: 20rpx;
  114. padding: 0 30rpx 30rpx 30rpx;
  115. margin-top: 50rpx;
  116. .title {
  117. height: 116rpx;
  118. display: flex;
  119. justify-content: center;
  120. .titlebg {
  121. width: 260rpx;
  122. height: 70rpx;
  123. font-weight: bold;
  124. font-size: 36rpx;
  125. background: url('../../../static/images/greetab.png') no-repeat;
  126. background-size: 100% 100%;
  127. text-align: center;
  128. line-height: 70rpx;
  129. color: #fff;
  130. }
  131. }
  132. }
  133. }
  134. </style>