Fix:旅居分享问题

This commit is contained in:
linxi
2025-12-10 18:23:12 +08:00
parent eaa36dcf44
commit 1f4ea5c0c8
6 changed files with 67 additions and 8 deletions
+7
View File
@@ -260,3 +260,10 @@ export function getJiaLouNewsList(params) {
export function getShareHousekeeper(id) { export function getShareHousekeeper(id) {
return request.get('/travel/steward/poster/' + id, {login: true}) return request.get('/travel/steward/poster/' + id, {login: true})
} }
/**
* 管家详情
*/
export function getJiaLouStewardDetail(id) {
return request.get('/travel/steward/' + id, {}, {login: true})
}
+2
View File
@@ -839,6 +839,7 @@ export default {
onLoad(options) { onLoad(options) {
const id = options.id || '' const id = options.id || ''
this.id = id this.id = id
if (id) { if (id) {
this.partnerId = options.partnerId || null this.partnerId = options.partnerId || null
} else { } else {
@@ -847,6 +848,7 @@ export default {
const query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene) const query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene)
this.partnerId = getUrlParam(query, 'partnerId') || null this.partnerId = getUrlParam(query, 'partnerId') || null
this.id = getUrlParam(query, 'id') || null this.id = getUrlParam(query, 'id') || null
} }
} }
if (this.partnerId) cookie.set('spread', this.partnerId) if (this.partnerId) cookie.set('spread', this.partnerId)
+25 -3
View File
@@ -75,8 +75,9 @@
</template> </template>
<script> <script>
import { getShareHousekeeper } from '@/api/qianxian.js' import { getShareHousekeeper, getJiaLouStewardDetail } from '@/api/qianxian.js'
import sharePopup from '@/components/sharePopup.vue' import sharePopup from '@/components/sharePopup.vue'
import {getUrlParam} from '@/utils/common.js'
export default { export default {
name: 'HousekeeperDetail', name: 'HousekeeperDetail',
components: { components: {
@@ -90,12 +91,33 @@ export default {
}, },
onLoad(options) { onLoad(options) {
this.record = JSON.parse(decodeURIComponent(options.obj)) // this.record = JSON.parse(decodeURIComponent(options.obj))
console.log(this.record); // console.log(this.record);
const id = options.id || ''
this.id = id
if (id) {
// this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) {
const query = options ? decodeURIComponent(options.scene + '') : decodeURIComponent(obj.query.scene)
this.id = getUrlParam(query, 'id') || null
}
}
this.getJiaLouStewardDetail()
}, },
methods: { methods: {
getJiaLouStewardDetail() {
uni.showLoading()
getJiaLouStewardDetail(this.id).then(res => {
uni.hideLoading()
if(res.status === 200) {
this.record = res.data || {}
}
})
},
shareHousekeeper() { shareHousekeeper() {
uni.showLoading() uni.showLoading()
getShareHousekeeper(this.record.id).then(res => { getShareHousekeeper(this.record.id).then(res => {
+15 -2
View File
@@ -342,6 +342,7 @@ import {
postJiaLouZan, postJiaLouZan,
postJiaLouShare postJiaLouShare
} from '@/api/qianxian' } from '@/api/qianxian'
import {getUrlParam} from '@/utils/common.js'
import imgBox from '@/components/imageTypeSet/imagebox.vue' import imgBox from '@/components/imageTypeSet/imagebox.vue'
export default { export default {
components: { components: {
@@ -375,8 +376,20 @@ export default {
onPageScroll(e) { onPageScroll(e) {
this.scrollData = e this.scrollData = e
}, },
onLoad(opts) { onLoad(options) {
this.id = opts.id const id = options.id || ''
this.id = id
if (id) {
// this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) {
const query = options ? decodeURIComponent(options.scene + '') : decodeURIComponent(obj.query.scene)
this.id = getUrlParam(query, 'id') || null
}
}
this.getFarmerData() this.getFarmerData()
}, },
methods: { methods: {
+16 -3
View File
@@ -355,6 +355,7 @@ import {
getJiaLouStewardList, getJiaLouStewardList,
getJiaLouNewsList getJiaLouNewsList
} from '@/api/qianxian' } from '@/api/qianxian'
import {getUrlParam} from '@/utils/common.js'
import imgBox from '@/components/imageTypeSet/imagebox.vue' import imgBox from '@/components/imageTypeSet/imagebox.vue'
export default { export default {
components: { components: {
@@ -397,8 +398,20 @@ export default {
onPageScroll(e) { onPageScroll(e) {
this.scrollData = e this.scrollData = e
}, },
onLoad(opts) { onLoad(options) {
this.id = opts.id const id = options.id || ''
this.id = id
if (id) {
// this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) {
const query = options ? decodeURIComponent(options.scene + '') : decodeURIComponent(obj.query.scene)
this.id = getUrlParam(query, 'id') || null
}
}
this.getFarmerData() this.getFarmerData()
}, },
watch: { watch: {
@@ -432,7 +445,7 @@ export default {
// 跳转管家详情 // 跳转管家详情
goHousekeeperDetail(item) { goHousekeeperDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/pkg_product/views/housekeeperDetail?obj=' +JSON.stringify(item) url: '/pkg_product/views/housekeeperDetail?id=' + item.id
}) })
}, },
getJiaLouStewardList() { getJiaLouStewardList() {
+2
View File
@@ -73,8 +73,10 @@ module.exports = {
}, },
getUrlParam(url, name) { getUrlParam(url, name) {
url = decodeURIComponent(url)
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = url.match(reg); var r = url.match(reg);
console.log(r);
if (r != null) return (r[2]); if (r != null) return (r[2]);
return null; return null;
} }