123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <template>
- <view class="container">
- <u-sticky>
- <view class="searchBox">
- <u-search bgColor="rgba(217,217,217,0.3)" placeholder="请输入案例名称进行搜索" :showAction="false"
- v-model="param.caseName" @search="search()"></u-search>
- </view>
- </u-sticky>
- <view class="selBox">
- <view class="selBox_l">
- <view @click="changeIsAsc">
- <view>最新上传</view>
- </view>
- <image v-if="isAsc == 'descending'" src="/static/img/switch.png" mode=""></image>
- <image v-else src="/static/img/switch_a.png" mode=""></image>
- </view>
- <view class="selBox_r" @click="show=true">
- 筛选
- <image src="/static/img/menu1.png" mode=""></image>
- </view>
- </view>
- <view class="imgList">
- <view class="imgList_item" @click="goDetail(v)" v-for="(v,i) in list" :key="i">
- <!-- <image :src="v.casePicture"></image> -->
- <u--image :src="v.casePicture" width="340rpx" height="340rpx">
- <template v-slot:loading>
- <image class="loading" src="../../static/loading.png" mode=""></image>
- </template>
- </u--image>
- <view class="imgList_item_txt">
- <view class="item_name">{{v.caseName}}</view>
- <view class="item_person">上传人:{{v.createBy}}</view>
- <view class="item_date">上传时间:{{v.createTime?v.createTime.substr(0,16):''}}</view>
- </view>
- </view>
- </view>
- <view class="loadmoreBox">
- <u-loadmore v-if="list.length>0" :status="status" />
- <u-empty v-if="list.length<=0&&status==='nomore'" textSize="16" mode="list" marginTop="100">
- </u-empty>
- </view>
- <u-popup :show="show" mode="bottom" round="50rpx" @close="close">
- <view class="popupBox">
- <view class="popupBox_title">筛选</view>
- <view class="popupBox_del" @click="close()"><u-icon name="close" color="#999999" size="20px"></u-icon>
- </view>
- <view class="popupBox_list">
- <view v-for="(v,i) in caseTypeList" :key="i" :class="{active:param.caseType==v.dictValue}"
- @click="caseTypeChange(v)">{{v.dictLabel}}</view>
- </view>
- <view class="popupBox_btn">
- <view class="popupBox_btn_cel" @click="close()">取消</view>
- <view class="popupBox_btn_sub" @click="search()">确认</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- caseMarketPage,
- dictData
- } from "@/api/index.js"
- export default {
- data() {
- return {
- show: false,
- // 加载前值为loadmore,加载中为loading,没有数据为nomore
- status: 'loadmore',
- param: {
- pageNum: 1,
- pageSize: 10,
- caseType: null
- },
- list: [],
- caseTypeList: [],
- isAsc: 'descending'
- }
- },
- onLoad() {
- this.getList();
- this.getDict()
- },
- onPullDownRefresh() {
- this.param.pageNum = 1
- this.getList()
- },
- onReachBottom() {
- if (this.status == "loadmore") {
- this.param.pageNum++;
- this.getList()
- }
- },
- methods: {
- goDetail(row) {
- uni.$u.route("pages/caseMarket/detail", {
- caseId: row.caseId
- })
- },
- close() {
- this.param.caseType = null;
- this.show = false;
- },
- caseTypeChange(row) {
- this.param.caseType = this.param.caseType != row.dictValue ? row.dictValue : null;
- },
- // 搜索
- search() {
- this.param.pageNum = 1;
- this.show = false;
- this.getList()
- },
- getDict() {
- dictData('case_type').then(res => {
- this.caseTypeList = res.data
- })
- },
- getList() {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- this.status = "loading";
- this.param.isAsc = this.isAsc
- this.param.orderByColumn = 'createTime'
- caseMarketPage(this.param).then(res => {
- if (this.param.pageNum == 1) {
- this.list = res.rows
- } else {
- this.list.push(...res.rows)
- }
- this.status = this.list.length < res.total ? "loadmore" : "nomore";
- }).finally(e => {
- uni.hideLoading();
- uni.stopPullDownRefresh();
- })
- },
- changeIsAsc() {
- if (this.isAsc == 'descending') {
- this.isAsc = 'ascending';
- } else {
- this.isAsc = 'descending';
- }
- this.getList();
- },
- }
- }
- </script>
- <style lang="scss">
- .searchBox {
- padding: 25rpx 30rpx;
- display: flex;
- border-bottom: 8rpx solid #EBECF0;
- ::v-deep .u-search__content__input {
- background-color: transparent !important;
- }
- }
- .selBox {
- display: flex;
- justify-content: space-between;
- padding: 28rpx 36rpx;
- .selBox_l {
- display: flex;
- align-items: center;
- font-size: 26rpx;
- image {
- width: 26rpx;
- height: 24rpx;
- margin-left: 4rpx;
- }
- }
- .selBox_r {
- display: flex;
- align-items: center;
- font-size: 28rpx;
- image {
- width: 30rpx;
- height: 30rpx;
- margin-left: 4rpx;
- }
- }
- }
- .imgList {
- padding: 0 28rpx;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .imgList_item {
- font-size: 0;
- width: 340rpx;
- border-radius: 20rpx;
- overflow: hidden;
- margin-bottom: 30rpx;
- background: rgb(243, 244, 246);
- /deep/ .u-image {
- width: 340rpx;
- height: 340rpx;
- }
- >.imgList_item_txt {
- background: #F2F2F2;
- padding: 20rpx 14rpx;
- line-height: 40rpx;
- .item_name {
- font-size: 26rpx;
- color: #1A1A1A;
- font-weight: 700;
- }
- .item_person,
- .item_date {
- font-size: 22rpx;
- color: #808080;
- }
- }
- }
- }
- .popupBox {
- padding: 0 20rpx;
- .popupBox_title {
- font-size: 36rpx;
- color: #1A1A1A;
- font-weight: 700;
- text-align: center;
- margin-top: 45rpx;
- margin-bottom: 65rpx;
- }
- .popupBox_del {
- position: absolute;
- right: 30rpx;
- top: 40rpx;
- }
- .popupBox_list {
- display: flex;
- flex-wrap: wrap;
- >view {
- width: 188rpx;
- background: #F5F5F5;
- font-size: 24rpx;
- color: #1A1A1A;
- border-radius: 35rpx;
- padding: 20rpx 0rpx;
- margin: 0 15rpx 65rpx;
- text-align: center;
- }
- .active {
- background: #FFA298;
- }
- }
- .popupBox_btn {
- display: flex;
- justify-content: space-between;
- padding: 0 30rpx 60rpx;
- view {
- width: 285rpx;
- height: 88rpx;
- border-radius: 20rpx;
- font-size: 32rpx;
- text-align: center;
- line-height: 88rpx;
- }
- .popupBox_btn_cel {
- color: #E83A27;
- border: 1rpx solid #e83a27;
- }
- .popupBox_btn_sub {
- background: #E83A27;
- color: #fff;
- }
- }
- }
- .loadmoreBox {
- padding-bottom: 1rpx;
- }
- // /deep/ .u-image__loading {
- // height: 180rpx !important;
- // }
- .loading {
- width: 160rpx;
- height: 160rpx;
- margin-top: 40rpx;
- }
- </style>
|