|
@@ -6,7 +6,8 @@ import {
|
|
|
Image,
|
|
|
Loading,
|
|
|
Radio,
|
|
|
- RadioGroup
|
|
|
+ RadioGroup,
|
|
|
+ Sticky
|
|
|
} from 'vant'
|
|
|
import { defineComponent, PropType } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
@@ -69,212 +70,216 @@ export default defineComponent({
|
|
|
render() {
|
|
|
return (
|
|
|
<div class={styles.subjects}>
|
|
|
- {this.subjectList.length ? (
|
|
|
- this.selectType === 'Checkbox' ? (
|
|
|
- <CheckboxGroup v-model={this.checkBox} max={this.max}>
|
|
|
- {!this.single &&
|
|
|
- this.subjectList.map((item: any) =>
|
|
|
- item.subjects && item.subjects.length > 0 ? (
|
|
|
- <>
|
|
|
- <div class={styles.title}>{item.name}</div>
|
|
|
- <div class={styles['subject-list']}>
|
|
|
- {item.subjects &&
|
|
|
- item.subjects.map((sub: any) => (
|
|
|
- <div
|
|
|
- class={styles['subject-item']}
|
|
|
- onClick={() => this.onSelect(sub.id)}
|
|
|
- >
|
|
|
- <Image
|
|
|
- src={sub.img}
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- fit="cover"
|
|
|
- v-slots={{
|
|
|
- loading: () => (
|
|
|
- <Loading type="spinner" size={20} />
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- <div class={styles.topBg}>
|
|
|
- <Checkbox
|
|
|
- name={sub.id}
|
|
|
- class={styles.checkbox}
|
|
|
- disabled
|
|
|
- ref={(el: any) =>
|
|
|
- (this.checkboxRefs[sub.id] = el)
|
|
|
- }
|
|
|
+ <div class={styles.subjectContainer}>
|
|
|
+ {this.subjectList.length ? (
|
|
|
+ this.selectType === 'Checkbox' ? (
|
|
|
+ <CheckboxGroup v-model={this.checkBox} max={this.max}>
|
|
|
+ {!this.single &&
|
|
|
+ this.subjectList.map((item: any) =>
|
|
|
+ item.subjects && item.subjects.length > 0 ? (
|
|
|
+ <>
|
|
|
+ <div class={styles.title}>{item.name}</div>
|
|
|
+ <div class={styles['subject-list']}>
|
|
|
+ {item.subjects &&
|
|
|
+ item.subjects.map((sub: any) => (
|
|
|
+ <div
|
|
|
+ class={styles['subject-item']}
|
|
|
+ onClick={() => this.onSelect(sub.id)}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ src={sub.img}
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ fit="cover"
|
|
|
v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- name={
|
|
|
- props.checked
|
|
|
- ? checkBoxActive
|
|
|
- : checkBoxDefault
|
|
|
- }
|
|
|
- size="22"
|
|
|
- />
|
|
|
+ loading: () => (
|
|
|
+ <Loading type="spinner" size={20} />
|
|
|
)
|
|
|
}}
|
|
|
/>
|
|
|
- <p class={styles.name}>{sub.name}</p>
|
|
|
+ <div class={styles.topBg}>
|
|
|
+ <Checkbox
|
|
|
+ name={sub.id}
|
|
|
+ class={styles.checkbox}
|
|
|
+ disabled
|
|
|
+ ref={(el: any) =>
|
|
|
+ (this.checkboxRefs[sub.id] = el)
|
|
|
+ }
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ name={
|
|
|
+ props.checked
|
|
|
+ ? checkBoxActive
|
|
|
+ : checkBoxDefault
|
|
|
+ }
|
|
|
+ size="22"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <p class={styles.name}>{sub.name}</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- </>
|
|
|
- ) : null
|
|
|
- )}
|
|
|
- {this.single ? (
|
|
|
- <div class={styles['subject-list']}>
|
|
|
- {this.subjectList.map((item: any) => (
|
|
|
- <div
|
|
|
- class={styles['subject-item']}
|
|
|
- onClick={() => this.onSelect(item.id)}
|
|
|
- >
|
|
|
- <Image
|
|
|
- src={item.img}
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- fit="cover"
|
|
|
- v-slots={{
|
|
|
- loading: () => <Loading type="spinner" size={20} />
|
|
|
- }}
|
|
|
- />
|
|
|
- <div class={styles.topBg}>
|
|
|
- <Checkbox
|
|
|
- name={item.id}
|
|
|
- class={styles.checkbox}
|
|
|
- disabled
|
|
|
- ref={(el: any) => (this.checkboxRefs[item.id] = el)}
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : null
|
|
|
+ )}
|
|
|
+ {this.single ? (
|
|
|
+ <div class={styles['subject-list']}>
|
|
|
+ {this.subjectList.map((item: any) => (
|
|
|
+ <div
|
|
|
+ class={styles['subject-item']}
|
|
|
+ onClick={() => this.onSelect(item.id)}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ src={item.img}
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ fit="cover"
|
|
|
v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- name={
|
|
|
- props.checked
|
|
|
- ? checkBoxActive
|
|
|
- : checkBoxDefault
|
|
|
- }
|
|
|
- size="22"
|
|
|
- />
|
|
|
- )
|
|
|
+ loading: () => <Loading type="spinner" size={20} />
|
|
|
}}
|
|
|
/>
|
|
|
- <p class={styles.name}>{item.name}</p>
|
|
|
+ <div class={styles.topBg}>
|
|
|
+ <Checkbox
|
|
|
+ name={item.id}
|
|
|
+ class={styles.checkbox}
|
|
|
+ disabled
|
|
|
+ ref={(el: any) => (this.checkboxRefs[item.id] = el)}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ name={
|
|
|
+ props.checked
|
|
|
+ ? checkBoxActive
|
|
|
+ : checkBoxDefault
|
|
|
+ }
|
|
|
+ size="22"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <p class={styles.name}>{item.name}</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
- </CheckboxGroup>
|
|
|
- ) : (
|
|
|
- <RadioGroup v-model={this.radio}>
|
|
|
- {!this.single &&
|
|
|
- this.subjectList.map((item: any) =>
|
|
|
- item.subjects && item.subjects.length > 0 ? (
|
|
|
- <>
|
|
|
- <div class={styles.title}>{item.name}</div>
|
|
|
- <div class={styles['subject-list']}>
|
|
|
- {item.subjects &&
|
|
|
- item.subjects.map((sub: any) => (
|
|
|
- <div
|
|
|
- class={styles['subject-item']}
|
|
|
- onClick={() => this.onSelect(sub.id)}
|
|
|
- >
|
|
|
- <Image
|
|
|
- src={sub.img}
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- fit="cover"
|
|
|
- v-slots={{
|
|
|
- loading: () => (
|
|
|
- <Loading type="spinner" size={20} />
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- <div class={styles.topBg}>
|
|
|
- <Radio
|
|
|
- name={sub.id}
|
|
|
- class={styles.checkbox}
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ </CheckboxGroup>
|
|
|
+ ) : (
|
|
|
+ <RadioGroup v-model={this.radio}>
|
|
|
+ {!this.single &&
|
|
|
+ this.subjectList.map((item: any) =>
|
|
|
+ item.subjects && item.subjects.length > 0 ? (
|
|
|
+ <>
|
|
|
+ <div class={styles.title}>{item.name}</div>
|
|
|
+ <div class={styles['subject-list']}>
|
|
|
+ {item.subjects &&
|
|
|
+ item.subjects.map((sub: any) => (
|
|
|
+ <div
|
|
|
+ class={styles['subject-item']}
|
|
|
+ onClick={() => this.onSelect(sub.id)}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ src={sub.img}
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ fit="cover"
|
|
|
v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- name={
|
|
|
- props.checked
|
|
|
- ? checkBoxActive
|
|
|
- : checkBoxDefault
|
|
|
- }
|
|
|
- size="22"
|
|
|
- />
|
|
|
+ loading: () => (
|
|
|
+ <Loading type="spinner" size={20} />
|
|
|
)
|
|
|
}}
|
|
|
/>
|
|
|
- <p class={styles.name}>{sub.name}</p>
|
|
|
+ <div class={styles.topBg}>
|
|
|
+ <Radio
|
|
|
+ name={sub.id}
|
|
|
+ class={styles.checkbox}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ name={
|
|
|
+ props.checked
|
|
|
+ ? checkBoxActive
|
|
|
+ : checkBoxDefault
|
|
|
+ }
|
|
|
+ size="22"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <p class={styles.name}>{sub.name}</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- </>
|
|
|
- ) : null
|
|
|
- )}
|
|
|
- {this.single ? (
|
|
|
- <div class={styles['subject-list']}>
|
|
|
- {this.subjectList.map((item: any) => (
|
|
|
- <div
|
|
|
- class={styles['subject-item']}
|
|
|
- onClick={() => this.onSelect(item.id)}
|
|
|
- >
|
|
|
- <Image
|
|
|
- src={item.img}
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- fit="cover"
|
|
|
- v-slots={{
|
|
|
- loading: () => <Loading type="spinner" size={20} />
|
|
|
- }}
|
|
|
- />
|
|
|
- <div class={styles.topBg}>
|
|
|
- <Radio
|
|
|
- name={item.id}
|
|
|
- class={styles.checkbox}
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : null
|
|
|
+ )}
|
|
|
+ {this.single ? (
|
|
|
+ <div class={styles['subject-list']}>
|
|
|
+ {this.subjectList.map((item: any) => (
|
|
|
+ <div
|
|
|
+ class={styles['subject-item']}
|
|
|
+ onClick={() => this.onSelect(item.id)}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ src={item.img}
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ fit="cover"
|
|
|
v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- name={
|
|
|
- props.checked
|
|
|
- ? checkBoxActive
|
|
|
- : checkBoxDefault
|
|
|
- }
|
|
|
- size="22"
|
|
|
- />
|
|
|
- )
|
|
|
+ loading: () => <Loading type="spinner" size={20} />
|
|
|
}}
|
|
|
/>
|
|
|
- <p class={styles.name}>{item.name}</p>
|
|
|
+ <div class={styles.topBg}>
|
|
|
+ <Radio
|
|
|
+ name={item.id}
|
|
|
+ class={styles.checkbox}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ name={
|
|
|
+ props.checked
|
|
|
+ ? checkBoxActive
|
|
|
+ : checkBoxDefault
|
|
|
+ }
|
|
|
+ size="22"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <p class={styles.name}>{item.name}</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
- </RadioGroup>
|
|
|
- )
|
|
|
- ) : (
|
|
|
- <ColResult tips="暂无声部数据" btnStatus={false} />
|
|
|
- )}
|
|
|
-
|
|
|
- <div class={styles['btn-group']}>
|
|
|
- <Button
|
|
|
- round
|
|
|
- block
|
|
|
- type="primary"
|
|
|
- onClick={() =>
|
|
|
- this.onChoice(
|
|
|
- this.selectType === 'Checkbox' ? this.checkBox : this.radio
|
|
|
- )
|
|
|
- }
|
|
|
- >
|
|
|
- 确定
|
|
|
- </Button>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ </RadioGroup>
|
|
|
+ )
|
|
|
+ ) : (
|
|
|
+ <ColResult tips="暂无声部数据" btnStatus={false} />
|
|
|
+ )}
|
|
|
</div>
|
|
|
+
|
|
|
+ <Sticky offsetBottom={0} position="bottom">
|
|
|
+ <div class={'btnGroup'}>
|
|
|
+ <Button
|
|
|
+ round
|
|
|
+ block
|
|
|
+ type="primary"
|
|
|
+ onClick={() =>
|
|
|
+ this.onChoice(
|
|
|
+ this.selectType === 'Checkbox' ? this.checkBox : this.radio
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 确定
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </Sticky>
|
|
|
</div>
|
|
|
)
|
|
|
}
|