添加以下4个页面的内容分享

1. 首页
2. 包间列表
3. 茶艺师列表
4. 茶艺师详情
This commit is contained in:
wangxiaowei
2026-01-08 02:30:57 +08:00
parent 40c2b0dd6c
commit 2b58bac9ac
7 changed files with 103 additions and 27 deletions

View File

@ -27,11 +27,6 @@
// uni.setStorageSync(LOCATION_CITY_KEY, LOCATION_DEFAULT_CITY) // uni.setStorageSync(LOCATION_CITY_KEY, LOCATION_DEFAULT_CITY)
}) })
onShow((options) => { onShow((options) => {
// uni.showModal({
// title: '提示',
// content: `当前请求域名是:${import.meta.env.VITE_SERVER_BASEURL}`,
// showCancel: false
// })
if (options?.path === 'bundle/order/tea-room/order-detail') { if (options?.path === 'bundle/order/tea-room/order-detail') {
uni.setStorageSync('transferOrderParams', { uni.setStorageSync('transferOrderParams', {
orderId: options?.query?.orderId || '', orderId: options?.query?.orderId || '',

View File

@ -99,9 +99,7 @@ export interface IRoomDetailParams {
} }
export function getTeaRoomDetail(data: IRoomDetailParams) { export function getTeaRoomDetail(data: IRoomDetailParams) {
return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails', return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails', data)
data
)
} }
/** /**
@ -142,12 +140,7 @@ export interface IStoreTeaRoomListParams {
} }
export function getStoreTeaRoomList(data: IStoreTeaRoomListParams) { export function getStoreTeaRoomList(data: IStoreTeaRoomListParams) {
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreRoomLists', return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreRoomLists', data)
data,
{
meta: { ignoreAuth: true }
}
)
} }
/** /**

View File

@ -187,6 +187,7 @@
const tagColors = ['#40AE36', '#F55726'] const tagColors = ['#40AE36', '#F55726']
onLoad((args) => { onLoad((args) => {
console.log("🚀 ~ args:", args)
if (args.id) { if (args.id) {
teaRoomId.value = Number(args.id) teaRoomId.value = Number(args.id)
storeType.value = Number(args.type) || StoreType.Direct storeType.value = Number(args.type) || StoreType.Direct
@ -198,6 +199,14 @@
Room.handleInit() Room.handleInit()
} }
// 如果是从分享进入的未登录的情况下
uni.$on('refreshShareTeaRoomLists', (params) => {
uni.$off('refreshShareTeaRoomLists')
Room.handleInit()
list.value = []
getMescroll().resetUpScroll()
})
uni.$on('refreshTeaRoomDetail', () => { uni.$on('refreshTeaRoomDetail', () => {
list.value = [] list.value = []
getMescroll().resetUpScroll() getMescroll().resetUpScroll()
@ -205,10 +214,18 @@
}) })
onUnload(() => { onUnload(() => {
console.log("🚀 ~ 卸载refreshTeaRoomDetail事件:") uni.$off('refreshShareTeaRoomLists')
uni.$off('refreshTeaRoomDetail') uni.$off('refreshTeaRoomDetail')
}) })
// 茶室分享(仅页面右上角分享,无需按钮分享)
onShareAppMessage(() => {
return {
title: teaRoom.value.name || '茶室预约',
path: `/bundle/tea-room/room?id=${teaRoomId.value}&type=${storeType.value}`,
}
})
const Room = { const Room = {
sheetMenuType: '', // 记录菜单类型 sheetMenuType: '', // 记录菜单类型

View File

@ -68,7 +68,15 @@
</wd-popup> </wd-popup>
<view> <view>
<navbar :title="isReserve ? '预约茶艺师' : '茶艺师详情'" fixed :left-arrow="false"> <navbar fixed layoutLeft hideLeftIcon>
<template #left>
<view class="h-48rpx flex items-center" @click="Detail.handleBack">
<view class="mt-4rpx">
<wd-icon name="thin-arrow-left" size="30rpx" color="#121212" ></wd-icon>
</view>
<view class="text-[#303133] text-36rpx ml-24rpx leading-48rpx">{{isReserve ? '预约茶艺师' : '茶艺师详情'}}</view>
</view>
</template>
<template #right> <template #right>
<view class="flex items-center ml-114rpx"> <view class="flex items-center ml-114rpx">
<!-- <view class="mr-16rpx flex items-center" @click="Detail.handleCollect"> <!-- <view class="mr-16rpx flex items-center" @click="Detail.handleCollect">
@ -403,20 +411,21 @@
const tipMoney = ref<string>('') // 其他打赏金额 const tipMoney = ref<string>('') // 其他打赏金额
onLoad(async (args) => { onLoad(async (args) => {
console.log("🚀 ~ args:", args)
const userStore = useUserStore() const userStore = useUserStore()
userInfo.value = userStore.userInfo userInfo.value = userStore.userInfo
id.value = args.id || 0 id.value = args.id || 0
Detail.handleGetTeaSpecialistDetail()
// 获取茶艺师详情 // 如果是从分享进入的未登录的情况下
const res = await getTeaSpecialistDetail({ uni.$on('refreshTeaSpecialistDetails', (params) => {
team_user_id: args.id, // 处理未登录的情况下
latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE, id.value = id.value
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE, uni.$off('refreshTeaSpecialistDetails')
Detail.handleGetTeaSpecialistDetail()
}) })
info.value = res.teamaster
console.log("🚀 ~ res:", res)
// rate.value = info.value.star // rate.value = info.value.star
// tabList.value = info.value.textarea // tabList.value = info.value.textarea
// console.log("🚀 ~ tabList:", res) // console.log("🚀 ~ tabList:", res)
@ -440,7 +449,32 @@
// }) // })
}) })
onUnload(() => {
uni.$off('refreshTeaSpecialistDetails')
})
// 茶艺师分享
onShareAppMessage(() => {
return {
title: info.value.name || '预约茶艺师',
path: `/bundle_b/pages/tea-specialist/detail?id=${id.value}`,
}
})
const Detail = { const Detail = {
/**
* 获取茶艺师详情
*/
handleGetTeaSpecialistDetail: async () => {
const res = await getTeaSpecialistDetail({
team_user_id: id.value,
latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
})
info.value = res.teamaster
},
/** /**
* TODO 处理收藏-暂时不要 * TODO 处理收藏-暂时不要
*/ */
@ -523,6 +557,15 @@
// id.value - 茶艺师的ID // id.value - 茶艺师的ID
router.navigateTo(`/bundle_b/pages/tea-specialist/reserve?id=${id.value}`) router.navigateTo(`/bundle_b/pages/tea-specialist/reserve?id=${id.value}`)
}, },
/**
* 分享的页面没有栈所以需要switch方法跳转
*/
handleBack: () => {
router.navigateBack().catch(err => {
router.switchTab('/pages/index/index')
})
}
} }
</script> </script>

View File

@ -12,8 +12,8 @@
<view class="home-bg w-[100%] sticky top-0 left-0 z-100"> <view class="home-bg w-[100%] sticky top-0 left-0 z-100">
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;"> <wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
<template #left> <template #left>
<view class="flex items-center"> <view class="flex items-center" @click="List.handleBack">
<view class="mt-4rpx" @click="router.navigateBack()"> <view class="mt-4rpx">
<wd-icon name="thin-arrow-left" size="30rpx" color="#121212"></wd-icon> <wd-icon name="thin-arrow-left" size="30rpx" color="#121212"></wd-icon>
</view> </view>
<view class="text-[#303133] text-36rpx ml-24rpx leading-48rpx">预约茶艺师</view> <view class="text-[#303133] text-36rpx ml-24rpx leading-48rpx">预约茶艺师</view>
@ -196,6 +196,13 @@
}) })
// 茶室分享(仅页面右上角分享,无需按钮分享)
onShareAppMessage(() => {
return {
title: '茶艺师列表',
path: `/bundle_b/pages/tea-specialist/list`,
}
})
const List = { const List = {
/** /**
@ -230,7 +237,6 @@
router.navigateTo(`/bundle_b/pages/tea-specialist/detail?id=${id}`) router.navigateTo(`/bundle_b/pages/tea-specialist/detail?id=${id}`)
}, },
/** /**
* 获取茶艺师等级 * 获取茶艺师等级
* @param value * @param value
@ -255,6 +261,15 @@
list.value = [] list.value = []
getMescroll().resetUpScroll() getMescroll().resetUpScroll()
}, },
/**
* 分享的页面没有栈所以需要switch方法跳转
*/
handleBack: () => {
router.navigateBack().catch(err => {
router.switchTab('/pages/index/index')
})
}
} }
</script> </script>

