From 4f924185adfe885ead862e38d75687ac015f38e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E5=B7=9E?= Date: Tue, 15 Jun 2021 15:42:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E5=BB=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - src/actions/app.js | 6 ++++-- src/app.config.js | 1 + src/components/Page/index.jsx | 32 ++++++++++++++++++++++++++++ src/components/Page/page.module.scss | 28 ++++++++++++++++++++++++ src/custom-taroui-variables.scss | 7 +++++- src/reducers/app.js | 1 + src/service/oss.js | 7 ++++-- 8 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 src/components/Page/index.jsx create mode 100644 src/components/Page/page.module.scss diff --git a/package.json b/package.json index bc2012d..7c21a78 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "@tarojs/cli": "3.2.10", "@tarojs/components": "3.2.10", "@tarojs/react": "3.2.10", - "@tarojs/redux": "^2.2.10", "@tarojs/rn-runner": "^3.2.10", "@tarojs/runtime": "3.2.10", "@tarojs/taro": "3.2.10", diff --git a/src/actions/app.js b/src/actions/app.js index 4d999db..79c503d 100644 --- a/src/actions/app.js +++ b/src/actions/app.js @@ -6,11 +6,13 @@ import { firstCharToLowerCase } from '../utils/tool'; async function saveSafeArea(dispatch) { const res = await Taro.getSystemInfo(); - if (res.safeArea) { + console.log('system info:', res); + if (res) { dispatch({ type: 'app/update', payload: { - safeArea: res.safeArea, + statusBarHeight: res.statusBarHeight, + safeArea: res.safeArea || {}, } }) } diff --git a/src/app.config.js b/src/app.config.js index 13ce879..65d3ff6 100644 --- a/src/app.config.js +++ b/src/app.config.js @@ -9,6 +9,7 @@ export default { navigationBarBackgroundColor: '#32323C', // navigationBarTitleText: 'WeChat', // navigationBarTextStyle: 'yellow' + navigationStyle: 'custom', }, tabBar: { color: "#7A7E83", diff --git a/src/components/Page/index.jsx b/src/components/Page/index.jsx new file mode 100644 index 0000000..8d53bd2 --- /dev/null +++ b/src/components/Page/index.jsx @@ -0,0 +1,32 @@ +import { ScrollView, View } from '@tarojs/components'; +import React from 'react'; +import { useSelector } from 'react-redux'; +import { AtNavBar } from 'taro-ui'; +import styles from './page.module.scss'; + +export default function Page(props) { + const { wrapperClassName, className, children, headerColor, title = '', leftText } = props; + const statusBarHeight = useSelector(state => state.app.statusBarHeight); + return ( + + + {/* + + {title} + + */} + {}}> + + {title} + + + + {children} + + + ) +} \ No newline at end of file diff --git a/src/components/Page/page.module.scss b/src/components/Page/page.module.scss new file mode 100644 index 0000000..529b220 --- /dev/null +++ b/src/components/Page/page.module.scss @@ -0,0 +1,28 @@ +.page { + // display: flex; + height: 100vh; + width: 100%; + // flex-direction: column; +} +.statusBar { + width: 100%; + height: 40px; + flex: none; + // background-color: red; +} +.header { + // display: flex; + // flex-direction: row; + // justify-content: space-between; + // flex: none; + height: 44Px; + .navBar { + background-color: transparent; + &:after { + content: none; + } + :global(.at-nav-bar__text) { + padding-left: 0; + } + } +} \ No newline at end of file diff --git a/src/custom-taroui-variables.scss b/src/custom-taroui-variables.scss index 4963c2f..1023034 100644 --- a/src/custom-taroui-variables.scss +++ b/src/custom-taroui-variables.scss @@ -3,4 +3,9 @@ $color-brand: #7850FF; $color-brand-light: #7850FF; $color-brand-dark: #7850FF; -@import "~taro-ui/dist/style/components/button.scss"; \ No newline at end of file +@import "~taro-ui/dist/style/components/button.scss"; +@import "~taro-ui/dist/style/components/search-bar.scss"; +@import "~taro-ui/dist/style/components/button.scss"; +@import "~taro-ui/dist/style/components/icon.scss"; +@import "~taro-ui/dist/style/components/nav-bar.scss"; +@import "~taro-ui/dist/style/components/list.scss"; \ No newline at end of file diff --git a/src/reducers/app.js b/src/reducers/app.js index d6c39a8..b34ae68 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -1,6 +1,7 @@ const initState = { isLogin:false, safeArea: {}, + statusBarHeight: 20, accountId: '', accountName: '', companyId: '', diff --git a/src/service/oss.js b/src/service/oss.js index 7712b81..d38b4b0 100644 --- a/src/service/oss.js +++ b/src/service/oss.js @@ -22,6 +22,8 @@ import { memoize } from 'lodash'; // const generateStoreKey = name => `${new Date().getTime()}/${name}`; export const wrapOssProtocol = path => `oss://${path}`; + +export const ossUrl = v => `https://yiyun-client-files.oss-cn-hangzhou.aliyuncs.com/${v}`; /** * * @param {*} objectKey 文件在服务器上的path值,格式为: oss://${timestamp}/filename @@ -30,10 +32,11 @@ export const wrapOssProtocol = path => `oss://${path}`; export const getFileUrl = memoize(function getFileUrlInner(serverOSSPath = '', saveAs) { if (serverOSSPath.indexOf('oss://') === 0) { const objectKey = serverOSSPath.substr(6); - return `https://yiyun-client-files.oss-cn-hangzhou.aliyuncs.com/${objectKey}`; + return ossUrl(objectKey); } if(serverOSSPath.indexOf('static/') === 0) { // 处理 static/img/faceImg/faceXX.png - return `https://yiyun-client-files.oss-cn-hangzhou.aliyuncs.com/faceImg/${serverOSSPath.substr(19)}`; + return ossUrl(`faceImg/${serverOSSPath.substr(19)}`); + // return `https://yiyun-client-files.oss-cn-hangzhou.aliyuncs.com/faceImg/${serverOSSPath.substr(19)}`; } // const filename = saveAs || objectKey.split('/').pop(); return serverOSSPath;