|
@@ -1,13 +1,53 @@
|
|
|
import { Cell, Checkbox, CheckboxGroup, Icon, Image, Sticky } from 'vant';
|
|
|
import { defineComponent, onMounted, reactive, ref, watch } from 'vue';
|
|
|
import styles from '../index.module.less';
|
|
|
-// import badge1 from '../images/badge-1.png';
|
|
|
+import badge1 from '../images/badge-1.png';
|
|
|
+import badge2 from '../images/badge-2.png';
|
|
|
+import badge3 from '../images/badge-3.png';
|
|
|
+import badge4 from '../images/badge-4.png';
|
|
|
+import badge5 from '../images/badge-5.png';
|
|
|
+import badge6 from '../images/badge-6.png';
|
|
|
+import badge7 from '../images/badge-7.png';
|
|
|
+import badge8 from '../images/badge-8.png';
|
|
|
import MSearch from '@/components/m-search';
|
|
|
import activeButtonIcon from '@/common/images/icon-check-active.png';
|
|
|
import inactiveButtonIcon from '@/common/images/icon-check.png';
|
|
|
import iconStudent from '@/common/images/icon-student-default.png';
|
|
|
import iconTeacher from '@/common/images/icon-teacher-default.png';
|
|
|
import request from '@/helpers/request';
|
|
|
+import MEmpty from '@/components/m-empty';
|
|
|
+
|
|
|
+export const formatterImage = (type: string) => {
|
|
|
+ let image: any = badge3;
|
|
|
+ switch (type) {
|
|
|
+ case 'SCHOOLMASTER':
|
|
|
+ image = badge5;
|
|
|
+ break;
|
|
|
+ case 'ORCHESTRA_LEADER':
|
|
|
+ image = badge1;
|
|
|
+ break;
|
|
|
+ case 'SCHOOL_LEADER':
|
|
|
+ image = badge6;
|
|
|
+ break;
|
|
|
+ case 'SCHOOL_TEACHER':
|
|
|
+ image = badge7;
|
|
|
+ break;
|
|
|
+ case 'ORCHESTRA_MANAGER':
|
|
|
+ image = badge4;
|
|
|
+ break;
|
|
|
+ case 'ORCHESTRA_TEACHER':
|
|
|
+ image = badge2;
|
|
|
+ break;
|
|
|
+ case 'MAINTENANCE_TECHNICIAN':
|
|
|
+ image = badge8;
|
|
|
+ break;
|
|
|
+ case 'STUDENT':
|
|
|
+ image = badge3;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return image;
|
|
|
+};
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'contacts-modal',
|
|
|
props: {
|
|
@@ -34,7 +74,8 @@ export default defineComponent({
|
|
|
const forms = reactive({
|
|
|
height: props.height,
|
|
|
list: [],
|
|
|
- check: [] as any
|
|
|
+ check: [] as any,
|
|
|
+ dataShow: true
|
|
|
});
|
|
|
|
|
|
const onToggle = (index: number) => {
|
|
@@ -48,6 +89,7 @@ export default defineComponent({
|
|
|
id: item.id,
|
|
|
value: item.friendNickname,
|
|
|
text: item.memo,
|
|
|
+ roleType: item.roleType,
|
|
|
avatar:
|
|
|
item.friend.avatar || item.friend.userType === 'TEACHER'
|
|
|
? iconTeacher
|
|
@@ -90,6 +132,8 @@ export default defineComponent({
|
|
|
forms.list = data || [];
|
|
|
} catch {
|
|
|
//
|
|
|
+ } finally {
|
|
|
+ forms.dataShow = forms.list.length > 0 ? true : false;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -108,56 +152,73 @@ export default defineComponent({
|
|
|
<MSearch placeholder="请输入群聊名称" />
|
|
|
</Sticky>
|
|
|
<CheckboxGroup v-model={forms.check}>
|
|
|
- {forms.list.map((item: any, index: number) => (
|
|
|
- <Cell
|
|
|
- center
|
|
|
- onClick={() => onToggle(index)}
|
|
|
- class={styles.popupCell}>
|
|
|
- {{
|
|
|
- icon: () => (
|
|
|
- <Image
|
|
|
- src={
|
|
|
- item.friend.avatar || item.friend.userType === 'TEACHER'
|
|
|
- ? iconTeacher
|
|
|
- : iconStudent
|
|
|
- }
|
|
|
- class={styles.imgLogo}
|
|
|
- fit="contain"
|
|
|
- />
|
|
|
- ),
|
|
|
- title: () => (
|
|
|
- <div class={styles.infos}>
|
|
|
- <div class={styles.infoTitle}>
|
|
|
- {item.friendNickname}
|
|
|
- {/* <img src={badge1} class={styles.iconBadge} /> */}
|
|
|
- </div>
|
|
|
- <div class={styles.infoContent}>{item.memo}</div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- 'right-icon': () => (
|
|
|
- <Checkbox
|
|
|
- name={item.id}
|
|
|
- ref={e => (checkboxRefs.value[index] = e)}
|
|
|
- onClick={(e: MouseEvent) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- class={styles.boxStyle}
|
|
|
- name={
|
|
|
- props.checked
|
|
|
- ? activeButtonIcon
|
|
|
- : inactiveButtonIcon
|
|
|
- }
|
|
|
+ {forms.dataShow ? (
|
|
|
+ forms.list.map((item: any, index: number) => (
|
|
|
+ <Cell
|
|
|
+ center
|
|
|
+ onClick={() => onToggle(index)}
|
|
|
+ class={styles.popupCell}>
|
|
|
+ {{
|
|
|
+ icon: () => (
|
|
|
+ <Image
|
|
|
+ src={
|
|
|
+ item.friend.avatar || item.friend.userType === 'TEACHER'
|
|
|
+ ? iconTeacher
|
|
|
+ : iconStudent
|
|
|
+ }
|
|
|
+ class={styles.imgLogo}
|
|
|
+ fit="contain"
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.infos}>
|
|
|
+ <div class={styles.infoTitle}>
|
|
|
+ {item.friendNickname}
|
|
|
+ <img
|
|
|
+ src={formatterImage(item.roleType)}
|
|
|
+ class={[
|
|
|
+ styles.iconBadge,
|
|
|
+ item.roleType === 'SCHOOL_LEADER'
|
|
|
+ ? styles.iconBadge2
|
|
|
+ : ''
|
|
|
+ ]}
|
|
|
/>
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- )
|
|
|
+ </div>
|
|
|
+ <div class={styles.infoContent}>{item.memo}</div>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ 'right-icon': () => (
|
|
|
+ <Checkbox
|
|
|
+ name={item.id}
|
|
|
+ ref={e => (checkboxRefs.value[index] = e)}
|
|
|
+ onClick={(e: MouseEvent) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ }}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ class={styles.boxStyle}
|
|
|
+ name={
|
|
|
+ props.checked
|
|
|
+ ? activeButtonIcon
|
|
|
+ : inactiveButtonIcon
|
|
|
+ }
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ ))
|
|
|
+ ) : (
|
|
|
+ <MEmpty
|
|
|
+ style={{
|
|
|
+ minHeight: `calc(100vh - ${props.headerHeight}px - ${forms.height}px - ${props.bottomHeight}px - 100px)`
|
|
|
}}
|
|
|
- </Cell>
|
|
|
- ))}
|
|
|
+ description="暂无数据"
|
|
|
+ />
|
|
|
+ )}
|
|
|
</CheckboxGroup>
|
|
|
</div>
|
|
|
);
|