admin.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <FlexCol :padding="30">
  3. <FlexRow justify="space-between">
  4. <SearchBar
  5. v-model="searchText"
  6. placeholder="搜一搜"
  7. :innerStyle="{ width: '460rpx' }"
  8. @confirm="search"
  9. />
  10. <NButton type="primary" @click="newData">+ 新增</NButton>
  11. </FlexRow>
  12. <FlexCol :gap="20" :margin="[20,0,0,0]">
  13. <button class="remove-button-style" open-type="share">
  14. <Touchable
  15. direction="column"
  16. center
  17. :padding="20"
  18. :height="300"
  19. :innerStyle="{
  20. backgroundImage: `url('https://mn.wenlvti.net/app_static/xiangyuan/images/share-btn.jpg')`,
  21. backgroundSize: 'cover',
  22. }"
  23. @click=""
  24. >
  25. <FlexCol position="relative">
  26. <Icon icon="smile-filling" color="primary" :size="156" />
  27. <Icon icon="share" color="warning" :size="56" :innerStyle="{ position: 'absolute', bottom: 0, right: '-40rpx' }" />
  28. </FlexCol>
  29. <Height :height="20" />
  30. <Text :fontSize="26" color="primary" text="分享给志愿者注册,加入志愿者队伍" />
  31. </Touchable>
  32. </button>
  33. <FlexRow
  34. v-for="item in listLoader.list.value"
  35. :key="item.id"
  36. backgroundColor="white"
  37. radius="20"
  38. :padding="20"
  39. :gap="20"
  40. @click="goDetail(item.id)"
  41. >
  42. <Image :src="item.image" width="150rpx" height="150rpx" round radius="30" />
  43. <FlexCol>
  44. <Text :fontSize="36" bold :text="`${item.name} ${item.sex === 0 ? '男' : '女'}`" />
  45. <Text :fontSize="26" :text="`手机:${item.mobile}`" />
  46. <Text :fontSize="26" :text="`地址:${item.address || ''}`" />
  47. <Text :fontSize="26" :text="`可采编:${item.collectModuleText || '暂无'}`" />
  48. </FlexCol>
  49. </FlexRow>
  50. </FlexCol>
  51. <SimplePageListLoader :loader="listLoader" :noEmpty="true">
  52. <template #empty>
  53. <Empty image="search" text="暂无数据,点击按钮新增数据">
  54. <Button type="primary" @click="newData">+ 新增数据</Button>
  55. </Empty>
  56. </template>
  57. </SimplePageListLoader>
  58. </FlexCol>
  59. </template>
  60. <script setup lang="ts">
  61. import { ref } from 'vue';
  62. import { navTo } from '@/components/utils/PageAction';
  63. import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
  64. import { useSimplePageListLoader } from '@/common/composeabe/SimplePageListLoader';
  65. import VillageApi from '@/api/inhert/VillageApi';
  66. import SimplePageListLoader from '@/common/components/SimplePageListLoader.vue';
  67. import NButton from '@/components/basic/Button.vue';
  68. import Icon from '@/components/basic/Icon.vue';
  69. import Image from '@/components/basic/Image.vue';
  70. import Text from '@/components/basic/Text.vue';
  71. import Empty from '@/components/feedback/Empty.vue';
  72. import SearchBar from '@/components/form/SearchBar.vue';
  73. import FlexCol from '@/components/layout/FlexCol.vue';
  74. import FlexRow from '@/components/layout/FlexRow.vue';
  75. import Touchable from '@/components/feedback/Touchable.vue';
  76. import Height from '@/components/layout/space/Height.vue';
  77. import { onShareAppMessage } from '@dcloudio/uni-app';
  78. const { querys } = useLoadQuerys({
  79. id: 0,
  80. name: '',
  81. points: 0,
  82. level: 0,
  83. villageVolunteerId: 0,
  84. }, () => {
  85. listLoader.loadData(undefined, true);
  86. });
  87. const searchText = ref('');
  88. const listLoader = useSimplePageListLoader(8, async (page, pageSize, params) => {
  89. if (page === 1) {
  90. let res = await VillageApi.getVillageVolunteerList(querys.value.id);
  91. if (searchText.value)
  92. res = res.filter((p) => p.name.includes(searchText.value));
  93. return {
  94. page,
  95. total: res.length,
  96. list: res.map((item) => ({
  97. ...item,
  98. title: `${item.name} ${item.sex === 0 ? '男' : '女'} 手机号:${item.mobile} 地址:${item.address || ''}`,
  99. desc: `可采编:${item.collectModuleText || '暂无'}`,
  100. })),
  101. }
  102. }
  103. return {
  104. page,
  105. total: 0,
  106. list: [],
  107. }
  108. });
  109. function newData() {
  110. navTo('./admin/volunteer', {
  111. id: -1,
  112. villageId: querys.value.id,
  113. villageVolunteerId: querys.value.villageVolunteerId,
  114. });
  115. }
  116. function goDetail(id: number) {
  117. }
  118. function search() {
  119. listLoader.loadData(undefined, true);
  120. }
  121. onShareAppMessage(() => ({
  122. title: '邀请你成为村社挖掘志愿者',
  123. desc: '分享给你的志愿者可以采编村社文化资源信息,加入志愿者队伍,为村社贡献力量。',
  124. path: '/pages/dig/sharereg/share-reg-page',
  125. imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/share-post.jpg',
  126. }))
  127. </script>