View File

@ -229,6 +229,13 @@
Index.handleResetSearch() Index.handleResetSearch()
}) })
// 首页分享
onShareAppMessage(async (e) => {
return {
title: '首页',
path: `/pages/index/index`,
}
})
const Index = { const Index = {
/** /**

View File

@ -92,6 +92,7 @@
const userStore = useUserStore() const userStore = useUserStore()
const res = await userStore.wxLogin() const res = await userStore.wxLogin()
console.log("🚀 ~ res:", res) console.log("🚀 ~ res:", res)
console.log("🚀 ~ token:", uni.getStorageSync('token'))
uni.hideLoading() uni.hideLoading()
if (!res.mobile) { if (!res.mobile) {
showBindMobilePopup.value = true showBindMobilePopup.value = true
@ -158,9 +159,14 @@
handleToLogin: () => { handleToLogin: () => {
const decoded = decodeURIComponent(redirectUrl.value) const decoded = decodeURIComponent(redirectUrl.value)
console.log("🚀 ~ decoded:", decoded) console.log("🚀 ~ decoded:", decoded)
console.log("🚀 ~ decoded:", uni.getStorageSync('refreshTeaSpecialistDetailsParams'))
if (decoded == '/bundle/order/tea-room/order-detail') { if (decoded == '/bundle/order/tea-room/order-detail') {
const transferOrderParams = uni.getStorageSync('transferOrderParams') const transferOrderParams = uni.getStorageSync('transferOrderParams')
uni.$emit('transferOrder', transferOrderParams) uni.$emit('transferOrder', transferOrderParams)
} else if (decoded == '/bundle_b/pages/tea-specialist/detail') {
uni.$emit('refreshTeaSpecialistDetails')
} else if (decoded == '/bundle/tea-room/room') {
uni.$emit('refreshShareTeaRoomLists')
} }
toast.info('登录成功') toast.info('登录成功')