修复朋友圈分享

This commit is contained in:
aixianling
2024-03-06 15:49:42 +08:00
parent efb18515f5
commit ba4904a9cb
3 changed files with 1147 additions and 1184 deletions

View File

@@ -130,6 +130,7 @@
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: 'Detail',
appName: '详情',
@@ -161,16 +162,11 @@
this.themeId = query.themeId
this.name = query.name || ''
this.$loading()
if (!this.token) {
this.autoLogin().then(() => {
this.getInfo(query.id)
this.$loading();
(this.token ? Promise.resolve() : this.autoLogin()).finally(() => Promise.all([
this.getInfo(query.id),
this.getCommontList(query.id)
})
} else {
this.getInfo(query.id)
this.getCommontList(query.id)
}
])).finally(() => this.$hideLoading())
},
methods: {
...mapActions(['autoLogin']),
@@ -240,15 +236,13 @@
})
},
getInfo(id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: !this.token,
}).then(res => {
if (res.code === 0) {
if (res?.data) {
this.info = res.data
this.pageShow = true
}
uni.hideLoading()
})
},
reciate() {
@@ -303,9 +297,8 @@
},
getCommontList(id) {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: !this.token,
params: {
id,
@@ -313,25 +306,22 @@
size: 10
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (res?.data) {
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(() => {
}).finally(() => {
this.$hideLoading()
})
}
@@ -345,7 +335,6 @@
path: `/pages/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
}
},
onShareAppMessage() {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${this.id}`).then(res => {
if (res.code === 0) {
@@ -456,6 +445,7 @@
}
}
}
.footer {
display: flex;
align-items: center;
@@ -733,8 +723,10 @@
font-family: "PingFang SC";
line-height: 30px;
margin-bottom: 16px;
.label {
width: 160px;
img {
width: 30px;
height: 30px;
@@ -742,6 +734,7 @@
vertical-align: bottom;
}
}
.value {
width: calc(100% - 160px);
color: #333;

View File

@@ -130,10 +130,10 @@
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: 'Detail',
appName: '详情',
data() {
return {
id: '',
@@ -153,32 +153,23 @@
replyName: ''
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad(query) {
this.isFrom = query.isFrom
this.id = query.id
this.themeId = query.themeId
this.name = query.name || ''
this.$loading()
if (!this.token) {
this.autoLogin().then(() => {
this.getInfo(query.id)
this.$loading();
(this.token ? Promise.resolve() : this.autoLogin()).finally(() => Promise.all([
this.getInfo(query.id),
this.getCommontList(query.id)
})
} else {
this.getInfo(query.id)
this.getCommontList(query.id)
}
])).finally(() => this.$hideLoading())
},
methods: {
...mapActions(['autoLogin']),
toTask() {
if (!this.user.areaId) {
this.$dialog.confirm({
@@ -191,14 +182,12 @@
}
this.$linkTo(`/mods/AppNewFarmerBank/taskDetail?id=${this.info.integralTaskId}`)
},
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
showComment() {
if (!this.user.areaId) {
this.$dialog.confirm({
@@ -222,7 +211,6 @@
}, 500)
})
},
replay(item) {
if (!this.user.areaId) {
this.$dialog.confirm({
@@ -247,20 +235,16 @@
}, 500)
})
},
getInfo(id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: !this.token,
}).then(res => {
if (res.code === 0) {
if (res?.data) {
this.info = res.data
this.pageShow = true
return this.pageShow = true
}
uni.hideLoading()
})
},
reciate() {
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => {
@@ -272,12 +256,10 @@
uni.hideLoading()
})
},
send() {
if (!this.content) {
return this.$toast('内容不能为空')
}
this.$loading()
this.$instance.post(!this.commentId ? `/app/appneighborhoodassistance/addComment` : `/app/appneighborhoodassistance/addReply`, {
content: this.content,
@@ -285,7 +267,6 @@
type: this.commentId ? 1 : 0,
commentId: this.commentId || ''
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.isShowComment = false
this.$toast('提交成功')
@@ -296,14 +277,12 @@
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getCommontList(this.id)
})
}
})
},
toTopic(url) {
if (this.isFrom === 'topic') {
uni.navigateBack({
@@ -313,12 +292,10 @@
this.$linkTo(url)
}
},
getCommontList(id) {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: !this.token,
params: {
id,
@@ -326,8 +303,7 @@
size: 10
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (res?.data) {
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
@@ -344,23 +320,18 @@
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}).finally(() => this.$hideLoading())
}
},
onReachBottom() {
this.getCommontList()
},
onShareTimeline() {
return {
title: this.info.content,
path: `/pages/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
}
},
onShareAppMessage() {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${this.id}`).then(res => {
if (res.code === 0) {
@@ -471,6 +442,7 @@
}
}
}
.footer {
display: flex;
align-items: center;
@@ -748,8 +720,10 @@
font-family: "PingFang SC";
line-height: 30px;
margin-bottom: 16px;
.label {
width: 160px;
img {
width: 30px;
height: 30px;
@@ -757,6 +731,7 @@
vertical-align: bottom;
}
}
.value {
width: calc(100% - 160px);
color: #333;

View File

@@ -173,13 +173,11 @@ export default {
this.id = query.id
this.themeId = query.themeId
this.name = query.name || ''
this.$loading()
Promise.resolve(this.token || this.autoLogin()).then(() =>
Promise.all([
this.$loading();
(this.token ? Promise.resolve() : this.autoLogin()).finally(() => Promise.all([
this.getInfo(query.id),
this.getCommontList(query.id)
])
).finally(() => this.$hideLoading())
])).finally(() => this.$hideLoading())
},
methods: {
...mapActions(['autoLogin']),
@@ -254,18 +252,15 @@ export default {
},
getInfo(id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: !this.token,
}).then(res => {
if (res.code === 0) {
if (res?.data) {
this.info = res.data
this.pageShow = true
return this.pageShow = true
}
uni.hideLoading()
})
},
reciate() {
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => {
@@ -323,7 +318,7 @@ export default {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
return this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: !this.token,
params: {
id,
@@ -331,7 +326,7 @@ export default {
size: 10
}
}).then(res => {
if (res.code === 0) {
if (res?.data) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
@@ -347,7 +342,7 @@ export default {
} else {
this.isMore = true
}
}).catch(() => {
}).finally(() => {
this.$hideLoading()
})
}
@@ -357,12 +352,12 @@ export default {
this.getCommontList()
},
// onShareTimeline() {
// return {
// title: this.info.content,
// // path: `/mods/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
// }
// },
onShareTimeline() {
return {
title: this.info.content,
path: `/mods/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
}
},
onShareAppMessage() {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${this.id}`).then(res => {
if (res.code === 0) {