merge(custom): m

This commit is contained in:
jerry
2025-08-21 18:35:11 +08:00
parent a80d363810
commit e5dd1fc416
14 changed files with 61 additions and 44 deletions

12
.env
View File

@@ -1,16 +1,16 @@
APP_BASE_URL=https://ecshopx1-en.shopex123.com/api/h5app/wxapp
APP_BASE_URL=https://demo-ecshopx.ishopex.cn/api/h5app/wxapp
APP_WEBSOCKET=wss://demo-ecshopx.ishopex.cn/ws
APP_COMPANY_ID=35
APP_PLATFORM=platform
APP_COMPANY_ID=38
APP_PLATFORM=standard
APP_CUSTOM_SERVER=https://ecshopx-h5.ex-sandbox.com/
APP_HOME_PAGE=/pages/index
APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a
APP_ID=wxcd40cac7764e570b
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
APP_ID=wx1e25e45145b70faa
APP_MAP_KEY=PSPBZ-KQ5CW-CSGRF-ON2S4-K2HQJ-XEBQG
APP_MAP_NAME=oneX新零售门店定位
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
APP_DIANWU_URL=
APP_DIANWU_URL=https://demo-ecshopx-dianwu.shopex123.com
APP_MERCHANT_URL=
APP_ADAPAY=

View File

@@ -104,6 +104,12 @@ function App({ children }) {
console.log('langJSON--------', langJSON)
langObj.setLanguagePackage(langJSON)
})
} else {
import('@/subpages/i18n/index').then((res) => {
const langJSON = Taro['langJSON']
console.log('langJSON--------', langJSON, langObj.setLanguagePackage)
langObj.setLanguagePackage(langJSON)
})
}
})

View File

