123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920 |
- <template>
- <div class="table-select">
- <span class="title">{{title}}</span>
- <div class="close-btn"><i class="iconfont icon-pop-ups_shut-down" @click="$emit('cancle')"></i></div>
- <div class="material-tab">
- <a v-if="selectableType.includes('image')" class="material-tab-item" @click.prevent="currentMaterialType = 'image'">
- <span class="text">图片</span>
- <div v-if="currentMaterialType === 'image'" class="bottom-line"></div>
- </a>
- <a v-if="selectableType.includes('pano')" class="material-tab-item" @click.prevent="currentMaterialType = 'pano'">
- <span class="text">全景图</span>
- <div v-if="currentMaterialType === 'pano'" class="bottom-line"></div>
- </a>
- <a v-if="selectableType.includes('audio')" class="material-tab-item" @click.prevent="currentMaterialType = 'audio'">
- <span class="text">音频</span>
- <div v-if="currentMaterialType === 'audio'" class="bottom-line"></div>
- </a>
- <a v-if="selectableType.includes('video')" class="material-tab-item" @click.prevent="currentMaterialType = 'video'">
- <span class="text">视频</span>
- <div v-if="currentMaterialType === 'video'" class="bottom-line"></div>
- </a>
- <a v-if="selectableType.includes('3D')" class="material-tab-item" @click.prevent="currentMaterialType = '3D'">
- <span class="text">三维场景</span>
- <div v-if="currentMaterialType === '3D'" class="bottom-line"></div>
- </a>
- </div>
-
- <div class="filter">
- <input type="text" placeholder="输入关键词" v-model="searchKey"/>
- <i v-if="!searchKey" class="iconfont icon-editor_search search-icon"/>
- <i v-if="searchKey" @click="searchKey=''" class="iconfont icontoast_red clear-icon"></i>
- </div>
- <div class="table table-image" v-show="currentMaterialType === 'image'">
- <div class="table-head-row">
- <span class="table-head nothing" v-if="!isMultiSelection">1</span>
- <span class="table-head select-all-checkbox-wrapper" v-if="isMultiSelection">
- <div v-show="!isAllSelected" class="unchecked" @click="onSelectAll"></div>
- <img v-show="isAllSelected" class="checked" @click="onUnselectAll" src="@/assets/images/icons/checkbox.png" />
- </span>
- <span class="table-head" v-for="(item,i) in tableHeadersForImage" :key="i">{{item.name}}</span>
- </div>
- <div
- v-if="imageListRealLength !== 0 || hasMoreImageData"
- class="table-body"
- v-infinite-scroll="requestMoreImageData"
- :infinite-scroll-disabled="!hasMoreImageData || isRequestingMoreImageData"
- >
- <!-- vuex中的上传中数据 -->
- <div class="table-body-row" v-for="(item, i) in uploadStatusListImage" :key="item.uid">
- <!-- 如果已经上传成功 -->
- <template v-if="item.status === 'SUCCESS'">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item.successInfo[primaryKey])"
- @change="v => selectItem(item.successInfo, v)"
- />
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForImage" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img :src="item.successInfo[tableItemStructure.key] + `?x-oss-process=image/resize,p_10&${Math.random()}`" alt="">
- </div>
- <span v-else class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.successInfo[tableItemStructure.key] : ''">{{ item.successInfo[tableItemStructure.key] }}</span>
- </span>
- </template>
- <!-- 如果还在上传中 -->
- <template v-else-if="item.status = 'LOADING'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForImage" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img src="@/assets/images/icons/upload-file-type-icon-image@2x.png" alt="">
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'dpi'"></span>
- <span v-if="tableItemStructure.key === 'dpi'">上传素材 {{Math.round(item.progress * 100)}}%</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- <!-- 如果上传失败了 -->
- <template v-else-if="item.status = 'FAIL'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForImage" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img src="@/assets/images/icons/upload-file-type-icon-image@2x.png" alt="">
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'dpi'"></span>
- <span v-if="tableItemStructure.key === 'dpi'">上传失败</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- </div>
- <!-- 本组件内的列表数据 -->
- <div class="table-body-row" v-for="(item,i) in imageList" :key="i">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item[primaryKey])"
- @change="v => selectItem(item, v)"
- />
- </span>
- <span class="table-data" v-for="(sub,idx) in tableHeadersForImage" :key="idx">
- <div v-if="sub.type=='image'" class="list-img">
- <img :src="item[sub.key] + `?x-oss-process=image/resize,p_10&${Math.random()}`" alt="">
- </div>
- <span class="ellipsis" v-else v-title="sub.key === 'name' ? item[sub.key] : ''">{{ item[sub.key] }}</span>
- </span>
- </div>
- </div>
- <!-- 无数据时的提示 -->
- <div v-else class="no-data">
- <div v-if="latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04_search.png')" alt="">
- <span>{{'未搜索到结果~'}}</span>
- </div>
- <div v-if="!latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04.png')" alt="">
- <span>{{'暂无素材~'}}</span>
- </div>
- </div>
- </div>
- <div class="table table-pano" v-show="currentMaterialType === 'pano'">
- <div class="table-head-row">
- <span class="table-head nothing" v-if="!isMultiSelection">1</span>
- <span class="table-head select-all-checkbox-wrapper" v-if="isMultiSelection">
- <div v-show="!isAllSelected" class="unchecked" @click="onSelectAll"></div>
- <div v-show="isAllSelected" class="checked" @click="onUnselectAll"></div>
- </span>
- <span class="table-head" v-for="(item,i) in tableHeadersForPano" :key="i">{{item.name}}</span>
- </div>
- <div
- v-if="panoListRealLength !== 0 || hasMorePanoData"
- class="table-body"
- v-infinite-scroll="requestMorePanoData"
- :infinite-scroll-disabled="!hasMorePanoData || isRequestingMorePanoData"
- >
- <!-- vuex中的上传中数据 -->
- <div class="table-body-row" v-for="(item, i) in uploadStatusListPano" :key="item.uid">
- <!-- 如果已经上传成功 -->
- <template v-if="item.status === 'SUCCESS'">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item.successInfo[primaryKey])"
- @change="v => selectItem(item.successInfo, v)"
- />
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForPano" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img :src="item.successInfo[tableItemStructure.key] + `?x-oss-process=image/resize,p_10&${Math.random()}`" alt="">
- </div>
- <span v-else class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.successInfo[tableItemStructure.key] : ''">{{ item.successInfo[tableItemStructure.key] }}</span>
- </span>
- </template>
- <!-- 如果还在上传或切图处理中 -->
- <template v-else-if="item.status = 'LOADING'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForPano" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img src="@/assets/images/icons/upload-file-type-icon-image@2x.png" alt="">
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize' && item.ifKnowProgress">上传素材 {{Math.round(item.progress * 100)}}%</span>
- <span v-if="tableItemStructure.key === 'fileSize' && !item.ifKnowProgress">{{item.statusText}}</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- <!-- 如果上传失败了 -->
- <template v-else-if="item.status = 'FAIL'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForPano" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img src="@/assets/images/icons/upload-file-type-icon-image@2x.png" alt="">
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize'">上传失败</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- </div>
- <!-- 本组件内的列表数据 -->
- <div class="table-body-row" v-for="(item,i) in panoList" :key="i">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item[primaryKey])"
- @change="v => selectItem(item, v)"
- />
- </span>
- <span class="table-data" v-for="(sub,idx) in tableHeadersForPano" :key="idx">
- <div v-if="sub.type=='image'" class="list-img">
- <img :src="item[sub.key] + `?x-oss-process=image/resize,p_10&${Math.random()}`" alt="">
- </div>
- <span class="ellipsis" v-else v-title="sub.key === 'name' ? item[sub.key] : ''">{{item[sub.key]}}</span>
- </span>
- </div>
- </div>
- <!-- 无数据时的提示 -->
- <div v-if="panoList.length === 0 && !hasMorePanoData" class="no-data">
- <div v-if="latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04_search.png')" alt="">
- <span>{{'未搜索到结果~'}}</span>
- </div>
- <div v-if="!latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04.png')" alt="">
- <span>{{'暂无素材~'}}</span>
- </div>
- </div>
- </div>
- <div class="table table-audio" v-show="currentMaterialType === 'audio'">
- <div class="table-head-row">
- <span class="table-head nothing" v-if="!isMultiSelection">1</span>
- <span class="table-head select-all-checkbox-wrapper" v-if="isMultiSelection">
- <div v-show="!isAllSelected" class="unchecked" @click="onSelectAll"></div>
- <div v-show="isAllSelected" class="checked" @click="onUnselectAll"></div>
- </span>
- <span class="table-head" v-for="(item,i) in tableHeadersForAudio" :key="i">{{item.name}}</span>
- </div>
- <div
- v-if="audioListRealLength !== 0 || hasMoreAudioData"
- class="table-body"
- v-infinite-scroll="requestMoreAudioData"
- :infinite-scroll-disabled="!hasMoreAudioData || isRequestingMoreAudioData"
- >
- <!-- vuex中的上传中数据 -->
- <div class="table-body-row" v-for="(item, i) in uploadStatusListAudio" :key="item.uid">
- <!-- 如果已经上传成功 -->
- <template v-if="item.status === 'SUCCESS'">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item.successInfo[primaryKey])"
- @change="v => selectItem(item.successInfo, v)"
- />
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForAudio" :key="idx">
- <div v-if="tableItemStructure.type=='audio'" class="list-img">
- <!-- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-audio@2x.png')"
- style="object-fit: contain;"
- alt=""
- > -->
- <AudioIconCanPlay
- class="icon"
- :vKey="item.successInfo.id"
- :idleft="`_${$randomWord(true, 8, 8)}`"
- :idright="`_${$randomWord(true, 8, 8)}`"
- :myAudioUrl="item.successInfo.ossPath"
- ></AudioIconCanPlay>
- </div>
- <span v-else class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.successInfo[tableItemStructure.key] : ''">{{ item.successInfo[tableItemStructure.key] }}</span>
- </span>
- </template>
- <!-- 如果还在上传中 -->
- <template v-else-if="item.status = 'LOADING'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForAudio" :key="idx">
- <div v-if="tableItemStructure.type=='audio'" class="list-img">
- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-audio@2x.png')"
- style="object-fit: contain;"
- alt=""
- >
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize'">上传素材 {{Math.round(item.progress * 100)}}%</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- <!-- 如果上传失败了 -->
- <template v-else-if="item.status = 'FAIL'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForImage" :key="idx">
- <div v-if="tableItemStructure.type=='audio'" class="list-img">
- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-audio@2x.png')"
- style="object-fit: contain;"
- alt=""
- >
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize'">上传失败</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- </div>
- <!-- 本组件内的列表数据 -->
- <div class="table-body-row" v-for="(item,i) in audioList" :key="i">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item[primaryKey])"
- @change="v => selectItem(item, v)"
- />
- </span>
- <span class="table-data" v-for="(sub,idx) in tableHeadersForAudio" :key="idx">
- <div v-if="sub.type=='audio'" class="list-img">
- <!-- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-audio@2x.png')"
- style="object-fit: contain;"
- alt=""
- > -->
- <AudioIconCanPlay
- class="audio-player"
- :vKey="item.id"
- :idleft="`_${$randomWord(true, 8, 8)}`"
- :idright="`_${$randomWord(true, 8, 8)}`"
- :myAudioUrl="item.ossPath"
- ></AudioIconCanPlay>
- </div>
- <span class="ellipsis" v-else v-title="sub.key === 'name' ? item[sub.key] : ''">{{item[sub.key]}}</span>
- </span>
- </div>
- </div>
- <!-- 无数据时的提示 -->
- <div v-if="audioList.length === 0 && !hasMoreAudioData" class="no-data">
- <div v-if="latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04_search.png')" alt="">
- <span>{{'未搜索到结果~'}}</span>
- </div>
- <div v-if="!latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04.png')" alt="">
- <span>{{'暂无素材~'}}</span>
- </div>
- </div>
- </div>
- <div class="table table-video" v-show="currentMaterialType === 'video'">
- <div class="table-head-row">
- <span class="table-head nothing" v-if="!isMultiSelection">1</span>
- <span class="table-head select-all-checkbox-wrapper" v-if="isMultiSelection">
- <div v-show="!isAllSelected" class="unchecked" @click="onSelectAll"></div>
- <div v-show="isAllSelected" class="checked" @click="onUnselectAll"></div>
- </span>
- <span class="table-head" v-for="(item,i) in tableHeadersForVideo" :key="i">{{item.name}}</span>
- </div>
- <div
- v-if="videoListRealLength !== 0 || hasMoreVideoData"
- class="table-body"
- v-infinite-scroll="requestMoreVideoData"
- :infinite-scroll-disabled="!hasMoreVideoData || isRequestingMoreVideoData"
- >
- <!-- vuex中的上传中数据 -->
- <div class="table-body-row" v-for="(item, i) in uploadStatusListVideo" :key="item.uid">
- <!-- 如果已经上传成功 -->
- <template v-if="item.status === 'SUCCESS'">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item.successInfo[primaryKey])"
- @change="v => selectItem(item.successInfo, v)"
- />
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForVideo" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img
- :src="item.successInfo[tableItemStructure.key]"
- alt=""
- >
- </div>
- <span v-else class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.successInfo[tableItemStructure.key] : ''">{{ item.successInfo[tableItemStructure.key] }}</span>
- </span>
- </template>
- <!-- 如果还在上传中 -->
- <template v-else-if="item.status = 'LOADING'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForVideo" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-video@2x.png')"
- style="object-fit: contain;"
- alt=""
- >
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize'">上传素材 {{Math.round(item.progress * 100)}}%</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- <!-- 如果上传失败了 -->
- <template v-else-if="item.status = 'FAIL'">
- <span class="table-data">
- <div class="checkbox">
- <span class="for-outer-circle"></span>
- <span class="for-inner-circle disabled"></span>
- </div>
- </span>
- <span class="table-data" v-for="(tableItemStructure, idx) in tableHeadersForImage" :key="idx">
- <div v-if="tableItemStructure.type=='image'" class="list-img">
- <img
- :src="require('@/assets/images/icons/upload-file-type-icon-video@2x.png')"
- style="object-fit: contain;"
- alt=""
- >
- </div>
- <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
- <span v-if="tableItemStructure.key === 'fileSize'">上传失败</span>
- <span v-if="tableItemStructure.key === 'name'" class="ellipsis" v-title="tableItemStructure.key === 'name' ? item.title : ''">{{ item.title }}</span>
- </span>
- </template>
- </div>
- <!-- 本组件内的列表数据 -->
- <div class="table-body-row" v-for="(item,i) in videoList" :key="i">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item[primaryKey])"
- @change="v => selectItem(item, v)"
- />
- </span>
- <span class="table-data" v-for="(sub,idx) in tableHeadersForVideo" :key="idx">
- <div v-if="sub.type=='image'" class="list-img">
- <img :src="item[sub.key]" alt="">
- </div>
- <span class="ellipsis" v-else v-title="sub.key === 'name' ? item[sub.key] : ''">{{item[sub.key]}}</span>
- </span>
- </div>
- </div>
- <!-- 无数据时的提示 -->
- <div v-if="videoList.length === 0 && !hasMoreVideoData" class="no-data">
- <div v-if="latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04_search.png')" alt="">
- <span>{{'未搜索到结果~'}}</span>
- </div>
- <div v-if="!latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04.png')" alt="">
- <span>{{'暂无素材~'}}</span>
- </div>
- </div>
- </div>
- <div class="table table-3D" v-show="currentMaterialType === '3D'">
- <div class="table-head-row">
- <span class="table-head nothing" v-if="!isMultiSelection">1</span>
- <span class="table-head select-all-checkbox-wrapper" v-if="isMultiSelection">
- <div v-show="!isAllSelected" class="unchecked" @click="onSelectAll"></div>
- <div v-show="isAllSelected" class="checked" @click="onUnselectAll"></div>
- </span>
- <span class="table-head" v-for="(item,i) in tableHeadersFor3D" :key="i">{{item.name}}</span>
- </div>
- <div
- v-if="scene3DList.length !== 0 || hasMore3DData"
- class="table-body"
- v-infinite-scroll="requestMorePanoData"
- :infinite-scroll-disabled="!hasMore3DData || isRequestingMore3DData"
- >
- <div class="table-body-row" v-for="(item,i) in scene3DList" :key="i">
- <span class="table-data">
- <RadioOrCheckbox
- class="checkbox"
- :isMultiSelection="isMultiSelection"
- :isCheckedInitial="select.some(i => i[primaryKey] === item[primaryKey])"
- @change="v => selectItem(item, v)"
- />
- </span>
- <span class="table-data" v-for="(sub,idx) in tableHeadersFor3D" :key="idx">
- <div v-if="sub.type=='image'" class="list-img">
- <img :src="item[sub.key] + `?x-oss-process=image/resize,p_10&${Math.random()}`" alt="">
- </div>
- <span class="ellipsis" v-else v-title="sub.key === 'name' ? item[sub.key] : ''">{{item[sub.key]}}</span>
- </span>
- </div>
- </div>
- <!-- 无数据时的提示 -->
- <div v-if="scene3DList.length === 0 && !hasMore3DData" class="no-data">
- <div v-if="latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04_search.png')" alt="">
- <span>{{'未搜索到结果~'}}</span>
- </div>
- <div v-if="!latestUsedSearchKey">
- <img :src="require('@/assets/images/default/empty_04.png')" alt="">
- <span>{{'暂无素材~'}}</span>
- <a href="/#/">
- <button class="ui-button">如何拍摄三维场景</button>
- </a>
- </div>
- </div>
- </div>
- <div class="btns">
- <button v-if="currentMaterialType !== '3D'" class="ui-button upload-btn" @click="$refs['file-input'].click()">
- <span>上传素材</span>
- <i class="iconfont icon-material_prompt tool-tip-for-editor"
- v-tooltip="
- currentMaterialType === 'image' ? '请上传10MB以内、jpg/png格式的图片' :
- currentMaterialType === 'pano' ? '请上传2:1、120MB以内、jpg格式的图片' :
- currentMaterialType === 'audio' ? '请上传20MB以内、mp3格式的音频' :
- currentMaterialType === 'video' ? '请上传200MB以内、mp4格式的视频' : ''
- ">
- </i>
- <FileInput
- ref="file-input"
- :failString="fileInputFailString"
- :limitFailStr="fileInputLimitFailStr"
- :acceptType="fileInputAcceptType"
- :mediaType="fileInputMediaType"
- :limit="fileInputLimit"
- @file-change="onFileInputChange"
- ></FileInput>
- </button>
- <div v-else class="button-placeholder"></div>
- <div>
- <button class="ui-button deepcancel" @click="$emit('cancle')">取消</button>
- <button class="ui-button submit" :class="{disable: !select.length}" @click="$emit('submit', select)">
- 确定
- </button>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {
- getMaterialList,
- getSceneList,
- uploadMaterial,
- checkMStatus,
- } from "@/api";
- import { getImgWH, changeByteUnit } from "@/utils/file";
- import config from "@/config";
- import { debounce } from "@/utils/other.js"
- import FileInput from "@/components/shared/uploads/UploadMultiple.vue";
- import { mapState } from "vuex";
- import AudioIconCanPlay from "@/components/audio/indexForEditor.vue";
- import RadioOrCheckbox from "@/components/shared/RadioOrCheckbox.vue";
- export default {
- props:{
- title:{
- default:'',
- type:String
- },
- primaryKey: {
- default:'id'
- },
- selectableType: {
- type: Array,
- default: function() {
- return [
- 'image',
- 'pano',
- 'audio',
- 'video',
- '3D',
- ]
- },
- },
- initialMaterialType: {
- type: String,
- default: 'image',
- },
- isMultiSelection: {
- type: Boolean,
- default: false,
- }
- },
- components:{
- FileInput,
- AudioIconCanPlay,
- RadioOrCheckbox
- },
- watch:{
- searchKey: {
- handler: function () {
- this.refreshMaterialList(this.currentMaterialType)
- },
- immediate: false,
- },
- currentMaterialType: {
- handler: function (newVal) {
- if (newVal === 'image' && this.imageList.length === 0) {
- this.refreshMaterialList('image')
- } else if (newVal === 'pano' && this.panoList.length === 0) {
- this.refreshMaterialList('pano')
- } else if (newVal === 'audio' && this.audioList.length === 0) {
- this.refreshMaterialList('audio')
- } else if (newVal === 'video' && this.videoList.length === 0) {
- this.refreshMaterialList('video')
- } else if (newVal === '3D' && this.scene3DList.length === 0) {
- this.refreshMaterialList('3D')
- }
- },
- immediate: false,
- },
- needLongPolling: {
- handler: function (newVal) {
- if (!newVal) {
- clearInterval(this.longPollingIntervalId)
- this.longPollingIntervalId = null
- } else {
- console.log('need long polling!');
- clearInterval(this.longPollingIntervalId)
- this.longPollingIntervalId = null
- this.longPollingIntervalId = setInterval(() => {
- this._checkMStatus();
- }, 3000);
- }
- },
- },
- },
- computed:{
- ...mapState({
- uploadStatusListAudio: 'uploadStatusListAudio',
- uploadStatusListImage: 'uploadStatusListImage',
- uploadStatusListPano: 'uploadStatusListPano',
- uploadStatusListVideo: 'uploadStatusListVideo',
- }),
- tableHeadersForImage() {
- return this.$MAPTABLEHEADER['image'].filter(item => {
- return ['icon', 'name', 'fileSize', 'dpi'].includes(item.key)
- })
- },
- tableHeadersForPano() {
- return this.$MAPTABLEHEADER['pano'].filter(item => {
- return ['icon', 'name', 'fileSize'].includes(item.key)
- })
- },
- tableHeadersForAudio() {
- return this.$MAPTABLEHEADER['audio'].filter(item => {
- return ['ossPath', 'name', 'fileSize'].includes(item.key)
- })
- },
- tableHeadersForVideo() {
- return this.$MAPTABLEHEADER['video'].filter(item => {
- return ['icon', 'name', 'fileSize'].includes(item.key)
- })
- },
- tableHeadersFor3D() {
- return this.$MAPTABLEHEADER['scene'].filter(item => {
- return ['thumb', 'sceneName', 'createTime'].includes(item.key)
- })
- },
- fileInputFailString() {
- let ret = ''
- switch (this.currentMaterialType) {
- case 'pano':
- ret = '格式错误,请上传2:1、120MB以内、jpg格式的全景图片'
- break;
- case 'image':
- ret = '格式错误,请上传10MB以内、jpg/png格式的图片'
- break;
- case 'audio':
- ret = '格式错误,请上传20MB以内、mp3格式的音频'
- break;
- case 'video':
- ret = '格式错误,请上传200MB以内、mp4格式的视频'
- break;
- default:
- break;
- }
- return ret
- },
- fileInputLimitFailStr() {
- let ret = ''
- switch (this.currentMaterialType) {
- case 'pano':
- ret = '过大,请上传2:1、120MB以内、jpg格式的全景图片'
- break;
- case 'image':
- ret = '过大,请上传10MB以内、jpg/png格式的图片'
- break;
- case 'audio':
- ret = '过大,请上传20MB以内、mp3格式的音频'
- break;
- case 'video':
- ret = '过大,请上传200MB以内、mp4格式的视频'
- break;
- default:
- break;
- }
- return ret
- },
- fileInputAcceptType() {
- let ret = ''
- switch (this.currentMaterialType) {
- case 'pano':
- ret = 'image/jpeg'
- break;
- case 'image':
- ret = 'image/png,image/jpeg'
- break;
- case 'audio':
- ret = 'audio/mp3'
- break;
- case 'video':
- ret = 'video/mp4'
- break;
- default:
- break;
- }
- return ret
- },
- fileInputMediaType() {
- let ret = ''
- switch (this.currentMaterialType) {
- case 'pano':
- ret = 'image'
- break;
- case 'image':
- ret = 'image'
- break;
- case 'audio':
- ret = 'audio'
- break;
- case 'video':
- ret = 'video'
- break;
- default:
- break;
- }
- return ret
- },
- fileInputLimit() {
- let ret
- switch (this.currentMaterialType) {
- case 'pano':
- ret = 120
- break;
- case 'image':
- ret = 10
- break;
- case 'audio':
- ret = 20
- break;
- case 'video':
- ret = 200
- break;
- default:
- break;
- }
- return ret
- },
- imageListRealLength() {
- return this.imageList.length + this.uploadStatusListImage.filter((item) => {
- return item.status === 'SUCCESS'
- }).length
- },
- panoListRealLength() {
- return this.imageList.length + this.uploadStatusListPano.filter((item) => {
- return item.status === 'SUCCESS'
- }).length
- },
- audioListRealLength() {
- return this.audioList.length + this.uploadStatusListAudio.filter((item) => {
- return item.status === 'SUCCESS'
- }).length
- },
- videoListRealLength() {
- return this.videoList.length + this.uploadStatusListVideo.filter((item) => {
- return item.status === 'SUCCESS'
- }).length
- },
- needLongPolling() {
- return this.uploadStatusListPano.some((item) => {
- return item.status === 'LOADING' && item.ifKnowProgress === false
- })
- },
- isAllSelected() {
- let ret = false
- switch (this.currentMaterialType) {
- case 'image':
- ret = this.select.length === this.imageListRealLength && this.select.length !== 0
- break;
- case 'pano':
- ret = this.select.length === this.panoListRealLength && this.select.length !== 0
- break;
- case 'audio':
- ret = this.select.length === this.audioListRealLength && this.select.length !== 0
- break;
- case 'video':
- ret = this.select.length === this.videoListRealLength && this.select.length !== 0
- break;
- case '3D':
- ret = this.select.length === this.scene3DList.length && this.select.length !== 0
- break;
- default:
- break;
- }
- return ret
- }
- },
- data () {
- return {
- imageList: [],
- panoList: [],
- audioList: [],
- videoList: [],
- scene3DList: [],
-
- select: [],
- searchKey:'', // 搜索关键词
- latestUsedSearchKey: '',
- currentMaterialType: this.initialMaterialType,
-
- isRequestingMoreImageData: false,
- isRequestingMorePanoData: false,
- isRequestingMoreAudioData: false,
- isRequestingMoreVideoData: false,
- isRequestingMore3DData: false,
- hasMoreImageData: true,
- hasMorePanoData: true,
- hasMoreAudioData: true,
- hasMoreVideoData: true,
- hasMore3DData: true,
- longPollingIntervalId: null,
- }
- },
- methods: {
- selectItem(item, v) {
- item.materialType = this.currentMaterialType // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
- if (false) {
- // 对于图片,大于600kb的,压缩?
- } else {
- if (this.isMultiSelection) {
- if (v) {
- this.select.push(item)
- } else {
- const toDeleteIdx = this.select.findIndex((eachSelect) => {
- return eachSelect.id === item.id
- })
- if (toDeleteIdx >= 0) {
- this.select.splice(toDeleteIdx, 1)
- }
- }
- } else {
- if (v) {
- this.select = [item]
- } else {
- this.select = []
- }
- }
- }
- },
- requestMoreImageData() {
- this.isRequestingMoreImageData = true
- const latestUsedSearchKey = this.searchKey
- getMaterialList(
- {
- pageNum: Math.floor(this.imageListRealLength / config.PAGE_SIZE) + 1,
- pageSize: config.PAGE_SIZE,
- searchKey: this.searchKey,
- type: 'image',
- },
- (data) => {
- const newData = data.data.list.map((i) => {
- i.fileSize = changeByteUnit(Number(i.fileSize));
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
- return i;
- });
- this.imageList = this.imageList.concat(newData)
- if (this.imageListRealLength === data.data.total) {
- this.hasMoreImageData = false
- }
- this.isRequestingMoreImageData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- },
- () => {
- this.isRequestingMoreImageData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- }
- );
- },
- requestMorePanoData() {
- this.isRequestingMorePanoData = true
- const latestUsedSearchKey = this.searchKey
- getMaterialList(
- {
- pageNum: Math.floor(this.panoListRealLength / config.PAGE_SIZE) + 1,
- pageSize: config.PAGE_SIZE,
- searchKey: this.searchKey,
- type: 'pano',
- },
- (data) => {
- const newData = data.data.list.map((i) => {
- i.fileSize = changeByteUnit(Number(i.fileSize));
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
- return i;
- });
- this.panoList = this.panoList.concat(newData)
- if (this.panoListRealLength === data.data.total) {
- this.hasMorePanoData = false
- }
- this.isRequestingMorePanoData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- },
- () => {
- this.isRequestingMorePanoData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- }
- );
- },
- requestMoreAudioData() {
- this.isRequestingMoreAudioData = true
- const latestUsedSearchKey = this.searchKey
- getMaterialList(
- {
- pageNum: Math.floor(this.audioListRealLength / config.PAGE_SIZE) + 1,
- pageSize: config.PAGE_SIZE,
- searchKey: this.searchKey,
- type: 'audio',
- },
- (data) => {
- const newData = data.data.list.map((i) => {
- i.fileSize = changeByteUnit(Number(i.fileSize));
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
- return i;
- });
- this.audioList = this.audioList.concat(newData)
- if (this.audioListRealLength === data.data.total) {
- this.hasMoreAudioData = false
- }
- this.isRequestingMoreAudioData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- },
- () => {
- this.isRequestingMoreAudioData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- }
- );
- },
- requestMoreVideoData() {
- this.isRequestingMoreVideoData = true
- const latestUsedSearchKey = this.searchKey
- getMaterialList(
- {
- pageNum: Math.floor(this.videoListReallength / config.PAGE_SIZE) + 1,
- pageSize: config.PAGE_SIZE,
- searchKey: this.searchKey,
- type: 'video',
- },
- (data) => {
- const newData = data.data.list.map((i) => {
- i.fileSize = changeByteUnit(Number(i.fileSize));
- i.icon = i.ossPath + '?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto';
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
- return i;
- });
- this.videoList = this.videoList.concat(newData)
- if (this.videoListReallength === data.data.total) {
- this.hasMoreVideoData = false
- }
- this.isRequestingMoreVideoData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- },
- () => {
- this.isRequestingMoreVideoData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- }
- );
- },
- requestMore3DData() {
- this.isRequestingMore3DData = true
- const latestUsedSearchKey = this.searchKey
- getSceneList(
- {
- pageNum: Math.floor(this.scene3DList.length / config.PAGE_SIZE) + 1,
- pageSize: config.PAGE_SIZE,
- searchKey: this.searchKey,
- },
- (data) => {
- const newData = data.data.data.list.map((i) => {
- return i;
- });
- this.scene3DList = this.scene3DList.concat(newData)
- if (this.scene3DList.length === data.data.data.total) {
- this.hasMore3DData = false
- }
- this.isRequestingMore3DData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- },
- () => {
- this.isRequestingMore3DData = false
- this.latestUsedSearchKey = latestUsedSearchKey
- }
- )
- },
- refreshMaterialList: debounce(function(type) {
- if (type === 'image') {
- this.isRequestingMoreImageData = false
- this.hasMoreImageData = true
- this.imageList = []
- let filterResult = this.uploadStatusListImage.filter((item) => {
- return item.status === 'LOADING'
- })
- this.$store.commit('setUploadStatusListImage', filterResult)
- this.requestMoreImageData()
- } else if (type === 'pano') {
- this.isRequestingMorePanoData = false
- this.hasMorePanoData = true
- this.panoList = []
- let filterResult = this.uploadStatusListPano.filter((item) => {
- return item.status === 'LOADING'
- })
- this.$store.commit('setUploadStatusListPano', filterResult)
- this.requestMorePanoData()
- } else if (type === 'audio') {
- this.isRequestingMoreAudioData = false
- this.hasMoreAudioData = true
- this.audioList = []
- let filterResult = this.uploadStatusListAudio.filter((item) => {
- return item.status === 'LOADING'
- })
- this.$store.commit('setUploadStatusListAudio', filterResult)
- this.requestMoreAudioData()
- } else if (type === 'video') {
- this.isRequestingMoreVideoData = false
- this.hasMoreVideoData = true
- this.videoList = []
- let filterResult = this.uploadStatusListVideo.filter((item) => {
- return item.status === 'LOADING'
- })
- this.$store.commit('setUploadStatusListVideo', filterResult)
- this.requestMoreVideoData()
- } else if (type === '3D') {
- this.isRequestingMore3DData = false
- this.hasMore3DData = true
- this.scene3DList = []
- this.requestMore3DData()
- }
- }, 700, false),
- onFileInputChange(e) {
- switch (this.currentMaterialType) {
- case 'pano':
- this.onPanoFileInputChange(e)
- break;
- case 'image':
- this.onImageFileInputChange(e)
- break;
- case 'audio':
- this.onAudioFileInputChange(e)
- break;
- case 'video':
- this.onVideoFileInputChange(e)
- break;
- default:
- break;
- }
- },
- onPanoFileInputChange(e) {
- e.files.forEach(async (eachFile, i) => {
- if (
- eachFile.type.indexOf("jpeg") <= -1
- ) {
- console.log('格式不对!');
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传2:1、120MB以内、jpg格式的全景图片`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”名称过长,请上传标题在50字以内的全景图片`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- let WHRate = null
- try {
- const {width, height} = await getImgWH(eachFile)
- WHRate = width / height
- } catch(e) {
- console.error('获取图像宽高失败:', e)
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传2:1、120MB以内、jpg格式的全景图片`,
- type: "warning",
- });
- }, i * 100);
- return
- }
- if (WHRate !== 2) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传2:1、120MB以内、jpg格式的全景图片`,
- type: "warning",
- });
- }, i * 100);
- return
- }
- let itemInUploadList = {
- title: eachFile.name,
- ifKnowProgress: true,
- progress: 0,
- status: 'LOADING',
- statusText: "正在上传素材",
- uid: `u_${this.$randomWord(true, 8, 8)}`,
- abortHandler: null,
- backendId: '',
- };
- itemInUploadList.abortHandler = uploadMaterial(
- {
- file: eachFile
- },
- {
- type: 'pano',
- uid: itemInUploadList.uid,
- },
- (response) => { // 上传成功
- itemInUploadList.statusText = '正在切图处理'
- itemInUploadList.ifKnowProgress = false
- itemInUploadList.backendId = response.data.id
- },
- (err) => {
- if (err.statusText === 'abort') { // 用户取消了上传任务。
- console.log('用户取消了任务!');
- const index = this.uploadStatusListPano.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- this.uploadStatusListPano.splice(index, 1)
- } else {
- console.log('失败!');
- itemInUploadList.status = 'FAIL'
- itemInUploadList.statusText = '素材上传失败'
- }
- },
- (progress) => {
- console.log('进度:', progress);
- itemInUploadList.progress = progress
- }
- )
- this.uploadStatusListPano.unshift(itemInUploadList);
- })
- },
- onImageFileInputChange(e) {
- console.log('tableHeadersForImage: ', this.tableHeadersForImage);
-
- e.files.forEach((eachFile, i) => {
- if (
- eachFile.type.indexOf("jpeg") <= -1 &&
- eachFile.type.indexOf("png") <= -1
- ) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传10MB以内、jpg/png格式的图片`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”名称过长,请上传标题在50字以内的图片`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- let itemInUploadList = {
- title: eachFile.name,
- ifKnowProgress: true,
- progress: 0,
- status: 'LOADING',
- statusText: "正在上传素材",
- uid: `u_${this.$randomWord(true, 8, 8)}`,
- abortHandler: null,
- successInfo: null,
- };
-
- itemInUploadList.abortHandler = uploadMaterial(
- {
- file: eachFile
- },
- {
- type: 'image',
- uid: itemInUploadList.uid,
- },
- (result) => { // 上传成功
- const index = this.uploadStatusListImage.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
- this.uploadStatusListImage[index].status = 'SUCCESS'
- this.uploadStatusListImage[index].successInfo = result.data
- return i;
- },
- (err) => {
- if (err.statusText === 'abort') { // 用户取消了上传任务。
- console.log('用户取消了任务!');
- const index = this.uploadStatusListImage.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- this.uploadStatusListImage.splice(index, 1)
- } else {
- console.log('失败!');
- itemInUploadList.status = 'FAIL'
- itemInUploadList.statusText = '素材上传失败'
- }
- },
- (progress) => {
- console.log('进度:', progress);
- itemInUploadList.progress = progress
- }
- );
- this.uploadStatusListImage.unshift(itemInUploadList);
- });
- },
- onAudioFileInputChange(e) {
- e.files.forEach((eachFile, i) => {
- if (eachFile.name.toLowerCase().indexOf("mp3") <= -1) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传20MB以内、mp3格式的音频`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”名称过长,请上传标题在50字以内的音频`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- let itemInUploadList = {
- title: eachFile.name,
- ifKnowProgress: true,
- progress: 0,
- status: 'LOADING',
- statusText: "正在上传素材",
- uid: `u_${this.$randomWord(true, 8, 8)}`,
- abortHandler: null,
- };
-
- itemInUploadList.abortHandler = uploadMaterial(
- {
- file: eachFile
- },
- {
- type: 'audio',
- uid: itemInUploadList.uid,
- },
- (result) => { // 上传成功
- console.log('success');
- const index = this.uploadStatusListAudio.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
- this.uploadStatusListAudio[index].status = 'SUCCESS'
- this.uploadStatusListAudio[index].successInfo = result.data
- },
- (err) => {
- console.log('error');
- if (err.statusText === 'abort') { // 用户取消了上传任务。
- console.log('用户取消了');
- const index = this.uploadStatusListAudio.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- this.uploadStatusListAudio.splice(index, 1)
- } else {
- console.log('上传失败');
- itemInUploadList.status = 'FAIL'
- itemInUploadList.statusText = '素材上传失败'
- }
- },
- (progress) => {
- console.log('progress');
- itemInUploadList.progress = progress
- }
- );
- this.uploadStatusListAudio.unshift(itemInUploadList);
- });
- },
- onVideoFileInputChange(e) {
- e.files.forEach((eachFile, i) => {
- if (eachFile.name.toLowerCase().indexOf("mp4") <= -1) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”格式错误,请上传200MB以内、mp4格式的视频`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
- setTimeout(() => {
- this.$msg({
- message: `“${eachFile.name}”名称过长,请上传标题在50字以内的视频`,
- type: "warning",
- });
- }, i * 100);
- return;
- }
- let itemInUploadList = {
- title: eachFile.name,
- ifKnowProgress: true,
- progress: 0,
- status: 'LOADING',
- statusText: "正在上传素材",
- uid: `u_${this.$randomWord(true, 8, 8)}`,
- abortHandler: null,
- };
-
- itemInUploadList.abortHandler = uploadMaterial(
- {
- file: eachFile
- },
- {
- type: 'video',
- uid: itemInUploadList.uid,
- },
- (result) => { // 上传成功
- console.log('成功!');
- const index = this.uploadStatusListVideo.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
- result.data.icon = result.data.ossPath + '?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto';
- this.uploadStatusListVideo[index].status = 'SUCCESS'
- this.uploadStatusListVideo[index].successInfo = result.data
- },
- (err) => {
- if (err.statusText === 'abort') { // 用户取消了上传任务。
- const index = this.uploadStatusListVideo.findIndex((eachItem) => {
- return eachItem.uid === itemInUploadList.uid
- })
- this.uploadStatusListVideo.splice(index, 1)
- } else {
- itemInUploadList.status = 'FAIL'
- itemInUploadList.statusText = '素材上传失败'
- }
- },
- (progress) => {
- console.log('进度:', progress);
- itemInUploadList.progress = progress
- }
- );
- this.uploadStatusListVideo.unshift(itemInUploadList);
- });
- },
- _checkMStatus() {
- let needPollingTaskList = this.uploadStatusListPano.filter((item) => item.status === 'LOADING' && item.ifKnowProgress === false);
- if (needPollingTaskList.length > 0) {
- checkMStatus(
- {
- ids: needPollingTaskList.map((item) => item.backendId),
- islongpolling: true,
- },
- (res) => {
- // 1切图中,2失败,3成功
- res.data.forEach(eachRes => {
- if (eachRes.status === 2) {
- const index = this.uploadStatusListPano.findIndex(eachTask => eachTask.backendId === eachRes.id)
- if (index >= 0) {
- const targetItem = this.uploadStatusListPano[index]
- targetItem.status = 'FAIL'
- targetItem.statusText = '素材切图失败'
- targetItem.ifKnowProgress = true
- }
- } else if (eachRes.status === 3) {
- const index = this.uploadStatusListPano.findIndex(eachTask => eachTask.backendId === eachRes.id)
- if (index >= 0) {
- const targetItem = this.uploadStatusListPano[index]
- targetItem.status = 'SUCCESS'
- eachRes.fileSize = changeByteUnit(Number(eachRes.fileSize));
- targetItem.successInfo = eachRes
- }
- }
- });
- }
- );
- }
- },
- onUnselectAll() {
- this.select = []
- },
- onSelectAll() {
- this.select = []
- switch (this.currentMaterialType) {
- case 'image':
- for (const iterator of this.uploadStatusListImage) {
- if (iterator.status === 'SUCCESS') {
- this.select.push(iterator.successInfo)
- }
- }
- for (const iterator of this.imageList) {
- this.select.push(iterator)
- }
- break;
- case 'pano':
- for (const iterator of this.uploadStatusListPano) {
- if (iterator.status === 'SUCCESS') {
- this.select.push(iterator.successInfo)
- }
- }
- for (const iterator of this.panoList) {
- this.select.push(iterator)
- }
- break;
- case 'audio':
- for (const iterator of this.uploadStatusListAudio) {
- if (iterator.status === 'SUCCESS') {
- this.select.push(iterator.successInfo)
- }
- }
- for (const iterator of this.audioList) {
- this.select.push(iterator)
- }
- break;
- case 'video':
- for (const iterator of this.uploadStatusListVideo) {
- if (iterator.status === 'SUCCESS') {
- this.select.push(iterator.successInfo)
- }
- }
- for (const iterator of this.videoList) {
- this.select.push(iterator)
- }
- break;
- case '3D':
- for (const iterator of this.scene3DList) {
- this.select.push(iterator)
- }
- break;
- default:
- break;
- }
- }
- },
- mounted() {
- console.log('tableHeadersForAudio: ', this.tableHeadersForAudio);
- console.log('tableHeadersForVideo: ', this.tableHeadersForVideo);
- },
- unmounted() {
- this.$store.commit('setUploadStatusListImage', this.uploadStatusListImage.filter((item) => {
- return item.status === 'LOADING'
- }))
- this.$store.commit('setUploadStatusListPano', this.uploadStatusListPano.filter((item) => {
- return item.status === 'LOADING'
- }))
- this.$store.commit('setUploadStatusListAudio', this.uploadStatusListAudio.filter((item) => {
- return item.status === 'LOADING'
- }))
- this.$store.commit('setUploadStatusListVideo', this.uploadStatusListVideo.filter((item) => {
- return item.status === 'LOADING'
- }))
- }
- }
- </script>
- <style lang="less" scoped>
- .ellipsis{
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- width: 100%;
- display: inline-block;
- }
- .table-select {
- position: absolute;
- z-index: 3;
- left: 50%;
- top: 50%;
- transform: translateX(-50%) translateY(-50%);
- width: 600px;
- height: 730px;
- background: #1A1B1D;
- border-radius: 4px;
- border: 1px solid #404040;
- padding: 26px;
- }
- .title {
- font-size: 18px;
- color: rgba(255, 255, 255, 0.6);
- }
- .close-btn {
- display: inline-block;
- position: absolute;
- top: 26px;
- right: 20px;
- font-size: 12px;
- color: #969799;
- cursor: pointer;
- padding: 6px;
- }
- .material-tab {
- margin-top: 35px;
- > .material-tab-item {
- display: inline-block;
- margin-right: 20px;
- position: relative;
- cursor: pointer;
- > .text {
- font-size: 14px;
- font-family: MicrosoftYaHei;
- color: rgba(255, 255, 255, 0.6);
- }
- > .bottom-line {
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- bottom: -4px;
- width: 16px;
- height: 2px;
- background: #0076F6;
- border-radius: 1px;
- }
- }
- }
- .filter {
- margin-top: 28px;
- width: 100%;
- height: 36px;
- background: #252526;
- border-radius: 2px;
- border: 1px solid #404040;
- position: relative;
- > input {
- box-sizing: border-box;
- width: calc(100% - 42px);
- height: 100%;
- border: none;
- padding-left: 16px;
- background: transparent;
- color: #fff;
- outline: none;
- }
- > .search-icon {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- right: 18px;
- color: #404040;
- font-size: 20px;
- }
- > .clear-icon {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- right: 18px;
- color: #404040;
- font-size: 20px;
- cursor: pointer;
- }
- }
- @table-height: 440px;
- @table-head-row-height: 40px;
- @table-border-size: 1px;
- .table {
- margin-top: 20px;
- border: @table-border-size solid #404040;
- background: #1A1B1D;
- width: 100%;
- height: @table-height;
- > .table-head-row {
- width: 100%;
- height: @table-head-row-height;
- background: #252526;
- color: rgba(255, 255, 255, 0.6);
- .table-head {
- font-size: 16px;
- line-height: @table-head-row-height;
- height: 100%;
- display: inline-block;
- }
- }
- > .table-body {
- height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
- overflow: auto;
- display: inline-block;
- width: 100%;
- > .table-body-row {
- height: 50px;
- border-bottom: 1px solid #404040;
- display: flex;
- align-items: center;
- > .table-data {
- font-size:14px;
- line-height:50px;
- height: 100%;
- color: #fff;
- > .list-img {
- position: relative;
- height: 100%;
- display: inline-block;
- width: 100%;
- > img, .audio-player {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: 40px;
- height: 40px;
- object-fit: cover;
- }
- }
- }
- }
- }
- > .no-data {
- height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
- width: 100%;
- position: relative;
- > div {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- > img {
- width: 116px;
- }
- > span {
- margin-top: 20px;
- display: block;
- font-size: 14px;
- color: rgba(255, 255, 255, 0.6);
- }
- > a {
- > button {
- margin-top: 20px;
- }
- }
- }
- }
- }
- .table-image .table-head,
- .table-image .table-data {
- &:nth-of-type(1) {
- width: 50px;
- &.nothing {
- color: transparent;
- }
- &.select-all-checkbox-wrapper {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- .unchecked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- border-radius: 2px;
- border: 1px solid #404040;
- }
- .checked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- &:nth-of-type(2) {
- width: calc(116px - 50px);
- }
- &:nth-of-type(3) {
- width: calc(316px - 116px);
- padding-right: 30px;
- }
- &:nth-of-type(4) {
- width: calc(416px - 316px);
- }
- &:nth-of-type(5) {
- width: calc(100% - 416px);
- }
- }
- .table-pano .table-head,
- .table-pano .table-data {
- &:nth-of-type(1) {
- width: 50px;
- &.nothing {
- color: transparent;
- }
- &.select-all-checkbox-wrapper {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- .unchecked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- border-radius: 2px;
- border: 1px solid #404040;
- }
- .checked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- &:nth-of-type(2) {
- width: calc(116px - 50px);
- }
- &:nth-of-type(3) {
- width: calc(416px - 116px);
- padding-right: 30px;
- }
- &:nth-of-type(4) {
- width: calc(100% - 416px);
- }
- }
- .table-audio .table-head,
- .table-audio .table-data {
- &:nth-of-type(1) {
- width: 50px;
- &.nothing {
- color: transparent;
- }
- &.select-all-checkbox-wrapper {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- .unchecked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- border-radius: 2px;
- border: 1px solid #404040;
- }
- .checked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- &:nth-of-type(2) {
- width: calc(116px - 50px);
- }
- &:nth-of-type(3) {
- width: calc(416px - 116px);
- padding-right: 30px;
- }
- &:nth-of-type(4) {
- width: calc(100% - 416px);
- }
- }
- .table-video .table-head,
- .table-video .table-data {
- &:nth-of-type(1) {
- width: 50px;
- &.nothing {
- color: transparent;
- }
- &.select-all-checkbox-wrapper {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- .unchecked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- border-radius: 2px;
- border: 1px solid #404040;
- }
- .checked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- &:nth-of-type(2) {
- width: calc(116px - 50px);
- }
- &:nth-of-type(3) {
- width: calc(416px - 116px);
- padding-right: 30px;
- }
- &:nth-of-type(4) {
- width: calc(100% - 416px);
- }
- }
- .table-3D .table-head,
- .table-3D .table-data {
- &:nth-of-type(1) {
- width: 50px;
- &.nothing {
- color: transparent;
- }
- &.select-all-checkbox-wrapper {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- .unchecked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- border-radius: 2px;
- border: 1px solid #404040;
- }
- .checked {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- &:nth-of-type(2) {
- width: calc(116px - 50px);
- }
- &:nth-of-type(3) {
- width: calc(416px - 116px);
- padding-right: 30px;
- }
- &:nth-of-type(4) {
- width: calc(100% - 416px);
- }
- }
- .checkbox {
- width: 100%;
- height: 100%;
- }
- .btns {
- display: flex;
- justify-content: space-between;
- margin-top: 40px;
- .upload-btn {
- display: flex;
- align-items: center;
- > span {
- display: inline-block;
- margin-right: 4px;
- }
- i.tool-tip-for-editor {
- font-size: 12px;
- transform: scale(0.923) translateY(1px);
- cursor: default;
- }
- }
- > div {
- .deepcancel {
- margin-right: 16px;
- }
- }
- }
- </style>
|