index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <!-- 返回区域 -->
  3. <view>
  4. <!-- <view @click="handleBack"></view> -->
  5. <view>选课</view>
  6. </view>
  7. <!-- 头部区域 -->
  8. <view>
  9. <view v-for="item in data.list" :key="item.value" :class="{active: item.value == data.chanpinActiveSelect}" @click="handleSelectChanpin">{{item.name}}</view>
  10. </view>
  11. <!-- 英语列表 -->
  12. <view class="list yingyu" v-if="data.chanpinActiveSelect == 1">
  13. </view>
  14. <!-- 数学列表 -->
  15. <shuxueListVue class="list shuxue" v-if="data.chanpinActiveSelect == 2" :list="data.shuxueList"></shuxueListVue>
  16. <!-- 语文列表 -->
  17. <view class="list yuwen" v-if="data.chanpinActiveSelect == 3">
  18. </view>
  19. <CustomTabBar :currentTabNumber="0"></CustomTabBar>
  20. <CustomTabBar :levelId="levelId" :currentTabNumber="3" :typeId="typeId" :subjectId="subjectId"
  21. :tipFlag="tipFlag">
  22. </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 handleBack() {}
  49. function getShuxueList() {
  50. shuxueHttp.getShuxueChanpinList().then(res => {
  51. data.shuxueList = res.data;
  52. })
  53. }
  54. function handleSelectChanpin(item) {
  55. data.chanpinActiveSelect = item.value
  56. }
  57. onLoad(() => {
  58. getShuxueList()
  59. })
  60. </script>
  61. <style scoped lang="scss">
  62. .active {
  63. color: red
  64. }
  65. </style>