mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-13 06:35:41 +08:00
Merge branch 'feature/ECX-7316' into 'master'
Feature/ecx 7316 See merge request huiqi/ecshopx-vshop!84
This commit is contained in:
@@ -37,7 +37,7 @@ class DistributionPoster {
|
||||
// TODO 获取微信二维码的接口,需要换alipay https://ecshopx1.shopex123.com/api/h5app/alipaymini/qrcode.png?company_id=1&page=page/index
|
||||
// const res = await api.alipay.alipay_qrcode(`page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}`)
|
||||
const res = await Taro.request({
|
||||
url: `${host}/api/h5app/alipaymini/qrcode.png?path=${url}&appid=${appid}&company_id=${company_id}&user_id=${user_id}`, //仅为示例,并非真实的接口地址
|
||||
url: `${host}/api/h5app/alipaymini/qrcode.png?path=pages/share-land&appid=${appid}&company_id=${company_id}&user_id=${user_id}target_path=${url}`, //仅为示例,并非真实的接口地址
|
||||
header: {
|
||||
'content-type': 'application/json' // 默认值
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ class DistributionPoster {
|
||||
|
||||
// const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}`
|
||||
const url = (isOpenShop && shop_status == 1) ? `marketing/pages/distribution/shop-home` : `pages/index`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?path=${url}&appid=${appid}&company_id=${company_id}&user_id=${user_id}`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?path=pages/share-land&appid=${appid}&company_id=${company_id}&user_id=${user_id}&target_path=${url}`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = qrcode_bg_img || `${process.env.APP_IMAGE_CDN}/fenxiao_bk.png`
|
||||
|
||||
@@ -39,7 +39,7 @@ class GoodsDetailPoster {
|
||||
// TODO 获取微信二维码的接口,需要换alipay https://ecshopx1.shopex123.com/api/h5app/alipaymini/qrcode.png?company_id=1&page=page/index
|
||||
// const res = await api.alipay.alipay_qrcode(`page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}`)
|
||||
const res = await Taro.request({
|
||||
url: `${host}/api/h5app/alipaymini/qrcode.png?page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}`, //仅为示例,并非真实的接口地址
|
||||
url: `${host}/api/h5app/alipaymini/qrcode.png?page=${`pages/share-land`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}&target_path=pages/item/espier-detail`, //仅为示例,并非真实的接口地址
|
||||
header: {
|
||||
'content-type': 'application/json' // 默认值
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ class GoodsDetailPoster {
|
||||
const { itemId, imgs, price, distributorId } = this.info
|
||||
const { user_id, avatar } = this.userInfo || {}
|
||||
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}&dtid=${distributorId}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/share-land`}&appid=${appid}&company_id=${company_id}&id=${itemId}&uid=${user_id}&dtid=${distributorId}&target_path=pages/item/espier-detail`
|
||||
// TODO 获取微信二维码的接口,需要换alipay https://ecshopx1.shopex123.com/api/h5app/alipaymini/qrcode.png?company_id=1&page=page/index
|
||||
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
|
||||
@@ -39,8 +39,8 @@ class GuideCheckoutPoster {
|
||||
* smid: 78,//导购id
|
||||
* distributor_id: 103,//门店id
|
||||
*/
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/cart/espier-checkout`}&
|
||||
appid=${appid}&company_id=${company_id}&cxdid=${salesPromotionId}&smid=${salesperson_id}&distributor_id=${distributor_id}&gu=${gu}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=pages/share-land&
|
||||
appid=${appid}&company_id=${company_id}&cxdid=${salesPromotionId}&smid=${salesperson_id}&distributor_id=${distributor_id}&gu=${gu}&target_path=pages/cart/espier-checkout`
|
||||
console.log('GuideCheckoutPoster-wxappCode:', wxappCode)
|
||||
|
||||
// 太阳码
|
||||
|
||||
@@ -39,8 +39,8 @@ class GuideCheckoutPoster {
|
||||
* smid: 78,//导购id
|
||||
* distributor_id: 103,//门店id
|
||||
*/
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/cart/espier-checkout`}&
|
||||
appid=${appid}&company_id=${company_id}&cxdid=${salesPromotionId}&smid=${salesperson_id}&distributor_id=${distributor_id}&gu=${gu}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=pages/share-land&
|
||||
appid=${appid}&company_id=${company_id}&cxdid=${salesPromotionId}&smid=${salesperson_id}&distributor_id=${distributor_id}&gu=${gu}&target_path=pages/cart/espier-checkout`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
// 太阳码
|
||||
|
||||
@@ -29,7 +29,7 @@ class GuideGoodsDetailPoster {
|
||||
const { itemId, imgs, price, subtaskId } = this.info
|
||||
const { salesperson_id, avatar, company_id, work_userid, shop_code } = this.userInfo
|
||||
const gu = `${work_userid}_${shop_code}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&smid=${salesperson_id}&subtask_id=${subtaskId}&gu=${gu}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=pages/share-land&appid=${appid}&company_id=${company_id}&id=${itemId}&smid=${salesperson_id}&subtask_id=${subtaskId}&gu=${gu}&target_path=pages/item/espier-detail`
|
||||
console.log('GuideGoodsDetailPoster-wxappCode:', wxappCode)
|
||||
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
|
||||
@@ -39,7 +39,7 @@ class GuideGoodsDetailPoster {
|
||||
const { itemId, imgs, price, subtaskId } = this.info
|
||||
const { salesperson_id, avatar, company_id, work_userid, shop_code } = this.userInfo
|
||||
const gu = `${work_userid}_${shop_code}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/item/espier-detail`}&appid=${appid}&company_id=${company_id}&id=${itemId}&smid=${salesperson_id}&subtask_id=${subtaskId}&gu=${gu}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=pages/share-land&appid=${appid}&company_id=${company_id}&id=${itemId}&smid=${salesperson_id}&subtask_id=${subtaskId}&gu=${gu}&target_path=pages/item/espier-detail`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
|
||||
@@ -30,7 +30,7 @@ class GoodsDetailPoster {
|
||||
|
||||
const data = await api.purchase.getEmployeeInviteCode({ enterprise_id, activity_id })
|
||||
debugger
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=${`pages/purchase/auth`}&appid=${appid}&company_id=${company_id}&code=${data.invite_code}&eid=${enterprise_id}&aid=${activity_id}`
|
||||
const wxappCode = `${host}/wechatAuth/wxapp/qrcode.png?page=pages/share-land&appid=${appid}&company_id=${company_id}&code=${data.invite_code}&eid=${enterprise_id}&aid=${activity_id}&target_path=pages/purchase/auth`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = sharePic
|
||||
|
||||
@@ -28,7 +28,7 @@ class StoreCode {
|
||||
const { appid, company_id } = getExtConfigData()
|
||||
const path = `subpages/trade/detail`
|
||||
// const path = `subpages/member/index`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?page=${path}&appid=${appid}&company_id=${company_id}&order_id=${orderId}`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?page=pages/share-land&appid=${appid}&company_id=${company_id}&order_id=${orderId}&target_path=${path}`
|
||||
|
||||
const pic = `${process.env.APP_IMAGE_CDN}/bg_fxhb.png`
|
||||
// 背景图片
|
||||
|
||||
@@ -26,7 +26,7 @@ class StoreCode {
|
||||
async drawPoster() {
|
||||
const { appid, company_id } = getExtConfigData()
|
||||
const path = `subpages/store/index`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?page=${path}&appid=${appid}&company_id=${company_id}&uid=${this.info.user_id}&dtid=${this.info.distributor_id}&qr=Y`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?page=pages/share-land&appid=${appid}&company_id=${company_id}&uid=${this.info.user_id}&dtid=${this.info.distributor_id}&qr=Y&target_path=${path}`
|
||||
|
||||
const pic = `${process.env.APP_IMAGE_CDN}/bg_fxhb.png`
|
||||
console.log('goods pic:', pic)
|
||||
|
||||
@@ -15,7 +15,7 @@ import S from '@/spx'
|
||||
import { View } from '@tarojs/components'
|
||||
import { SpPage, SpSearch, SpSkuSelect, SpTabbar, SpLogin } from '@/components'
|
||||
import { WgtsContext } from '@/pages/home/wgts/wgts-context'
|
||||
import { getDistributorId, log, entryLaunch, pickBy, showToast, VERSION_STANDARD } from '@/utils'
|
||||
import { getDistributorId, log, entryLaunch, pickBy, showToast, VERSION_STANDARD, buildSharePath } from '@/utils'
|
||||
import { platformTemplateName, transformPlatformUrl } from '@/utils/platform'
|
||||
import { useLogin, useNavigation, useLocation, useModal } from '@/hooks'
|
||||
import { SG_ROUTER_PARAMS } from '@/consts/localstorage'
|
||||
@@ -107,8 +107,11 @@ function CustomPage(props) {
|
||||
const getAppShareInfo = async () => {
|
||||
const { id } = await entryLaunch.getRouteParams($instance.router.params)
|
||||
const { userId } = Taro.getStorageSync('userinfo')
|
||||
const query = userId ? `?uid=${userId}&id=${id}` : `?id=${id}`
|
||||
let path = `/pages/custom/custom-page${query}`
|
||||
const params = { id }
|
||||
if (userId) {
|
||||
params.uid = userId
|
||||
}
|
||||
const path = buildSharePath('/pages/custom/custom-page', params)
|
||||
|
||||
log.debug(`getAppShareInfo: ${path}`)
|
||||
return {
|
||||
|
||||
@@ -35,7 +35,8 @@ import {
|
||||
pickBy,
|
||||
log,
|
||||
showToast,
|
||||
entryLaunch
|
||||
entryLaunch,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
import { updateShopInfo } from '@/store/slices/shop'
|
||||
import {
|
||||
@@ -145,7 +146,7 @@ function Home() {
|
||||
if (VERSION_STANDARD) {
|
||||
params = Object.assign(params, { dtid: getCurrentShopId() })
|
||||
}
|
||||
let path = `/pages/index${isEmpty(params) ? '' : '?' + resolveStringifyParams(params)}`
|
||||
const path = buildSharePath('/pages/index', params)
|
||||
|
||||
console.log('useShareAppMessage path:', path, params)
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ import {
|
||||
isAPP,
|
||||
showToast,
|
||||
getDistributorId,
|
||||
VERSION_STANDARD
|
||||
VERSION_STANDARD,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
import { fetchUserFavs } from '@/store/slices/user'
|
||||
|
||||
@@ -239,7 +240,7 @@ function EspierDetail(props) {
|
||||
if (userInfo) {
|
||||
query['uid'] = userInfo.user_id
|
||||
}
|
||||
const path = `/pages/item/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/pages/item/espier-detail', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: itemName,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { AtButton } from 'taro-ui'
|
||||
import { SpPage } from '@/components'
|
||||
import api from '@/api'
|
||||
import doc from '@/doc'
|
||||
import { pickBy, log } from '@/utils'
|
||||
import { pickBy, log, buildSharePath } from '@/utils'
|
||||
import { withPageWrapper } from '@/hocs'
|
||||
import { WgtFilm, WgtSlider, WgtWriting, WgtGoods, WgtHeading } from '../home/wgts'
|
||||
import './detail.scss'
|
||||
@@ -47,7 +47,7 @@ function GuideRecommendDetail(props) {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id
|
||||
}
|
||||
const sharePath = `/pages/recommend/detail?${qs.stringify(query)}`
|
||||
const sharePath = buildSharePath('/pages/recommend/detail', query)
|
||||
log.debug(`【/pages/recommend/detail】onShareAppMessage path: ${sharePath}`)
|
||||
return {
|
||||
title: title,
|
||||
|
||||
@@ -7,9 +7,14 @@ import qs from 'qs'
|
||||
import { entryLaunch, showToast } from '@/utils'
|
||||
|
||||
/**
|
||||
* path 页面路径(必穿参数)(参数格式 path=/pages/indes)
|
||||
* 其余参数会自动携带到path后面,不用手动处理
|
||||
* scene=uid%3D884%26id%3D121%26qr%3DY%26path%3D%2Fsubpages%2Fprescription%2Fprescription-information(页面参数,可供验证)
|
||||
* 统一分享落地页
|
||||
* 参数说明:
|
||||
* - target_path: 目标页面路径 (必传, 如: target_path=pages/index)
|
||||
* - 其余参数会自动携带到目标页面 target_path=pages/item/espier-detail&id=123
|
||||
*
|
||||
* 兼容旧的场景:
|
||||
* - from_scene: 导购欢迎语场景
|
||||
* - t: 特殊场景标识(如处方药)
|
||||
* @returns
|
||||
*/
|
||||
function ShareIand() {
|
||||
@@ -23,47 +28,94 @@ function ShareIand() {
|
||||
const resloveRouterParams = async () => {
|
||||
const routeParams = await entryLaunch.getRouteParams(router)
|
||||
Taro.setStorageSync(SG_ROUTER_PARAMS, routeParams)
|
||||
if (/^guide_welcome/.test(routeParams?.from_scene)) {
|
||||
// 导购欢迎语
|
||||
if (routeParams.from_scene == 'guide_welcome_home') {
|
||||
// 导购欢迎语--商城首页
|
||||
Taro.redirectTo({ url: '/pages/index' })
|
||||
} else if (routeParams.from_scene == 'guide_welcome_category') {
|
||||
// 导购欢迎语--商城分类页
|
||||
Taro.redirectTo({ url: '/pages/category/index' })
|
||||
} else if (routeParams.from_scene == 'guide_welcome_couponlist') {
|
||||
// 导购欢迎语--商城优惠券中心
|
||||
Taro.redirectTo({ url: '/subpages/marketing/coupon-center' })
|
||||
} else if (routeParams.from_scene == 'guide_welcome_recommend') {
|
||||
// 导购欢迎语--商城种草
|
||||
Taro.redirectTo({ url: '/pages/recommend/list' })
|
||||
} else if (routeParams.from_scene == 'guide_welcome_member') {
|
||||
// 导购欢迎语--商城会员中心
|
||||
Taro.redirectTo({ url: '/subpages/member/index' })
|
||||
} else if (routeParams.from_scene == 'guide_welcome_itemlist') {
|
||||
// 导购欢迎语--商城商品列表
|
||||
Taro.redirectTo({ url: '/pages/item/list' })
|
||||
} else {
|
||||
showToast('未匹配到参数')
|
||||
}
|
||||
|
||||
// 欢迎语携带用户编号
|
||||
if (routeParams?.gu || routeParams?.gu_user_id) { // 导购参数处理
|
||||
Taro.setStorageSync(SG_GUIDE_PARAMS, routeParams)
|
||||
Taro.setStorageSync(SG_GUIDE_PARAMS_UPDATETIME, dayjs().unix())
|
||||
|
||||
if (S.getAuthToken()) {
|
||||
entryLaunch.postGuideUV()
|
||||
entryLaunch.postGuideTask()
|
||||
}
|
||||
} else {
|
||||
// 分享的太阳码场景
|
||||
const _tempParams = {}
|
||||
if (routeParams?.t == 1) { // 处方药
|
||||
_tempParams.order_id = routeParams.oi
|
||||
_tempParams.prescription_order_random = routeParams.r
|
||||
Taro.redirectTo({ url: `/subpages/prescription/prescription-information?${qs.stringify(_tempParams)}` })
|
||||
entryLaunch.postGuideUV() // 导购uv上报
|
||||
entryLaunch.postGuideTask() // 导购任务上报
|
||||
}
|
||||
}
|
||||
debugger
|
||||
|
||||
// 处理导购欢迎语场景
|
||||
if (/^guide_welcome/.test(routeParams?.from_scene)) {
|
||||
handleGuideWelcome(routeParams)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理处方药场景
|
||||
if (routeParams?.t == 1) {
|
||||
handlePrescription(routeParams)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理通用分享场景
|
||||
if (routeParams?.target_path) {
|
||||
debugger
|
||||
handleGeneralShare(routeParams)
|
||||
return
|
||||
}
|
||||
|
||||
// 默认跳转到首页
|
||||
Taro.redirectTo({ url: '/pages/index' })
|
||||
}
|
||||
|
||||
// 处理导购欢迎语
|
||||
const handleGuideWelcome = (routeParams) => {
|
||||
const welcomeRoutes = {
|
||||
'guide_welcome_home': '/pages/index', // 导购欢迎语--商城首页
|
||||
'guide_welcome_category': '/pages/category/index', // 导购欢迎语--商城分类页
|
||||
'guide_welcome_couponlist': '/subpages/marketing/coupon-center', // 导购欢迎语--商城优惠券中心
|
||||
'guide_welcome_recommend': '/pages/recommend/list', // 导购欢迎语--商城种草
|
||||
'guide_welcome_member': '/subpages/member/index', // 导购欢迎语--商城会员中心
|
||||
'guide_welcome_itemlist': '/pages/item/list' // 导购欢迎语--商城商品列表
|
||||
}
|
||||
|
||||
const targetUrl = welcomeRoutes[routeParams.from_scene]
|
||||
if (targetUrl) {
|
||||
Taro.redirectTo({ url: targetUrl })
|
||||
} else {
|
||||
showToast('未匹配到参数')
|
||||
}
|
||||
}
|
||||
|
||||
// 处理处方药场景
|
||||
const handlePrescription = (routeParams) => {
|
||||
const params = {
|
||||
order_id: routeParams.oi,
|
||||
prescription_order_random: routeParams.r
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: `/subpages/prescription/prescription-information?${qs.stringify(params)}`
|
||||
})
|
||||
}
|
||||
|
||||
// 处理通用分享场景
|
||||
// 1、海报分享 pages/share-land?scene=share_id%3D68f2037ca18f8 通过shareid获取参数
|
||||
// 2、小程序转发 pages/share-land?target_path=pages/item/espier-detail&id=123
|
||||
// 3、其他小程序跳转过来 pages/share-land?target_path=pages/item/espier-detail&id=123
|
||||
// 4、小程序卡片跳转过来 pages/share-land?target_path=pages/item/espier-detail&id=123
|
||||
const handleGeneralShare = (routeParams) => { // routeParams:pa
|
||||
const { target_path, ...otherParams } = routeParams
|
||||
|
||||
// 过滤掉内部使用的参数
|
||||
const filteredParams = { ...otherParams }
|
||||
delete filteredParams.scene
|
||||
delete filteredParams.$taroTimestamp
|
||||
|
||||
// 确保路径以 / 开头
|
||||
let normalizedPath = target_path
|
||||
if (normalizedPath && !normalizedPath.startsWith('/')) {
|
||||
normalizedPath = '/' + normalizedPath
|
||||
}
|
||||
|
||||
// 构建目标URL
|
||||
const queryString = qs.stringify(filteredParams)
|
||||
const targetUrl = queryString ? `${normalizedPath}?${queryString}` : normalizedPath
|
||||
|
||||
console.log('通用分享跳转:', targetUrl)
|
||||
Taro.redirectTo({ url: targetUrl })
|
||||
}
|
||||
|
||||
return null
|
||||
|
||||
@@ -35,7 +35,8 @@ import {
|
||||
classNames,
|
||||
navigateTo,
|
||||
VERSION_PLATFORM,
|
||||
isAPP
|
||||
isAPP,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
|
||||
import doc from '@/doc'
|
||||
@@ -183,7 +184,7 @@ function EspierDetail(props) {
|
||||
if (userInfo) {
|
||||
query['uid'] = userInfo.uid
|
||||
}
|
||||
const path = `/pages/item/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/pages/item/espier-detail', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: itemName,
|
||||
|
||||
@@ -5,7 +5,7 @@ import Taro, { useShareAppMessage, useDidShow, getCurrentInstance } from '@taroj
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { SpPage, SpImage, SpButton, SpUpload, SpCell } from '@/components'
|
||||
import { AtCountdown, AtButton, AtProgress } from 'taro-ui'
|
||||
import { calcTimer, pickBy, log, isArray } from '@/utils'
|
||||
import { calcTimer, pickBy, log, isArray, buildSharePath } from '@/utils'
|
||||
import doc from '@/doc'
|
||||
import api from '@/api'
|
||||
|
||||
@@ -52,7 +52,7 @@ function GroupLeaderDetail(props) {
|
||||
}
|
||||
|
||||
useShareAppMessage(() => {
|
||||
const path = `/subpages/community/group-memberdetail?activity_id=${detail.activityId}`
|
||||
const path = buildSharePath('/subpages/community/group-memberdetail', { activity_id: detail.activityId })
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
imageUrl: shareImageUrl,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { SpPage, SpScrollView, CouponItem } from '@/components'
|
||||
import api from '@/api'
|
||||
import doc from '@/doc'
|
||||
import qs from 'qs'
|
||||
import { pickBy, log } from '@/utils'
|
||||
import { pickBy, log, buildSharePath } from '@/utils'
|
||||
import { useQwLogin } from '@/hooks'
|
||||
import {
|
||||
BaHomeWgts,
|
||||
@@ -72,7 +72,7 @@ function GuideCouponIndex(props) {
|
||||
// subtask_id: subtaskId
|
||||
}
|
||||
|
||||
const path = `/subpages/marketing/coupon-center?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/subpages/marketing/coupon-center', query)
|
||||
log.debug(`getAppShareInfo: ${path}`)
|
||||
return {
|
||||
title: title,
|
||||
|
||||
@@ -11,7 +11,7 @@ import qs from 'qs'
|
||||
import { AtButton } from 'taro-ui'
|
||||
import { SpScreenAd, SpPage, SpSearch, SpRecommend, SpTabbar } from '@/components'
|
||||
import api from '@/api'
|
||||
import { isWeixin, log } from '@/utils'
|
||||
import { isWeixin, log, buildSharePath } from '@/utils'
|
||||
import entryLaunch from '@/utils/entryLaunch'
|
||||
import { updateStoreInfo } from '@/store/slices/guide'
|
||||
import { useImmer } from 'use-immer'
|
||||
@@ -78,7 +78,7 @@ function GuideCustomPage() {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id
|
||||
}
|
||||
const path = `/pages/custom/custom-page?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/pages/custom/custom-page', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
|
||||
return {
|
||||
|
||||
@@ -35,7 +35,8 @@ import {
|
||||
isWeb,
|
||||
pickBy,
|
||||
classNames,
|
||||
navigateTo
|
||||
navigateTo,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
|
||||
import doc from '@/doc'
|
||||
@@ -200,7 +201,7 @@ function EspierDetail(props) {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id: subtaskId
|
||||
}
|
||||
const path = `/pages/item/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/pages/item/espier-detail', query)
|
||||
console.log('gu---------------------',path)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { AtButton } from 'taro-ui'
|
||||
import { SpPage } from '@/components'
|
||||
import api from '@/api'
|
||||
import doc from '@/doc'
|
||||
import { pickBy, log } from '@/utils'
|
||||
import { pickBy, log, buildSharePath } from '@/utils'
|
||||
import { WgtFilm, WgtSlider, WgtWriting, WgtGoods, WgtHeading } from '../components/wgts'
|
||||
import './detail.scss'
|
||||
|
||||
@@ -46,7 +46,7 @@ function GuideRecommendDetail(props) {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id
|
||||
}
|
||||
const sharePath = `/pages/recommend/detail?${qs.stringify(query)}`
|
||||
const sharePath = buildSharePath('/pages/recommend/detail', query)
|
||||
log.debug(`【guide/recommend/detail】onShareAppMessage path: ${sharePath}`)
|
||||
return {
|
||||
title: title,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AtButton, AtInput, AtActionSheet, AtActionSheetItem } from 'taro-ui'
|
||||
import { SpHtml, SpFloatMenuItem, SpPage, SpImage, SpLoading, SpLogin, SpScrollView } from '@/components'
|
||||
import S from '@/spx'
|
||||
import { WgtFloorImg } from '@/pages/home/wgts'
|
||||
import { classNames, isWeb, isWeixin, showToast, pickBy, isNumber } from '@/utils'
|
||||
import { classNames, isWeb, isWeixin, showToast, pickBy, isNumber, buildSharePath } from '@/utils'
|
||||
|
||||
import api from '@/api'
|
||||
import doc from '@/doc'
|
||||
@@ -131,10 +131,11 @@ function UgcNoteDetail(props) {
|
||||
draft.info['shareNums'] = shareInfo.share_nums
|
||||
})
|
||||
}
|
||||
console.log(`useShareAppMessage:`, `/subpages/mdugc/note-detail?post_id=${post_id}`)
|
||||
const path = buildSharePath('/subpages/mdugc/note-detail', { post_id })
|
||||
console.log(`useShareAppMessage:`, path)
|
||||
return {
|
||||
title: info.title,
|
||||
path: `/subpages/mdugc/note-detail?post_id=${post_id}`,
|
||||
path,
|
||||
imageUrl: info.cover
|
||||
}
|
||||
})
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useImmer } from 'use-immer'
|
||||
import S from '@/spx'
|
||||
import qs from 'qs'
|
||||
import req from '@/api/req'
|
||||
import { buildSharePath } from '@/utils'
|
||||
|
||||
import { SpLogin, SpImage, SpTabbar, SpPage, SpCell } from '@/components'
|
||||
import api from '@/api'
|
||||
@@ -185,10 +186,11 @@ function MemberIndex(props) {
|
||||
const { logo } = await api.distribution.getDistributorInfo({
|
||||
distributor_id: 0
|
||||
})
|
||||
const path = buildSharePath('/pages/index', {})
|
||||
return {
|
||||
title: share_title,
|
||||
imageUrl: share_pic_wechatapp || logo,
|
||||
path: '/pages/index'
|
||||
path: path
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ import {
|
||||
classNames,
|
||||
navigateTo,
|
||||
VERSION_PLATFORM,
|
||||
isAPP
|
||||
isAPP,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
|
||||
import doc from '@/doc'
|
||||
@@ -167,7 +168,7 @@ function PointShopEspierDetail(props) {
|
||||
if (userInfo) {
|
||||
query['uid'] = userInfo.user_id
|
||||
}
|
||||
const path = `/subpages/pointshop/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/subpages/pointshop/espier-detail', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: itemName,
|
||||
|
||||
@@ -28,7 +28,8 @@ import {
|
||||
classNames,
|
||||
pickBy,
|
||||
showToast,
|
||||
log
|
||||
log,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
import {
|
||||
updatePurchaseShareInfo,
|
||||
@@ -168,11 +169,17 @@ function Home() {
|
||||
const activity_id = router.params?.activity_id || purchase_share_info?.activity_id
|
||||
const enterprise_id = router.params?.enterprise_id || purchase_share_info?.enterprise_id
|
||||
const data = await api.purchase.getEmployeeInviteCode({ enterprise_id, activity_id })
|
||||
log.debug(`/pages/purchase/auth?code=${data.invite_code}`)
|
||||
const params = {
|
||||
code: data.invite_code,
|
||||
enterprise_id,
|
||||
activity_id
|
||||
}
|
||||
const path = buildSharePath('/pages/purchase/auth', params)
|
||||
log.debug(path)
|
||||
resolve({
|
||||
title: activityInfo.name,
|
||||
imageUrl: activityInfo.share_pic,
|
||||
path: `/pages/purchase/auth?code=${data.invite_code}&enterprise_id=${enterprise_id}&activity_id=${activity_id}`
|
||||
path
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -31,7 +31,8 @@ import {
|
||||
entryLaunch,
|
||||
pickBy,
|
||||
log,
|
||||
showToast
|
||||
showToast,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
import { useImmer } from 'use-immer'
|
||||
import { useNavigation, useDebounce } from '@/hooks'
|
||||
@@ -269,7 +270,7 @@ function StoreIndex() {
|
||||
const query = {
|
||||
dtid
|
||||
}
|
||||
const path = `/subpages/store/index?${qs.stringify(query)}`
|
||||
const path = buildSharePath('/subpages/store/index', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: storeInfo?.name,
|
||||
|
||||
@@ -64,6 +64,8 @@ class EntryLaunch {
|
||||
..._options,
|
||||
...res
|
||||
}
|
||||
delete _options?.distributorInfo
|
||||
delete _options?.salespersonInfo
|
||||
}
|
||||
} else {
|
||||
_options = params
|
||||
|
||||
@@ -883,6 +883,21 @@ export const pxToUnitRpx = (px) => {
|
||||
return Taro.pxTransform(px * 2)
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建统一分享路径
|
||||
* @param {string} target_path - 目标页面路径
|
||||
* @param {object} params - 路径参数
|
||||
* @returns {string} 统一的分享落地页路径
|
||||
*/
|
||||
export function buildSharePath(target_path, params = {}) {
|
||||
const shareParams = {
|
||||
target_path: target_path,
|
||||
...params
|
||||
}
|
||||
const queryString = qs.stringify(shareParams)
|
||||
return `/pages/share-land${queryString ? '?' + queryString : ''}`
|
||||
}
|
||||
|
||||
export {
|
||||
classNames,
|
||||
log,
|
||||
|
||||
Reference in New Issue
Block a user