选择部门时如果没有部门则指引跳转添加部门,选择公司名展示成了联系人名字的bug修复

v2
一杯沧海 1 year ago
parent 7666062ea0
commit 9178e7ba47
  1. 5
      src/pages/manage/addStudent/addStudent.tsx
  2. 33
      src/pages/manage/courseAdmin/components/search.tsx
  3. 1
      src/pages/manage/courseAdmin/courseAdmin.tsx
  4. 2
      src/pages/manage/depAdmin/depAdmin.scss
  5. 9
      src/pages/manage/depAdmin/depAdmin.tsx
  6. 3
      src/pages/manage/department/addDepartment.tsx
  7. 62
      src/pages/manage/selectDep/selectDep.tsx
  8. 2
      src/pages/my/components/header/header.tsx
  9. 2
      src/pages/my/my.tsx
  10. 2
      src/pages/preview/brand/info/info.tsx

@ -73,13 +73,14 @@ const AddStudent = () => {
}, [depIds])
useEffect(() => {
getDepartment()
if (params.id) {
getUserInfo()
}
}, [])
Taro.useDidShow(() => {
Taro.useDidShow( async() => {
await getDepartment()
const newDepIds = storageDep.get()
setDepIds(newDepIds)
})

@ -1,4 +1,4 @@
import {FC, useCallback, useEffect, useState} from "react";
import {FC, useCallback, useState} from "react";
import {Image, Input, Radio, Text, View} from "@tarojs/components";
import styles from "../courseAdmin.module.scss";
import Icon from "@/components/icon";
@ -7,9 +7,9 @@ import CustomPageContainer from "@/components/custom-page-container/custom-page-
import Empty from "@/components/empty/empty";
import MyButton from "@/components/button/MyButton";
import downArrow from '@/static/img/downArrow.png'
import downArrowKey from '@/static/img/downArrowKey.png'
import omit from '@/static/img/omit.png'
import Taro from "@tarojs/taro";
import {Profile} from "@/store";
interface Props {
param: CourseAllParam
@ -23,8 +23,13 @@ export const Search: FC<Props> = ({param, setParam, total, setBatch}) => {
const [deps, setDeps] = useState<Manage[]>([])
const [depId, setDepId] = useState<number>(param.dep_id)
const [title, setTitle] = useState(param.title)
const {company} = Profile.useContainer()
Taro.useDidShow(() => {
getDepList()
})
function onBatch() {
Taro.showActionSheet({
itemList: ['批量添加部门'],
@ -67,9 +72,8 @@ export const Search: FC<Props> = ({param, setParam, total, setBatch}) => {
}
}, [depId])
useEffect(() => {
getDepList()
}, [])
return (
<>
@ -150,7 +154,24 @@ export const Search: FC<Props> = ({param, setParam, total, setBatch}) => {
</View>
</View>
</>
: <Empty name='暂无部门'/>}
:
<>
<Empty name=''/>
<View className="flex flex-column align-center width100">
<Text className="font-24 mb-3" style={{color:'#ccc'}}></Text>
<MyButton
width={300}
onClick={() => {
Taro.navigateTo({url:`/pages/manage/department/addDepartment?company_id=${company?.id}&parent_id=0&sort=0`})
setTimeout(() => {
setShow(false)
},1000)
}}
></MyButton>
</View>
</>
}
</View>
</CustomPageContainer>

@ -24,6 +24,7 @@ const CourseAdmin: FC = () => {
dep_id: 0
})
/**
*@param replace
*/

@ -17,8 +17,6 @@
.safeAreaInsetBottom {
height: 100rpx;
align-items: center;
justify-content: space-around;
padding-bottom: env(safe-area-inset-bottom);
display: flex;
}

@ -90,8 +90,7 @@ const DepAdmin: FC = () => {
break
}
},
fail() {
}
fail(){}
})
}
@ -168,10 +167,10 @@ const DepAdmin: FC = () => {
<View className='operation'>
<View className='safeAreaInsetBottom'>
<View onClick={jumpAddStudent}></View>
<View onClick={jumpDepartment}></View>
<View style={{flex:'1',textAlign:'center',lineHeight:'100rpx'}} onClick={jumpAddStudent}></View>
<View style={{flex:'1',textAlign:'center',lineHeight:'100rpx'}} onClick={jumpDepartment}></View>
{
router.params.id && <View onClick={managesSheet}></View>
router.params.id && <View style={{flex:'1',textAlign:'center',lineHeight:'100rpx'}} onClick={managesSheet}></View>
}
</View>
</View>

@ -8,7 +8,6 @@ import {getCurrentInstance} from "@tarojs/runtime";
const AddDepartment = () => {
const [departmentInfo, setDepartmentInfo] = useState<{ name: string } | null>(null)
const params = getCurrentInstance()?.router?.params as { id?: string;parent_id?: string;sort?: string;company_id?:string }
console.log(params)
useEffect(() => {
Taro.setNavigationBarTitle({ title:'添加部门' })
@ -22,7 +21,7 @@ const AddDepartment = () => {
const value: {name: string} = e.detail.value
for (const [_, val] of Object.entries(value)) {
if (!val) {
Taro.showToast({title: "请填写部门名称", icon: 'error'})
Taro.showToast({title: "请填写部门名称a", icon: 'error'})
return
}
}

@ -1,5 +1,5 @@
import React, {FC, useCallback, useEffect, useState} from "react";
import {Checkbox, View} from "@tarojs/components";
import React, {FC, useCallback, useState} from "react";
import {Checkbox, Text, View} from "@tarojs/components";
import Taro from "@tarojs/taro";
import {curriculum} from "@/api";
import PopPut from "@/components/popPut/popPut";
@ -7,6 +7,8 @@ import folder from "@/static/img/folder.png";
import MyButton from "@/components/button/MyButton";
import storageDep from "@/hooks/storageDep";
import Spin from "@/components/spinner";
import Empty from "@/components/empty/empty";
import {Profile} from "@/store";
/**
* depIds JSON = number[]
@ -17,14 +19,23 @@ const SelectDep: FC = () => {
const [ids, setIds] = useState<number[]>([])
const [deps, setDeps] = useState<Manage[]>([])
const [enable, setEnable] = useState(true)
const {company} = Profile.useContainer()
useEffect(() => {
// useEffect(() => {
// curriculum.department().then(res => {
// setDeps(res.data)
// })
// setEnable(false)
// setIds(JSON.parse(params.depIds))
// }, [])
Taro.useDidShow(() => {
curriculum.department().then(res => {
setDeps(res.data)
})
setEnable(false)
setIds(JSON.parse(params.depIds))
}, [])
})
const onChange = useCallback((id: number) => {
const index = ids.indexOf(id)
@ -49,20 +60,39 @@ const SelectDep: FC = () => {
return (
<View className='px-2 bg-white'>
<Spin overlay enable={enable}/>
{deps.map((d) => <View className='flex align-center' key={d.id} onClick={() => onChange(d.id)}>
<Checkbox value={d.id + ''} checked={ids.includes(d.id)} color='#45d4a8'/>
<View style={{flex: 1}}>
<PopPut
key={d.id}
title={d.name}
chevron
leftImage={folder}/>
{
deps.length > 0 ?
deps.map((d) => <View className='flex align-center' key={d.id} onClick={() => onChange(d.id)}>
<Checkbox value={d.id + ''} checked={ids.includes(d.id)} color='#45d4a8'/>
<View style={{flex: 1}}>
<PopPut
key={d.id}
title={d.name}
chevron
leftImage={folder}/>
</View>
</View>)
:
<>
<Empty name=''/>
<View className="flex flex-column align-center width100">
<Text className="font-24 mb-3" style={{color:'#ccc'}}></Text>
<MyButton
width={300}
onClick={() => {
Taro.navigateTo({url:`/pages/manage/department/addDepartment?company_id=${company?.id}&parent_id=0&sort=0`})
}}
></MyButton>
</View>
</>
}
{
deps.length > 0 &&<View className={'my-3'}>
<MyButton onClick={ok}></MyButton>
</View>
</View>)}
}
<View className={'my-3'}>
<MyButton onClick={ok}></MyButton>
</View>
</View>
)

@ -29,7 +29,7 @@ const Header: FC<Props> = ({companyList, showCompany}) => {
<View className='flex-1 flex flex-column justify-start align-start mt-1'>
<View className='font-32' onClick={token ? undefined : login}>{token ? user?.name ?? '匿名' : '请登录'}</View>
<View className='flex align-center mt-1' onClick={token ? showCompany : login}>
<Text style={{fontSize: '24rpx', fontWeight: '500', color: '#323635'}}>{token ? company?.name : '登录解锁更多功能哦'}</Text>
<Text style={{fontSize: '24rpx', fontWeight: '500', color: '#323635'}}>{token ? company?.company_name : '登录解锁更多功能哦'}</Text>
{showChoose && <Image src={blacktriang} style={{width: '20rpx', height: '20rpx'}}/>}
</View>
</View>

@ -160,7 +160,7 @@ const My: FC = () => {
<Img width={68} height={68} src={d.logo}/>
</View>
<View className={styles.innerBox}>
<View className={styles.title}>{d.name}</View>
<View className={styles.title}>{d.company_name}</View>
<Image src={company?.id === d.id ? GreenNike : ''} className={styles.icon}></Image>
</View>
</View>

@ -96,7 +96,7 @@ const BrandInfo: FC = () => {
{
(brandInfo?.brand_album?.length || 0) > 0
&& brandInfo?.brand_album?.split(',').map((d) =>
<SwiperItem>
<SwiperItem key={d}>
<Img mode={'aspectFill'} width={750} height={600} src={d} errorType='brand'/>
</SwiperItem>)
}

Loading…
Cancel
Save