From 1775c391367d76b2338a533b36fae66de8619b5d Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Wed, 30 Aug 2023 16:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=99=BB=E5=BD=95=E8=A7=86=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83=E5=B1=95=E7=A4=BA=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=EF=BC=8C=E5=B9=B6=E5=8F=AF=E4=BB=A5=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.ts | 18 ++++----- src/app.tsx | 1 + src/components/loginView/index.module.scss | 36 ++++++++++++++++++ src/components/loginView/index.tsx | 31 +++++++++++++++ src/pages/index/index.tsx | 16 +++++++- src/pages/login/login.module.scss | 2 + src/pages/login/login.tsx | 6 ++- src/pages/my/components/header/header.tsx | 10 ++++- src/pages/my/my.module.scss | 42 +++++++++++++++++++++ src/pages/my/my.tsx | 37 ++++++++++++++++-- src/pages/preview/brand/info/info.tsx | 2 +- src/static/img/blacktriangle.png | Bin 0 -> 291 bytes src/static/img/greenNike.png | Bin 0 -> 624 bytes src/static/img/noLogin.png | Bin 0 -> 22962 bytes src/store/profile.ts | 2 +- 15 files changed, 183 insertions(+), 20 deletions(-) create mode 100644 src/components/loginView/index.module.scss create mode 100644 src/components/loginView/index.tsx create mode 100644 src/static/img/blacktriangle.png create mode 100644 src/static/img/greenNike.png create mode 100644 src/static/img/noLogin.png diff --git a/src/api/request.ts b/src/api/request.ts index 59d2501..5c1712f 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -88,15 +88,15 @@ export function request( } else if (res.statusCode === 401) { if (notLoging) return notLoging = true - Taro.showModal({ - title: "请登录", - content: token ? '登录过期' : "完成登录开启功能", - showCancel: false, - success() { - Taro.clearStorageSync() - Taro.redirectTo({url: '/pages/login/login'}) - } - }) + // Taro.showModal({ + // title: "请登录", + // content: token ? '登录过期' : "完成登录开启功能", + // showCancel: false, + // success() { + // Taro.clearStorageSync() + // Taro.redirectTo({url: '/pages/login/login'}) + // } + // }) } else { reject(null) Taro.showToast({ diff --git a/src/app.tsx b/src/app.tsx index 9e6d8c4..61fca2e 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -44,6 +44,7 @@ function App(props) { statusBarHeight: res.statusBarHeight || 0, screenWidth: res.screenWidth, screenHeight: res.screenHeight, + windowHeight: res.windowHeight, safeArea: res.safeArea, } } diff --git a/src/components/loginView/index.module.scss b/src/components/loginView/index.module.scss new file mode 100644 index 0000000..e7e2337 --- /dev/null +++ b/src/components/loginView/index.module.scss @@ -0,0 +1,36 @@ +.content { + position: relative; + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + image{ + width: 320rpx; + height: 208rpx; + } + .title{ + font-size: 28rpx; + font-weight: bold; + color: #323635; + line-height: 80rpx; + } + .label{ + font-size: 24rpx; + font-weight: 500; + color: #909795; + line-height: 24rpx; + margin-bottom: 40rpx; + } + .button{ + width: 70%; + height: 76rpx; + background: #45D4A8; + border-radius: 38rpx 38rpx 38rpx 38rpx; + color: #fff; + line-height: 76rpx; + text-align: center; + font-size: 32rpx; + font-weight: 500; + } +} diff --git a/src/components/loginView/index.tsx b/src/components/loginView/index.tsx new file mode 100644 index 0000000..367e61e --- /dev/null +++ b/src/components/loginView/index.tsx @@ -0,0 +1,31 @@ +import {CSSProperties,FC} from "react"; +import {View,Image} from "@tarojs/components"; +import styles from './index.module.scss' +import NoLogin from '@/static/img/noLogin.png' +import {Profile} from "@/store"; + +interface Props { + tips?: string + height?: number +} + +const LoginView: FC = (props) => { + const {empty} = Profile.useContainer() + const text = props.tips ?? '登录后可查看更多内容' + const size: string = props.height? `${props.height}px`:'750rpx' + const sizeStyle: CSSProperties = { + height:size, + } + + + return ( + + + 暂未登录 + {text} + {empty()}} className={styles.button}>立即登录 + + ) +} + +export default LoginView diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 99032e0..6eb859a 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -4,8 +4,13 @@ import styles from './index.module.scss' import {VideoList} from "@/pages/index/components/videoList"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; import {CoursesKey} from "@/api/public"; +import LoginView from "@/components/loginView"; +import Taro from "@tarojs/taro"; +import {Profile} from "@/store" const Index: FC = () => { + const globalData = Taro.getApp().globalData + const {token} = Profile.useContainer() const category: TabList[] = [ {title: "必修", value: 'is_required'}, {title: "选修", value: 'is_not_required'}, @@ -22,8 +27,15 @@ const Index: FC = () => { return ( <> - - setCategoryKey(categoryKey)}/> + { !token ? + + : + <> + + setCategoryKey(categoryKey)}/> + + } + ) diff --git a/src/pages/login/login.module.scss b/src/pages/login/login.module.scss index 43518ce..b568542 100644 --- a/src/pages/login/login.module.scss +++ b/src/pages/login/login.module.scss @@ -59,3 +59,5 @@ height: 50vh; padding: 50px 30px 0; } + + diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index 42ccd03..86b9750 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -1,6 +1,6 @@ import {FC, useEffect, useState} from "react"; import {Profile} from "@/store"; -import {Image, Text, View} from "@tarojs/components"; +import {Image, PageContainer, Text, View} from "@tarojs/components"; import Taro from "@tarojs/taro"; import styles from './login.module.scss' import Icon from "@/components/icon"; @@ -8,11 +8,13 @@ import {userApi} from "@/api"; import {loginApi, LoginParams} from "@/api/login"; import MyButton from "@/components/button/MyButton"; + const Login: FC = () => { const [isLoading, setLoading] = useState(false) const [error, setError] = useState(null) const {setUser, setToken, setCompany} = Profile.useContainer() const [h5params, setH5Params] = useState(null) + const [show,setShow] = useState(true) useEffect(() => { @@ -58,7 +60,9 @@ const Login: FC = () => { setCompany(company) setLoading(false) Taro.switchTab({url: '/pages/home/home'}) + } else { + Taro.setStorageSync('openid', catch_key) Taro.reLaunch({url: '/pages/check/check'}) } diff --git a/src/pages/my/components/header/header.tsx b/src/pages/my/components/header/header.tsx index 35de45f..c590a7c 100644 --- a/src/pages/my/components/header/header.tsx +++ b/src/pages/my/components/header/header.tsx @@ -2,6 +2,7 @@ import {Profile} from "@/store"; import {Image, Text, View} from "@tarojs/components"; import styles from "@/pages/my/my.module.scss"; import avatar from "@/static/img/avatar.png" +import blacktriang from "@/static/img/blacktriangle.png" const Header = () => { const {user} = Profile.useContainer() @@ -12,9 +13,14 @@ const Header = () => { {user?.name} - - 手机号:{user?.phone_number} + + + 江苏康缘药业股份有限公司 + + {/**/} + {/* 手机号:{user?.phone_number}*/} + {/**/} diff --git a/src/pages/my/my.module.scss b/src/pages/my/my.module.scss index 648a4d9..c5098a2 100644 --- a/src/pages/my/my.module.scss +++ b/src/pages/my/my.module.scss @@ -89,3 +89,45 @@ page { padding: 30rpx 20px; margin: 20rpx; } + +.box { + display: flex; + background-color: #fff; + border-radius: 16rpx; + padding: 16rpx 0; + box-sizing: border-box; + border-bottom: 2rpx solid #F5F8F7; + .image{ + width: 68rpx; + height:68rpx; + background-color: #eee; + border-radius: 8rpx; + overflow: hidden; + } + .innerBox{ + height: 68rpx; + align-items: center; + margin-left: 24rpx; + box-sizing: border-box; + flex: 1; + display: flex; + justify-content: space-between; + .title{ + font-size: 32rpx; + font-weight: 500; + color: #323635; + flex: 1; + display: -webkit-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:1; + } + .icon{ + margin-left: 24rpx; + width:24rpx; + height:24rpx; + } + } + +} diff --git a/src/pages/my/my.tsx b/src/pages/my/my.tsx index a784b3a..df47fc9 100644 --- a/src/pages/my/my.tsx +++ b/src/pages/my/my.tsx @@ -1,19 +1,48 @@ -import {View} from "@tarojs/components"; +import {PageContainer, View, Image} from "@tarojs/components"; import Taro from "@tarojs/taro"; import styles from './my.module.scss' import Header from "./components/header/header"; import {FC} from "react"; import Time from "@/pages/my/components/header/time"; import Service from "@/pages/my/components/header/service"; +import LoginView from "@/components/loginView"; +import {Profile} from "@/store"; +import {rfc33392time} from "@/utils/day"; +import Img from "@/components/image/image"; +import GreenNike from "@/static/img/greenNike.png" const My: FC = () => { const globalData = Taro.getApp().globalData + const {token,empty} = Profile.useContainer() return ( -
-