|
@@ -13,11 +13,13 @@
|
|
|
ref
|
|
|
} from 'vue'
|
|
|
import {
|
|
|
- onLoad
|
|
|
+ onLoad, onShareAppMessage, onShareTimeline
|
|
|
} from '@dcloudio/uni-app'
|
|
|
import {
|
|
|
getSwiperDetail
|
|
|
} from '@/api/home.js'
|
|
|
+ const currentId = ref(null);
|
|
|
+ const currentTitle = ref(null);
|
|
|
const announcement = ref({
|
|
|
title: "",
|
|
|
content: "", // 假设这是后端返回的内容
|
|
@@ -37,6 +39,9 @@
|
|
|
getSwiperDetail(id).then(res => {
|
|
|
if (res?.data) {
|
|
|
announcement.value = res.data
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: announcement.value.title
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -44,8 +49,24 @@
|
|
|
const {
|
|
|
id
|
|
|
} = option
|
|
|
+ currentId.value = id
|
|
|
init(id)
|
|
|
})
|
|
|
+
|
|
|
+ onShareAppMessage(async (res) => {
|
|
|
+ return {
|
|
|
+ title: announcement.value.title,
|
|
|
+ path: `/pages/swiperDetail/swiperDetail?id=${currentId.value}`
|
|
|
+ };
|
|
|
+ })
|
|
|
+
|
|
|
+ onShareTimeline(async () => {
|
|
|
+ // console.log(imgurl.value)&title=${currentTitle.value}
|
|
|
+ return {
|
|
|
+ title: announcement.value.title,
|
|
|
+ query: `id=${currentId.value}`
|
|
|
+ };
|
|
|
+ })
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -94,7 +115,7 @@
|
|
|
.date {
|
|
|
font-size: 14px;
|
|
|
color: #999;
|
|
|
- text-align: right;
|
|
|
+ text-align: center;
|
|
|
/* 时间右对齐 */
|
|
|
margin-top: 10px;
|
|
|
/* 与内容分离 */
|