index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="ezy-xuanke-page">
  3. <!-- 返回区域 -->
  4. <view class="icon-title-navBar-box">
  5. <text class="nav-bar-title">选课</text>
  6. </view>
  7. <view class="ezy-page-body">
  8. <!-- 头部区域 -->
  9. <view class="xuanke-tab-box">
  10. <view v-for="item in data.list" :key="item.value" class="tab-item"
  11. :class="{active: item.value == data.chanpinActiveSelect}" @click="handleSelectChanpin(item)">{{item.name}}</view>
  12. </view>
  13. <!-- 英语列表 -->
  14. <view v-if="data.chanpinActiveSelect == 1"> </view>
  15. <!-- 数学列表 -->
  16. <shuxueListVue v-if="data.chanpinActiveSelect == 2" :list="data.shuxueList"></shuxueListVue>
  17. <!-- 语文列表 -->
  18. <view class="list yuwen" v-if="data.chanpinActiveSelect == 3">
  19. </view>
  20. </view>
  21. </view>
  22. <CustomTabBar :currentTabNumber="0"></CustomTabBar>
  23. </template>
  24. <script setup>
  25. import {reactive} from "vue";
  26. import shuxueListVue from "./components/shuxueList.vue";
  27. import {onLoad} from "@dcloudio/uni-app"
  28. import * as shuxueHttp from "@/api/chanpinShuxue.js"
  29. import CustomTabBar from "@/components/custom-tabbar/custom-tabbar.vue";
  30. const data = reactive({
  31. list: [
  32. {
  33. name: '英语',
  34. value: 1
  35. },
  36. {
  37. name: '数学',
  38. value: 2
  39. },
  40. {
  41. name: '语文',
  42. value: 3
  43. },
  44. ],
  45. chanpinActiveSelect: 2,
  46. shuxueList: [],
  47. })
  48. function getShuxueList() {
  49. shuxueHttp.getShuxueChanpinList().then(res => {
  50. data.shuxueList = res.data;
  51. })
  52. }
  53. function handleSelectChanpin(item) {
  54. data.chanpinActiveSelect = item.value
  55. }
  56. onLoad(() => {
  57. getShuxueList()
  58. })
  59. </script>