xq-csg-weapp_uni-ts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
6.2KB

  1. <template>
  2. <view>
  3. <custom-nav-bar position="fixed" color="black" left-text="活动风采" left-arrow />
  4. <view class="search">
  5. <view class="flex flex-between search-input">
  6. <input class="input" :value="searchValue" type="text" confirm-type="search"
  7. placeholder-class="placeholder-style" placeholder="请输入搜索商户名称" @input="onSearch" @confirm="onChange" />
  8. <view class="search-icon flex flex-center" @click="onSearch">
  9. <image class="imgage" src="/static/images/search.png"></image>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="activity" v-if="newsPageList.length !== 0">
  14. <block v-for="(item,index) in newsPageList" :key="index">
  15. <view class="activity-item" @click="headerDetail(item)">
  16. <image class="activity-image" :src="item.activityCoverImg" mode="aspectFill"></image>
  17. <view class="activity-type" v-if="index < 5" :class="`activity-type${index}`">NO.{{index+1}}</view>
  18. <view class="activity-title multi-line">{{item.activityTitle}}</view>
  19. <view class="activity-time">{{getDateTime(item.createTime)}}</view>
  20. <view class="activity-rigth">
  21. <text>{{item.userName}}</text>
  22. <image :src="item.avatar || '@/images/default-avatar.png'" mode=""></image>
  23. </view>
  24. </view>
  25. </block>
  26. </view>
  27. <van-empty v-else
  28. image="https://jiexiu.xuqidata.com:8083/jiexiujumin/e1bb4242ccc209c332b84a3fde862cc156b31634152d5df503642438bfdded50.png"
  29. :image-size="['78%','100%']" description="没有找到您要查询的信息" />
  30. </view>
  31. </template>
  32. <script>
  33. import * as peopleApi from '@/api/peopleApi';
  34. import * as publicApi from '@/api/publicApi';
  35. import utils from '@/utils/util.map'
  36. export default {
  37. data() {
  38. return {
  39. option: {},
  40. searchValue: '',
  41. newsPageList: []
  42. }
  43. },
  44. onLoad(option) {
  45. this.option = option
  46. this.merchantPageApi(false)
  47. },
  48. methods: {
  49. getDateTime(time) {
  50. return utils.getDateTime(time, 2)
  51. },
  52. onSearch(e) {
  53. this.searchValue = e.detail.value
  54. if (e.detail.value !== '') {
  55. return;
  56. }
  57. this.searchValue = e.detail.value
  58. this.merchantPageApi();
  59. },
  60. onChange(e) {
  61. this.searchValue = e.detail.value
  62. this.merchantPageApi();
  63. },
  64. // 分页参数处理事件
  65. generalQueryData(reset = false) {
  66. const {
  67. pageNo,
  68. pageSize,
  69. } = this;
  70. const params = {
  71. pageNo: 1,
  72. pageSize: 14,
  73. };
  74. if (reset) {
  75. return params;
  76. }
  77. return {
  78. ...params,
  79. pageNo: pageNo + 1,
  80. pageSize
  81. };
  82. },
  83. async merchantPageApi(reset = true) {
  84. const params = this.generalQueryData(reset);
  85. const param = {
  86. pageNo: 1,
  87. pageSize: 10,
  88. };
  89. if (this.searchValue) {
  90. param.key = this.searchValue;
  91. }
  92. const res = await peopleApi.activityPageApi(param);
  93. if (res.data) {
  94. this.newsPageList = res.data.list
  95. }
  96. },
  97. headerDetail(item) {
  98. uni.navigateTo({
  99. url: './detail?id=' + item.id
  100. })
  101. }
  102. },
  103. onReachBottom() {
  104. if (this.newsPageList.length === this.total) {
  105. return;
  106. }
  107. this.merchantPageApi(false);
  108. }
  109. }
  110. </script>
  111. <style lang="less" scoped>
  112. page {
  113. background-color: #F9F9F9;
  114. }
  115. .search {
  116. padding: 0rpx 30rpx 40rpx 30rpx;
  117. background-color: #ffffff;
  118. }
  119. .search-input {
  120. height: 64rpx;
  121. line-height: 64rpx;
  122. background: #f9f9f9;
  123. border-radius: 35rpx;
  124. border: 1px solid #e1e1e1;
  125. text-align: center;
  126. position: relative;
  127. box-sizing: content-box;
  128. padding: 0 30rpx;
  129. .input {
  130. width: 100%;
  131. height: 64rpx;
  132. line-height: 64rpx;
  133. text-decoration: 20rpx;
  134. padding: 0 64rpx;
  135. font-size: 26rpx;
  136. font-weight: 400;
  137. }
  138. .placeholder-style {
  139. text-align: center;
  140. color: #c1c1c1;
  141. }
  142. }
  143. .search-icon {
  144. width: 64rpx;
  145. height: 64rpx;
  146. background: #ffffff;
  147. border-radius: 35rpx;
  148. border: 1px solid #e1e1e1;
  149. position: absolute;
  150. right: -1px;
  151. top: 0;
  152. z-index: 1;
  153. .imgage {
  154. width: 32rpx;
  155. height: 32rpx;
  156. }
  157. }
  158. .activity {
  159. padding: 23rpx 20rpx;
  160. display: grid;
  161. grid-template-columns: repeat(2, 1fr);
  162. grid-gap: 16rpx;
  163. .activity-item {
  164. position: relative;
  165. background: #fff;
  166. border-radius: 8rpx;
  167. overflow: hidden;
  168. .activity-image {
  169. width: 100%;
  170. height: 180rpx;
  171. }
  172. .activity-title {
  173. font-size: 24rpx;
  174. font-weight: 400;
  175. color: #000000;
  176. padding: 0 16rpx;
  177. }
  178. .activity-time {
  179. font-size: 24rpx;
  180. font-weight: 400;
  181. margin-top: 8rpx;
  182. color: #999999;
  183. padding: 0 16rpx;
  184. }
  185. .activity-rigth {
  186. text-align: right;
  187. font-size: 24rpx;
  188. font-weight: 400;
  189. color: #FF7F34;
  190. display: flex;
  191. justify-content: flex-end;
  192. align-items: center;
  193. padding: 28rpx 28rpx 30rpx 0rpx;
  194. image {
  195. width: 32rpx;
  196. height: 32rpx;
  197. margin-left: 16rpx;
  198. border-radius: 1932312312px;
  199. }
  200. }
  201. }
  202. }
  203. .activity-type {
  204. position: absolute;
  205. top: 0;
  206. left: 0;
  207. border-radius: 0px 8rpx 1000rpx 0;
  208. font-size: 24rpx;
  209. font-weight: 400;
  210. color: #fff;
  211. width: 100rpx;
  212. padding: 12rpx 30rpx 12rpx 12rpx;
  213. text-align: center;
  214. }
  215. .activity-type0 {
  216. background: linear-gradient(270deg, #E71E00 0%, #FF5E33 100%);
  217. }
  218. .activity-type1 {
  219. background: linear-gradient(270deg, #F3623B 0%, #F88C44 100%);
  220. }
  221. .activity-type2 {
  222. background: linear-gradient(291deg, #fea422 0%, #f9ca10 100%);
  223. }
  224. .activity-type3 {
  225. background: linear-gradient(291deg, #4a507b 0%, #6882b1 100%);
  226. }
  227. .activity-type4 {
  228. background: linear-gradient(291deg, #4a507b 0%, #6882b1 100%);
  229. }
  230. .van-empty__description {
  231. font-size: 28rpx !important;
  232. font-weight: 400;
  233. color: #BFBFBF;
  234. }
  235. .van-empty__image {
  236. width: 75% !important;
  237. height: 100%;
  238. }
  239. </style>