安徽博创起重uniapp
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.
 
 
 
 

268 lines
6.1 KiB

<template>
<view class="news-list organ">
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption">
<view class="contain">
<view class="banner">
<ad-swipers :pid="32" height="340rpx">
</ad-swipers>
</view>
<!-- 城市 -->
<router-link class="m-l-16 flex row-center city" to="/bundle_b/pages/city/city">
<text class="m-r-6">{{ cityInfo.name || '选择' }}</text>
<u-icon name="arrow-down" size="24" color="#FFFFFF"></u-icon>
<!-- <image class="icon-md m-l-30" src="/static/images/icon_news.png">
</image> -->
</router-link>
<tabs :current="active" @change="changeActive" :bar-width="60">
<tab :name="cname" >
</tab>
</tabs>
<view class="main">
<view class="article-list">
<view class="article-item bg-white" v-for="(item, index) in newsList" :key="index" >
<router-link :to="{path: '/pages/community/organ_team_details', query: {id: item.id,type:0}}">
<view class="flex col-top">
<view class="info flex-1">
<view class="title lg line-2 m-b-20">{{ item.name }}</view>
<view class="lighter line-2">
<view>{{ item.intro }}</view>
</view>
<view class="flex row-between m-t-20 price">
<view class="xs muted">区域: <text style="color: red;">{{item.address}}</text></view>
</view>
</view>
<u-image width="240rpx" height="180rpx" class="img m-l-20" :src="item.image" />
</view>
<view class="flex row-between m-t-20">
<view class="flex">
<image class="icon-sm" src="/static/images/icon_see.png"></image>
<view class="m-l-10 xs muted">{{ item.visit }}人浏览</view>
</view>
</view>
</router-link>
</view>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import {
mapGetters,
mapActions
} from 'vuex'
import {
getOrganLists
} from '@/api/community.js';
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
export default {
mixins: [MescrollMixin],
props: {
active: {
type: Number
}
},
data() {
return {
active: 0,
upOption: {
auto: false,
empty: {
icon: '/static/images/news_null.png',
tip: "暂无数据",
}
},
cname : "",
categoryList: [],
newsList: [],
type: -1,
};
},
watch: {
active() {
if(this.active == 3){
this.mescroll.resetUpScroll()
}
},
cityInfo(){
console.log(111)
// 选择城市后是否刷新
this.downCallback();
}
},
async onShow() {
uni.setNavigationBarTitle({
title: '检测机构'
});
// 选择城市后是否刷新
await this.downCallback();
},
async onLoad(options) {
this.type = 0;
uni.setNavigationBarTitle({
title: '检测机构'
});
// 选择城市后是否刷新
await this.downCallback();
},
methods: {
changeActive(e) {
this.active = e;
this.newsList = [] // 先置空列表,显示加载进度
this.mescroll.resetUpScroll() // 再刷新列表数据
},
async downCallback() {
this.mescroll.resetUpScroll();
},
upCallback(page) {
let {
cityInfo,
isLogin,
type,
active,
categoryList
} = this;
this.cname = this.cityInfo !=null && this.cityInfo.id>0 ? this.cityInfo.name : '全国',
console.log(categoryList,11222)
getOrganLists({
cid: this.cityInfo !=null && this.cityInfo.id>0 ? this.cityInfo.id : '',
page_size:page.size,
page_no:page.num
}).then(({
data
}) => {
if (page.num == 1) this.newsList = [];
let curPageData = data.list;
let curPageLen = curPageData.length;
let hasNext = !!data.more;
this.newsList = this.newsList.concat(curPageData);
this.mescroll.endSuccess(curPageLen, hasNext);
}).catch(() => {
this.mescroll.endErr()
})
},
async getCategoryListFun() {
let {
cityInfo,
isLogin
} = this;
const {
code,
data
} = await getResourceCategoryList({
type: this.type
})
if (code == 1) {
this.categoryList = data
}
let item = {id:0,name:"全国"}
if(cityInfo.id !=null && cityInfo.id!=undefined && cityInfo.id>0){
item = {id:"city_"+cityInfo.id,name:"本地"}
}
this.categoryList.push(item)
if(isLogin){
item = {id:"my_buy",name:"我的购买"}
this.categoryList.push(item)
item = {id:"my_download",name:"我的下载"}
this.categoryList.push(item)
}
},
},
computed: {
...mapGetters(['cityInfo'])
}
};
</script>
<style lang="scss">
.news-list {
.main {
.article-list {
padding-top: 20rpx;
.article-item {
padding: 20rpx;
align-items: flex-start;
&:not(:last-of-type){
border-bottom: $-solid-border;
}
}
}
}
}
page {
padding: 0;
}
.index-bg {
background-image: url('/static/images/index_bg.png');
background-size: 100% auto;
background-repeat: no-repeat;
}
.index {
min-height: calc(100vh - var(--window-bottom));
.u-navbar {
::v-deep .u-search {
padding: 0 30rpx;
}
}
// 胶囊提示
.capsule-tips {
width: 584rpx;
color: #FFFFFF;
padding: 12rpx 18rpx;
border-radius: 14rpx;
background: rgba(0, 0, 0, 0.7);
position: relative;
position: absolute;
z-index: 9999;
bottom: -80rpx;
right: -150rpx;
}
.capsule-tips::after {
content: '';
border-bottom: 14rpx solid rgba(0, 0, 0, 0.7);
border-right: 14rpx solid transparent;
border-left: 14rpx solid transparent;
position: absolute;
top: -14rpx;
right: 88rpx;
}
.cate-btn {
padding: 12rpx 16rpx 12rpx 20rpx;
border-radius: 60rpx 0 0 60rpx;
background-color: rgba(256, 256, 256, .4);
}
}
.col-top {
position: relative;
.price {
position: absolute;
bottom:10rpx;
}
}
.city {
position: absolute;
top: 20rpx;
z-index: 999;
color: #fff;
padding: 10rpx 15rpx;
background: rgba(0,0,0,.3);
border-radius: 10rpx;
}
</style>