@@ -11,7 +11,7 @@ function SpInput(props) {
const [cursor, setCursor] = useState(-1)
const handleInput = async (event) => {
console.log('sp-input', event, event.detail.value)
console.log('sp-input', event, event.detail.value, props.maxLength)
if (props.maxLength && event.detail.value?.length > props.maxLength) {
return
}

View File

@@ -87,13 +87,13 @@ const SpPage = memo(
if (state.lock) {
// 保存当前滚动位置
const currentScrollTop = scrollTopRef.current || 0
setState((draft) => {
draft.lockStyle = {
overflow: 'hidden'
}
})
// 设置滚动位置,防止回到顶部
setTimeout(() => {
Taro.pageScrollTo({
@@ -101,7 +101,6 @@ const SpPage = memo(
duration: 0
})
}, 0)
} else {
setState((draft) => {
draft.lockStyle = {
@@ -136,6 +135,9 @@ const SpPage = memo(
_menuWidth = menuButton.width
_navigationLSpace = windowWidth - menuButton.right
_navigationRSpace = menuButton.width + (windowWidth - menuButton.right)
} else if (hasNavbar) {
_gNavbarH = props.navigateHeight
_gStatusBarHeight = 0
}
const custom_navigation = isWeixin ? navigationStyle === 'custom' : false
@@ -440,7 +442,7 @@ const SpPage = memo(
style={styleNames(pageCenterStyle)}
>
{props.renderNavigation ? (
<context.Provider>{props.renderNavigation}</context.Provider>
<context.Provider value={store}>{props.renderNavigation}</context.Provider>
) : (
<View className='title-container' style={styleNames(pageTitleStyle)}>
{renderTitle || props.title || navigationBarTitleText}
@@ -480,9 +482,11 @@ const SpPage = memo(
<View
className='sp-page__body'
style={styleNames({
'height': props.immersive
? `${state.height + state.gNavbarH}px`
: `${state.height}px`,
'height':
props.immersive || hasNavbar
? `${state.height + state.gNavbarH}px`
: `${state.height}px`,
'padding-top': `${hasNavbar ? state.gNavbarH : 0}px`,
'margin-top': `${state.customNavigation && !props.immersive ? state.gNavbarH : 0}px`,
'padding-bottom': props.renderFooter
? Taro.pxTransform(

View File

@@ -3,6 +3,7 @@
.sp-page__body {
box-sizing: border-box;
overflow-y: auto;
}
.sp-page__footer {

View File

@@ -1,9 +1,9 @@
{
"extEnable": true,
"extAppid": "wxf7abee400d50e0d0",
"extAppid": "wx1e25e45145b70faa",
"ext": {
"company_id": "5",
"appid": "wxf7abee400d50e0d0",
"company_id": "38",
"appid": "wx1e25e45145b70faa",
"wxa_name": "通用小程序",
"ali_isvid":""
},

View File

@@ -1,12 +1,16 @@
import React, { useEffect } from 'react'
import { useSelector } from 'react-redux'
import { isWeixin } from '@/utils'
import Taro, { getCurrentInstance } from '@tarojs/taro'
export default (props = {}) => {
const setNavigationBarTitle = (title) => {
Taro.setNavigationBarTitle({
title
})
if (isWeixin) {
Taro.setNavigationBarTitle({
title
})
}
const { page } = getCurrentInstance()
const allPages = Taro.getCurrentPages()
console.log('allPages:', allPages)

View File

@@ -14,8 +14,8 @@
<!-- <script src='https://webapi.amap.com/maps?v=2.0&key=${process.env.APP_MAP_KEY}'></script> -->
<!-- <script src='https://apis.map.qq.com/tools/geolocation/min?key=${process.env.APP_MAP_KEY}&referer=myapp'></script> -->
<script>
!function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window);
</script>
<%= htmlWebpackPlugin.options.script %>
</script>
</head>
<body>
<div id="app"></div>

View File

@@ -1,7 +1,7 @@
const i18n = {
zhcn: '简体中文',
en: 'English',
zhtw: '繁體中文'
en: 'English'
// zhtw: '繁體中文'
}
export default i18n

View File

@@ -84,11 +84,11 @@ class Lang {
}
globalThis.langMap = langMap
// 存储语言是否存在
// 判断 globalThis.localStorage.getItem 是否为函数
// 判断 globalThis._localStorage.getItem 是否为函数
const isFunction = (fn) => {
return typeof fn === 'function'
}
globalThis.localStorage = {
globalThis._localStorage = {
getItem: (key) => {
return Taro.getStorageSync(key)
},
@@ -102,29 +102,29 @@ class Lang {
const withStorageLang =
isFunction &&
globalThis &&
globalThis.localStorage &&
isFunction(globalThis.localStorage.getItem) &&
globalThis.localStorage.getItem('lang')
globalThis._localStorage &&
isFunction(globalThis._localStorage.getItem) &&
globalThis._localStorage.getItem('lang')
const withStorageCommonLang =
isFunction &&
globalThis &&
globalThis.localStorage &&
isFunction(globalThis.localStorage.getItem) &&
globalThis.localStorage.getItem('')
globalThis._localStorage &&
isFunction(globalThis._localStorage.getItem) &&
globalThis._localStorage.getItem('')
// 从本地存储中获取通用语言,如果不存在则使用空字符串
const commonLang = withStorageCommonLang ? globalThis.localStorage.getItem('') : ''
const commonLang = withStorageCommonLang ? globalThis._localStorage.getItem('') : ''
// 从本地存储中获取当前语言,如果不存在则使用源语言
const baseLang = withStorageLang ? globalThis.localStorage.getItem('lang') : 'zhcn'
const baseLang = withStorageLang ? globalThis._localStorage.getItem('lang') : 'zhcn'
const lang = commonLang ? commonLang : baseLang
if (!globalThis.localStorage.getItem('lang')) {
if (!globalThis._localStorage.getItem('lang')) {
// 设置默认语言
globalThis.localStorage.setItem('lang', 'zhcn')
globalThis._localStorage.setItem('lang', 'zhcn')
}
// 根据当前语言设置翻译函数的语言包
globalThis.$t.locale(globalThis.langMap[lang], 'lang')
Taro.$changeLang = (lang) => {
globalThis.localStorage.setItem('lang', lang)
globalThis._localStorage.setItem('lang', lang)
globalThis.$t.locale(globalThis.langMap[lang], 'lang')
}
}

View File

@@ -13,7 +13,7 @@ const initialValue = {
}
const CompPasswordInput = (props) => {
const { onChange = () => {}, disabled, onFocus = () => {}, onBlur = () => {} } = props
const { onChange = () => {}, disabled, onFocus = () => {}, onBlur = () => {}, value } = props
const [state, setState] = useImmer(initialValue)
@@ -35,6 +35,7 @@ const CompPasswordInput = (props) => {
onChange={onChange}
onFocus={onFocus}
onBlur={onBlur}
value={value}
disabled={disabled}
/>
<View className='input-icon' onClick={handleToggle}>

View File

@@ -284,7 +284,7 @@ export default class Login extends Component {
info.password.length >= 6 &&
!info.is_new)) &&
info.mobile.length === 11
console.log('info', passwordLogin, info)
const inputProp = {
onFocus: this.logoShow(false),
onBlur: this.logoShow(true)
@@ -318,6 +318,7 @@ export default class Login extends Component {
<CompPasswordInput
onChange={this.handleInputChange.bind(this, 'password')}
{...inputProp}
value={info.password}
// onFocus={this.handleRemarkFocus.bind(this)}
// onBlur={this.handleRemarkBlur.bind(this)}
/>

View File

@@ -64,10 +64,10 @@ const langMap = {
globalThis && globalThis.lang && globalThis.lang.en
? globalThis.lang.en
: globalThis._getJSONKey('en', langJSON),
'zhtw':
globalThis && globalThis.lang && globalThis.lang.zhtw
? globalThis.lang.zhtw
: globalThis._getJSONKey('zh-tw', langJSON),
// 'zhtw':
// globalThis && globalThis.lang && globalThis.lang.zhtw
// ? globalThis.lang.zhtw
// : globalThis._getJSONKey('zh-tw', langJSON),
'zhcn':
globalThis && globalThis.lang && globalThis.lang.zhcn
? globalThis.lang.zhcn

View File

@@ -607,7 +607,7 @@ function MemberIndex(props) {
{/* <View className='header-block__ft'></View> */}
</View>
<WgtsContext.Provider>
<WgtsContext.Provider value={{}}>
<HomeWgts wgts={state.wgts} />
</WgtsContext.Provider>