UNPKG

qm-bus

Version:

千米公有云业务组件库

97 lines (76 loc) 2.03 kB
import { DataViewStore } from 'qm-ux' import CategoryActor from './actor/category-actor' import GalleryActor from './actor/gallery-actor' import UploadActor from './actor/upload-actor' export default class AppStore extends DataViewStore { bindActor() { let actors = super.bindActor() actors = actors.concat([new CategoryActor(), new GalleryActor(), new UploadActor()]) return actors } constructor(props) { super(props) } /** * 切换视图 */ switchview = value => this.dispatch('gallery:view', value) uploadSwitch = value => { this.dispatch('upload:switch', value) } initCategory = value => { this.dispatch('initCategory', value) } initLeaves = value => { this.dispatch('initLeaves', value) } expand = expandedKeys => { this.dispatch('cate:expand', expandedKeys) } onFormReset = group => { this.dispatch('form:reset', group) this.dispatch('gallery:searchKey', '') } onSearch = value => { this.dispatch('gallery:searchKey', value) } addNetImage = value => { this.dispatch('upload:addNetImage', value) } removeNetImage = value => { this.dispatch('upload:removeNetImage', value) } addImage = value => { this.dispatch('upload:addImage', value) } removeImage = value => { this.dispatch('upload:removeImage', value) } addVideo = value => { this.dispatch('upload:addVideo', value) } removeVideo = value => { this.dispatch('upload:removeVideo', value) } uploadClearAll = () => { this.dispatch('upload:clearAll') } setLinkAddress = value => { this.dispatch('upload:setLinkAddress', value) } set = ({ limit, scope, fileType }) => { this.batchDispatch([ ['gallery:update:limit', limit], ['gallery:update:scope', scope], ['gallery:update:fileType', fileType], ]) } onRefresh = () => { this.batchDispatch([ ['page:update', { pageCurrent: 1 }], ['net:loading', true], 'form:syncSnap', ]) this.fetchData() } }