intelligentGroup/components/newsList.vue

102 lines
2.4 KiB
Vue
Raw Normal View History

2023-09-08 14:52:40 +08:00
<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">
2023-09-08 14:52:40 +08:00
<view class="size14 c999" style="width:60%">
<icon class="iconfont icon-icon-test1"></icon>
{{item.createdtime}}
</view>
2024-05-02 15:31:12 +08:00
<view class="size14 c999 textR" style="width:40%">
2023-09-08 14:52:40 +08:00
<icon class="iconfont icon-icon-test"></icon>
{{item.browsecnt}}次浏览
</view>
</view>
<!-- <view class="time isAddress" v-if="isAddress==4">
2023-09-08 14:52:40 +08:00
<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> -->
2023-09-08 14:52:40 +08:00
</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 == 1 || that.isAddress == 4 ? 1 : that.isAddress
2023-09-08 14:52:40 +08:00
let account = {
id: id,
2024-05-02 15:31:12 +08:00
IsBrowseCnt: 2,
type: type.toString()
2023-09-08 14:52:40 +08:00
}
let https = ""
if (type == 1 || type == 4 || type == 5 || type == 6 || type == 7) {
2023-09-08 14:52:40 +08:00
https = that.$model.getInfoDetail(account)
// } else if (type == 4) {
// https = that.$model.getCampaignDetail(account)
2023-09-08 14:52:40 +08:00
}
return https.then((res) => {
if (res.code != 0) return
res.data.type = type
2024-05-02 15:31:12 +08:00
that.$emit("handleSearchId", id, res.data.browsecnt)
2023-09-08 14:52:40 +08:00
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;
}
2024-05-02 15:31:12 +08:00
.textR {
display: flex !important;
justify-content: flex-end !important;
}
2023-09-08 14:52:40 +08:00
</style>