import {FC, useState} from "react"; import {View} from "@tarojs/components"; import {ManageApi} from "@/api/manage"; import {Profile} from '@/store' import PopPut from "@/components/popPut/popPut"; import Taro from "@tarojs/taro"; interface Props { cur_id: number name?: string } const Dep: FC = ({cur_id}: Props) => { const [bindDep, setBindDep] = useState([]) async function getBind() { try { const res = await ManageApi.bingDep(cur_id) setBindDep(res.department) } catch (e) { } } function jump(item: Department) { Taro.showModal({ title: "是否查看" + item.name, success({confirm}) { confirm && Taro.navigateTo({url: `/pages/manage/depCur/depCur?id=${item.id}`}) } }) } Taro.useDidShow(() => { getBind() }) return (<> {bindDep && 课程已分配部门 {bindDep && bindDep.map(d => ( jump(d)}/> ))} } ) } const StudentRecord: FC = ({cur_id, name}: Props) => { function jump() { Taro.navigateTo({url: `/pages/manage/studentRecord/studentRecord?cur_id=${cur_id}&name=${name}`}) } return ( ) } const ContainDeps: FC = ({cur_id,name}: Props) => { const {user} = Profile.useContainer() return ( <> {user?.role_type !== 0 ? : null} ) } export default ContainDeps