Merge remote-tracking branch 'origin/master'

v2
king 1 year ago
commit 8ae17e1bfc
  1. 18
      src/api/request.ts
  2. 1
      src/app.tsx
  3. 36
      src/components/loginView/index.module.scss
  4. 31
      src/components/loginView/index.tsx
  5. 16
      src/pages/index/index.tsx
  6. 2
      src/pages/login/login.module.scss
  7. 6
      src/pages/login/login.tsx
  8. 10
      src/pages/my/components/header/header.tsx
  9. 42
      src/pages/my/my.module.scss
  10. 37
      src/pages/my/my.tsx
  11. 2
      src/pages/preview/brand/info/info.tsx
  12. BIN
      src/static/img/blacktriangle.png
  13. BIN
      src/static/img/greenNike.png
  14. BIN
      src/static/img/noLogin.png
  15. 2
      src/store/profile.ts

@ -88,15 +88,15 @@ export function request<T = unknown>(
} 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({

@ -44,6 +44,7 @@ function App(props) {
statusBarHeight: res.statusBarHeight || 0,
screenWidth: res.screenWidth,
screenHeight: res.screenHeight,
windowHeight: res.windowHeight,
safeArea: res.safeArea,
}
}

@ -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;
}
}

@ -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> = (props) => {
const {empty} = Profile.useContainer()
const text = props.tips ?? '登录后可查看更多内容'
const size: string = props.height? `${props.height}px`:'750rpx'
const sizeStyle: CSSProperties = {
height:size,
}
return (
<View className={styles.content} style={sizeStyle}>
<Image src={NoLogin}></Image>
<View className={styles.title}></View>
<View className={styles.label}>{text}</View>
<View onClick={()=>{empty()}} className={styles.button}></View>
</View>
)
}
export default LoginView

@ -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 (
<>
<View className={styles.content}>
<Tabs tabList={category} onChange={tabChange} current={categoryKey}/>
<VideoList categoryKey={categoryKey} setCategoryKey={(categoryKey) => setCategoryKey(categoryKey)}/>
{ !token ?
<LoginView height={globalData.windowHeight-100}></LoginView>
:
<>
<Tabs tabList={category} onChange={tabChange} current={categoryKey}/>
<VideoList categoryKey={categoryKey} setCategoryKey={(categoryKey) => setCategoryKey(categoryKey)}/>
</>
}
</View>
</>
)

@ -59,3 +59,5 @@
height: 50vh;
padding: 50px 30px 0;
}

@ -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<string | null>(null)
const {setUser, setToken, setCompany} = Profile.useContainer()
const [h5params, setH5Params] = useState<LoginParams | null>(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'})
}

@ -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 = () => {
<Image src={avatar} className={styles.avatar}/>
<View className='flex-1'>
<View className='font-32'>{user?.name}</View>
<View className='login font-24 mt-2 text-secondary flex justify-between content-start'>
<Text>{user?.phone_number}</Text>
<View className='flex align-center mt-2'>
<Text style={{fontSize:'24rpx',fontWeight:'500',color:'#323635'}}></Text>
<Image src={blacktriang} style={{width:'20rpx',height:'20rpx'}}></Image>
</View>
{/*<View className='login font-24 mt-2 text-secondary flex justify-between content-start'>*/}
{/* <Text>手机号:{user?.phone_number}</Text>*/}
{/*</View>*/}
</View>
</View>
</View>

@ -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;
}
}
}

@ -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 (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight}px`}>
<Header/>
<Time/>
<Service/>
{ !token ?
<LoginView height={globalData.windowHeight-100}></LoginView>
:
<>
<Header/>
<Time/>
<Service/>
</>
}
<PageContainer position={'bottom'} round={true} show={false}>
<View className="px-3 py-5">
<View className="font-32 pb-3" style={{display:'flex',justifyContent:'center',borderBottom:'2rpx solid #f5f8f7'}}></View>
<View className={styles.box} onClick={() => {}}>
<View className={styles.image}>
<Img width={68} height={68} src={'dd'}/>
</View>
<View className={styles.innerBox}>
<View className={styles.title}></View>
<Image src={GreenNike} className={styles.icon}></Image>
</View>
</View>
</View>
</PageContainer>
</View>
)
}

@ -117,7 +117,7 @@ const BrandInfo: FC = () => {
<View className={styles.desc}>{rfc33392time(i.created_at)} {i.page_view}</View>
</View>
<View className={styles.image}>
<Img width={172} height={128} src={'dd'}/>
<Img width={172} height={128} src={i.cover}/>
</View>
</View>
</View>

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@ -57,7 +57,7 @@ function useProfile() {
setUser(null)
setToken(null)
Taro.removeStorageSync('profile')
Taro.redirectTo({url: '/pages/login/login'})
Taro.navigateTo({url: '/pages/login/login'})
}
useEffect(() => {

Loading…
Cancel
Save