intelligentGroup/components/newsList.vue

95 lines
2.2 KiB
Vue

<template>
<view class="product">
<view class="newslist" v-for="(item,index) in list" :key="index" @click="handleActive(item.id)">
<view class="right">
<image :src="item.headimg" mode="aspectFit"></image>
</view>
<view class="left">
<view class="title">
{{item.title}}
</view>
</view>
<view class="time" v-if="isAddress!=4">
<view class="size14 c999" style="width:60%">
<icon class="iconfont icon-icon-test1"></icon>
{{item.createdtime}}
</view>
<view class="size14 c999 " style="width:40%">
<icon class="iconfont icon-icon-test"></icon>
{{item.browsecnt}}次浏览
</view>
</view>
<view class="time isAddress" v-if="isAddress==4">
<view class="size14 c999">
<uni-icons type="location-filled" size="20" class="location"></uni-icons>
{{item.province}}{{item.city}}{{item.area}}{{item.address}}
</view>
<view class="size14 c999 ml-10">
<icon class="iconfont icon-icon-test1"></icon>
{{item.starttime}}至{{item.endtime}}
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
name: "productList",
props: {
isAddress: {
type: Number,
default: 1 //1资讯4活动,7党建
},
list: {
type: Array,
default () {
return []
}
}
},
methods: {
handleActive(id) {
let that = this
// if (!uni.getStorageSync('token')) {
// that.$tools.msg("登录后查看更多")
// return
// }
let type = that.isAddress
let account = {
id: id,
type: type
}
let https = ""
if (type == 1 || type == 5 || type == 6 || type == 7) {
https = that.$model.getInfoDetail(account)
} else if (type == 4) {
https = that.$model.getCampaignDetail(account)
}
return https.then((res) => {
if (res.code != 0) return
res.data.type = type
if (type == 4) {
uni.navigateTo({
url: "/pageTwo/news/detail?id=" + res.data.id + "&type=" + res.data.type
})
} else {
that.$tools.NewsPtype(res.data)
}
})
}
}
}
</script>
<style scoped lang="scss">
.location {
float: left;
display: block;
margin-top: 0px;
}
</style>