功能完善

This commit is contained in:
yanran200730
2023-03-20 11:09:30 +08:00
parent 4503abe419
commit d3df5cb76e
5 changed files with 89 additions and 52 deletions

View File

@@ -12,6 +12,7 @@ const getToken = () => {
} }
const source = axios.CancelToken.source(); const source = axios.CancelToken.source();
instance.interceptors.request.use(config => { instance.interceptors.request.use(config => {
console.log(config)
if (config.withoutToken) { if (config.withoutToken) {
return config return config
} else if (getToken()) { } else if (getToken()) {

View File

@@ -57,7 +57,7 @@
</div> </div>
<AiEmpty v-if="!list.length"></AiEmpty> <AiEmpty v-if="!list.length"></AiEmpty>
</div> </div>
<div class="add" hover-class="text-hover" @click="$linkTo('./Add')"> <div class="add" hover-class="text-hover" @click="toAdd">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-fatie.png" /> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-fatie.png" />
</div> </div>
<AiLogin ref="login"/> <AiLogin ref="login"/>
@@ -89,19 +89,25 @@
} }
}, },
onLoad() { onLoad () {
this.getTopicList() this.getTopicList()
uni.$on('updateList', () => { uni.$on('updateList', () => {
this.changeTab(this.currIndex) this.changeTab(this.currIndex)
}) })
if (this.token) { if (!this.token) {
this.autoLogin().then(() => {
this.getMyPublishCount()
})
} else {
this.getMyPublishCount() this.getMyPublishCount()
} }
}, },
methods: { methods: {
...mapActions(['autoLogin']),
getMyPublishCount () { getMyPublishCount () {
this.$instance.post(`/app/appneighborhoodassistance/list`, null, { this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: { params: {
@@ -117,6 +123,12 @@
}) })
}, },
toAdd () {
if (!this.user.AreaId) {
this.$linkTo('./Add')
}
},
getTopicList () { getTopicList () {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, { this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true, withoutToken: true,
@@ -147,8 +159,8 @@
this.$loading() this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, { this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
withoutToken: this.token ? false : true,
params: { params: {
withoutToken: this.token ? false : true,
current: this.current, current: this.current,
size: 10, size: 10,
visibleRange: this.currIndex === 0 ? 1 : 0 visibleRange: this.currIndex === 0 ? 1 : 0
@@ -283,20 +295,23 @@
.item-imgs { .item-imgs {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
image { image {
flex: 1; height: 208px;
height: 202px; width: 33.33%;
margin-right: 12px; padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) { &:nth-of-type(3n) {
margin-right: 0; padding-right: 0;
} }
} }
} }
& > p { & > p {
margin: 24px 0; margin: 12px 0;
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }

View File

@@ -13,7 +13,7 @@
<text>{{ info.content }}</text> <text>{{ info.content }}</text>
</div> </div>
<div class="item-imgs" v-if="info.files && info.files.length"> <div class="item-imgs" v-if="info.files && info.files.length">
<image mode="aspectFill" v-for="(item, index) in item.files" :key="index" :src="item.url" /> <image mode="aspectFill" v-for="(item, index) in info.files" :key="index" :src="item.url" />
</div> </div>
<p>{{ info.createTime }}</p> <p>{{ info.createTime }}</p>
<div class="item-bottom"> <div class="item-bottom">
@@ -95,6 +95,7 @@
</template> </template>
<script> <script>
import { mapActions, mapState } from 'vuex'
export default { export default {
name: 'Detail', name: 'Detail',
appName: '详情', appName: '详情',
@@ -118,6 +119,10 @@
} }
}, },
computed: {
...mapState(['user', 'token'])
},
onLoad (query) { onLoad (query) {
this.isFrom = query.isFrom this.isFrom = query.isFrom
this.id = query.id this.id = query.id
@@ -125,13 +130,24 @@
this.name = query.name || '' this.name = query.name || ''
this.$loading() this.$loading()
this.getInfo(query.id) if (!this.token) {
this.getCommontList(query.id) this.autoLogin().then(() => {
this.getInfo(query.id)
this.getCommontList(query.id)
})
} else {
this.getInfo(query.id)
this.getCommontList(query.id)
}
}, },
methods: { methods: {
...mapActions(['autoLogin']),
getInfo (id) { getInfo (id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`).then(res => { this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: this.token ? false : true,
}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.info = res.data this.info = res.data
@@ -199,8 +215,8 @@
this.$loading() this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, { this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: this.token ? false : true,
params: { params: {
withoutToken: this.token ? false : true,
id, id,
current: this.current, current: this.current,
size: 10 size: 10
@@ -516,20 +532,23 @@
.item-imgs { .item-imgs {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
image { image {
flex: 1; height: 208px;
height: 202px; width: 33.33%;
margin-right: 12px; padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) { &:nth-of-type(3n) {
margin-right: 0; padding-right: 0;
} }
} }
} }
& > p { & > p {
margin: 24px 0; margin: 12px 0;
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }

View File

@@ -522,6 +522,24 @@
} }
} }
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
.item-content { .item-content {
margin: 16px 0; margin: 16px 0;
line-height: 1.3; line-height: 1.3;
@@ -536,21 +554,6 @@
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }
.item-imgs {
display: flex;
align-items: center;
image {
flex: 1;
height: 202px;
margin-right: 12px;
&:nth-of-type(3n) {
margin-right: 0;
}
}
}
} }
} }
} }
@@ -600,20 +603,23 @@
.item-imgs { .item-imgs {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
image { image {
flex: 1; height: 208px;
height: 202px; width: 33.33%;
margin-right: 12px; padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) { &:nth-of-type(3n) {
margin-right: 0; padding-right: 0;
} }
} }
} }
& > p { & > p {
margin: 24px 0; margin: 12px 0;
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }
@@ -644,7 +650,7 @@
} }
.item-content { .item-content {
margin: 16px; margin: 16px 0;
line-height: 1.3; line-height: 1.3;
// text-align: justify; // text-align: justify;

View File

@@ -131,13 +131,6 @@
onReachBottom () { onReachBottom () {
this.getList() this.getList()
},
onShareAppMessage() {
return {
title: '欢迎使用数字乡村治理服务一体化平台~',
path: `/pages/AppCircle/AppCircle`
}
} }
} }
</script> </script>
@@ -203,20 +196,23 @@
.item-imgs { .item-imgs {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
image { image {
flex: 1; height: 208px;
height: 202px; width: 33.33%;
margin-right: 12px; padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) { &:nth-of-type(3n) {
margin-right: 0; padding-right: 0;
} }
} }
} }
& > p { & > p {
margin: 24px 0; margin: 12px 0;
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }