123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <template>
- <view class="content">
- <!-- 导航 -->
- <view class="nav">
- <view class="leftView" @click="back">
- <image src="../../static/mobile/backBtn.png" mode=""
- style="width: 22rpx; height: 40rpx; padding-left: 24rpx;"></image>
- </view>
- <view class="navTitle">{{topName}}</view>
- <view class="rightView">
- <image src="../../static/mobile/icon_search@2x.png" mode="" class="rightImg" style="margin-left: 40rpx;"
- @click="goSearch"></image>
- </view>
- </view>
- <!-- content -->
-
- <view class="top" v-if="comment.length != 0">{{comment}}</view>
- <!-- item -->
- <view class="itemBg">
- <view v-for="(item,index) in itemArr" :key="index" class="twoItem" :class="{line:index>0}" @click="goDetail(item)">
- <image :src="item.LogoImg" mode="" class="img2"></image>
- <view class="rightItem">
- <view class="title">{{item.Title}}</view>
- <view class="title2">{{item.Comment}}</view>
- </view>
- </view>
- </view>
- <!-- 上拉 加载更多 -->
- <view class="noMore" v-if="noMoreShow">没有更多数据</view>
- <!-- 无数据空白页 -->
- <nodata v-if="itemArr.length==0"></nodata>
-
- <view class="gotop" @click="gotoTop">
- <image src="../../static/pcimg/btn_top@2x.png" mode="" class="gotopImg"></image>
- </view>
-
- </view>
- </template>
- <script>
- import nodata from '../../components/nodata/nodata.vue'
- export default {
- components: {
- nodata,
- },
- data() {
- return {
- topName: '',
- topCode: '',
- comment: '',
- page: 1,
- itemArr: [],
- noMoreShow: false,
- }
- },
- onLoad(opt) {
- console.log('opt', opt);
- this.topName = opt.topName
- this.topCode = opt.topCode
- this.comment = opt.comment
- this.page = 1
- this.getItemData()
- // uni.setNavigationBarTitle({
- // title: this.topName
- // })
- },
- methods: {
- gotoTop(){
- uni.pageScrollTo({
- scrollTop: 0, duration: 300
- });
- },
- goDetail(item){
- uni.navigateTo({
- url:'detail?id=' + item.ID
- })
- },
- getItemData() {
- uni.showLoading({
- title: '加载中'
- })
- let url = 'trainingOpenApiV2/groupPageData',
- params = {
- page: this.page,
- limit: 10,
- parentCode: this.topCode,
- }
- this.$http(url, params, 'GET').then(res => {
- uni.hideLoading();
- var data = res.data
- // 处理 undefined和null转为空白字符串
- for (const key in data) {
- data[key] = this.$praseStrEmpty(data[key])
- }
- if (this.page == 1) {
- this.itemArr = data.Items
- } else {
- this.itemArr = this.itemArr.concat(data.Items)
- }
- if (data.Items.length < 10) {
- this.noMoreShow = true
- } else {
- this.noMoreShow = false
- }
- if (this.itemArr.length == 0) {
- this.noMoreShow = false
- }
- })
- },
- goSearch() {
- uni.navigateTo({
- url: 'search'
- })
- },
- back() {
- uni.navigateBack({
- })
- },
- // 下拉刷新 上拉加载更多
- onPullDownRefresh() {
- this.page = 1;
- this.getItemData()
- // this.getDetailData()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() {
- this.page++;
- this.getItemData()
- }
- }
- }
- </script>
- <style scoped>
- .content {
- min-height: 100vh;
- background-color: #FFFFFF;
- padding-top: 88rpx;
- padding-bottom: 20rpx;
- }
- .nav {
- position: fixed;
- left: 0;
- top: 0;
- width: 100vw;
- height: 88rpx;
- background-color: #FFFFFF;
- display: flex;
- justify-content: space-between;
- align-items: center;
- z-index: 999;
- border-bottom: #eeeeee 2rpx solid;
- }
- .navTitle {
- font-size: 36rpx;
- font-weight: bold;
- color: #3c3c3c;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 600rpx;
- text-align: center;
- line-height: 44rpx;
- }
- .leftView {
- /* width: 30%; */
- width: 80rpx;
- }
- .rightView {
- /* width: 30%; */
- width: 80rpx;
- display: flex;
- justify-content: flex-end;
- padding-right: 24rpx;
- }
- .rightImg {
- width: 40rpx;
- height: 40rpx;
- }
- .commend {
- position: fixed;
- left: 0;
- top: 90rpx;
- width: calc(100vw - 50rpx);
- background-color: #FFFFFF;
- padding: 0 25rpx 30rpx;
- z-index: 999;
- height: 140rpx;
- }
- .top {
-
- background-color: #FFFFFF;
-
- padding: 40rpx 74rpx;
-
-
- color: #999999;
- font-size: 24rpx;
- text-align: center;
-
- }
- .itemBg {
- background-color: #FFFFFF;
- padding: 0 24rpx;
- }
- .twoItem {
- display: flex;
- background-color: #FFFFFF;
- padding: 30rpx 0;
-
- }
- .line {
- border-top: #eeeeee 2rpx solid;
- }
- .title {
- font-size: 28rpx;
- font-weight: bold;
- color: #3c3c3c;
-
- /* 隐藏文字显示 ...不换行 */
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .title2 {
-
- font-size: 24rpx;
- color: #999999;
-
- //超过固定行数 隐藏
- display: -webkit-box;
- overflow: hidden;
- text-overflow: ellipsis;
- word-wrap: break-word;
- white-space: normal !important;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- margin: 14rpx 0;
- }
- .img2 {
- width: 240rpx;
- height: 135rpx;
- border-radius: 10rpx;
- }
- .rightItem {
- margin-left: 30rpx;
- width: calc(100vw - 300rpx);
- }
- .noMore {
- text-align: center;
- line-height: 50rpx;
- color: #999999;
- font-size: 28rpx;
- }
- .gotopImg{
- width: 100rpx;
- height: 100rpx;
- }
- .gotop{
- position: fixed;
- right: 15rpx;
- bottom: 100rpx;
- cursor: pointer;
- }
- </style>
|