mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-13 06:35:41 +08:00
fix(custom): 辉绮-分享改造
This commit is contained in:
@@ -96,6 +96,7 @@ const SpLogin = forwardRef((props, ref) => {
|
||||
// const { uid } = entryLaunch.getLaunchParams()
|
||||
const { uid, dtid } = Taro.getStorageSync(SG_ROUTER_PARAMS)
|
||||
const { gu_user_id, gu } = Taro.getStorageSync(SG_GUIDE_PARAMS)
|
||||
const { source_id, monitor_id, latest_source_id, latest_monitor_id } = Taro.getStorageSync('sourceInfo') // 千人千码参数
|
||||
if (uid) {
|
||||
// 分销绑定
|
||||
params['uid'] = uid
|
||||
@@ -120,6 +121,19 @@ const SpLogin = forwardRef((props, ref) => {
|
||||
params['work_userid'] = work_userid
|
||||
}
|
||||
|
||||
if (source_id) {
|
||||
params['source_id'] = source_id
|
||||
}
|
||||
if (monitor_id) {
|
||||
params['monitor_id'] = monitor_id
|
||||
}
|
||||
if (latest_source_id) {
|
||||
params['latest_source_id'] = latest_source_id
|
||||
}
|
||||
if (latest_monitor_id) {
|
||||
params['latest_monitor_id'] = latest_monitor_id
|
||||
}
|
||||
|
||||
try {
|
||||
const { token, is_new } = await api.wx.newlogin(params)
|
||||
if (token) {
|
||||
|
||||
@@ -31,13 +31,12 @@ class DistributionPoster {
|
||||
const { isOpenShop, shop_status, qrcode_bg_img } = 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}`
|
||||
const url =
|
||||
isOpenShop && shop_status == 1 ? `marketing/pages/distribution/shop-home` : `pages/index`
|
||||
const type = (isOpenShop && shop_status == 1) ? `poster_shop_home` : `poster_home`
|
||||
let wxappCode
|
||||
// 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}from_scene=${type}`, //仅为示例,并非真实的接口地址
|
||||
header: {
|
||||
'content-type': 'application/json' // 默认值
|
||||
}
|
||||
|
||||
@@ -31,9 +31,8 @@ class DistributionPoster {
|
||||
// const { dtid } =
|
||||
|
||||
// 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 type = isOpenShop && shop_status == 1 ? `poster_shop_home` : `poster_home`
|
||||
const wxappCode = `${process.env.APP_BASE_URL}/promoter/qrcode.png?path=pages/share-land&appid=${appid}&company_id=${company_id}&user_id=${user_id}&from_scene=${type}`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = qrcode_bg_img || `${process.env.APP_IMAGE_CDN}/fenxiao_bk.png`
|
||||
|
||||
@@ -37,7 +37,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}&from_scene=poster_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}&from_scene=poster_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}&from_scene=poster_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}&from_scene=poster_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}&from_scene=poster_espier_detail`
|
||||
console.log('GuideGoodsDetailPoster-wxappCode:', wxappCode)
|
||||
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getExtConfigData } from '@/utils'
|
||||
import { drawText, drawImage, drawBlock } from './helper'
|
||||
|
||||
const canvasWidth = 600
|
||||
const canvasHeight = 960
|
||||
// const canvasHeight = 960
|
||||
|
||||
class GuideGoodsDetailPoster {
|
||||
constructor(props) {
|
||||
@@ -16,20 +16,30 @@ class GuideGoodsDetailPoster {
|
||||
this.toRpx = toRpx
|
||||
}
|
||||
|
||||
getCanvasSize() {
|
||||
async getCanvasSize() {
|
||||
const { imgs } = this.info
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
const { width: goodsImageWidth, height: goodsImageHeight } = await Taro.getImageInfo({ src: pic })
|
||||
this.canvasWidth = canvasWidth
|
||||
this.canvasImgHeight = parseInt(
|
||||
(canvasWidth * goodsImageHeight) / goodsImageWidth
|
||||
)
|
||||
this.canvasHeight = this.canvasImgHeight + 360
|
||||
|
||||
return {
|
||||
canvasWidth: canvasWidth,
|
||||
canvasHeight: canvasHeight
|
||||
canvasWidth: this.canvasWidth,
|
||||
canvasHeight: this.canvasHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async drawPoster() {
|
||||
const host = process.env.APP_BASE_URL.replace('/api/h5app/wxapp', '')
|
||||
const { appid } = getExtConfigData()
|
||||
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}&from_scene=poster_espier_detail`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = imgs[0].replace('http:', 'https:')
|
||||
@@ -56,8 +66,8 @@ class GuideGoodsDetailPoster {
|
||||
{
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: canvasWidth,
|
||||
height: canvasHeight,
|
||||
width: this.canvasWidth,
|
||||
height: this.canvasHeight,
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
drawOptions
|
||||
@@ -68,8 +78,8 @@ class GuideGoodsDetailPoster {
|
||||
imgPath: this.goodsImg.path,
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: canvasWidth,
|
||||
h: canvasWidth,
|
||||
w: this.canvasWidth,
|
||||
h: this.canvasImgHeight,
|
||||
sx: 0,
|
||||
sy: 0,
|
||||
sw: this.goodsImg.width,
|
||||
@@ -81,7 +91,7 @@ class GuideGoodsDetailPoster {
|
||||
drawBlock(
|
||||
{
|
||||
x: 24,
|
||||
y: 624,
|
||||
y: this.canvasImgHeight + 24,
|
||||
width: 312,
|
||||
height: 80,
|
||||
backgroundColor: '#efefef',
|
||||
@@ -94,7 +104,7 @@ class GuideGoodsDetailPoster {
|
||||
{
|
||||
imgPath: this.avatar.path,
|
||||
x: 24,
|
||||
y: 624,
|
||||
y: this.canvasImgHeight + 24,
|
||||
w: 80,
|
||||
h: 80,
|
||||
sx: 0,
|
||||
@@ -109,7 +119,7 @@ class GuideGoodsDetailPoster {
|
||||
drawText(
|
||||
{
|
||||
x: 112,
|
||||
y: 656,
|
||||
y: this.canvasImgHeight + 56,
|
||||
fontSize: 24,
|
||||
color: '#000',
|
||||
text: salesperson_name
|
||||
@@ -120,7 +130,7 @@ class GuideGoodsDetailPoster {
|
||||
drawText(
|
||||
{
|
||||
x: 112,
|
||||
y: 688,
|
||||
y: this.canvasImgHeight + 88,
|
||||
fontSize: 22,
|
||||
color: '#999',
|
||||
text: '推荐一个好物给你'
|
||||
@@ -133,7 +143,7 @@ class GuideGoodsDetailPoster {
|
||||
drawText(
|
||||
{
|
||||
x: 24,
|
||||
y: 815,
|
||||
y: this.canvasImgHeight + 215,
|
||||
color: '#222',
|
||||
text: [
|
||||
{
|
||||
@@ -159,7 +169,7 @@ class GuideGoodsDetailPoster {
|
||||
drawText(
|
||||
{
|
||||
x: 24,
|
||||
y: 887,
|
||||
y: this.canvasImgHeight + 287,
|
||||
fontSize: 24,
|
||||
width: 312,
|
||||
color: '#666',
|
||||
@@ -173,7 +183,7 @@ class GuideGoodsDetailPoster {
|
||||
{
|
||||
imgPath: this.codeImg.path,
|
||||
x: 416,
|
||||
y: 742,
|
||||
y: this.canvasImgHeight + 142,
|
||||
w: 160,
|
||||
h: 160,
|
||||
sx: 0,
|
||||
@@ -186,7 +196,7 @@ class GuideGoodsDetailPoster {
|
||||
drawText(
|
||||
{
|
||||
x: 433,
|
||||
y: 928,
|
||||
y: this.canvasImgHeight + 328,
|
||||
fontSize: 18,
|
||||
// width: this.canvasImgWidth - 60 - this.miniCodeHeight,
|
||||
color: '#999',
|
||||
|
||||
@@ -29,9 +29,8 @@ class GoodsDetailPoster {
|
||||
const { sharePic, enterprise_id, activity_id } = this.info
|
||||
|
||||
const data = await api.purchase.getEmployeeInviteCode({ enterprise_id, activity_id })
|
||||
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}`
|
||||
debugger
|
||||
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}&from_scene=poster_purchase_auth`
|
||||
console.log('wxappCode:', wxappCode)
|
||||
|
||||
const pic = sharePic
|
||||
|
||||
@@ -26,9 +26,9 @@ class StoreCode {
|
||||
async drawPoster() {
|
||||
const { orderId, detailInfo, totalInfo } = this.info
|
||||
const { appid, company_id } = getExtConfigData()
|
||||
const path = `subpages/trade/detail`
|
||||
const path = `poster_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}&from_scene=${path}`
|
||||
|
||||
const pic = `${process.env.APP_IMAGE_CDN}/bg_fxhb.png`
|
||||
// 背景图片
|
||||
|
||||
@@ -25,8 +25,8 @@ 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 path = `poster_store_index`
|
||||
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&from_scene=${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'
|
||||
@@ -110,8 +110,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('poster_custom_page', params)
|
||||
|
||||
log.debug(`getAppShareInfo: ${path}`)
|
||||
return {
|
||||
|
||||
@@ -36,7 +36,8 @@ import {
|
||||
pickBy,
|
||||
log,
|
||||
showToast,
|
||||
entryLaunch
|
||||
entryLaunch,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
import { updateShopInfo } from '@/store/slices/shop'
|
||||
import {
|
||||
@@ -146,7 +147,7 @@ function Home() {
|
||||
if (VERSION_STANDARD) {
|
||||
params = Object.assign(params, { dtid: getCurrentShopId() })
|
||||
}
|
||||
let path = `/pages/index${isEmpty(params) ? '' : '?' + resolveStringifyParams(params)}`
|
||||
const path = buildSharePath('poster_home', 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'
|
||||
|
||||
@@ -103,7 +104,8 @@ const initialState = {
|
||||
recommendList: [],
|
||||
isParameter: false,
|
||||
imgHeightList: [], // 用于存储banner高度
|
||||
navigateMantle: false
|
||||
navigateMantle: false,
|
||||
defaultImageHeight: 520 // 默认图片高度,避免空白
|
||||
}
|
||||
|
||||
function EspierDetail(props) {
|
||||
@@ -141,7 +143,8 @@ function EspierDetail(props) {
|
||||
recommendList,
|
||||
isParameter,
|
||||
imgHeightList,
|
||||
navigateMantle
|
||||
navigateMantle,
|
||||
defaultImageHeight
|
||||
} = state
|
||||
|
||||
useEffect(() => {
|
||||
@@ -237,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('poster_espier_detail', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: itemName,
|
||||
@@ -305,15 +308,24 @@ function EspierDetail(props) {
|
||||
}
|
||||
})
|
||||
}
|
||||
const banner = await getMultipleImageInfo(data.imgs)
|
||||
setState((draft) => {
|
||||
draft.info = {
|
||||
...data,
|
||||
subscribe
|
||||
}
|
||||
draft.play = data.video ? true : false // 辉绮需求
|
||||
draft.imgHeightList = banner
|
||||
draft.promotionActivity = data.promotionActivity
|
||||
// 初始化图片高度数组,使用默认高度
|
||||
draft.imgHeightList = new Array(data.imgs.length).fill(draft.defaultImageHeight)
|
||||
})
|
||||
|
||||
// 异步计算图片真实高度,不阻塞页面渲染
|
||||
getMultipleImageInfo(data.imgs).then(heights => {
|
||||
setState((draft) => {
|
||||
draft.imgHeightList = heights
|
||||
})
|
||||
}).catch(error => {
|
||||
console.log('计算图片高度失败,使用默认高度:', error)
|
||||
})
|
||||
|
||||
if (isAPP() && userInfo) {
|
||||
@@ -339,7 +351,7 @@ function EspierDetail(props) {
|
||||
}
|
||||
}
|
||||
const getMultipleImageInfo = async (imageUrls = []) => {
|
||||
let windowWidth = 375
|
||||
let windowWidth = defaultImageHeight
|
||||
try {
|
||||
const sys = Taro.getSystemInfoSync()
|
||||
if (sys && sys.windowWidth) windowWidth = sys.windowWidth
|
||||
@@ -349,9 +361,9 @@ function EspierDetail(props) {
|
||||
|
||||
const promises = imageUrls.map(async (url) => {
|
||||
try {
|
||||
const info = await Taro.getImageInfo({ src: url })
|
||||
const imgWidth = Number(info?.width) || 0
|
||||
const imgHeight = Number(info?.height) || 0
|
||||
const imageInfo = await Taro.getImageInfo({ src: url })
|
||||
const imgWidth = Number(imageInfo?.width) || 0
|
||||
const imgHeight = Number(imageInfo?.height) || 0
|
||||
if (imgWidth > 0 && imgHeight > 0) {
|
||||
return Math.round((windowWidth * imgHeight) / imgWidth)
|
||||
}
|
||||
@@ -503,7 +515,7 @@ function EspierDetail(props) {
|
||||
className='goods-swiper'
|
||||
// current={curImgIdx}
|
||||
onChange={onChangeSwiper}
|
||||
style={{ height: imgHeightList[curImgIdx] + 'px' }}
|
||||
style={{ height: (imgHeightList[curImgIdx] || defaultImageHeight) + 'px' }}
|
||||
>
|
||||
{info.imgs.map((img, idx) => (
|
||||
<SwiperItem key={`swiperitem__${idx}`}>
|
||||
@@ -853,7 +865,7 @@ function EspierDetail(props) {
|
||||
<View className='product-parameter-all'>
|
||||
{info?.itemParams?.map((item, index) => {
|
||||
return (
|
||||
<View className='product-parameter-item'>
|
||||
<View className='product-parameter-item' key={`product-parameter-item__${index}`}>
|
||||
<Text className='title'>{item.attribute_name}</Text>
|
||||
<Text className='content'>{item.attribute_value_name}</Text>
|
||||
</View>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { SpPage } from '@/components'
|
||||
import api from '@/api'
|
||||
import doc from '@/doc'
|
||||
import S from '@/spx'
|
||||
import { pickBy, log, isWeixin, showToast } from '@/utils'
|
||||
import { pickBy, log, isWeixin, showToast, buildSharePath } from '@/utils'
|
||||
import { withPageWrapper } from '@/hocs'
|
||||
import { WgtFilm, WgtSlider, WgtWriting, WgtGoods, WgtHeading } from '../home/wgts'
|
||||
import './detail.scss'
|
||||
@@ -52,7 +52,7 @@ function GuideRecommendDetail(props) {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id
|
||||
}
|
||||
const sharePath = `/pages/recommend/detail?${qs.stringify(query)}`
|
||||
const sharePath = buildSharePath('poster_recommend_detail', query)
|
||||
log.debug(`【/pages/recommend/detail】onShareAppMessage path: ${sharePath}`)
|
||||
return {
|
||||
title: title,
|
||||
|
||||
@@ -7,9 +7,13 @@ 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(页面参数,可供验证)
|
||||
* 统一分享落地页
|
||||
* 参数说明:
|
||||
* - from_scene: 目标页面类型 (必传, 如: from_scene=xxxx_xxx_xxx)
|
||||
* - 通过from_scene匹配对应的页面进行跳转
|
||||
*
|
||||
* 兼容旧的场景:
|
||||
* - t: 特殊场景标识(如处方药)
|
||||
* @returns
|
||||
*/
|
||||
function ShareIand() {
|
||||
@@ -22,50 +26,114 @@ 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?.gu || routeParams?.gu_user_id) { // 导购参数处理
|
||||
Taro.setStorageSync(SG_GUIDE_PARAMS, routeParams)
|
||||
Taro.setStorageSync(SG_GUIDE_PARAMS_UPDATETIME, dayjs().unix())
|
||||
|
||||
// 导购欢迎语
|
||||
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 (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() // 导购任务上报
|
||||
}
|
||||
}
|
||||
|
||||
if (routeParams?.t == 1) {
|
||||
handlePrescription(routeParams)
|
||||
} else if (routeParams?.target_path) { // 兼容1021版本
|
||||
handleGeneralShare(routeParams)
|
||||
} else {
|
||||
handleShareLand(routeParams)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理落地页类型
|
||||
const handleShareLand = (routeParams) => {
|
||||
const { from_scene, ...otherParams } = 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', // 导购欢迎语--商城商品列表
|
||||
|
||||
// 导购任务
|
||||
'guide_task_home': '/pages/index', // 导购任务-管理端-小程序首页
|
||||
'guide_task_gucustom': '/subpages/guide/custom/custom-page', // 导购任务-管理端-导购货架自定义页
|
||||
'guide_task_gucoupon': '/subpages/guide/coupon-home/index', // 导购任务-小程序-优惠券转发
|
||||
'guide_task_gugoods': '/subpages/guide/item/espier-detail', // 导购任务-小程序-商品转发
|
||||
'guide_task_goods': '/pages/item/espier-detail', // 导购任务-小程序-商品海报
|
||||
|
||||
// 商城小程序
|
||||
'poster_home': '/pages/index', // 小程序-海报分享&页面转发-店务小店
|
||||
'poster_shop_home': '/marketing/pages/distribution/shop-home', // 小程序-海报分享&页面转发-店务小店
|
||||
'poster_espier_detail': '/pages/item/espier-detail', // 小程序-海报分享-商品详情
|
||||
'poster_espier_checkout': '/pages/cart/espier-checkout', // 小程序-海报分享&页面转发-结算页
|
||||
'poster_purchase_auth': '/pages/purchase/auth', // 小程序-海报分享&页面转发-内购邀请
|
||||
'poster_trade_detail': '/subpages/trade/detail', // 小程序-海报分享&页面转发-交易详情
|
||||
'poster_store_index': '/subpages/store/index', // 小程序-海报分享&页面转发-店铺首页
|
||||
'poster_custom_page': '/pages/custom/custom-page', // 小程序-海报分享&页面转发-自定义页
|
||||
'poster_recommend_detail': '/pages/recommend/detail', // 小程序-海报分享&页面转发-种草详情
|
||||
'poster_community_memberdetail': '/subpages/community/group-memberdetail', // 小程序-海报分享&页面转发-社区
|
||||
'poster_coupon_center': '/subpages/marketing/coupon-center', // 小程序-海报分享&页面转发-领券中心
|
||||
'poster_mdugc_detail': '/subpages/mdugc/note-detail', // 小程序-海报分享&页面转发-笔记详情
|
||||
'poster_pointshop_espier_detail': '/subpages/pointshop/espier-detail', // 小程序-海报分享&页面转发-积分商品详情
|
||||
}
|
||||
|
||||
// 过滤掉内部使用的参数
|
||||
const filteredParams = { ...otherParams }
|
||||
delete filteredParams.scene
|
||||
delete filteredParams.$taroTimestamp
|
||||
const queryString = qs.stringify(filteredParams)
|
||||
|
||||
const targetUrl = queryString ? `${welcomeRoutes[from_scene]}?${queryString}` : welcomeRoutes[from_scene]
|
||||
console.log('导购任务分享跳转:', targetUrl)
|
||||
|
||||
if (targetUrl) {
|
||||
Taro.redirectTo({ url: targetUrl })
|
||||
} else {
|
||||
showToast('未匹配到参数')
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({ url: '/pages/index' })
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理处方药场景
|
||||
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
|
||||
|
||||
@@ -110,6 +110,7 @@ export default class Login extends Component {
|
||||
}
|
||||
|
||||
async handleSubmit() {
|
||||
const { source_id, monitor_id, latest_source_id, latest_monitor_id } = Taro.getStorageSync('sourceInfo') // 千人千码参数
|
||||
const { redirect } = this.$instance.router.params
|
||||
const { loginType } = this.state
|
||||
const { mobile, password, vcode } = this.state.info
|
||||
@@ -145,6 +146,19 @@ export default class Login extends Component {
|
||||
|
||||
params['auth_type'] = 'local'
|
||||
|
||||
if (source_id) {
|
||||
params['source_id'] = source_id
|
||||
}
|
||||
if (monitor_id) {
|
||||
params['monitor_id'] = monitor_id
|
||||
}
|
||||
if (latest_source_id) {
|
||||
params['latest_source_id'] = latest_source_id
|
||||
}
|
||||
if (latest_monitor_id) {
|
||||
params['latest_monitor_id'] = latest_monitor_id
|
||||
}
|
||||
|
||||
try {
|
||||
const { token, error_message } = await api.wx.newloginh5(params)
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ import {
|
||||
classNames,
|
||||
navigateTo,
|
||||
VERSION_PLATFORM,
|
||||
isAPP
|
||||
isAPP,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
|
||||
import doc from '@/doc'
|
||||
@@ -182,7 +183,7 @@ function EspierDetail(props) {
|
||||
if (userInfo) {
|
||||
query['uid'] = userInfo.uid
|
||||
}
|
||||
const path = `/pages/item/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('poster_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'
|
||||
|
||||
@@ -51,7 +51,7 @@ function GroupLeaderDetail(props) {
|
||||
}
|
||||
|
||||
useShareAppMessage(() => {
|
||||
const path = `/subpages/community/group-memberdetail?activity_id=${detail.activityId}`
|
||||
const path = buildSharePath('poster_community_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('poster_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'
|
||||
@@ -77,7 +77,7 @@ function GuideCustomPage() {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id
|
||||
}
|
||||
const path = `/pages/custom/custom-page?${qs.stringify(query)}`
|
||||
const path = buildSharePath('poster_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'
|
||||
@@ -87,6 +88,7 @@ const initialState = {
|
||||
// 多规格商品选中的规格
|
||||
curItem: null,
|
||||
imgHeightList: [], // 用于存储banner高度
|
||||
defaultImageHeight: 520, // 默认图片高度,避免空白
|
||||
}
|
||||
|
||||
function EspierDetail(props) {
|
||||
@@ -122,6 +124,7 @@ function EspierDetail(props) {
|
||||
subtaskId,
|
||||
curItem,
|
||||
imgHeightList, // 用于存储banner高度
|
||||
defaultImageHeight,
|
||||
} = state
|
||||
|
||||
useEffect(() => {
|
||||
@@ -198,8 +201,8 @@ function EspierDetail(props) {
|
||||
gu: `${work_userid}_${shop_code}`,
|
||||
subtask_id: subtaskId
|
||||
}
|
||||
const path = `/pages/item/espier-detail?${qs.stringify(query)}`
|
||||
console.log('gu---------------------', path)
|
||||
const path = buildSharePath('poster_espier_detail', query)
|
||||
console.log('gu---------------------',path)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: itemName,
|
||||
@@ -256,30 +259,51 @@ function EspierDetail(props) {
|
||||
}
|
||||
})
|
||||
}
|
||||
const banner = await getMultipleImageInfo(data.imgs)
|
||||
|
||||
setState((draft) => {
|
||||
draft.info = {
|
||||
...data,
|
||||
subscribe
|
||||
}
|
||||
draft.imgHeightList = banner
|
||||
draft.promotionActivity = data.promotionActivity
|
||||
// 初始化图片高度数组,使用默认高度
|
||||
draft.imgHeightList = new Array(data.imgs.length).fill(draft.defaultImageHeight)
|
||||
})
|
||||
|
||||
// 异步计算图片真实高度,不阻塞页面渲染
|
||||
getMultipleImageInfo(data.imgs).then(heights => {
|
||||
setState((draft) => {
|
||||
draft.imgHeightList = heights
|
||||
})
|
||||
}).catch(error => {
|
||||
console.log('计算图片高度失败,使用默认高度:', error)
|
||||
})
|
||||
}
|
||||
|
||||
const getMultipleImageInfo = async (imageUrls) => {
|
||||
const promises = imageUrls.map(url =>
|
||||
Taro.getImageInfo({ src: url })
|
||||
.then(info => info)
|
||||
.catch(error => {
|
||||
console.log('获取图片信息失败:', url, error)
|
||||
// 返回一个默认高度或 null
|
||||
return { width: 0, height: 650 }
|
||||
})
|
||||
)
|
||||
const results = await Promise.all(promises)
|
||||
return results.map(info => (info.height) / 2 > 650 ? 650 : info.height / 2)
|
||||
const getMultipleImageInfo = async (imageUrls = []) => {
|
||||
let windowWidth = defaultImageHeight
|
||||
try {
|
||||
const sys = Taro.getSystemInfoSync()
|
||||
if (sys && sys.windowWidth) windowWidth = sys.windowWidth
|
||||
} catch (e) {
|
||||
console.log('获取系统信息失败,使用默认宽度:', e)
|
||||
}
|
||||
|
||||
const promises = imageUrls.map(async (url) => {
|
||||
try {
|
||||
const imageInfo = await Taro.getImageInfo({ src: url })
|
||||
const imgWidth = Number(imageInfo?.width) || 0
|
||||
const imgHeight = Number(imageInfo?.height) || 0
|
||||
if (imgWidth > 0 && imgHeight > 0) {
|
||||
return Math.round((windowWidth * imgHeight) / imgWidth)
|
||||
}
|
||||
return Math.round(windowWidth)
|
||||
} catch (error) {
|
||||
console.log('获取图片信息失败:', url, error)
|
||||
return Math.round(windowWidth)
|
||||
}
|
||||
})
|
||||
|
||||
return Promise.all(promises)
|
||||
}
|
||||
|
||||
// 获取包裹
|
||||
@@ -389,7 +413,7 @@ function EspierDetail(props) {
|
||||
className='goods-swiper'
|
||||
// current={curImgIdx}
|
||||
onChange={onChangeSwiper}
|
||||
style={{ height: (imgHeightList[curImgIdx]) + 'px' }}
|
||||
style={{ height: (imgHeightList[curImgIdx] || defaultImageHeight) + 'px' }}
|
||||
>
|
||||
{info.imgs.map((img, idx) => (
|
||||
<SwiperItem key={`swiperitem__${idx}`}>
|
||||
|
||||
@@ -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('poster_recommend_detail', query)
|
||||
log.debug(`【guide/recommend/detail】onShareAppMessage path: ${sharePath}`)
|
||||
return {
|
||||
title: title,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} 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'
|
||||
@@ -140,10 +140,11 @@ function UgcNoteDetail(props) {
|
||||
draft.info['shareNums'] = shareInfo.share_nums
|
||||
})
|
||||
}
|
||||
console.log(`useShareAppMessage:`, `/subpages/mdugc/note-detail?post_id=${post_id}`)
|
||||
const path = buildSharePath('poster_mdugc_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'
|
||||
@@ -199,10 +200,11 @@ function MemberIndex(props) {
|
||||
const { logo } = await api.distribution.getDistributorInfo({
|
||||
distributor_id: 0
|
||||
})
|
||||
const path = buildSharePath('poster_home', {})
|
||||
return {
|
||||
title: share_title,
|
||||
imageUrl: share_pic_wechatapp || logo,
|
||||
path: '/pages/index'
|
||||
path: path
|
||||
}
|
||||
})
|
||||
|
||||
@@ -454,13 +456,17 @@ function MemberIndex(props) {
|
||||
Taro.navigateTo({ url: link })
|
||||
}
|
||||
}
|
||||
|
||||
const onLoginChange = (url) => {
|
||||
if (!isLogin || !url) return
|
||||
Taro.navigateTo({ url })
|
||||
}
|
||||
|
||||
const VipGradeDom = () => {
|
||||
return (
|
||||
<View
|
||||
className='user-grade-name'
|
||||
onClick={() => {
|
||||
Taro.navigateTo({ url: '/subpages/member/member-level' })
|
||||
}}
|
||||
onClick={() => onLoginChange('/subpages/member/member-level')}
|
||||
>
|
||||
<Text>
|
||||
{
|
||||
@@ -502,15 +508,11 @@ function MemberIndex(props) {
|
||||
className='header-block'
|
||||
style={userInfo?.gradeInfo?.grade_background ? memberBckStyle : {}}
|
||||
>
|
||||
<View className='user-info-card'>
|
||||
<SpLogin newUser={isNewUser} className='user-info-card'>
|
||||
<View className='user-info-header'>
|
||||
<View
|
||||
className='user-avatar'
|
||||
onClick={() => {
|
||||
if (isLogin) {
|
||||
Taro.navigateTo({ url: '/subpages/member/user-info' })
|
||||
}
|
||||
}}
|
||||
onClick={() => onLoginChange('/subpages/member/user-info')}
|
||||
style={{ width: '72px', height: '72px' }}
|
||||
>
|
||||
<SpImage
|
||||
@@ -526,7 +528,7 @@ function MemberIndex(props) {
|
||||
<>
|
||||
<View
|
||||
className='user-name'
|
||||
onClick={() => Taro.navigateTo({ url: '/subpages/member/user-info' })}
|
||||
onClick={() => onLoginChange('/subpages/member/user-info')}
|
||||
>
|
||||
{userInfo?.username || userInfo?.mobile}
|
||||
</View>
|
||||
@@ -541,9 +543,7 @@ function MemberIndex(props) {
|
||||
</View>
|
||||
</>
|
||||
) : (
|
||||
<SpLogin>
|
||||
<Text className='login-text font-medium text-34'>点击登录</Text>
|
||||
</SpLogin>
|
||||
<Text className='login-text font-medium text-34'>点击登录</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -563,47 +563,29 @@ function MemberIndex(props) {
|
||||
className='member-level-bg'
|
||||
/> */}
|
||||
{isLogin && config.menu.member_code && !VERSION_SHUYUN && (
|
||||
<SpLogin
|
||||
onChange={handleClickLink.bind(this, '/marketing/pages/member/member-code')}
|
||||
>
|
||||
<Text className='iconfont icon-erweima-01'></Text>
|
||||
</SpLogin>
|
||||
<Text
|
||||
className='iconfont icon-erweima-01'
|
||||
onClick={() => onLoginChange('/marketing/pages/member/member-code')}
|
||||
></Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='user-stats'>
|
||||
<SpLogin
|
||||
onChange={() => {
|
||||
Taro.navigateTo({ url: '/subpages/marketing/coupon' })
|
||||
}}
|
||||
<View
|
||||
className='stat-item'
|
||||
onClick={() => onLoginChange('/subpages/marketing/coupon')}
|
||||
>
|
||||
<View
|
||||
className='stat-item'
|
||||
// onClick={() => }
|
||||
>
|
||||
<Text className='stat-value'>{isLogin ? state.couponCount || 0 : '···'}</Text>
|
||||
<Text className='stat-label'>优惠券</Text>
|
||||
</View>
|
||||
</SpLogin>
|
||||
<SpLogin
|
||||
onChange={() => {
|
||||
if (VERSION_SHUYUN) {
|
||||
handleClickLink('/subpages/member/point-rule')
|
||||
} else {
|
||||
handleClickLink('/subpages/member/point-detail')
|
||||
}
|
||||
}}
|
||||
>
|
||||
{!VERSION_SHUYUN && (
|
||||
<View className='stat-item'>
|
||||
<Text className='stat-value'>{isLogin ? state.point || 0 : '···'}</Text>
|
||||
<Text className='stat-label'>{VERSION_SHUYUN ? '积分规则' : pointName}</Text>
|
||||
</View>
|
||||
)}
|
||||
</SpLogin>
|
||||
<Text className='stat-value'>{isLogin ? state.couponCount || 0 : '···'}</Text>
|
||||
<Text className='stat-label'>优惠券</Text>
|
||||
</View>
|
||||
|
||||
<View className='stat-item' onClick={() => onLoginChange('/subpages/member/point-detail')}>
|
||||
<Text className='stat-value'>{isLogin ? state.point || 0 : '···'}</Text>
|
||||
<Text className='stat-label'>积分</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</SpLogin>
|
||||
{/* <View className='header-block__ft'></View> */}
|
||||
</View>
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
|
||||
.login-text {
|
||||
color: #1a1a1a;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ import {
|
||||
classNames,
|
||||
navigateTo,
|
||||
VERSION_PLATFORM,
|
||||
isAPP
|
||||
isAPP,
|
||||
buildSharePath
|
||||
} from '@/utils'
|
||||
|
||||
import doc from '@/doc'
|
||||
@@ -166,7 +167,7 @@ function PointShopEspierDetail(props) {
|
||||
if (userInfo) {
|
||||
query['uid'] = userInfo.user_id
|
||||
}
|
||||
const path = `/subpages/pointshop/espier-detail?${qs.stringify(query)}`
|
||||
const path = buildSharePath('poster_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('poster_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'
|
||||
@@ -271,7 +272,7 @@ function StoreIndex() {
|
||||
const query = {
|
||||
dtid
|
||||
}
|
||||
const path = `/subpages/store/index?${qs.stringify(query)}`
|
||||
const path = buildSharePath('poster_store_index', query)
|
||||
log.debug(`share path: ${path}`)
|
||||
return {
|
||||
title: storeInfo?.name,
|
||||
|
||||
@@ -300,14 +300,11 @@ async function getStoreStatus() {
|
||||
// })
|
||||
// }
|
||||
// 新增千人千码跟踪记录
|
||||
function trackViewNum(monitor_id, source_id) {
|
||||
let _session = Taro.getStorageSync('_session')
|
||||
if (!_session) {
|
||||
return true
|
||||
}
|
||||
|
||||
async function trackViewNum(monitor_id, source_id) {
|
||||
if (monitor_id && source_id) {
|
||||
let param = { source_id: source_id, monitor_id: monitor_id }
|
||||
const logRes = await Taro.login()
|
||||
const res = await api.wx.getYoushuOpenid({ code:logRes.code })
|
||||
let param = { source_id: source_id, monitor_id: monitor_id,open_id:res?.openid }
|
||||
api.track.viewnum(param)
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -61,6 +61,8 @@ class EntryLaunch {
|
||||
..._options,
|
||||
...res
|
||||
}
|
||||
delete _options?.distributorInfo
|
||||
delete _options?.salespersonInfo
|
||||
}
|
||||
} else {
|
||||
_options = params
|
||||
|
||||
@@ -881,6 +881,22 @@ export const pxToUnitRpx = (px) => {
|
||||
return Taro.pxTransform(px * 2)
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建统一分享路径
|
||||
* @param {string} from_scene - 目标页面类型
|
||||
* @param {object} params - 路径参数
|
||||
* @returns {string} 统一的分享落地页路径
|
||||
*/
|
||||
export function buildSharePath(from_scene, params = {}) {
|
||||
const shareParams = {
|
||||
from_scene: from_scene,
|
||||
...params
|
||||
}
|
||||
const queryString = qs.stringify(shareParams)
|
||||
debugger
|
||||
return `/pages/share-land${queryString ? '?' + queryString : ''}`
|
||||
}
|
||||
|
||||
export {
|
||||
classNames,
|
||||
log,
|
||||
|
||||
Reference in New Issue
Block a user