index.vue 1.7 KB

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