添加以下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)
})
onShow((options) => {
// uni.showModal({
// title: '提示',
// content: `当前请求域名是:${import.meta.env.VITE_SERVER_BASEURL}`,
// showCancel: false
// })
if (options?.path === 'bundle/order/tea-room/order-detail') {
uni.setStorageSync('transferOrderParams', {
orderId: options?.query?.orderId || '',

View File

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

View File

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

View File

@ -68,7 +68,15 @@
</wd-popup>
<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>
<view class="flex items-center ml-114rpx">
<!-- <view class="mr-16rpx flex items-center" @click="Detail.handleCollect">
@ -403,20 +411,21 @@
const tipMoney = ref<string>('') // 其他打赏金额
onLoad(async (args) => {
console.log("🚀 ~ args:", args)
const userStore = useUserStore()
userInfo.value = userStore.userInfo
id.value = args.id || 0
Detail.handleGetTeaSpecialistDetail()
// 获取茶艺师详情
const res = await getTeaSpecialistDetail({
team_user_id: args.id,
latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
// 如果是从分享进入的未登录的情况下
uni.$on('refreshTeaSpecialistDetails', (params) => {
// 处理未登录的情况下
id.value = id.value
uni.$off('refreshTeaSpecialistDetails')
Detail.handleGetTeaSpecialistDetail()
})
info.value = res.teamaster
console.log("🚀 ~ res:", res)
// rate.value = info.value.star
// tabList.value = info.value.textarea
// 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 = {
/**
* 获取茶艺师详情
*/
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 处理收藏-暂时不要
*/
@ -523,6 +557,15 @@
// id.value - 茶艺师的ID
router.navigateTo(`/bundle_b/pages/tea-specialist/reserve?id=${id.value}`)
},
/**
* 分享的页面没有栈所以需要switch方法跳转
*/
handleBack: () => {
router.navigateBack().catch(err => {
router.switchTab('/pages/index/index')
})
}
}
</script>

View File

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

View File

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

View File

@ -92,6 +92,7 @@
const userStore = useUserStore()
const res = await userStore.wxLogin()
console.log("🚀 ~ res:", res)
console.log("🚀 ~ token:", uni.getStorageSync('token'))
uni.hideLoading()
if (!res.mobile) {
showBindMobilePopup.value = true
@ -158,9 +159,14 @@
handleToLogin: () => {
const decoded = decodeURIComponent(redirectUrl.value)
console.log("🚀 ~ decoded:", decoded)
console.log("🚀 ~ decoded:", uni.getStorageSync('refreshTeaSpecialistDetailsParams'))
if (decoded == '/bundle/order/tea-room/order-detail') {
const transferOrderParams = uni.getStorageSync('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('登录成功')