index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <FlexCol gap="gap.md" padding="padding.md">
  3. <FlexRow justify="space-between" align="center" gap="gap.sm">
  4. <SearchBar v-model:value="searchValue" placeholder="搜索乡源好物" :innerStyle="{ width: '440rpx' }" />
  5. <FrameButton text="开通微信小店" size="small" />
  6. </FlexRow>
  7. <Construction text="现在是测试数据,暂无接口" />
  8. <FlexRow wrap justify="space-around" gap="gap.sm">
  9. <BoxMid
  10. v-for="good in goodsLoader.content.value" :key="good.id"
  11. :innerStyle="{
  12. width: 'calc(50% - 50rpx)',
  13. }"
  14. >
  15. <Touchable direction="column" gap="gap.lg" @click="handleGoodDetail(good)">
  16. <Image
  17. :src="good.image"
  18. :radius="20"
  19. width="100%"
  20. height="300rpx"
  21. mode="aspectFill"
  22. />
  23. <FlexRow align="center" gap="gap.md">
  24. <Avatar
  25. :src="good.avatar"
  26. :size="40"
  27. />
  28. <Text :text="`发布人: ${good.userName}`" fontConfig="contentText" />
  29. </FlexRow>
  30. </Touchable>
  31. </BoxMid>
  32. </FlexRow>
  33. </FlexCol>
  34. </template>
  35. <script setup lang="ts">
  36. import { navTo } from '@/components/utils/PageAction';
  37. import { ref } from 'vue';
  38. import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
  39. import BoxMid from '@/common/components/box/BoxMid.vue';
  40. import Construction from '@/common/components/Construction.vue';
  41. import FrameButton from '@/common/components/FrameButton.vue';
  42. import Image from '@/components/basic/Image.vue';
  43. import Text from '@/components/basic/Text.vue';
  44. import Avatar from '@/components/display/Avatar.vue';
  45. import Touchable from '@/components/feedback/Touchable.vue';
  46. import SearchBar from '@/components/form/SearchBar.vue';
  47. import FlexCol from '@/components/layout/FlexCol.vue';
  48. import FlexRow from '@/components/layout/FlexRow.vue';
  49. const goodsLoader = useSimpleDataLoader(async () => {
  50. let games = [
  51. {
  52. id: 1,
  53. name: '知识竞赛',
  54. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games1.png',
  55. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games1.png',
  56. userName: '张三',
  57. },
  58. {
  59. id: 2,
  60. name: '乡源寻美景',
  61. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games2.png',
  62. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games2.png',
  63. userName: '李四',
  64. },
  65. {
  66. id: 3,
  67. name: '农耕小拼图',
  68. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games3.png',
  69. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games3.png',
  70. userName: '王五',
  71. },
  72. {
  73. id: 4,
  74. name: '乡情口令接龙',
  75. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games4.png',
  76. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games4.png',
  77. userName: '赵六',
  78. },
  79. {
  80. id: 5,
  81. name: '农耕小拼图',
  82. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games5.png',
  83. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games5.png',
  84. userName: '孙七',
  85. },
  86. {
  87. id: 6,
  88. name: '乡情口令接龙',
  89. image: 'https://xy.wenlvti.net/app_static/images/home/games/Games6.png',
  90. avatar: 'https://xy.wenlvti.net/app_static/images/home/games/Games6.png',
  91. userName: '周八',
  92. },
  93. ];
  94. games = games.concat(games);
  95. return games;
  96. });
  97. const searchValue = ref('');
  98. const handleGoodDetail = (good: { id: number }) => {
  99. navTo('./detail', {
  100. id: good.id,
  101. });
  102. };
  103. </script>