Merge remote-tracking branch 'origin/master'

v2
king 1 year ago
commit e437e131cd
  1. 32
      src/pages/my/components/header/header.tsx
  2. 24
      src/pages/my/components/header/service.tsx
  3. 4
      src/pages/my/components/header/time.tsx
  4. 12
      src/pages/my/my.tsx
  5. 1
      src/pages/preview/search/search/index.module.scss
  6. 2
      src/pages/preview/search/search/index.tsx

@ -5,25 +5,37 @@ import avatar from "@/static/img/avatar.png"
import blacktriang from "@/static/img/blacktriangle.png" import blacktriang from "@/static/img/blacktriangle.png"
const Header = ({showCompany}:{showCompany:()=> void}) => { const Header = ({showCompany}:{showCompany:()=> void}) => {
const {user,company} = Profile.useContainer() const {token,user,company,empty} = Profile.useContainer()
return ( return (
<View className={styles.header}> <View className={styles.header}>
<View className='flex'> <View className='flex'>
<Image src={avatar} className={styles.avatar}/> {
<View className='flex-1'> token ?
<View className='font-32'>{user?.name}</View> <Image src={user?.avatar || avatar} className={styles.avatar}/>:
<Image src={avatar} className={styles.avatar}/>
}
{ token ?
<View className='flex-1'>
<View className='font-32'>{user?.name}</View>
<View className='flex align-center mt-2' onClick={()=>{ <View className='flex align-center mt-2' onClick={()=>{
showCompany() showCompany()
}}> }}>
<Text style={{fontSize:'24rpx',fontWeight:'500',color:'#323635'}}>{company?.name}</Text> <Text style={{fontSize:'24rpx',fontWeight:'500',color:'#323635'}}>{company?.name}</Text>
<Image src={blacktriang} style={{width:'20rpx',height:'20rpx'}}></Image> <Image src={blacktriang} style={{width:'20rpx',height:'20rpx'}}></Image>
</View>
</View>:
<View className='flex-1'>
<View className='font-32 mt-2' onClick={()=>{
empty()
}}>/</View>
</View> </View>
}
{/*<View className='login font-24 mt-2 text-secondary flex justify-between content-start'>*/} {/*<View className='login font-24 mt-2 text-secondary flex justify-between content-start'>*/}
{/* <Text>手机号:{user?.phone_number}</Text>*/} {/* <Text>手机号:{user?.phone_number}</Text>*/}
{/*</View>*/} {/*</View>*/}
</View>
</View> </View>
</View> </View>
) )

@ -22,7 +22,7 @@ const Service = () => {
{title: '个人中心', src: userInfo, router: '/pages/business/userInfo/userInfo'}, {title: '个人中心', src: userInfo, router: '/pages/business/userInfo/userInfo'},
]) ])
const {user, setUser} = Profile.useContainer() const {token,user, setUser} = Profile.useContainer()
Taro.useDidShow(async () => { Taro.useDidShow(async () => {
if (user?.id) { if (user?.id) {
@ -33,18 +33,24 @@ const Service = () => {
useEffect(() => { useEffect(() => {
const oldList: List[] = JSON.parse(JSON.stringify(list)) const oldList: List[] = JSON.parse(JSON.stringify(list))
if ([1, 2].includes(user?.role_type || 0)) { if(token){
oldList.unshift(...[ if ([1, 2].includes(user?.role_type || 0)) {
{title: '部门管理', src: dep, router: '/pages/manage/depAdmin/depAdmin'}, oldList.unshift(...[
// {title: '课程市场', src: buy, router: '/pages/manage/curriculum/curriculum'}, {title: '部门管理', src: dep, router: '/pages/manage/depAdmin/depAdmin'},
{title: '现场会', src: spotMeeting, router: '/pages/manage/spotMeeting/spotMeeting'}, // {title: '课程市场', src: buy, router: '/pages/manage/curriculum/curriculum'},
{title: '课程管理', src: course, router: '/pages/manage/courseAdmin/courseAdmin'}, {title: '现场会', src: spotMeeting, router: '/pages/manage/spotMeeting/spotMeeting'},
]) {title: '课程管理', src: course, router: '/pages/manage/courseAdmin/courseAdmin'},
setList(oldList) ])
setList(oldList)
}
} }
}, []) }, [])
function jump(url: string) { function jump(url: string) {
if(!token){
Taro.navigateTo({url:'/pages/login/login'})
return
}
Taro.navigateTo({url}) Taro.navigateTo({url})
} }

@ -10,6 +10,7 @@ import time1 from "@/static/img/time1.png";
import time2 from "@/static/img/time2.png"; import time2 from "@/static/img/time2.png";
import over from '@/static/img/over.png' import over from '@/static/img/over.png'
import incomplete from '@/static/img/incomplete.png' import incomplete from '@/static/img/incomplete.png'
import {Profile} from "@/store";
interface List { interface List {
title: string title: string
@ -19,6 +20,7 @@ interface List {
} }
const Time: FC = () => { const Time: FC = () => {
const {token} = Profile.useContainer()
const [list, setList] = useState<List[]>([ const [list, setList] = useState<List[]>([
{title: '今日时长', time: '00:00', src: time1}, {title: '今日时长', time: '00:00', src: time1},
{title: '累计时长', time: '00:00', src: time2}, {title: '累计时长', time: '00:00', src: time2},
@ -59,7 +61,7 @@ const Time: FC = () => {
<View className={styles.timeBoxFlex}> <View className={styles.timeBoxFlex}>
<View> <View>
<View className='mb-2'>{d.title}</View> <View className='mb-2'>{d.title}</View>
<View className='text-muted font-26'>{d.time}</View> { token && <View className='text-muted font-26'>{d.time}</View>}
</View> </View>
<Image src={d.src} mode='aspectFit' className={styles.timeImag}/> <Image src={d.src} mode='aspectFit' className={styles.timeImag}/>
</View> </View>

@ -5,7 +5,6 @@ import Header from "./components/header/header";
import {FC, useState} from "react"; import {FC, useState} from "react";
import Time from "@/pages/my/components/header/time"; import Time from "@/pages/my/components/header/time";
import Service from "@/pages/my/components/header/service"; import Service from "@/pages/my/components/header/service";
import LoginView from "@/components/loginView";
import {Profile} from "@/store"; import {Profile} from "@/store";
import Img from "@/components/image/image"; import Img from "@/components/image/image";
import GreenNike from "@/static/img/greenNike.png" import GreenNike from "@/static/img/greenNike.png"
@ -30,16 +29,13 @@ const My: FC = () => {
return ( return (
<View className={styles.content} style={`paddingTop:${globalData.statusBarHeight}px`}> <View className={styles.content} style={`paddingTop:${globalData.statusBarHeight}px`}>
{ !token ?
<LoginView></LoginView> <Header showCompany={()=>{
: companyList.length >= 2 && setCompanyShow(true)
<> }}/>
<Header showCompany={()=>{setCompanyShow(true)}}/>
<Time/> <Time/>
<Service/> <Service/>
</>
}
<PageContainer overlayStyle={'background:rgba(0,0,0,0.3)'} position={'bottom'} round={true} show={companyShow} <PageContainer overlayStyle={'background:rgba(0,0,0,0.3)'} position={'bottom'} round={true} show={companyShow}
onClickOverlay={() => setCompanyShow(false)}> onClickOverlay={() => setCompanyShow(false)}>

@ -14,6 +14,7 @@ page{
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
margin-left: 24rpx; margin-left: 24rpx;
flex:1;
} }
} }
.titleBox{ .titleBox{

@ -63,7 +63,7 @@ const Search:FC = () => {
<AtIcon value='search' size='20' color='#ccc'></AtIcon> <AtIcon value='search' size='20' color='#ccc'></AtIcon>
{ show ? { show ?
<Text className={styles.input} >{value}</Text>: <Text className={styles.input} >{value}</Text>:
<Input className={styles.input} placeholder="输入关键字搜索课程" type={'text'} confirmType={'search'} onInput={inpFn} onConfirm={searchInput} /> <Input className={styles.input} placeholder="输入关键字搜索" type={'text'} confirmType={'search'} onInput={inpFn} onConfirm={searchInput} />
} }
</View> </View>

Loading…
Cancel
Save