部门样式

main
king 1 year ago
parent 33abea6a49
commit 618d28cd62
  1. 6
      src/components/popPut/popPut.tsx
  2. 16
      src/pages/manage/addStudent/addStudent.tsx
  3. 12
      src/pages/manage/depAdmin/depAdmin.scss
  4. 90
      src/pages/manage/depAdmin/depAdmin.tsx
  5. 4
      src/static/css/module.scss
  6. BIN
      src/static/img/folder.png

@ -14,6 +14,7 @@ interface Props {
show?: boolean show?: boolean
onClick?: () => void onClick?: () => void
no_border?: boolean no_border?: boolean
leftImage?: string
} }
const PopPut: FC<Props> = ({title, chevron, content, image, isProp, children, show, ...opt}: Props) => { const PopPut: FC<Props> = ({title, chevron, content, image, isProp, children, show, ...opt}: Props) => {
@ -44,7 +45,10 @@ const PopPut: FC<Props> = ({title, chevron, content, image, isProp, children, sh
return ( return (
<> <>
<View className='card' onClick={click} style={style()}> <View className='card' onClick={click} style={style()}>
<View>{title}</View> <View className='flex align-center'>
{opt.leftImage && <Image src={opt.leftImage} className='mr-3' mode='aspectFit'/>}
<View>{title}</View>
</View>
<View className='card-content'> <View className='card-content'>
<Text>{content}</Text> <Text>{content}</Text>
{!chevron && <Icon name='chevron-right'/>} {!chevron && <Icon name='chevron-right'/>}

@ -107,17 +107,6 @@ const AddStudent = () => {
onInput={(event) => setUerInfo({...userInfo, phone_number: event.detail.value} as Student)}/> onInput={(event) => setUerInfo({...userInfo, phone_number: event.detail.value} as Student)}/>
</View> </View>
<View className='item'>
<View></View>
<Input placeholder='请输入登录邮箱' name='email' value={userInfo?.email}
onInput={(event) => setUerInfo({...userInfo, email: event.detail.value} as Student)}/>
</View>
<View className='item'>
<View></View>
<Input password placeholder='请输入登录密码' name='password' value={userInfo?.password}
onInput={(event) => setUerInfo({...userInfo, password: event.detail.value} as Student)}/>
</View>
<View className='item'> <View className='item'>
<View></View> <View></View>
@ -131,11 +120,6 @@ const AddStudent = () => {
</View> </View>
</View> </View>
<View className='item'>
<View></View>
<Input password placeholder='请输入身份证号' name='id_card' value={userInfo?.id_card}
onInput={(event) => setUerInfo({...userInfo, id_card: event.detail.value} as Student)}/>
</View>
<Button className='add' formType='submit' disabled={disable}></Button> <Button className='add' formType='submit' disabled={disable}></Button>
</Form> </Form>

@ -0,0 +1,12 @@
.operation {
display: flex;
width: 100%;
justify-content: space-around;
background: #F5F8F7;
position: fixed;
bottom: 0;
padding-bottom: env(safe-area-inset-bottom);
padding-top: 30px;
color: #45D4A8;
left: 0;
}

@ -1,9 +1,11 @@
import {FC, useEffect, useState} from "react"; import {FC, useEffect, useState} from "react";
import {AddDepProps, ManageApi} from "@/api/manage"; import {AddDepProps, ManageApi} from "@/api/manage";
import '../studentAdmin/student.scss' import {Button, View, PageContainer, Input, Form} from "@tarojs/components";
import {Button, Text, View, PageContainer, Input, Form, CustomWrapper} from "@tarojs/components";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import {Profile} from '@/store' import {Profile} from '@/store'
import './depAdmin.scss'
import PopPut from "@/components/popPut/popPut";
import folder from '@/static/img/folder.png'
interface ChangeDataProps { interface ChangeDataProps {
putCompany: Manage | null putCompany: Manage | null
@ -75,7 +77,7 @@ const ChangeData: FC<ChangeDataProps> = ({putCompany, getDeps}: ChangeDataProps)
} }
const DepAdmin: FC = () => { const DepAdmin: FC = () => {
const [data, setData] = useState<Manage[]>([]) const [manages, setManages] = useState<Manage[]>([])
const [show, setShow] = useState(false) const [show, setShow] = useState(false)
const [putCompany, setPutCompany] = useState<Manage | null>(null) const [putCompany, setPutCompany] = useState<Manage | null>(null)
@ -87,7 +89,7 @@ const DepAdmin: FC = () => {
Object.values(res)?.forEach(d => { Object.values(res)?.forEach(d => {
formatData.push(...d) formatData.push(...d)
}) })
setData(formatData) setManages(formatData)
} }
} }
@ -114,44 +116,56 @@ const DepAdmin: FC = () => {
}) })
} }
function jumpCur(id: number) { function managesSheet(item: Manage) {
Taro.navigateTo({url: `/pages/manage/depCur/depCur?id=${id}`}) Taro.showActionSheet({
itemList: ['查看部门课程', '修改', '删除'],
success({tapIndex}) {
switch (tapIndex) {
case 0:
Taro.navigateTo({url: `/pages/manage/depCur/depCur?id=${item.id}`})
break
case 1:
showPop(item)
break
case 2:
del(item.name, item.id)
break
}
}
})
} }
useEffect(() => { function jumpAddStudent() {
getData() Taro.navigateTo({url: '/pages/manage/addStudent/addStudent'})
}, []) }
Taro.useDidShow(getData)
return ( return (
<CustomWrapper> <Profile.Provider>
<Profile.Provider> <View>
{data.map(d => ( {
<View className='bg-white user' key={d.id}> manages.map(d => <PopPut
<View className='flex mt-3 header p-2 justify-between'> key={d.id}
<View className='flex'> title={d.name}
<Text>{d.id}</Text> chevron
<View className='font-weight'>{d.name}</View> onClick={() => managesSheet(d)}
</View> leftImage={folder}
</View> />)
<View className='flex justify-between p-2 operation'> }
<View onClick={() => showPop(d)}></View>
<View onClick={() => jumpCur(d.id)}></View> <View className='operation'>
<View className='text-danger' onClick={() => del(d.name, d.id)}></View> <View onClick={jumpAddStudent}></View>
</View> <View onClick={() => showPop(null)}></View>
</View> </View>
))} </View>
<View className='mt-3 text-center'>- -</View> <PageContainer show={show} round onAfterLeave={() => setShow(false)}>
<View className='h-4'>
<Button className='add' onClick={() => showPop(null)}></Button> {show && <ChangeData getDeps={getData} putCompany={putCompany}/>}
</View>
<PageContainer show={show} round onAfterLeave={() => setShow(false)}> </PageContainer>
<View className='h-4'> </Profile.Provider>
{show && <ChangeData getDeps={getData} putCompany={putCompany}/>}
</View>
</PageContainer>
</Profile.Provider>
</CustomWrapper>
) )
} }

@ -48,7 +48,7 @@ page {
} }
Image { Image {
width: 80px; width: 68px;
height: 80px; height: 68px;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Loading…
Cancel
Save