allActivity.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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">
  6. <cus-search @handleSearch="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">
  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"></div>
  60. </div>
  61. <div class="window" :style="{'top':topAll+'px','height':'calc(100vh - '+topAll+'px)'}" v-if="allShow">
  62. <div class="window-all"></div>
  63. </div>
  64. </view>
  65. </template>
  66. <script setup name="">
  67. import CusHeader from '@/components/CusHeader/index.vue'
  68. import CusSearch from '@/components/CusSearch/index.vue'
  69. import NonprofitActivety from '@/components/pages/nonprofitActivety/index.vue'
  70. import ActivityCalendar from '@/components/pages/activityCalendar/index.vue'
  71. import { ref, onMounted, nextTick } from 'vue'
  72. const typeIndex = ref('')
  73. const typeList = ref([
  74. {id:1,name:'儿童关爱'},
  75. {id:2,name:'老人关爱'},
  76. {id:3,name:'社区发展'},
  77. {id:4,name:'社会服务'},
  78. {id:5,name:'健康行动'},
  79. {id:6,name:'减肥运动'}
  80. ])
  81. const scrollLeft = ref(0)
  82. const time = ref('全部时间')
  83. const timeText = ref('')
  84. const place = ref('全部地区')
  85. const status = ref('活动状态')
  86. const queryParams = ref({})
  87. const list = ref([1,1,1,1])
  88. const top = ref(0)
  89. const topAll = ref(0)
  90. const timeShow = ref(false)
  91. const placeShow = ref(false)
  92. const allShow = ref(false)
  93. const wtIndex = ref(0)
  94. const acRef = ref(null)
  95. const search = (keyword) => {
  96. console.log(keyword);
  97. }
  98. const changeType = (item,index) => {
  99. typeIndex.value = index;
  100. if(typeList.value.length>4){
  101. if(index<3) scrollLeft.value = 0
  102. else{
  103. scrollLeft.value = (index-2)*154/2;
  104. }
  105. }
  106. }
  107. const handleAll = () => {
  108. typeIndex.value = '';
  109. scrollLeft.value = 0;
  110. allShow.value = true;
  111. }
  112. const changeWindowTime = (wtindex,text) => {
  113. wtIndex.value = wtindex;
  114. timeText.value = text;
  115. acRef.value.setStartEndDay(wtindex);
  116. }
  117. const showTime = () => {
  118. timeShow.value = true;
  119. setTimeout(()=>{
  120. acRef.value.setStartEndDay(wtIndex.value);
  121. },100)
  122. }
  123. const timeConfirm = () => {
  124. time.value = timeText.value;
  125. timeShow.value = false;
  126. }
  127. const scrolltolower = () => {
  128. console.log(1);
  129. }
  130. const getTop = () => {
  131. let query = uni.createSelectorQuery();
  132. query.select('#list').boundingClientRect(rect=>{
  133. if(rect){
  134. top.value = (rect?.top+20)||0;//20是上间距
  135. }
  136. }).exec()
  137. query.select('#filter').boundingClientRect(rect=>{
  138. if(rect){
  139. topAll.value = (rect?.top-13)||0;
  140. }
  141. }).exec()
  142. }
  143. onMounted(()=>{
  144. nextTick(()=>{
  145. getTop();
  146. })
  147. })
  148. </script>
  149. <style scoped lang="scss">
  150. .scroll-view_H {
  151. white-space: nowrap;
  152. width: 100%;
  153. }
  154. .scroll-view-item_H {
  155. display: inline-block;
  156. height: 50rpx;
  157. margin-left: 42rpx;
  158. &:first-child{
  159. margin-left: 0;
  160. }
  161. }
  162. .common_page{
  163. .top-search{
  164. position: relative;
  165. margin-top: 20rpx;
  166. }
  167. .type{
  168. margin-top: 40rpx;
  169. width: 100%;
  170. height: 50rpx;
  171. position: relative;
  172. &-list{
  173. width: calc(100% - 72rpx);
  174. padding-right: 40rpx;
  175. box-sizing: border-box;
  176. .cl_item{
  177. width: 112rpx;
  178. line-height: 50rpx;
  179. font-family: PingFangSC, PingFang SC;
  180. font-weight: 400;
  181. font-size: 30rpx;
  182. color: #676775;
  183. &.active{
  184. font-weight: bold;
  185. font-size: 36rpx;
  186. color: #252525;
  187. line-height: 50rpx;
  188. }
  189. }
  190. }
  191. &-all{
  192. width: 72rpx;
  193. font-family: PingFangSC, PingFang SC;
  194. font-weight: 400;
  195. font-size: 28rpx;
  196. color: #676775;
  197. line-height: 40rpx;
  198. position: relative;
  199. &.active{
  200. font-weight: bold;
  201. font-size: 36rpx;
  202. color: #252525;
  203. line-height: 50rpx;
  204. &::after{
  205. content: '';
  206. width: 40rpx;
  207. height: 8rpx;
  208. background: linear-gradient( 270deg, #B7F358 0%, #00AE57 100%);
  209. border-radius: 4rpx;
  210. position: absolute;
  211. left: 50%;
  212. margin-left: -20rpx;
  213. bottom: -10rpx;
  214. }
  215. }
  216. }
  217. }
  218. .filter{
  219. margin-top: 33rpx;
  220. position: relative;
  221. &-pre{
  222. width: 186rpx;
  223. text{
  224. font-family: PingFang-SC, PingFang-SC;
  225. font-weight: bold;
  226. font-size: 24rpx;
  227. color: #252525;
  228. line-height: 33rpx;
  229. }
  230. image{
  231. width: 24rpx;
  232. height: 24rpx;
  233. margin-left: 6rpx;
  234. }
  235. }
  236. }
  237. .list{
  238. flex: 1;
  239. padding: 20rpx 0;
  240. box-sizing: border-box;
  241. overflow-y: auto;
  242. }
  243. }
  244. .window{
  245. width: 100%;
  246. position: fixed;
  247. left: 0;
  248. right: 0;
  249. background: rgba(0, 0, 0, .4);
  250. &-time{
  251. background: #FFFFFF;
  252. border-radius: 0 0 24rpx 24rpx;
  253. .top{
  254. padding: 32rpx 30rpx;
  255. &-pre{
  256. padding: 10rpx 24rpx;
  257. background: #F5F6F8;
  258. border-radius: 27rpx;
  259. font-family: PingFangSC, PingFang SC;
  260. font-weight: 400;
  261. font-size: 24rpx;
  262. color: #252525;
  263. line-height: 33rpx;
  264. margin-left: 20rpx;
  265. &:first-child{
  266. margin-left: 0;
  267. }
  268. &.active{
  269. background: #B7F358;
  270. font-weight: bold;
  271. }
  272. }
  273. }
  274. .middle{
  275. height: 594rpx;
  276. background: #F7F7F7;
  277. }
  278. .bottom{
  279. padding: 24rpx 24rpx 36rpx;
  280. .reset{
  281. width: 222rpx;
  282. height: 80rpx;
  283. border-radius: 45rpx;
  284. border: 1rpx solid #252525;
  285. font-family: PingFang-SC, PingFang-SC;
  286. font-weight: bold;
  287. font-size: 28rpx;
  288. color: #252525;
  289. line-height: 80rpx;
  290. text-align: center;
  291. letter-spacing: 2rpx;
  292. }
  293. .confirm{
  294. width: calc(100% - 252rpx);
  295. height: 80rpx;
  296. background: #B7F358;
  297. border-radius: 45rpx;
  298. font-family: PingFang-SC, PingFang-SC;
  299. font-weight: bold;
  300. font-size: 28rpx;
  301. color: #252525;
  302. line-height: 80rpx;
  303. text-align: center;
  304. }
  305. }
  306. }
  307. }
  308. </style>