index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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="xuanke-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.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. data.chanpinActiveSelect = item.value
  57. }
  58. onLoad(() => {
  59. getShuxueList()
  60. })
  61. </script>