部门样式

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
onClick?: () => void
no_border?: boolean
leftImage?: string
}
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 (
<>
<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'>
<Text>{content}</Text>
{!chevron && <Icon name='chevron-right'/>}

@ -107,17 +107,6 @@ const AddStudent = () => {
onInput={(event) => setUerInfo({...userInfo, phone_number: event.detail.value} as Student)}/>
</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></View>
@ -131,11 +120,6 @@ const AddStudent = () => {
</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>
</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 {AddDepProps, ManageApi} from "@/api/manage";
import '../studentAdmin/student.scss'
import {Button, Text, View, PageContainer, Input, Form, CustomWrapper} from "@tarojs/components";
import {Button, View, PageContainer, Input, Form} from "@tarojs/components";
import Taro from "@tarojs/taro";
import {Profile} from '@/store'
import './depAdmin.scss'
import PopPut from "@/components/popPut/popPut";
import folder from '@/static/img/folder.png'
interface ChangeDataProps {
putCompany: Manage | null
@ -75,7 +77,7 @@ const ChangeData: FC<ChangeDataProps> = ({putCompany, getDeps}: ChangeDataProps)
}
const DepAdmin: FC = () => {
const [data, setData] = useState<Manage[]>([])
const [manages, setManages] = useState<Manage[]>([])
const [show, setShow] = useState(false)
const [putCompany, setPutCompany] = useState<Manage | null>(null)
@ -87,7 +89,7 @@ const DepAdmin: FC = () => {
Object.values(res)?.forEach(d => {
formatData.push(...d)
})
setData(formatData)
setManages(formatData)
}
}
@ -114,44 +116,56 @@ const DepAdmin: FC = () => {
})
}
function jumpCur(id: number) {
Taro.navigateTo({url: `/pages/manage/depCur/depCur?id=${id}`})
function managesSheet(item: Manage) {
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(() => {
getData()
}, [])
function jumpAddStudent() {
Taro.navigateTo({url: '/pages/manage/addStudent/addStudent'})
}
Taro.useDidShow(getData)
return (
<CustomWrapper>
<Profile.Provider>
{data.map(d => (
<View className='bg-white user' key={d.id}>
<View className='flex mt-3 header p-2 justify-between'>
<View className='flex'>
<Text>{d.id}</Text>
<View className='font-weight'>{d.name}</View>
</View>
</View>
<View className='flex justify-between p-2 operation'>
<View onClick={() => showPop(d)}></View>
<View onClick={() => jumpCur(d.id)}></View>
<View className='text-danger' onClick={() => del(d.name, d.id)}></View>
</View>
</View>
))}
<View className='mt-3 text-center'>- -</View>
<Button className='add' onClick={() => showPop(null)}></Button>
<PageContainer show={show} round onAfterLeave={() => setShow(false)}>
<View className='h-4'>
{show && <ChangeData getDeps={getData} putCompany={putCompany}/>}
</View>
</PageContainer>
</Profile.Provider>
</CustomWrapper>
<Profile.Provider>
<View>
{
manages.map(d => <PopPut
key={d.id}
title={d.name}
chevron
onClick={() => managesSheet(d)}
leftImage={folder}
/>)
}
<View className='operation'>
<View onClick={jumpAddStudent}></View>
<View onClick={() => showPop(null)}></View>
</View>
</View>
<PageContainer show={show} round onAfterLeave={() => setShow(false)}>
<View className='h-4'>
{show && <ChangeData getDeps={getData} putCompany={putCompany}/>}
</View>
</PageContainer>
</Profile.Provider>
)
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Loading…
Cancel
Save