home.uvue 4.6 KB

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