home.uvue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <script lang="ts" setup>
  2. import { computed, onMounted, ref } from 'vue'
  3. import { dict } from '@/.cool/store'
  4. import { router } from '@/.cool'
  5. import { user } from '@/.cool'
  6. import Physics from './components/physics.uvue'
  7. import Chinese from './components/chinese.uvue'
  8. import English from './components/english.uvue'
  9. import Mix from './components/mix.uvue'
  10. import Game from './components/game.uvue'
  11. import Exchange from './components/exchange.uvue'
  12. const menuList = computed(() => {
  13. return [
  14. ...dict.getChildrenList('index_subject_id'),
  15. {
  16. label: '兑换',
  17. code: 'exchange'
  18. },
  19. {
  20. label: '个人中心',
  21. code: 'user'
  22. },
  23. ]
  24. })
  25. const icons = {
  26. physics: "https://oss.xiaoxiongcode.com/static/home/wl.png",
  27. chinese: "https://oss.xiaoxiongcode.com/static/home/语文.png",
  28. english: "https://oss.xiaoxiongcode.com/static/home/英语.png",
  29. mix: "https://oss.xiaoxiongcode.com/static/home/百度百科.png",
  30. game: "https://oss.xiaoxiongcode.com/static/home/娱乐.png",
  31. exchange: "https://oss.xiaoxiongcode.com/static/home/图层 5.png",
  32. user: "https://oss.xiaoxiongcode.com/static/home/个人中心.png",
  33. }
  34. const selected = ref<string>('physics')
  35. function handlePage(val: any) {
  36. if (val.code === 'user') {
  37. router.push({ path: '/pages/user/info' })
  38. return
  39. }
  40. selected.value = val.code
  41. }
  42. onMounted(() => {
  43. console.log(menuList.value)
  44. })
  45. function handleView(url) {
  46. router.push({ path: url })
  47. }
  48. const userInfo = computed(() => user.info.value?.userInfo)
  49. const visible = ref(false)
  50. </script>
  51. <template>
  52. <cl-page :backTop="false">
  53. <img src="https://oss.xiaoxiongcode.com/static/home/111.png" alt=""
  54. class="w-full h-full object-cover absolute top-0 left-0" />
  55. <view class="menus w-[90vw]">
  56. <image src="https://oss.xiaoxiongcode.com/static/home/643.png"
  57. class="w-[90vw] h-[24vh] absolute top-0 left-0 z-[1]"></image>
  58. <view class="w-[87vw] relative z-[2] p-1 px-3 flex flex-row items-center justify-between gap-1 mx-auto ">
  59. <view v-for="item in menuList" :key="item.code"
  60. class="flex flex-col items-center p-1 px-4 justify-center gap-1 transition-all duration-300"
  61. @tap="handlePage(item)" :class="{ 'selected': item.code === selected }">
  62. <image :src="icons[item.code]" mode="aspectFill" class="w-[4vw] h-[4vw]"></image>
  63. <text class="text-[1.5vw] text-[#1E1E1E]">{{ item.label }}</text>
  64. </view>
  65. <view class="flex flex-col items-center p-1 px-4 justify-center gap-1 transition-all duration-300"
  66. @tap="visible = true">
  67. <view class="bg-[#09ba07] p-[1vw] rounded-[2vw] w-[4vw] h-[4vw] flex items-center justify-center" @tap="visible = true">
  68. <image src="https://oss.xiaoxiongcode.com/static/个人中心/微信.png" class="w-full h-full"></image>
  69. </view>
  70. <text class="text-[1.5vw] text-[#1E1E1E]">添加老师</text>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- <view class="flex flex-col items-center justify-center fixed bottom-[3vh] right-[3vh] ">
  75. <view class="bg-[#09ba07] p-2 rounded-full border-[2px] border-[#FFF] border-solid " @tap="visible = true">
  76. <image src="https://oss.xiaoxiongcode.com/static/个人中心/微信.png" class="w-5 h-5"></image>
  77. </view>
  78. <text class="text-[14px] text-white font-bold text-stroke">添加老师</text>
  79. </view> -->
  80. <cl-popup v-model="visible" :size="400" :show-header="false" direction="center">
  81. <view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
  82. <cl-text class="text-center " color="#09ba07" :size="30"> ——专属服务内容—— </cl-text>
  83. <image src="https://oss.xiaoxiongcode.com/static/home/qr.png" show-menu-by-longpress
  84. class="w-32 h-32" />
  85. <view class="text-center "> <cl-text class="text-center" color="#999" :size="14"> 长按识别二维码 </cl-text>
  86. <cl-text class="text-center" color="#999" :size="14"> 添加微信,享专业老师服务 </cl-text>
  87. </view>
  88. </view>
  89. </cl-popup>
  90. <Physics v-if="selected === 'physics'" />
  91. <Chinese v-else-if="selected === 'chinese'" />
  92. <English v-else-if="selected === 'english'" />
  93. <Mix v-else-if="selected === 'mix'" />
  94. <Game v-else-if="selected === 'game'" />
  95. <Exchange v-else-if="selected === 'exchange'" />
  96. </cl-page>
  97. </template>
  98. <style lang="scss" scoped>
  99. .menus {
  100. @apply mt-[3vh] mx-auto rounded-[20px];
  101. }
  102. .selected {
  103. @apply scale-[1.1] bg-[#efefef99] rounded-xl;
  104. font-weight: bold;
  105. }
  106. .text-stroke {
  107. text-shadow:
  108. -1px -1px 0 #000,
  109. 1px -1px 0 #000,
  110. -1px 1px 0 #000,
  111. 1px 1px 0 #000;
  112. }
  113. </style>