allActivity.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="全部活动" bgColor="transparent"></cus-header>
  4. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/54b75bc8-d926-449b-95a5-1126f700b481.png" class="top_bg_img" mode="widthFix"></image>
  5. <view class="top-search" @click="toSearch">
  6. <cus-search ref="searchRef"></cus-search>
  7. </view>
  8. <view class="type adfacjb">
  9. <view class="type-list">
  10. <scroll-view class="scroll-view_H" scroll-x="true" scroll-with-animation="true" :scroll-left="scrollLeft">
  11. <view class="scroll-view-item_H" :id="'svih_'+index" v-for="(item,index) in typeList" :key="index" @click="changeType(item,index)">
  12. <view class="cl_item" :class="{'active':typeIndex===index}">
  13. <text>{{item.name}}</text>
  14. </view>
  15. </view>
  16. </scroll-view>
  17. </view>
  18. <view class="type-all" :class="{'active':typeIndex===''}" @click="handleAll">全部</view>
  19. </view>
  20. <view class="filter adfac" id="filter">
  21. <view class="filter-pre adfac" @click="showTime">
  22. <text>{{time}}</text>
  23. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>
  24. </view>
  25. <view class="filter-pre adfac" @click="timeShow=false;allShow=false;placeShow=!placeShow">
  26. <text>{{place}}</text>
  27. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>
  28. </view>
  29. <!-- <view class="filter-pre adfac">
  30. <text>{{status}}</text>
  31. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>
  32. </view> -->
  33. </view>
  34. <view class="list" id="list" :class="{'adffcacjc':list.length===0}">
  35. <template v-if="list.length">
  36. <up-list @scrolltolower="scrolltolower" style="height: 100%;">
  37. <up-list-item v-for="(item, index) in list" :key="item.id">
  38. <NonprofitActivety :item="item"></NonprofitActivety>
  39. </up-list-item>
  40. </up-list>
  41. </template>
  42. <page-empty text="暂无活动" v-else></page-empty>
  43. </view>
  44. <view class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="timeShow">
  45. <view class="window-time">
  46. <view class="top adfac">
  47. <view class="top-pre" :class="{'active':wtIndex===0}" @click="changeWindowTime(0,'全部时间')">全部时间</view>
  48. <view class="top-pre" :class="{'active':wtIndex===1}" @click="changeWindowTime(1,'一周内')">一周内</view>
  49. <view class="top-pre" :class="{'active':wtIndex===2}" @click="changeWindowTime(2,'一月内')">一月内</view>
  50. <view class="top-pre" :class="{'active':wtIndex===3}" @click="changeWindowTime(3,'本周末')">本周末</view>
  51. </view>
  52. <view class="middle">
  53. <ActivityCalendar ref="acRef"></ActivityCalendar>
  54. </view>
  55. <view class="bottom adfacjb">
  56. <view class="reset" @click="changeWindowTime(0,'全部时间')">重置</view>
  57. <view class="confirm" @click="timeConfirm">确定</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="placeShow">
  62. <view class="window-place">
  63. <ActivityArea @confirm="areaConfirm"></ActivityArea>
  64. </view>
  65. </view>
  66. <view class="window nbg" :style="{'top':topAll+'px','height':'calc(100vh - '+topAll+'px)'}" v-if="allShow">
  67. <view class="window-bg" @click="handleAll"></view>
  68. <view class="window-all">
  69. <view class="pre" v-for="(t,i) in typeList2" :key="i" @click="changeType2(t,t.name,i)">{{t.name}}</view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup name="">
  75. import CusHeader from '@/components/CusHeader/index.vue'
  76. import CusSearch from '@/components/CusSearch/index.vue'
  77. import NonprofitActivety from '@/components/pages/nonprofitActivety/index.vue'
  78. import ActivityCalendar from '@/components/pages/activityCalendar/index.vue'
  79. import ActivityArea from '@/components/pages/activityArea/index.vue'
  80. import PageEmpty from '@/components/pageEmpty/index.vue'
  81. import { ref, onMounted, nextTick, getCurrentInstance } from 'vue'
  82. const { proxy } = getCurrentInstance()
  83. const typeIndex = ref('')
  84. const typeList = ref([])
  85. const typeList2 = ref([])
  86. const scrollLeft = ref(0)
  87. const time = ref('全部时间')
  88. const timeText = ref('全部时间')
  89. const place = ref('全部地区')
  90. const status = ref('活动状态')
  91. const queryParams = ref({
  92. page:1,
  93. limit:10,
  94. userId:'',
  95. activityName:'',
  96. beginTime:'',
  97. endTime:'',
  98. categoryId:'',
  99. districtId:''
  100. })
  101. const isOver = ref(false)
  102. const list = ref([])
  103. const top = ref(0)
  104. const topAll = ref(0)
  105. const timeShow = ref(false)
  106. const placeShow = ref(false)
  107. const allShow = ref(false)
  108. const wtIndex = ref(0)
  109. const acRef = ref(null)
  110. const toSearch = () => {
  111. uni.navigateTo({
  112. url:'/pagesHome/searchActivity',
  113. events:{
  114. confirmSearch: data => {
  115. initList();
  116. proxy.$refs.searchRef.keyword = data;
  117. queryParams.value.activityName = data;
  118. getActivityList()
  119. }
  120. }
  121. })
  122. }
  123. const initList = () => {
  124. queryParams.value.page = 1;
  125. list.value = [];
  126. isOver.value = false;
  127. }
  128. const changeType = (item,index) => {
  129. initList();
  130. queryParams.value.categoryId = item.id;
  131. typeIndex.value = index;
  132. if(typeList.value.length>4){
  133. if(index<3) scrollLeft.value = 0
  134. else{
  135. scrollLeft.value = (index-2)*154/2;
  136. }
  137. }
  138. allShow.value = false;
  139. getActivityList()
  140. }
  141. const changeType2 = (item,name,index) => {
  142. initList();
  143. queryParams.value.categoryId = item.id;
  144. if(name==='全部'){
  145. typeIndex.value = '';
  146. scrollLeft.value = 0;
  147. }else{
  148. index--;
  149. typeIndex.value = index;
  150. if(typeList.value.length>4){
  151. if(index<3) scrollLeft.value = 0
  152. else{
  153. scrollLeft.value = (index-2)*154/2;
  154. }
  155. }
  156. }
  157. allShow.value = false;
  158. getActivityList()
  159. }
  160. const handleAll = () => {
  161. // typeIndex.value = '';
  162. // scrollLeft.value = 0;
  163. timeShow.value = false;
  164. placeShow.value = false;
  165. allShow.value = !allShow.value;
  166. }
  167. const changeWindowTime = (wtindex,text) => {
  168. wtIndex.value = wtindex;
  169. timeText.value = text;
  170. acRef.value.setStartEndDay(wtindex);
  171. }
  172. const showTime = () => {
  173. placeShow.value = false;
  174. allShow.value = false;
  175. timeShow.value = !timeShow.value;
  176. setTimeout(()=>{
  177. acRef.value.setStartEndDay(wtIndex.value);
  178. },100)
  179. }
  180. const timeConfirm = () => {
  181. time.value = timeText.value;
  182. timeShow.value = false;
  183. queryParams.value.beginTime = proxy.$refs.acRef.startDay;
  184. queryParams.value.endTime = proxy.$refs.acRef.endDay;
  185. initList()
  186. getActivityList()
  187. }
  188. const areaConfirm = (data) => {
  189. initList()
  190. place.value = data.city+'-'+data.area;
  191. queryParams.value.districtId = data.areaId;
  192. placeShow.value = false;
  193. getActivityList()
  194. }
  195. const scrolltolower = () => {
  196. if(isOver.value) return
  197. getActivityList()
  198. }
  199. const getTop = () => {
  200. let query = uni.createSelectorQuery();
  201. query.select('#list').boundingClientRect(rect=>{
  202. if(rect){
  203. top.value = (rect?.top+20)||0;//20是上间距
  204. }
  205. }).exec()
  206. query.select('#filter').boundingClientRect(rect=>{
  207. if(rect){
  208. topAll.value = rect?.top||0;
  209. }
  210. }).exec()
  211. }
  212. const getTypeList = () => {
  213. proxy.$api.get('/core/activity/category/list').then(({data:res})=>{
  214. if(res.code!==0) return proxy.$showToast(res.msg)
  215. typeList.value = [...res.data.map(d=>({id:d.id,name:d.categoryName}))];
  216. typeList2.value = [{id:'',name:'全部'},...res.data.map(d=>({id:d.id,name:d.categoryName}))];
  217. })
  218. }
  219. const getActivityList = () => {
  220. proxy.$api.get('/core/activity/page',queryParams.value).then(({data:res})=>{
  221. if(res.code!==0) return proxy.$showToast(res.msg)
  222. list.value = [...list.value,...res.data.list];
  223. queryParams.value.page++;
  224. if(res.data.list.length===0) isOver.value = true
  225. })
  226. }
  227. const getActivityTickets = () => {
  228. }
  229. onMounted(()=>{
  230. if(uni.getStorageSync('userInfo')){
  231. queryParams.value.userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  232. }
  233. getTypeList()
  234. getActivityList()
  235. nextTick(()=>{
  236. getTop();
  237. })
  238. })
  239. </script>
  240. <style scoped lang="scss">
  241. .scroll-view_H {
  242. white-space: nowrap;
  243. width: 100%;
  244. }
  245. .scroll-view-item_H {
  246. display: inline-block;
  247. height: 50rpx;
  248. margin-left: 42rpx;
  249. &:first-child{
  250. margin-left: 0;
  251. }
  252. }
  253. .common_page{
  254. .top-search{
  255. position: relative;
  256. margin-top: 20rpx;
  257. }
  258. .type{
  259. margin-top: 40rpx;
  260. width: 100%;
  261. height: 50rpx;
  262. position: relative;
  263. &-list{
  264. width: calc(100% - 72rpx);
  265. padding-right: 40rpx;
  266. box-sizing: border-box;
  267. .cl_item{
  268. width: 112rpx;
  269. line-height: 50rpx;
  270. font-family: PingFangSC, PingFang SC;
  271. font-weight: 400;
  272. font-size: 30rpx;
  273. color: #676775;
  274. &.active{
  275. font-weight: bold;
  276. font-size: 36rpx;
  277. color: #252525;
  278. line-height: 50rpx;
  279. }
  280. }
  281. }
  282. &-all{
  283. width: 72rpx;
  284. font-family: PingFangSC, PingFang SC;
  285. font-weight: 400;
  286. font-size: 28rpx;
  287. color: #676775;
  288. line-height: 40rpx;
  289. position: relative;
  290. &.active{
  291. font-weight: bold;
  292. font-size: 36rpx;
  293. color: #252525;
  294. line-height: 50rpx;
  295. &::after{
  296. content: '';
  297. width: 40rpx;
  298. height: 8rpx;
  299. background: linear-gradient( 270deg, #B7F358 0%, #00AE57 100%);
  300. border-radius: 4rpx;
  301. position: absolute;
  302. left: 50%;
  303. margin-left: -20rpx;
  304. bottom: -10rpx;
  305. }
  306. }
  307. }
  308. }
  309. .filter{
  310. margin-top: 33rpx;
  311. position: relative;
  312. &-pre{
  313. width: 186rpx;
  314. text{
  315. font-family: PingFang-SC, PingFang-SC;
  316. font-weight: bold;
  317. font-size: 24rpx;
  318. color: #252525;
  319. line-height: 33rpx;
  320. }
  321. image{
  322. width: 24rpx;
  323. height: 24rpx;
  324. margin-left: 6rpx;
  325. }
  326. }
  327. }
  328. .list{
  329. flex: 1;
  330. padding: 20rpx 0;
  331. box-sizing: border-box;
  332. overflow-y: auto;
  333. }
  334. }
  335. .window{
  336. width: 100%;
  337. position: fixed;
  338. left: 0;
  339. right: 0;
  340. background: rgba(0, 0, 0, .4);
  341. &-time{
  342. background: #FFFFFF;
  343. border-radius: 0 0 24rpx 24rpx;
  344. .top{
  345. padding: 32rpx 30rpx;
  346. &-pre{
  347. padding: 10rpx 24rpx;
  348. background: #F5F6F8;
  349. border-radius: 27rpx;
  350. font-family: PingFangSC, PingFang SC;
  351. font-weight: 400;
  352. font-size: 24rpx;
  353. color: #252525;
  354. line-height: 33rpx;
  355. margin-left: 20rpx;
  356. &:first-child{
  357. margin-left: 0;
  358. }
  359. &.active{
  360. background: #B7F358;
  361. font-weight: bold;
  362. }
  363. }
  364. }
  365. .middle{
  366. height: 594rpx;
  367. background: #F7F7F7;
  368. }
  369. .bottom{
  370. padding: 24rpx 24rpx 36rpx;
  371. .reset{
  372. width: 222rpx;
  373. height: 80rpx;
  374. border-radius: 45rpx;
  375. border: 1rpx solid #252525;
  376. font-family: PingFang-SC, PingFang-SC;
  377. font-weight: bold;
  378. font-size: 28rpx;
  379. color: #252525;
  380. line-height: 80rpx;
  381. text-align: center;
  382. letter-spacing: 2rpx;
  383. }
  384. .confirm{
  385. width: calc(100% - 252rpx);
  386. height: 80rpx;
  387. background: #B7F358;
  388. border-radius: 45rpx;
  389. font-family: PingFang-SC, PingFang-SC;
  390. font-weight: bold;
  391. font-size: 28rpx;
  392. color: #252525;
  393. line-height: 80rpx;
  394. text-align: center;
  395. }
  396. }
  397. }
  398. &-all{
  399. padding: 26rpx 30rpx 103rpx;
  400. background: #FFFFFF;
  401. display: flex;
  402. flex-wrap: wrap;
  403. justify-content: space-between;
  404. border-radius: 0 0 24rpx 24rpx;
  405. .pre{
  406. width: calc(100% / 3 - 12rpx);
  407. height: 59rpx;
  408. background: #F7F7F7;
  409. border-radius: 30rpx;
  410. font-family: PingFangSC, PingFang SC;
  411. font-weight: 400;
  412. font-size: 24rpx;
  413. color: #252525;
  414. line-height: 59rpx;
  415. text-align: center;
  416. margin-top: 24rpx;
  417. }
  418. }
  419. &.nbg{
  420. background: none;
  421. }
  422. &-bg{
  423. width: 100%;
  424. height: 100%;
  425. background: rgba(0, 0, 0, .4);
  426. position: absolute;
  427. z-index: -1;
  428. }
  429. }
  430. </style>