From 81ca19ee0b7c074676f1eba2262a33edc40debbf Mon Sep 17 00:00:00 2001 From: xuan Date: Mon, 5 Sep 2022 10:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E5=A2=9E=E5=8A=A0script?= =?UTF-8?q?=E5=91=BD=E4=BB=A4):=20=E9=99=90=E5=88=B6=E6=80=A7init:iconfont?= =?UTF-8?q?=E5=86=8D=E6=89=A7=E8=A1=8Cdev:weapp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/pre.js | 1 + config/prod.js | 1 + package.json | 11 ++++++----- src/app.config.ts | 3 ++- src/custom-tab-bar/index.tsx | 23 +++++++---------------- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/config/pre.js b/config/pre.js index ce69a73..6238010 100644 --- a/config/pre.js +++ b/config/pre.js @@ -3,6 +3,7 @@ module.exports = { env: { NODE_ENV: '"pre"', }, + outputRoot: 'build', defineConstants: { CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"', }, diff --git a/config/prod.js b/config/prod.js index 4e3a20d..507a409 100644 --- a/config/prod.js +++ b/config/prod.js @@ -3,6 +3,7 @@ module.exports = { env: { NODE_ENV: '"production"', }, + outputRoot: 'build', defineConstants: { CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"', }, diff --git a/package.json b/package.json index 6900c26..97bb42b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "css": "sass" }, "scripts": { - "build:weapp": "npx iconfont-taro && taro build --type weapp", + "init:iconfont": "npx iconfont-taro", + "build:weapp": "taro build --type weapp", "build:swan": "taro build --type swan", "build:alipay": "taro build --type alipay", "build:tt": "taro build --type tt", @@ -18,17 +19,17 @@ "build:qq": "taro build --type qq", "build:jd": "taro build --type jd", "build:quickapp": "taro build --type quickapp", - "dev:weapp": "npx iconfont-taro && npm run build:weapp -- --watch", + "dev:weapp": "npm run init:iconfont && npm run build:weapp -- --watch", "dev:swan": "npm run build:swan -- --watch", "dev:alipay": "npm run build:alipay -- --watch", "dev:tt": "npm run build:tt -- --watch", - "dev:h5": "npm run build:h5 -- --watch", + "dev:h5": "npm run init:iconfont && npm run build:h5 -- --watch", "dev:rn": "npm run build:rn -- --watch", "dev:qq": "npm run build:qq -- --watch", "dev:jd": "npm run build:jd -- --watch", "dev:quickapp": "npm run build:quickapp -- --watch", - "build:weapp:pre": "npx iconfont-taro && cross-env NODE_ENV=pre taro build --type weapp", - "dev:weapp:pre": "npx iconfont-taro && cross-env NODE_ENV=pre npm run build:weapp -- --watch" + "build:weapp:pre": "npm run init:iconfont && cross-env NODE_ENV=pre taro build --type weapp", + "dev:weapp:pre": "npm run init:iconfont && cross-env NODE_ENV=pre npm run build:weapp -- --watch" }, "browserslist": [ "last 3 versions", diff --git a/src/app.config.ts b/src/app.config.ts index 86146b4..4465e1c 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,12 +1,13 @@ import { useGlobalIconFont } from './components/iconfont/helper' export default defineAppConfig({ - pages: ['pages/user/index', + pages: [ 'pages/index/index', 'pages/order/index', 'pages/shopping/index', 'pages/searchPage/index', 'pages/customerPage/index', 'pages/saleuserPage/index', + 'pages/user/index' ], window: { backgroundTextStyle: 'light', diff --git a/src/custom-tab-bar/index.tsx b/src/custom-tab-bar/index.tsx index 59fcca1..539b268 100644 --- a/src/custom-tab-bar/index.tsx +++ b/src/custom-tab-bar/index.tsx @@ -31,13 +31,13 @@ const CustomTabBar: FC = () => { console.log('sdfasdfa', state) return state.tabBarData }) - const tabBarIndexMap = useMemo(() => { - let map: TabBarIndexMap = {} - for (let i = 0; i < tabItem.length; i++) { - map[tabItem[i].id] = tabItem[i] - } - return map - }, [tabItem]) + // const tabBarIndexMap = useMemo(() => { + // let map: TabBarIndexMap = {} + // for (let i = 0; i < tabItem.length; i++) { + // map[tabItem[i].id] = tabItem[i] + // } + // return map + // }, [tabItem]) console.log('selectedId', selectedId) const dispatch = useDispatch>() @@ -52,15 +52,6 @@ const CustomTabBar: FC = () => { dispatch({ type: TabBarType.SET_SELECTED, data: { tabItem, selectedId: id } }) } - // const router = useRouter() - // console.log('getCurrentPages==>', router) - - // handleSelectTabItem(tabItem.find((item) => item.pagePath === router.path)?.id!)() - - // useDidShow(() => { - // console.log('getCurrentPages==>', router) - // }) - return (