index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="submit_main">
  3. <view class="img-banner">
  4. <image mode="aspectFill" src="https://mn.wenlvti.net/app_static/xiangan/banner_submit.jpg"></image>
  5. </view>
  6. <view class="main">
  7. <template v-if="!villageListLoader.content.value?.length">
  8. <view class="cat">
  9. <text>村庄认领</text>
  10. </view>
  11. <u-button type="primary" @click="goClamVillage">
  12. <text>+</text>
  13. 认领新村庄
  14. </u-button>
  15. </template>
  16. <view class="cat">
  17. <text>我的村庄</text>
  18. </view>
  19. <RequireLogin unLoginMessage="登录后查看我认领的村庄">
  20. <SimplePageContentLoader
  21. :loader="villageListLoader"
  22. :showEmpty="villageListLoader.content.value?.length == 0"
  23. :emptyView="{
  24. text: '你还没有认领的村庄',
  25. button: true,
  26. buttonText: '去认领',
  27. buttonClick: goClamVillage,
  28. }"
  29. >
  30. <view class="village-list">
  31. <view
  32. v-for="item in villageListLoader.content.value"
  33. :key="item.id"
  34. class="item"
  35. >
  36. <ImageWrapper
  37. mode="aspectFill"
  38. :src="item.image"
  39. width="154rpx"
  40. height="154rpx"
  41. />
  42. <view class="info">
  43. <view class="name">{{ item.villageName }}</view>
  44. <view class="d-flex flex-row align-center">
  45. <view class="btn p-1 pr-2" @click="navTo('/pages/inherit/village/details', { id: item.villageId })">
  46. <text class="iconfont icon-view"></text>预览
  47. </view>
  48. <view class="btn p-1 pr-2 active" @click="goSubmitDigPage(item)">
  49. <text class="iconfont icon-search"></text>采编
  50. </view>
  51. <view v-if="authStore.isAdmin" class="btn p-1 pr-2 active" @click="goManagePage(item)">
  52. 管理
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </SimplePageContentLoader>
  59. </RequireLogin>
  60. <view class="cat">
  61. <text>我的贡献</text>
  62. </view>
  63. <RequireLogin unLoginMessage="登录后贡献,加入排行榜">
  64. <view class="retribution">
  65. <view class="item">
  66. <text class="iconfont icon-total-points"></text>
  67. <view class="num">{{ volunteerInfoLoader.content.value?.points }}</view>
  68. <view>文化积分</view>
  69. </view>
  70. <view>
  71. <text class="iconfont icon-art-arrow"></text>
  72. </view>
  73. <view class="item">
  74. <text class="iconfont icon-level"></text>
  75. <view class="level">Lv.{{ volunteerInfoLoader.content.value?.level }}</view>
  76. <view>等级</view>
  77. </view>
  78. </view>
  79. </RequireLogin>
  80. </view>
  81. </view>
  82. </template>
  83. <script setup lang="ts">
  84. import VillageApi, { VillageListItem } from '@/api/inhert/VillageApi';
  85. import ImageWrapper from '@/common/components/ImageWrapper.vue';
  86. import RequireLogin from '@/common/components/RequireLogin.vue';
  87. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  88. import { useReqireLogin } from '@/common/composeabe/RequireLogin';
  89. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  90. import { useAuthStore } from '@/store/auth';
  91. import { navTo } from '@imengyu/imengyu-utils/dist/uniapp/PageAction';
  92. const authStore = useAuthStore();
  93. const villageListLoader = useSimpleDataLoader(async () => await VillageApi.getClaimedVallageList(), true);
  94. const volunteerInfoLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerInfo(), true);
  95. const rankListLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerRanklist(), true);
  96. const { requireLogin } = useReqireLogin();
  97. function goClamVillage() {
  98. requireLogin(() => navTo('forms/village_claim'), '登录后才能认领村庄哦!');
  99. }
  100. function goSubmitDigPage(item: VillageListItem) {
  101. navTo('./dig/details', {
  102. id: item.villageId,
  103. name: item.villageName,
  104. villageVolunteerId: item.villageVolunteerId,
  105. points: volunteerInfoLoader.content.value?.points,
  106. level: volunteerInfoLoader.content.value?.level,
  107. })
  108. }
  109. function goManagePage(item: VillageListItem) {
  110. navTo('./dig/admin', {
  111. id: item.villageId,
  112. name: item.villageName,
  113. villageVolunteerId: item.villageVolunteerId,
  114. points: volunteerInfoLoader.content.value?.points,
  115. level: volunteerInfoLoader.content.value?.level,
  116. })
  117. }
  118. </script>
  119. <style lang="scss">
  120. .submit_main {
  121. .img-banner{
  122. border-radius: 0;
  123. height: 466rpx;
  124. }
  125. .cat{
  126. font-weight: 600;
  127. display: flex;
  128. margin: 36rpx 0 40rpx;
  129. align-items: center;
  130. text{
  131. display: block;
  132. font-size: 36rpx;
  133. color: #312520;
  134. flex:1;
  135. }
  136. .btn{
  137. border-radius: 28rpx;
  138. border: 1px solid #999999;
  139. font-size: 27rpx;
  140. color: #666666;
  141. padding:15rpx 28rpx;
  142. display: inline-block;
  143. margin-left: 18rpx;
  144. &.active{
  145. color:#fff;
  146. background: #FF8719;
  147. border-color: #FF8719;
  148. }
  149. }
  150. }
  151. .village-list{
  152. .item{
  153. background: #FFFFFF;
  154. border-radius: 10rpx;
  155. padding:18rpx 14rpx 11rpx;
  156. display: flex;
  157. margin-bottom: 27rpx;
  158. image,.image-wrapper {
  159. border-radius: 10rpx;
  160. width: 154rpx;
  161. height: 154rpx;
  162. display: block;
  163. margin-right: 25rpx;
  164. overflow: hidden;
  165. }
  166. .info{
  167. .name{
  168. font-size: 30rpx;
  169. color: #333333;
  170. margin-bottom: 35rpx;
  171. margin-top: 14rpx;
  172. }
  173. .btn{
  174. border-radius: 10rpx;
  175. border: 1px solid #25515E;
  176. padding:16rpx 14rpx;
  177. font-size: 28rpx;
  178. color:#25515E;
  179. margin-right: 34rpx;
  180. display: inline-block;
  181. &.active{
  182. background: #FF8719;
  183. color:#fff;
  184. border-color: #FF8719;
  185. }
  186. text.iconfont{
  187. display: inline-block;
  188. margin-right: 15rpx;
  189. font-size: 36rpx;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. .retribution{
  196. background: #FFFFFF;
  197. border-radius: 10rpx;
  198. display: flex;
  199. justify-content: space-around;
  200. .item{
  201. text-align: center;
  202. font-size: 24rpx;
  203. color: #312520;
  204. padding: 35rpx 0 33rpx;
  205. text.iconfont{
  206. font-size: 56rpx;
  207. color:#25515E;
  208. display: block;
  209. }
  210. .num{
  211. font-weight: 600;
  212. font-size: 48rpx;
  213. color: #FF8719;
  214. margin-top: 12rpx;
  215. line-height: 48rpx;
  216. margin-bottom: 15rpx;
  217. }
  218. .level{
  219. margin-top: 12rpx;
  220. margin-bottom: 15rpx;
  221. font-family: Rockwell;
  222. font-size: 44rpx;
  223. line-height: 48rpx;
  224. color: #FF8719;
  225. }
  226. }
  227. }
  228. .people-list{
  229. .item{
  230. width: 100%;
  231. display: flex;
  232. align-items: center;
  233. padding: 28rpx 21rpx 28rpx 10rpx;
  234. text-align: left;
  235. .rank{
  236. position: relative;
  237. top:inherit;
  238. left:inherit;
  239. margin-right: 25rpx;
  240. width: 77rpx;
  241. }
  242. .info{
  243. flex:1;
  244. }
  245. .level{
  246. font-family: Rockwell;
  247. font-size: 36rpx;
  248. color: #FF8719;
  249. }
  250. image.avatar{
  251. margin-bottom: 0;
  252. margin-right: 51rpx;
  253. background-color: #efefef;
  254. border-radius: 50%;
  255. }
  256. }
  257. }
  258. }
  259. </style>