From a847ae93fda0a55dadbfecad5982d040f2927e6a Mon Sep 17 00:00:00 2001 From: maqian Date: Wed, 15 Oct 2025 17:54:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8D=83=E4=BA=BA=E5=8D=83=E7=A0=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/sp-login/index.weapp.js | 14 ++++++++++++++ src/subpages/auth/login.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/components/sp-login/index.weapp.js b/src/components/sp-login/index.weapp.js index 0ddefbb63..6a9f2ae9f 100644 --- a/src/components/sp-login/index.weapp.js +++ b/src/components/sp-login/index.weapp.js @@ -86,6 +86,7 @@ function SpLogin(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 @@ -110,6 +111,19 @@ function SpLogin(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) { diff --git a/src/subpages/auth/login.js b/src/subpages/auth/login.js index 5eccd98a0..b233940df 100644 --- a/src/subpages/auth/login.js +++ b/src/subpages/auth/login.js @@ -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) From 7d573bd0da6cbc4a9ecb5f79332357d6fb5ab584 Mon Sep 17 00:00:00 2001 From: maqian Date: Wed, 15 Oct 2025 18:37:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subpages/member/index.js | 157 +++++++++++++++------------------ src/subpages/member/index.scss | 1 + 2 files changed, 74 insertions(+), 84 deletions(-) diff --git a/src/subpages/member/index.js b/src/subpages/member/index.js index 7ae373ea1..76f1d8616 100644 --- a/src/subpages/member/index.js +++ b/src/subpages/member/index.js @@ -431,13 +431,17 @@ function MemberIndex(props) { Taro.navigateTo({ url: link }) } } + + const onLoginChange = (url) => { + if (!isLogin) return + Taro.navigateTo({ url }) + } + const VipGradeDom = () => { return ( { - Taro.navigateTo({ url: '/subpages/member/member-level' }) - }} + onClick={() => onLoginChange('/subpages/member/member-level')} > {{ @@ -478,101 +482,86 @@ function MemberIndex(props) { className='header-block' style={userInfo?.gradeInfo?.grade_background ? memberBckStyle : {}} > - - - { - if (isLogin) { - Taro.navigateTo({ url: '/subpages/member/user-info' }) - } - }} - style={{ width: '72px', height: '72px' }} - > - - + + + + onLoginChange('/subpages/member/user-info')} + style={{ width: '72px', height: '72px' }} + > + + - - {isLogin ? ( - <> - Taro.navigateTo({ url: '/subpages/member/user-info' })} - > - {userInfo?.username || userInfo?.mobile} - - - {VipGradeDom()} - {/* */} - - - ) : ( - + + {isLogin ? ( + <> + onLoginChange('/subpages/member/user-info')} + > + {userInfo?.username || userInfo?.mobile} + + + {VipGradeDom()} + {/* */} + + + ) : ( 点击登录 - - )} + )} + + + + {/* + */} + {isLogin && config.menu.member_code && ( + onLoginChange('/marketing/pages/member/member-code')} + > + )} + - - {/* - */} - {isLogin && config.menu.member_code && ( - Taro.navigateTo({ url: '/marketing/pages/member/member-code' })} - > - )} - - - - - { - Taro.navigateTo({ url: '/subpages/marketing/coupon' }) - }} - > + } + onClick={() => onLoginChange('/subpages/marketing/coupon')} > {isLogin ? state.couponCount || 0 : '···'} 优惠券 - - { - handleClickLink('/subpages/member/point-detail') - }} - > - + + onLoginChange('/subpages/member/point-detail')}> {isLogin ? state.point || 0 : '···'} 积分 - + - + {/* */} diff --git a/src/subpages/member/index.scss b/src/subpages/member/index.scss index e72be77ef..b6cf5d71e 100644 --- a/src/subpages/member/index.scss +++ b/src/subpages/member/index.scss @@ -88,6 +88,7 @@ .login-text { color: #1a1a1a; + font-size: 30px; } } From fd7b35da8582d5dcad9f3adc1399c11409610e4f Mon Sep 17 00:00:00 2001 From: maqian Date: Thu, 16 Oct 2025 09:54:30 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E4=B8=AD=E5=BF=83ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subpages/member/index.js | 61 ++++++++++++++---------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/src/subpages/member/index.js b/src/subpages/member/index.js index 7ae373ea1..17d2ad740 100644 --- a/src/subpages/member/index.js +++ b/src/subpages/member/index.js @@ -431,13 +431,17 @@ function MemberIndex(props) { Taro.navigateTo({ url: link }) } } + + const onLoginChange = (url) => { + if (!isLogin) return + Taro.navigateTo({ url }) + } + const VipGradeDom = () => { return ( { - Taro.navigateTo({ url: '/subpages/member/member-level' }) - }} + onClick={() => onLoginChange('/subpages/member/member-level')} > {{ @@ -478,15 +482,11 @@ function MemberIndex(props) { className='header-block' style={userInfo?.gradeInfo?.grade_background ? memberBckStyle : {}} > - + { - if (isLogin) { - Taro.navigateTo({ url: '/subpages/member/user-info' }) - } - }} + onClick={() => onLoginChange('/subpages/member/user-info')} style={{ width: '72px', height: '72px' }} > Taro.navigateTo({ url: '/subpages/member/user-info' })} + onClick={() => onLoginChange('/subpages/member/user-info')} > {userInfo?.username || userInfo?.mobile} @@ -517,9 +517,7 @@ function MemberIndex(props) { ) : ( - - 点击登录 - + 点击登录 )} @@ -541,38 +539,27 @@ function MemberIndex(props) { {isLogin && config.menu.member_code && ( Taro.navigateTo({ url: '/marketing/pages/member/member-code' })} + onClick={() => onLoginChange('/marketing/pages/member/member-code')} > )} - { - Taro.navigateTo({ url: '/subpages/marketing/coupon' }) - }} + onLoginChange('/subpages/marketing/coupon')} > - } - > - {isLogin ? state.couponCount || 0 : '···'} - 优惠券 - - - { - handleClickLink('/subpages/member/point-detail') - }} - > - - {isLogin ? state.point || 0 : '···'} - 积分 - - + {isLogin ? state.couponCount || 0 : '···'} + 优惠券 + + + onLoginChange('/subpages/member/point-detail')}> + {isLogin ? state.point || 0 : '···'} + 积分 + - + {/* */} From ac2678de96774d04e2481cb339a5f1da4cb7b1d0 Mon Sep 17 00:00:00 2001 From: maqian Date: Thu, 16 Oct 2025 11:57:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/item/espier-detail.js | 31 ++++++++----- src/subpages/guide/item/espier-detail.js | 55 +++++++++++++++++------- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/pages/item/espier-detail.js b/src/pages/item/espier-detail.js index e29767059..234fee801 100644 --- a/src/pages/item/espier-detail.js +++ b/src/pages/item/espier-detail.js @@ -103,7 +103,8 @@ const initialState = { recommendList: [], isParameter: false, imgHeightList: [], // 用于存储banner高度 - navigateMantle: false + navigateMantle: false, + defaultImageHeight: 520 // 默认图片高度,避免空白 } function EspierDetail(props) { @@ -141,7 +142,8 @@ function EspierDetail(props) { recommendList, isParameter, imgHeightList, - navigateMantle + navigateMantle, + defaultImageHeight } = state useEffect(() => { @@ -303,15 +305,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) { @@ -337,7 +348,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 @@ -347,9 +358,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) } @@ -501,7 +512,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) => ( @@ -845,7 +856,7 @@ function EspierDetail(props) { {info?.itemParams?.map((item, index) => { return ( - + {item.attribute_name} {item.attribute_value_name} diff --git a/src/subpages/guide/item/espier-detail.js b/src/subpages/guide/item/espier-detail.js index ca39ca1d2..7171f267d 100644 --- a/src/subpages/guide/item/espier-detail.js +++ b/src/subpages/guide/item/espier-detail.js @@ -87,6 +87,7 @@ const initialState = { // 多规格商品选中的规格 curItem: null, imgHeightList: [], // 用于存储banner高度 + defaultImageHeight: 520, // 默认图片高度,避免空白 } function EspierDetail(props) { @@ -122,6 +123,7 @@ function EspierDetail(props) { subtaskId, curItem, imgHeightList, // 用于存储banner高度 + defaultImageHeight, } = state useEffect(() => { @@ -254,30 +256,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) } // 获取包裹 @@ -387,7 +410,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) => (