;(function () { function _toConsumableArray(arr) { return ( _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread() ) } function _nonIterableSpread() { throw new TypeError( 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.' ) } function _unsupportedIterableToArray(o, minLen) { if (!o) return if (typeof o === 'string') return _arrayLikeToArray(o, minLen) var n = Object.prototype.toString.call(o).slice(8, -1) if (n === 'Object' && o.constructor) n = o.constructor.name if (n === 'Map' || n === 'Set') return Array.from(o) if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen) } function _iterableToArray(iter) { if ( (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) || iter['@@iterator'] != null ) return Array.from(iter) } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr) } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i] } return arr2 } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg) var value = info.value } catch (error) { reject(error) return } if (info.done) { resolve(value) } else { Promise.resolve(value).then(_next, _throw) } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments return new Promise(function (resolve, reject) { var gen = fn.apply(self, args) function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value) } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err) } _next(undefined) }) } } var __vite_style__ = document.createElement('style') __vite_style__.innerHTML = '._subjects_1t5fp_1{padding:.4rem 0 0;background:#f6f8f9;min-height:calc(100vh - 0.4rem)}._subjects_1t5fp_1 ._subjectContainer_1t5fp_6{min-height:calc(100vh - 2.53333rem)}._subjects_1t5fp_1 ._subjectMaxLength_1t5fp_9{margin:0 .37333rem .26667rem;background:linear-gradient(139deg,#fff6ee 0%,#ffecdd 100%) #ffffff;border-radius:.26667rem;padding:.18667rem .29333rem;background:#ffffff;font-size:.37333rem;color:#ff9e5a;line-height:.58667rem}._subjects_1t5fp_1 ._title_1t5fp_19{padding:.32rem 0;margin:0 .4rem;color:#333;font-size:.42667rem;display:flex;align-items:center}._subjects_1t5fp_1 ._title_1t5fp_19:before{content:" ";display:inline-block;width:.08rem;height:.42667rem;background:#01C1B5;border-radius:.08rem;margin-right:.21333rem;vertical-align:text-bottom}._subjects_1t5fp_1 ._subject-list_1t5fp_37{display:flex;align-items:center;flex-wrap:wrap;padding:0 .26667rem}._subjects_1t5fp_1 ._subject-list_1t5fp_37 ._subject-item_1t5fp_43{position:relative;width:2.88rem;height:2.88rem;margin-right:.13333rem;margin-left:.13333rem;margin-bottom:.26667rem;border-radius:.18667rem;overflow:hidden}._subjects_1t5fp_1 ._subject-list_1t5fp_37 ._topBg_1t5fp_53{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,0) 0%,rgba(0,0,0,.54) 100%)}._subjects_1t5fp_1 ._subject-list_1t5fp_37 ._checkbox_1t5fp_61{position:absolute;right:.18667rem;top:.18667rem}._subjects_1t5fp_1 ._subject-list_1t5fp_37 ._name_1t5fp_66{position:absolute;bottom:.18667rem;left:.18667rem;font-size:.42667rem;font-weight:500;color:#fff;line-height:.58667rem}._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-checkbox__icon,._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-radio__icon{height:.58667rem}._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-checkbox__icon .van-icon,._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-radio__icon .van-icon{border:0;background-color:transparent}._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-checkbox__icon--checked .van-icon,._subjects_1t5fp_1 ._subject-list_1t5fp_37 .van-radio__icon--checked .van-icon{background-color:transparent;border:transparent}\n' document.head.appendChild(__vite_style__) System.register( [ './vendor-legacy.09f20d09.js', './index-legacy.f25f109a13.js', './index-legacy.f25f109a14.js', './index-legacy.f25f109a2.js', './index-legacy.637f35565.js', './index-legacy.f25f109a3.js', './checkbox_default-legacy.88950e5d.js', './index-legacy.595c24c3.js' ], function (exports) { 'use strict' var defineComponent, Toast, createVNode, CheckboxGroup, createTextVNode, Fragment, Image, Loading, Checkbox, Icon, RadioGroup, Radio, Sticky, Button, checkBoxActive, checkBoxDefault, ColResult return { setters: [ function (module) { defineComponent = module.d Toast = module.T createVNode = module.a CheckboxGroup = module.a4 createTextVNode = module.j Fragment = module.F Image = module.I Loading = module.L Checkbox = module.a5 Icon = module.K RadioGroup = module.ac Radio = module.ad Sticky = module.S Button = module.B }, function () {}, function () {}, function () {}, function () {}, function () {}, function (module) { checkBoxActive = module.c checkBoxDefault = module.a }, function (module) { ColResult = module.C } ], execute: function execute() { var subjects = '_subjects_1t5fp_1' var subjectContainer = '_subjectContainer_1t5fp_6' var subjectMaxLength = '_subjectMaxLength_1t5fp_9' var title = '_title_1t5fp_19' var topBg = '_topBg_1t5fp_53' var checkbox = '_checkbox_1t5fp_61' var name = '_name_1t5fp_66' var styles = { subjects: subjects, subjectContainer: subjectContainer, subjectMaxLength: subjectMaxLength, title: title, 'subject-list': '_subject-list_1t5fp_37', 'subject-item': '_subject-item_1t5fp_43', topBg: topBg, checkbox: checkbox, name: name } var SubjectModel = exports( 'S', defineComponent({ name: 'SubjectList', props: { onChoice: { type: Function, default: function _default(item) {} }, choiceSubjectIds: { type: Array, default: [] }, subjectList: { type: Array, default: [] }, max: { // 最多可选数量 type: Number, default: 5 }, selectType: { // 选择类型,Radio:单选,Checkbox:多选 type: String, default: 'Checkbox' }, single: { // 单选模式 type: Boolean, default: false } }, data: function data() { return { checkBox: [], checkboxRefs: [], radio: null // 单选 } }, mounted: function mounted() { var _this = this return _asyncToGenerator( /*#__PURE__*/ regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch ((_context.prev = _context.next)) { case 0: if (_this.selectType === 'Radio') { _this.radio = _this.choiceSubjectIds[0] } else { _this.checkBox = _this.choiceSubjectIds } case 1: case 'end': return _context.stop() } } }, _callee) }) )() }, watch: { choiceSubjectIds: function choiceSubjectIds(val, oldVal) { // 同步更新显示数据 this.checkBox = _toConsumableArray(val) } }, methods: { onSelect: function onSelect(id) { if (this.selectType === 'Checkbox') { if ( this.max === this.checkBox.length && !this.checkBox.includes(id) ) { Toast( '\u4E50\u5668\u6700\u591A\u9009\u62E9'.concat( this.max, '\u4E2A' ) ) } this.checkboxRefs[id].toggle() } else if (this.selectType === 'Radio') { this.radio = id } } }, render: function render() { var _this2 = this return createVNode('div', { class: styles.subjects }, [ createVNode('div', { class: styles.subjectContainer }, [ this.subjectList.length ? this.selectType === 'Checkbox' ? createVNode( CheckboxGroup, { modelValue: this.checkBox, 'onUpdate:modelValue': function onUpdateModelValue($event) { return (_this2.checkBox = $event) }, max: this.max }, { default: function _default() { return [ createVNode( 'div', { class: styles.subjectMaxLength }, [ createTextVNode( '\u6700\u591A\u53EF\u9009\u62E9' ), _this2.max, createTextVNode('\u4E2A\u4E50\u5668') ] ), !_this2.single && _this2.subjectList.map(function (item) { return item.subjects && item.subjects.length > 0 ? createVNode(Fragment, null, [ createVNode( 'div', { class: styles.title }, [item.name] ), createVNode( 'div', { class: styles['subject-list'] }, [ item.subjects && item.subjects.map(function ( sub ) { return createVNode( 'div', { class: styles[ 'subject-item' ], onClick: function onClick() { return _this2.onSelect( sub.id ) } }, [ createVNode( Image, { src: sub.img || 'xxx', width: '100%', height: '100%', fit: 'cover' }, { loading: function loading() { return createVNode( Loading, { type: 'spinner', size: 20 }, null ) } } ), createVNode( 'div', { class: styles.topBg }, [ createVNode( Checkbox, { name: sub.id, class: styles.checkbox, disabled: true, ref: function ref( el ) { return (_this2.checkboxRefs[ sub.id ] = el) } }, { icon: function icon( props ) { return createVNode( Icon, { name: props.checked ? checkBoxActive : checkBoxDefault, size: '20' }, null ) } } ), createVNode( 'p', { class: styles.name }, [sub.name] ) ] ) ] ) }) ] ) ]) : null }), _this2.single ? createVNode( 'div', { class: styles['subject-list'] }, [ _this2.subjectList.map(function ( item ) { return createVNode( 'div', { class: styles['subject-item'], onClick: function onClick() { return _this2.onSelect( item.id ) } }, [ createVNode( Image, { src: item.img || 'xxx', width: '100%', height: '100%', fit: 'cover' }, { loading: function loading() { return createVNode( Loading, { type: 'spinner', size: 20 }, null ) } } ), createVNode( 'div', { class: styles.topBg }, [ createVNode( Checkbox, { name: item.id, class: styles.checkbox, disabled: true, ref: function ref(el) { return (_this2.checkboxRefs[ item.id ] = el) } }, { icon: function icon( props ) { return createVNode( Icon, { name: props.checked ? checkBoxActive : checkBoxDefault, size: '20' }, null ) } } ), createVNode( 'p', { class: styles.name }, [item.name] ) ] ) ] ) }) ] ) : null ] } } ) : createVNode( RadioGroup, { modelValue: this.radio, 'onUpdate:modelValue': function onUpdateModelValue($event) { return (_this2.radio = $event) } }, { default: function _default() { return [ !_this2.single && _this2.subjectList.map(function (item) { return item.subjects && item.subjects.length > 0 ? createVNode(Fragment, null, [ createVNode( 'div', { class: styles.title }, [item.name] ), createVNode( 'div', { class: styles['subject-list'] }, [ item.subjects && item.subjects.map(function ( sub ) { return createVNode( 'div', { class: styles[ 'subject-item' ], onClick: function onClick() { return _this2.onSelect( sub.id ) } }, [ createVNode( Image, { src: sub.img || 'xxx', width: '100%', height: '100%', fit: 'cover' }, { loading: function loading() { return createVNode( Loading, { type: 'spinner', size: 20 }, null ) } } ), createVNode( 'div', { class: styles.topBg }, [ createVNode( Radio, { name: sub.id, class: styles.checkbox }, { icon: function icon( props ) { return createVNode( Icon, { name: props.checked ? checkBoxActive : checkBoxDefault, size: '20' }, null ) } } ), createVNode( 'p', { class: styles.name }, [sub.name] ) ] ) ] ) }) ] ) ]) : null }), _this2.single ? createVNode( 'div', { class: styles['subject-list'] }, [ _this2.subjectList.map(function ( item ) { return createVNode( 'div', { class: styles['subject-item'], onClick: function onClick() { return _this2.onSelect( item.id ) } }, [ createVNode( Image, { src: item.img || 'xxx', width: '100%', height: '100%', fit: 'cover' }, { loading: function loading() { return createVNode( Loading, { type: 'spinner', size: 20 }, null ) } } ), createVNode( 'div', { class: styles.topBg }, [ createVNode( Radio, { name: item.id, class: styles.checkbox }, { icon: function icon( props ) { return createVNode( Icon, { name: props.checked ? checkBoxActive : checkBoxDefault, size: '20' }, null ) } } ), createVNode( 'p', { class: styles.name }, [item.name] ) ] ) ] ) }) ] ) : null ] } } ) : createVNode( ColResult, { tips: '暂无声部数据', btnStatus: false }, null ) ]), this.subjectList.length > 0 && createVNode( Sticky, { offsetBottom: 0, position: 'bottom' }, { default: function _default() { return [ createVNode('div', { class: 'btnGroup' }, [ createVNode( Button, { round: true, block: true, type: 'primary', style: { width: '96%', margin: '0 auto' }, onClick: function onClick() { return _this2.onChoice( _this2.selectType === 'Checkbox' ? _this2.checkBox : _this2.radio ) } }, { default: function _default() { return [createTextVNode('\u786E\u5B9A')] } } ) ]) ] } } ) ]) } }) ) } } } ) })()