caseMarket.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="container">
  3. <u-sticky>
  4. <view class="searchBox">
  5. <u-search bgColor="rgba(217,217,217,0.3)" placeholder="请输入案例名称进行搜索" :showAction="false"
  6. v-model="param.caseName" @search="search()"></u-search>
  7. </view>
  8. </u-sticky>
  9. <view class="selBox">
  10. <view class="selBox_l">
  11. <view @click="changeIsAsc">
  12. <view>最新上传</view>
  13. </view>
  14. <image v-if="isAsc == 'descending'" src="/static/img/switch.png" mode=""></image>
  15. <image v-else src="/static/img/switch_a.png" mode=""></image>
  16. </view>
  17. <view class="selBox_r" @click="show=true">
  18. 筛选
  19. <image src="/static/img/menu1.png" mode=""></image>
  20. </view>
  21. </view>
  22. <view class="imgList">
  23. <view class="imgList_item" @click="goDetail(v)" v-for="(v,i) in list" :key="i">
  24. <!-- <image :src="v.casePicture"></image> -->
  25. <u--image :src="v.casePicture" width="340rpx" height="340rpx">
  26. <template v-slot:loading>
  27. <image class="loading" src="../../static/loading.png" mode=""></image>
  28. </template>
  29. </u--image>
  30. <view class="imgList_item_txt">
  31. <view class="item_name">{{v.caseName}}</view>
  32. <view class="item_person">上传人:{{v.createBy}}</view>
  33. <view class="item_date">上传时间:{{v.createTime?v.createTime.substr(0,16):''}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="loadmoreBox">
  38. <u-loadmore v-if="list.length>0" :status="status" />
  39. <u-empty v-if="list.length<=0&&status==='nomore'" textSize="16" mode="list" marginTop="100">
  40. </u-empty>
  41. </view>
  42. <u-popup :show="show" mode="bottom" round="50rpx" @close="close">
  43. <view class="popupBox">
  44. <view class="popupBox_title">筛选</view>
  45. <view class="popupBox_del" @click="close()"><u-icon name="close" color="#999999" size="20px"></u-icon>
  46. </view>
  47. <view class="popupBox_list">
  48. <view v-for="(v,i) in caseTypeList" :key="i" :class="{active:param.caseType==v.dictValue}"
  49. @click="caseTypeChange(v)">{{v.dictLabel}}</view>
  50. </view>
  51. <view class="popupBox_btn">
  52. <view class="popupBox_btn_cel" @click="close()">取消</view>
  53. <view class="popupBox_btn_sub" @click="search()">确认</view>
  54. </view>
  55. </view>
  56. </u-popup>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. caseMarketPage,
  62. dictData
  63. } from "@/api/index.js"
  64. export default {
  65. data() {
  66. return {
  67. show: false,
  68. // 加载前值为loadmore,加载中为loading,没有数据为nomore
  69. status: 'loadmore',
  70. param: {
  71. pageNum: 1,
  72. pageSize: 10,
  73. caseType: null
  74. },
  75. list: [],
  76. caseTypeList: [],
  77. isAsc: 'descending'
  78. }
  79. },
  80. onLoad() {
  81. this.getList();
  82. this.getDict()
  83. },
  84. onPullDownRefresh() {
  85. this.param.pageNum = 1
  86. this.getList()
  87. },
  88. onReachBottom() {
  89. if (this.status == "loadmore") {
  90. this.param.pageNum++;
  91. this.getList()
  92. }
  93. },
  94. methods: {
  95. goDetail(row) {
  96. uni.$u.route("pages/caseMarket/detail", {
  97. caseId: row.caseId
  98. })
  99. },
  100. close() {
  101. this.param.caseType = null;
  102. this.show = false;
  103. },
  104. caseTypeChange(row) {
  105. this.param.caseType = this.param.caseType != row.dictValue ? row.dictValue : null;
  106. },
  107. // 搜索
  108. search() {
  109. this.param.pageNum = 1;
  110. this.show = false;
  111. this.getList()
  112. },
  113. getDict() {
  114. dictData('case_type').then(res => {
  115. this.caseTypeList = res.data
  116. })
  117. },
  118. getList() {
  119. uni.showLoading({
  120. title: '加载中',
  121. mask: true
  122. });
  123. this.status = "loading";
  124. this.param.isAsc = this.isAsc
  125. this.param.orderByColumn = 'createTime'
  126. caseMarketPage(this.param).then(res => {
  127. if (this.param.pageNum == 1) {
  128. this.list = res.rows
  129. } else {
  130. this.list.push(...res.rows)
  131. }
  132. this.status = this.list.length < res.total ? "loadmore" : "nomore";
  133. }).finally(e => {
  134. uni.hideLoading();
  135. uni.stopPullDownRefresh();
  136. })
  137. },
  138. changeIsAsc() {
  139. if (this.isAsc == 'descending') {
  140. this.isAsc = 'ascending';
  141. } else {
  142. this.isAsc = 'descending';
  143. }
  144. this.getList();
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="scss">
  150. .searchBox {
  151. padding: 25rpx 30rpx;
  152. display: flex;
  153. border-bottom: 8rpx solid #EBECF0;
  154. ::v-deep .u-search__content__input {
  155. background-color: transparent !important;
  156. }
  157. }
  158. .selBox {
  159. display: flex;
  160. justify-content: space-between;
  161. padding: 28rpx 36rpx;
  162. .selBox_l {
  163. display: flex;
  164. align-items: center;
  165. font-size: 26rpx;
  166. image {
  167. width: 26rpx;
  168. height: 24rpx;
  169. margin-left: 4rpx;
  170. }
  171. }
  172. .selBox_r {
  173. display: flex;
  174. align-items: center;
  175. font-size: 28rpx;
  176. image {
  177. width: 30rpx;
  178. height: 30rpx;
  179. margin-left: 4rpx;
  180. }
  181. }
  182. }
  183. .imgList {
  184. padding: 0 28rpx;
  185. display: flex;
  186. flex-wrap: wrap;
  187. justify-content: space-between;
  188. .imgList_item {
  189. font-size: 0;
  190. width: 340rpx;
  191. border-radius: 20rpx;
  192. overflow: hidden;
  193. margin-bottom: 30rpx;
  194. background: rgb(243, 244, 246);
  195. /deep/ .u-image {
  196. width: 340rpx;
  197. height: 340rpx;
  198. }
  199. >.imgList_item_txt {
  200. background: #F2F2F2;
  201. padding: 20rpx 14rpx;
  202. line-height: 40rpx;
  203. .item_name {
  204. font-size: 26rpx;
  205. color: #1A1A1A;
  206. font-weight: 700;
  207. }
  208. .item_person,
  209. .item_date {
  210. font-size: 22rpx;
  211. color: #808080;
  212. }
  213. }
  214. }
  215. }
  216. .popupBox {
  217. padding: 0 20rpx;
  218. .popupBox_title {
  219. font-size: 36rpx;
  220. color: #1A1A1A;
  221. font-weight: 700;
  222. text-align: center;
  223. margin-top: 45rpx;
  224. margin-bottom: 65rpx;
  225. }
  226. .popupBox_del {
  227. position: absolute;
  228. right: 30rpx;
  229. top: 40rpx;
  230. }
  231. .popupBox_list {
  232. display: flex;
  233. flex-wrap: wrap;
  234. >view {
  235. width: 188rpx;
  236. background: #F5F5F5;
  237. font-size: 24rpx;
  238. color: #1A1A1A;
  239. border-radius: 35rpx;
  240. padding: 20rpx 0rpx;
  241. margin: 0 15rpx 65rpx;
  242. text-align: center;
  243. }
  244. .active {
  245. background: #FFA298;
  246. }
  247. }
  248. .popupBox_btn {
  249. display: flex;
  250. justify-content: space-between;
  251. padding: 0 30rpx 60rpx;
  252. view {
  253. width: 285rpx;
  254. height: 88rpx;
  255. border-radius: 20rpx;
  256. font-size: 32rpx;
  257. text-align: center;
  258. line-height: 88rpx;
  259. }
  260. .popupBox_btn_cel {
  261. color: #E83A27;
  262. border: 1rpx solid #e83a27;
  263. }
  264. .popupBox_btn_sub {
  265. background: #E83A27;
  266. color: #fff;
  267. }
  268. }
  269. }
  270. .loadmoreBox {
  271. padding-bottom: 1rpx;
  272. }
  273. // /deep/ .u-image__loading {
  274. // height: 180rpx !important;
  275. // }
  276. .loading {
  277. width: 160rpx;
  278. height: 160rpx;
  279. margin-top: 40rpx;
  280. }
  281. </style>