index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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="no-kc-list" v-if="data.chanpinActiveSelect == 3">
  19. <icon></icon>
  20. <text>暂无数据</text>
  21. </view>
  22. </view>
  23. </view>
  24. <CustomTabBar :currentTabNumber="0"></CustomTabBar>
  25. </template>
  26. <script setup>
  27. import {reactive} from "vue";
  28. import shuxueListVue from "./components/shuxueList.vue";
  29. import {onLoad} from "@dcloudio/uni-app"
  30. import * as shuxueHttp from "@/api/chanpinShuxue.js"
  31. import CustomTabBar from "@/components/custom-tabbar/custom-tabbar.vue";
  32. const data = reactive({
  33. list: [
  34. {
  35. name: '英语',
  36. value: 1
  37. },
  38. {
  39. name: '数学',
  40. value: 2
  41. },
  42. {
  43. name: '语文',
  44. value: 3
  45. },
  46. ],
  47. chanpinActiveSelect: 2,
  48. shuxueList: [],
  49. })
  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>