From 9eb68f8d919c8b8c79ba4debc0462d6ad315ba65 Mon Sep 17 00:00:00 2001 From: xuan Date: Mon, 29 Aug 2022 16:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20chore(=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E4=BB=93=E5=BA=93):=20=E8=BF=81=E7=A7=BB=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=88=B0=E6=96=B0=E7=9A=84=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- project.config.json | 4 +- src/app.config.ts | 31 +++++++------ src/components/Divider/index.module.scss | 45 +++++++++++++++++++ src/components/Divider/index.tsx | 57 ++++++++++++++++++++++++ src/components/closeBtn/index.tsx | 2 +- src/components/tabs/index.tsx | 4 +- src/pages/order/index.tsx | 6 +++ src/pages/shopping/index.config.ts | 3 ++ src/pages/shopping/index.tsx | 9 ++++ src/pages/user/index.config.ts | 11 +++-- src/pages/user/index.module.scss | 5 +++ src/pages/user/index.tsx | 10 +++++ src/styles/common.scss | 2 +- yarn.lock | 4 +- 15 files changed, 167 insertions(+), 28 deletions(-) create mode 100644 src/components/Divider/index.module.scss create mode 100644 src/components/Divider/index.tsx create mode 100644 src/pages/shopping/index.config.ts create mode 100644 src/pages/shopping/index.tsx create mode 100644 src/pages/user/index.module.scss diff --git a/package.json b/package.json index 215c423..65bde1b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@tarojs/react": "3.5.4", "@tarojs/runtime": "3.5.4", "@tarojs/taro": "3.5.4", - "big.js": "^6.1.1", + "big.js": "^6.2.1", "dayjs": "^1.11.3", "qs": "^6.10.3", "react": "^18.2.0", diff --git a/project.config.json b/project.config.json index 8c5ddc2..1b96f7b 100644 --- a/project.config.json +++ b/project.config.json @@ -4,7 +4,7 @@ "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "appid": "wx64fe67f111d52457", "setting": { - "urlCheck": true, + "urlCheck": false, "es6": false, "postcss": false, "minified": false, @@ -45,4 +45,4 @@ "tabIndent": "insertSpaces", "tabSize": 2 } -} \ No newline at end of file +} diff --git a/src/app.config.ts b/src/app.config.ts index c3a8af3..6d5cc26 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,9 +1,5 @@ -export default { - pages: [ - 'pages/index/index', - 'pages/order/index', - 'pages/user/index', - ], +export default defineAppConfig({ + pages: ['pages/user/index', 'pages/index/index', 'pages/order/index', 'pages/shopping/index'], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', @@ -19,6 +15,12 @@ export default { iconPath: './styles/tabbar/list.png', selectedIconPath: './styles/tabbar/list_on.png', }, + { + pagePath: 'pages/shopping/index', + text: '购物', + iconPath: './styles/tabbar/order.png', + selectedIconPath: './styles/tabbar/order_on.png', + }, { pagePath: 'pages/order/index', text: '订单', @@ -30,15 +32,12 @@ export default { text: '我的', iconPath: './styles/tabbar/my.png', selectedIconPath: './styles/tabbar/my_on.png', - } + }, ], - 'color': '#707070', - 'selectedColor': '#2680EB', - 'backgroundColor': '#fff', - 'borderStyle': 'white' + color: '#707070', + selectedColor: '#2680EB', + backgroundColor: '#fff', + borderStyle: 'white', }, - subPackages: [ - - - ] -} + subPackages: [], +}) diff --git a/src/components/Divider/index.module.scss b/src/components/Divider/index.module.scss new file mode 100644 index 0000000..edc7516 --- /dev/null +++ b/src/components/Divider/index.module.scss @@ -0,0 +1,45 @@ + +.divider { + position: relative; + // 垂直 + &-vertical { + display: inline-block; + width: 1px; + height: 1em; + margin: 0 8px; + border-left: 1px $borderStyle $borderColor; + vertical-align: middle; + } + // 水平 + &-horizontal { + display: block; + width: 100%; + height: 1px; + margin: 48px 0; + border-top: 1px $borderStyle $borderColor; + } + &-text{ + position: absolute; + text-align: center; + padding: 0 40px; + font-weight: 500; + font-size: 28px; + color: #333; + background-color: #fff; + } +} +.is{ + &-center{ + left: 50%; + transform: translateX(-50%) translateY(-50%); + } + &-left{ + left: 20px; + transform:translateY(-50%); + } + &-right{ + right: 20px; + transform:translateY(-50%); + } +} + diff --git a/src/components/Divider/index.tsx b/src/components/Divider/index.tsx new file mode 100644 index 0000000..a809ceb --- /dev/null +++ b/src/components/Divider/index.tsx @@ -0,0 +1,57 @@ +/** + * Usage: + * + * 巴拉巴拉小魔仙 + * 全身变 + * + */ + +import { View } from "@tarojs/components"; +import { FC, ReactNode } from "react"; +import styles from "./index.module.scss"; +import classnames from "classnames"; + +type BorderStype = 'solid' | 'dashed' | 'dotted' | 'double' + +interface DividerProps { + direction?: "horizontal" | "vertical"; + borderStyle?: BorderStype; + contentPosition?: "left" | "center" | "right"; + children?: ReactNode; +} +const Divider: FC = props => { + const { + direction = "horizontal", + borderStyle = "solid", + contentPosition = "center" + } = props; + + const classname = classnames( + styles["divider"], + styles["divider-" + direction] + ); + const contentClassname = classnames( + styles["divider-text"], + styles["is-" + contentPosition] + ); + + const borderTopStyle: { borderTopStyle: BorderStype } = { + borderTopStyle: borderStyle + }; + const borderLeftStyle: { borderLeftStyle: BorderStype } = { + borderLeftStyle: borderStyle + }; + + const dividerStyle = + direction === "horizontal" ? borderTopStyle : borderLeftStyle; + + return ( + + {props.children && direction !== "vertical" && ( + {props.children} + )} + + ); +}; +export default Divider diff --git a/src/components/closeBtn/index.tsx b/src/components/closeBtn/index.tsx index 396ab6d..9b24b14 100644 --- a/src/components/closeBtn/index.tsx +++ b/src/components/closeBtn/index.tsx @@ -17,4 +17,4 @@ export default memo(({onClose, styleObj = {}}:Params) => { ) -}) \ No newline at end of file +}) diff --git a/src/components/tabs/index.tsx b/src/components/tabs/index.tsx index 3c7492e..d107b9a 100644 --- a/src/components/tabs/index.tsx +++ b/src/components/tabs/index.tsx @@ -25,7 +25,7 @@ export default memo(({list = [], defaultValue = 0, tabsOnClick, style={}}: Param useEffect(() => { const index = list?.findIndex(item => { - return item.value == defaultValue + return item.value == defaultValue }) if(index !== -1) { const num = index > 0?( index - 1) : 0 @@ -58,4 +58,4 @@ export default memo(({list = [], defaultValue = 0, tabsOnClick, style={}}: Param ) -}) \ No newline at end of file +}) diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 8b13789..efe4f56 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -1 +1,7 @@ +import { View } from "@tarojs/components" +const Order = () => { + return +} + +export default Order diff --git a/src/pages/shopping/index.config.ts b/src/pages/shopping/index.config.ts new file mode 100644 index 0000000..dfe1de6 --- /dev/null +++ b/src/pages/shopping/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '购物页面', +} diff --git a/src/pages/shopping/index.tsx b/src/pages/shopping/index.tsx new file mode 100644 index 0000000..2ae0ef7 --- /dev/null +++ b/src/pages/shopping/index.tsx @@ -0,0 +1,9 @@ +import { isEmptyObject } from '@/common/common' +import { View } from '@tarojs/components' + +const User = () => { + const obj = {} + console.log(isEmptyObject(obj)) + return sdfasdfasdf +} +export default User diff --git a/src/pages/user/index.config.ts b/src/pages/user/index.config.ts index a4e5a9b..90ec98a 100644 --- a/src/pages/user/index.config.ts +++ b/src/pages/user/index.config.ts @@ -1,3 +1,8 @@ -export default { - navigationBarTitleText: '我的', -} +export default definePageConfig({ + navigationBarTitleText: '我的', + navigationBarTextStyle: 'white', + navigationBarBackgroundColor: '#4581FF', + backgroundColor: '#4581FF', + backgroundColorTop: '#4581FF', + enablePullDownRefresh: true +}) diff --git a/src/pages/user/index.module.scss b/src/pages/user/index.module.scss new file mode 100644 index 0000000..c4c3e5e --- /dev/null +++ b/src/pages/user/index.module.scss @@ -0,0 +1,5 @@ +.main{ + width: 100%; + min-height: 100vh; + background: linear-gradient(to bottom, $color_main 25%, $color_bg_one 42%); +} diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index e69de29..4d6b291 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -0,0 +1,10 @@ +import { isEmptyObject } from '@/common/common' +import { View } from '@tarojs/components' +import styles from './index.module.scss' +// 我的 +const User = () => { + const obj = {} + console.log(isEmptyObject(obj)) + return sdfasdfasdf +} +export default User diff --git a/src/styles/common.scss b/src/styles/common.scss index 6e55986..11655cf 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -3,7 +3,7 @@ $color_bg_one: #F8F8F8; $color_font_one: #3C3C3C; $color_font_two: #ABABAB; $color_font_three: #707070; -$color_main: #007AFF; +$color_main: #4581FF; $font_size_big: 32px; $font_size: 28px; diff --git a/yarn.lock b/yarn.lock index 1748fb4..8e4b7fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4370,9 +4370,9 @@ big.js@^5.2.2: resolved "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== -big.js@^6.1.1: +big.js@^6.2.1: version "6.2.1" - resolved "https://registry.npmmirror.com/big.js/-/big.js-6.2.1.tgz" + resolved "https://registry.npmmirror.com/big.js/-/big.js-6.2.1.tgz#7205ce763efb17c2e41f26f121c420c6a7c2744f" integrity sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ== binary-extensions@^2.0.0: