接口对接

This commit is contained in:
yanran200730
2023-03-17 11:35:02 +08:00
parent 29a03f52a3
commit cad15c95ff
2 changed files with 141 additions and 31 deletions

View File

@@ -11,46 +11,44 @@
</div>
</div>
<div class="nav">
<div class="nav-item" hover-class="text-hover" v-for="(item, index) in 7" :key="index" @click="$linkTo('./TopicDetail')">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-fangwuchuzu.png" />
<h2>物品交易</h2>
<div class="nav-item" hover-class="text-hover" v-for="(item, index) in topic" :key="index" @click="$linkTo('./TopicDetail')">
<image :src="item.picUrl" mode="aspectFill" />
<h2>{{ item.title }}</h2>
</div>
<div class="nav-item" @click="$linkTo('./Topic')">
<div class="nav-item" @click="$linkTo('./Topic')" v-if="topicList.length > 7">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-more.png" />
<h2>更多</h2>
</div>
</div>
<div class="AppCircle-list">
<div class="item" v-for="(item, index) in 10" :key="index" @click="$linkTo('./Detail')" hover-class="bg-hover">
<div class="item" v-for="(item, index) in list" :key="index" @click="$linkTo('./Detail')" hover-class="bg-hover">
<div class="item-top">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-fangwuchuzu.png" />
<image :src="item.createUserAvatar" />
<div class="right">
<h3>李在地</h3>
<span>清风街道</span>
<h3>{{ item.createUserName }}</h3>
<span>{{ item.publishDepartName }}</span>
</div>
</div>
<div class="item-content">
<span @click="$linkTo('./TopicDetail')">#闲置物品交易</span>
<text>社家用闲置柜子自用原价212现价80要的联系</text>
<span v-if="item.themeId" @click="$linkTo('./TopicDetail')">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/home-bg.png" />
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/home-bg.png" />
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/home-bg.png" />
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" v-for="(item, index) in item.files" :key="index" :src="item.url" />
</div>
<p>2020-12-11 10:10</p>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<i>10</i>
<i>{{ item.sharedCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png" />
<i>10</i>
<i>{{ item.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" />
<i>10</i>
<i>{{ item.commentCount }}</i>
</div>
</div>
</div>
@@ -70,26 +68,88 @@
data () {
return {
currIndex: 0
currIndex: 0,
topicList: [],
list: []
}
},
computed: {
...mapState(['user', 'token'])
...mapState(['user', 'token']),
topic () {
return this.topicList.filter((v, index) => index < 8)
}
},
onLoad() {
this.getTopicList()
},
methods: {
...mapActions(['autoLogin', 'authCheck'])
getTopicList () {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
// withoutToken: true,
params: {
current: 1,
size: 100
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
this.getList()
}
})
},
getList () {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
source: 0,
visibleRange: this.currIndex === 0 ? 1 : 0
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})]
} else {
this.list = res.data.records.map(e => {
return {
...e,
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onShareAppMessage() {
return {
title: '欢迎使用数字乡村治理服务一体化平台~',
path: `/pages/AppCircle/AppCircle`
}
onReachBottom () {
this.getList()
}
}
</script>
@@ -118,7 +178,6 @@
.nav {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
margin: 0 32px 24px;
padding-top: 30px;
@@ -227,9 +286,9 @@
}
.item-content {
margin: 16px;
margin: 16px 0;
line-height: 1.3;
// text-align: justify;
text-align: justify;
span {
font-size: 28px;

View File

@@ -137,12 +137,63 @@
...mapState(['user', 'token']),
},
onLoad () {
this.getTopicList()
},
methods: {
getTopicList () {
this.$instance.post(`/api/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
current: 1,
size: 1000
}
}).then(res => {
if (res.code === 0) {
},
onShow() {
}
})
},
getList () {
if (this.isMore) return
this.$loading()
this.$instance.post(`/api/appactivityinfo/list`, null, {
withoutToken: true,
params: {
current: this.current,
size: 10
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onReachBottom () {
this.getList()
}
}
</script>