allActivity.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. <div class="top-search" @tap="toSearch">
  6. <cus-search></cus-search>
  7. </div>
  8. <div class="type adfacjb">
  9. <div 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" @tap="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. </div>
  18. <div class="type-all" :class="{'active':typeIndex===''}" @tap="handleAll">全部</div>
  19. </div>
  20. <div class="filter adfac" id="filter">
  21. <div class="filter-pre adfac" @tap="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. </div>
  25. <div class="filter-pre adfac" @tap="placeShow=true;timeShow=false;allShow=false">
  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. </div>
  29. <!-- <div 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. </div> -->
  33. </div>
  34. <div class="list" id="list">
  35. <up-list @scrolltolower="scrolltolower" style="height: 100%;">
  36. <up-list-item v-for="(item, index) in list" :key="index">
  37. <NonprofitActivety></NonprofitActivety>
  38. </up-list-item>
  39. </up-list>
  40. </div>
  41. <div class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="timeShow">
  42. <div class="window-time">
  43. <div class="top adfac">
  44. <div class="top-pre" :class="{'active':wtIndex===0}" @tap="changeWindowTime(0,'全部时间')">全部时间</div>
  45. <div class="top-pre" :class="{'active':wtIndex===1}" @tap="changeWindowTime(1,'一周内')">一周内</div>
  46. <div class="top-pre" :class="{'active':wtIndex===2}" @tap="changeWindowTime(2,'一月内')">一月内</div>
  47. <div class="top-pre" :class="{'active':wtIndex===3}" @tap="changeWindowTime(3,'本周末')">本周末</div>
  48. </div>
  49. <div class="middle">
  50. <ActivityCalendar ref="acRef"></ActivityCalendar>
  51. </div>
  52. <div class="bottom adfacjb">
  53. <div class="reset" @tap="changeWindowTime(0,'全部时间')">重置</div>
  54. <div class="confirm" @tap="timeConfirm">确定</div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="placeShow">
  59. <div class="window-place">
  60. <ActivityArea @confirm="areaConfirm"></ActivityArea>
  61. </div>
  62. </div>
  63. <div class="window" :style="{'top':topAll+'px','height':'calc(100vh - '+topAll+'px)'}" v-if="allShow">
  64. <div class="window-all">
  65. <div class="pre" v-for="(t,i) in typeList2" :key="i" @tap="changeType2(t.name,i)">{{t.name}}</div>
  66. </div>
  67. </div>
  68. </view>
  69. </template>
  70. <script setup name="">
  71. import CusHeader from '@/components/CusHeader/index.vue'
  72. import CusSearch from '@/components/CusSearch/index.vue'
  73. import NonprofitActivety from '@/components/pages/nonprofitActivety/index.vue'
  74. import ActivityCalendar from '@/components/pages/activityCalendar/index.vue'
  75. import ActivityArea from '@/components/pages/activityArea/index.vue'
  76. import { ref, onMounted, nextTick } from 'vue'
  77. const typeIndex = ref('')
  78. const typeList = ref([
  79. {id:1,name:'儿童关爱'},
  80. {id:2,name:'老人关爱'},
  81. {id:3,name:'社区发展'},
  82. {id:4,name:'社会服务'},
  83. {id:5,name:'健康行动'},
  84. {id:6,name:'减肥运动'}
  85. ])
  86. const typeList2 = ref([])
  87. const scrollLeft = ref(0)
  88. const time = ref('全部时间')
  89. const timeText = ref('')
  90. const place = ref('全部地区')
  91. const status = ref('活动状态')
  92. const queryParams = ref({})
  93. const list = ref([1,1,1,1])
  94. const top = ref(0)
  95. const topAll = ref(0)
  96. const timeShow = ref(false)
  97. const placeShow = ref(false)
  98. const allShow = ref(false)
  99. const wtIndex = ref(0)
  100. const acRef = ref(null)
  101. const toSearch = () => {
  102. uni.navigateTo({
  103. url:'/pagesHome/searchActivity',
  104. events:{
  105. confirmSearch: data => {
  106. console.log(data,'data');
  107. }
  108. }
  109. })
  110. }
  111. const changeType = (item,index) => {
  112. typeIndex.value = index;
  113. if(typeList.value.length>4){
  114. if(index<3) scrollLeft.value = 0
  115. else{
  116. scrollLeft.value = (index-2)*154/2;
  117. }
  118. }
  119. allShow.value = false;
  120. }
  121. const changeType2 = (item,index) => {
  122. if(item==='全部'){
  123. typeIndex.value = '';
  124. scrollLeft.value = 0;
  125. }else{
  126. index--;
  127. typeIndex.value = index;
  128. if(typeList.value.length>4){
  129. if(index<3) scrollLeft.value = 0
  130. else{
  131. scrollLeft.value = (index-2)*154/2;
  132. }
  133. }
  134. }
  135. allShow.value = false;
  136. }
  137. const handleAll = () => {
  138. // typeIndex.value = '';
  139. // scrollLeft.value = 0;
  140. timeShow.value = false;
  141. placeShow.value = false;
  142. typeList2.value = [{id:'',name:'全部'}].concat(typeList.value);
  143. allShow.value = true;
  144. }
  145. const changeWindowTime = (wtindex,text) => {
  146. wtIndex.value = wtindex;
  147. timeText.value = text;
  148. acRef.value.setStartEndDay(wtindex);
  149. }
  150. const showTime = () => {
  151. timeShow.value = true;
  152. setTimeout(()=>{
  153. acRef.value.setStartEndDay(wtIndex.value);
  154. },100)
  155. }
  156. const timeConfirm = () => {
  157. time.value = timeText.value;
  158. timeShow.value = false;
  159. }
  160. const areaConfirm = (data) => {
  161. place.value = data.city+'-'+data.area;
  162. placeShow.value = false;
  163. }
  164. const scrolltolower = () => {
  165. console.log(1);
  166. }
  167. const getTop = () => {
  168. let query = uni.createSelectorQuery();
  169. query.select('#list').boundingClientRect(rect=>{
  170. if(rect){
  171. top.value = (rect?.top+20)||0;//20是上间距
  172. }
  173. }).exec()
  174. query.select('#filter').boundingClientRect(rect=>{
  175. if(rect){
  176. topAll.value = rect?.top||0;
  177. }
  178. }).exec()
  179. }
  180. onMounted(()=>{
  181. nextTick(()=>{
  182. getTop();
  183. })
  184. })
  185. </script>
  186. <style scoped lang="scss">
  187. .scroll-view_H {
  188. white-space: nowrap;
  189. width: 100%;
  190. }
  191. .scroll-view-item_H {
  192. display: inline-block;
  193. height: 50rpx;
  194. margin-left: 42rpx;
  195. &:first-child{
  196. margin-left: 0;
  197. }
  198. }
  199. .common_page{
  200. .top-search{
  201. position: relative;
  202. margin-top: 20rpx;
  203. }
  204. .type{
  205. margin-top: 40rpx;
  206. width: 100%;
  207. height: 50rpx;
  208. position: relative;
  209. &-list{
  210. width: calc(100% - 72rpx);
  211. padding-right: 40rpx;
  212. box-sizing: border-box;
  213. .cl_item{
  214. width: 112rpx;
  215. line-height: 50rpx;
  216. font-family: PingFangSC, PingFang SC;
  217. font-weight: 400;
  218. font-size: 30rpx;
  219. color: #676775;
  220. &.active{
  221. font-weight: bold;
  222. font-size: 36rpx;
  223. color: #252525;
  224. line-height: 50rpx;
  225. }
  226. }
  227. }
  228. &-all{
  229. width: 72rpx;
  230. font-family: PingFangSC, PingFang SC;
  231. font-weight: 400;
  232. font-size: 28rpx;
  233. color: #676775;
  234. line-height: 40rpx;
  235. position: relative;
  236. &.active{
  237. font-weight: bold;
  238. font-size: 36rpx;
  239. color: #252525;
  240. line-height: 50rpx;
  241. &::after{
  242. content: '';
  243. width: 40rpx;
  244. height: 8rpx;
  245. background: linear-gradient( 270deg, #B7F358 0%, #00AE57 100%);
  246. border-radius: 4rpx;
  247. position: absolute;
  248. left: 50%;
  249. margin-left: -20rpx;
  250. bottom: -10rpx;
  251. }
  252. }
  253. }
  254. }
  255. .filter{
  256. margin-top: 33rpx;
  257. position: relative;
  258. &-pre{
  259. width: 186rpx;
  260. text{
  261. font-family: PingFang-SC, PingFang-SC;
  262. font-weight: bold;
  263. font-size: 24rpx;
  264. color: #252525;
  265. line-height: 33rpx;
  266. }
  267. image{
  268. width: 24rpx;
  269. height: 24rpx;
  270. margin-left: 6rpx;
  271. }
  272. }
  273. }
  274. .list{
  275. flex: 1;
  276. padding: 20rpx 0;
  277. box-sizing: border-box;
  278. overflow-y: auto;
  279. }
  280. }
  281. .window{
  282. width: 100%;
  283. position: fixed;
  284. left: 0;
  285. right: 0;
  286. background: rgba(0, 0, 0, .4);
  287. &-time{
  288. background: #FFFFFF;
  289. border-radius: 0 0 24rpx 24rpx;
  290. .top{
  291. padding: 32rpx 30rpx;
  292. &-pre{
  293. padding: 10rpx 24rpx;
  294. background: #F5F6F8;
  295. border-radius: 27rpx;
  296. font-family: PingFangSC, PingFang SC;
  297. font-weight: 400;
  298. font-size: 24rpx;
  299. color: #252525;
  300. line-height: 33rpx;
  301. margin-left: 20rpx;
  302. &:first-child{
  303. margin-left: 0;
  304. }
  305. &.active{
  306. background: #B7F358;
  307. font-weight: bold;
  308. }
  309. }
  310. }
  311. .middle{
  312. height: 594rpx;
  313. background: #F7F7F7;
  314. }
  315. .bottom{
  316. padding: 24rpx 24rpx 36rpx;
  317. .reset{
  318. width: 222rpx;
  319. height: 80rpx;
  320. border-radius: 45rpx;
  321. border: 1rpx solid #252525;
  322. font-family: PingFang-SC, PingFang-SC;
  323. font-weight: bold;
  324. font-size: 28rpx;
  325. color: #252525;
  326. line-height: 80rpx;
  327. text-align: center;
  328. letter-spacing: 2rpx;
  329. }
  330. .confirm{
  331. width: calc(100% - 252rpx);
  332. height: 80rpx;
  333. background: #B7F358;
  334. border-radius: 45rpx;
  335. font-family: PingFang-SC, PingFang-SC;
  336. font-weight: bold;
  337. font-size: 28rpx;
  338. color: #252525;
  339. line-height: 80rpx;
  340. text-align: center;
  341. }
  342. }
  343. }
  344. &-all{
  345. padding: 26rpx 30rpx 103rpx;
  346. background: #FFFFFF;
  347. display: flex;
  348. flex-wrap: wrap;
  349. justify-content: space-between;
  350. .pre{
  351. width: calc(100% / 3 - 12rpx);
  352. height: 59rpx;
  353. background: #F7F7F7;
  354. border-radius: 30rpx;
  355. font-family: PingFangSC, PingFang SC;
  356. font-weight: 400;
  357. font-size: 24rpx;
  358. color: #252525;
  359. line-height: 59rpx;
  360. text-align: center;
  361. margin-top: 24rpx;
  362. }
  363. }
  364. }
  365. </style>