materialListInMaterialSelector.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. <template>
  2. <div
  3. class="material-list"
  4. :class="{
  5. dark: isDarkTheme,
  6. }"
  7. >
  8. <crumbs
  9. class="crumbs"
  10. v-if="!searchKey"
  11. :isDarkTheme="isDarkTheme"
  12. :list="folderPath"
  13. :rootName="$i18n.t(`gather.${materialTypeAlias}`)"
  14. @click-path="onClickPath"
  15. />
  16. <div v-if="searchKey" class="crumbs">{{$i18n.t(`gather.${materialTypeAlias}`)}}</div>
  17. <div class="table">
  18. <!-- <div class="table-head-row">
  19. <span
  20. class="table-head"
  21. :style="{
  22. width: '50px',
  23. }"
  24. >
  25. 1
  26. </span>
  27. <span
  28. class="table-head"
  29. v-for="(item, idx) in tableHeaders"
  30. :key="idx"
  31. :style="{
  32. width: columnWidthList[idx],
  33. }"
  34. >
  35. {{ item.name && $i18n.t(`zh_key.${item.name}`) }}
  36. </span>
  37. </div> -->
  38. <div
  39. v-show="listLocalLength !== 0 || hasMoreData"
  40. class="table-body"
  41. v-infinite-scroll="requestMoreData"
  42. :infinite-scroll-disabled="!hasMoreData || isRequestingMoreData"
  43. >
  44. <!-- vuex中的上传中数据 -->
  45. <div v-for="(item, i) in uploadStatusList" :key="item.uid">
  46. <div
  47. class="table-body-row"
  48. v-if="item.parentFolderId === currentFolderId && !searchKey"
  49. @click="onClickRow"
  50. >
  51. <!-- 如果已经上传成功 -->
  52. <template v-if="item.status === 'SUCCESS'">
  53. <span
  54. class="table-data"
  55. >
  56. <RadioOrCheckbox
  57. class="checkbox"
  58. :isLightTheme="!isDarkTheme"
  59. :isMultiSelection="isMultiSelection"
  60. :isCheckedInitial="select.some(i => i.id === item.successInfo.id)"
  61. @change="v => selectItem(item.successInfo, v)"
  62. />
  63. </span>
  64. <span
  65. class="table-data"
  66. :style="{
  67. width: columnWidthList[idx] || '',
  68. }"
  69. v-for="(tableItemStructure, idx) in tableHeaders"
  70. :key="idx"
  71. >
  72. <div v-if="tableItemStructure.type" class="list-img">
  73. <slot name="materialUploadSuccessIcon" :uploadInfo="item" :tableItemStructure="tableItemStructure">
  74. </slot>
  75. </div>
  76. <span
  77. v-else-if="tableItemStructure.key === 'name'"
  78. class="name"
  79. >
  80. <div
  81. class="name-inner ellipsis"
  82. v-title="item.successInfo[tableItemStructure.key]"
  83. >
  84. {{ item.successInfo[tableItemStructure.key] }}
  85. </div>
  86. </span>
  87. <span
  88. v-else
  89. class="ellipsis"
  90. >
  91. {{item.successInfo[tableItemStructure.key]}}
  92. </span>
  93. </span>
  94. </template>
  95. <!-- 如果还在上传或切图处理中 -->
  96. <template v-else-if="item.status === 'LOADING'">
  97. <span
  98. class="table-data"
  99. >
  100. <RadioOrCheckbox
  101. class="checkbox"
  102. :isLightTheme="!isDarkTheme"
  103. :isMultiSelection="isMultiSelection"
  104. :isDisabled="true"
  105. />
  106. </span>
  107. <span
  108. class="table-data"
  109. :style="{
  110. width: columnWidthList[idx],
  111. }"
  112. v-for="(tableItemStructure, idx) in tableHeaders"
  113. :key="idx"
  114. >
  115. <div v-if="tableItemStructure.type" class="list-img">
  116. <slot name="materialUploadingIcon">
  117. </slot>
  118. </div>
  119. <span
  120. v-if="tableItemStructure.key === 'name'"
  121. class="name upload-status-wrap"
  122. >
  123. <div
  124. class="name-inner ellipsis"
  125. v-title="item.title"
  126. >
  127. {{ item.title }}
  128. </div>
  129. <div v-if="item.ifKnowProgress" class="upload-status">
  130. {{$i18n.t(`gather.upload_material`)}} {{ Math.round(item.progress * 100)}}%
  131. </div>
  132. <div v-else class="upload-status">
  133. {{ item.statusText }}
  134. </div>
  135. </span>
  136. <span v-else></span>
  137. </span>
  138. </template>
  139. <!-- 如果上传失败了 -->
  140. <template v-else-if="item.status === 'FAIL'">
  141. <span
  142. class="table-data"
  143. >
  144. <RadioOrCheckbox
  145. class="checkbox"
  146. :isLightTheme="!isDarkTheme"
  147. :isMultiSelection="isMultiSelection"
  148. :isDisabled="true"
  149. />
  150. </span>
  151. <span
  152. class="table-data"
  153. :style="{
  154. width: columnWidthList[idx],
  155. }"
  156. v-for="(tableItemStructure, idx) in tableHeaders"
  157. :key="idx"
  158. >
  159. <div v-if="tableItemStructure.type" class="list-img">
  160. <slot name="materialUploadFailIcon">
  161. </slot>
  162. </div>
  163. <span
  164. v-if="tableItemStructure.key === 'name'"
  165. class="name upload-status-wrap"
  166. >
  167. <div
  168. class="name-inner ellipsis"
  169. v-title="item.title"
  170. >
  171. {{ item.title }}
  172. </div>
  173. <div class="upload-status">
  174. {{ item.statusText }}
  175. </div>
  176. </span>
  177. <span v-if="tableItemStructure.key === 'fileSize'">{{ $i18n.t(`tips_code.FAILURE_3025`) }}</span>
  178. <span v-if="tableItemStructure.key !== 'name' && tableItemStructure.key !== 'fileSize'"></span>
  179. </span>
  180. </template>
  181. </div>
  182. </div>
  183. <!-- 本组件内的列表数据 -->
  184. <div
  185. class="table-body-row"
  186. v-for="(item, i) in list"
  187. :key="i"
  188. @click="(e) => {
  189. if (item.type === 'dir') {
  190. onClickFolder(item)
  191. } else {
  192. onClickRow(e)
  193. }
  194. }"
  195. >
  196. <span
  197. class="table-data"
  198. >
  199. <RadioOrCheckbox
  200. class="checkbox"
  201. :isLightTheme="!isDarkTheme"
  202. :isDisabled="item.type === 'dir'"
  203. :isMultiSelection="isMultiSelection"
  204. :isCheckedInitial="select.some(i => i.id === item.id)"
  205. @change="v => selectItem(item, v)"
  206. />
  207. </span>
  208. <span
  209. class="table-data"
  210. v-for="(tableItemStructure, idx) in tableHeaders"
  211. :style="{
  212. width: columnWidthList[idx],
  213. }"
  214. :key="idx"
  215. >
  216. <div
  217. v-if="tableItemStructure.type"
  218. class="list-img"
  219. >
  220. <img
  221. v-if="item.type === 'dir'"
  222. class="folderIcon"
  223. src="@/assets/images/icons/folder-blue.png"
  224. alt=""
  225. />
  226. <slot v-else name="materialIcon" :materialInfo="item" :tableItemStructure="tableItemStructure">
  227. </slot>
  228. </div>
  229. <span
  230. v-else-if="tableItemStructure.key === 'name'"
  231. class="name"
  232. :class="{
  233. searchRes: latestUsedSearchKey,
  234. }"
  235. >
  236. <div
  237. class="name-inner ellipsis"
  238. v-title="item[tableItemStructure.key]"
  239. >
  240. {{ item[tableItemStructure.key] }}
  241. </div>
  242. <div
  243. v-if="latestUsedSearchKey"
  244. class="parent-info"
  245. >
  246. {{$i18n.t('gather.dir')}} <span class="parent-name" @click.stop="onClickParentFolder(item)">{{item.dirId === 1 ? $i18n.t('gather.root_dir') : item.dirName}}</span>
  247. </div>
  248. </span>
  249. <span
  250. v-else
  251. class="ellipsis"
  252. >
  253. {{ item[tableItemStructure.key] }}
  254. </span>
  255. </span>
  256. </div>
  257. <LoadingPoints
  258. v-show="isRequestingMoreData"
  259. :isDarkTheme="isDarkTheme"
  260. />
  261. <div class="no-more-data" v-show="!hasMoreData">
  262. - {{$i18n.t('gather.no_more_data')}} -
  263. </div>
  264. </div>
  265. <!-- 无数据时的提示 -->
  266. <div v-show="!(listLocalLength !== 0 || hasMoreData)" class="no-data">
  267. <div v-if="latestUsedSearchKey">
  268. <img :src="require(`@/assets/images/default/empty_search_${isDarkTheme ? 'dark' : 'bright'}.png`)" alt="">
  269. <span>{{ $i18n.t("gather.no_serch_result") }}</span>
  270. </div>
  271. <div v-if="!latestUsedSearchKey">
  272. <img :src="require(`@/assets/images/default/empty_${isDarkTheme ? 'dark' : 'bright'}.png`)" alt="">
  273. <span>{{ $i18n.t("gather.no_material_result") }}</span>
  274. <a v-if="!canUpload" href="/#/">
  275. <button class="ui-button">{{ $i18n.t("gather.how_to_shoot") }}</button>
  276. </a>
  277. </div>
  278. </div>
  279. </div>
  280. <div class="btns">
  281. <button v-if="canUpload && !searchKey" class="ui-button upload-btn" @click="onClickUpload">
  282. <span>{{ $i18n.t("gather.upload_material") }}</span>
  283. <i
  284. class="iconfont icon-material_prompt tool-tip-for-editor"
  285. v-tooltip="fileInputBtnTip"
  286. />
  287. <FileInput
  288. ref="file-input"
  289. :failString="fileInputFailString"
  290. :limitFailStr="fileInputLimitFailStr"
  291. :acceptType="fileInputAcceptType"
  292. :mediaType="fileInputMediaType"
  293. :limit="fileInputLimit"
  294. @file-change="onFileInputChange"
  295. />
  296. </button>
  297. </div>
  298. </div>
  299. </template>
  300. <script>
  301. import {
  302. getMaterialList,
  303. getSceneList,
  304. searchInAllScenes,
  305. uploadMaterial,
  306. checkUserSize,
  307. } from "@/api";
  308. import { changeByteUnit } from "@/utils/file";
  309. import { debounce, capitalize } from "@/utils/other.js"
  310. import config from "@/config";
  311. import FileInput from "@/components/shared/uploads/UploadMultiple.vue";
  312. import RadioOrCheckbox from "@/components/shared/RadioOrCheckbox.vue";
  313. import LoadingPoints from "@/components/shared/LoadingPoints.vue";
  314. import folderMixin from "./materialSelectorFolderMixin.js";
  315. export default {
  316. components: {
  317. FileInput,
  318. RadioOrCheckbox,
  319. LoadingPoints,
  320. },
  321. mixins: [
  322. folderMixin,
  323. ],
  324. props: {
  325. isDarkTheme: {
  326. type: Boolean,
  327. default: true,
  328. },
  329. currentMaterialType: {
  330. type: String,
  331. required: true,
  332. },
  333. materialType: {
  334. type: String,
  335. required: true,
  336. },
  337. materialItemCustomProcess: {
  338. type: Function,
  339. default: (item) => {
  340. return
  341. }
  342. },
  343. tableHeaderKeyList: {
  344. type: Array,
  345. default: () => {
  346. return []
  347. }
  348. },
  349. columnWidthList: {
  350. type: Array,
  351. default: () => {
  352. return []
  353. },
  354. },
  355. isMultiSelection: {
  356. type: Boolean,
  357. default: false,
  358. },
  359. select: {
  360. type: Array,
  361. required: true,
  362. },
  363. searchKey: {
  364. type: String,
  365. default: '',
  366. },
  367. canUpload: {
  368. type: Boolean,
  369. defaut: false,
  370. },
  371. fileInputBtnTip: {
  372. type: String,
  373. },
  374. fileInputCustomCheck: {
  375. type: Function,
  376. default: async () => {
  377. return true
  378. }
  379. },
  380. fileUploadLongPollingCb: {
  381. type: Function || null,
  382. default: null
  383. },
  384. fileUploadLongPollingStatusText: {
  385. type: String,
  386. defaut: ''
  387. },
  388. fileInputFailString: {
  389. type: String,
  390. },
  391. fileInputLimitFailStr: {
  392. type: String,
  393. },
  394. fileInputAcceptType: {
  395. type: String,
  396. },
  397. fileInputMediaType: {
  398. type: String,
  399. },
  400. fileInputLimit: {
  401. type: Number,
  402. },
  403. },
  404. data() {
  405. return {
  406. list: [],
  407. latestUsedSearchKey: '',
  408. isRequestingMoreData: false,
  409. hasMoreData: true,
  410. longPollingIntervalId: null,
  411. }
  412. },
  413. computed: {
  414. materialTypeAlias() {
  415. if (this.materialType === '3D') {
  416. return 'scene'
  417. } else {
  418. return this.materialType
  419. }
  420. },
  421. tableHeaders() {
  422. /*
  423. [
  424. {
  425. en: "素材", // 暂时没用到
  426. key: "icon",
  427. name: "素材",
  428. type: "image",
  429. width: 150, // 暂时没用到
  430. },
  431. {
  432. en: "名称",
  433. key: "name",
  434. name: "名称",
  435. width: 240,
  436. },
  437. {
  438. en: "大小",
  439. key: "fileSize",
  440. name: "大小",
  441. width: 80,
  442. }
  443. ]
  444. */
  445. return this.$MAPTABLEHEADER[this.materialTypeAlias].filter(item => {
  446. return this.tableHeaderKeyList.includes(item.key)
  447. })
  448. },
  449. uploadStatusList() {
  450. if (this.canUpload) {
  451. return this.$store.state[`uploadStatusList${capitalize(this.materialType)}`]
  452. } else {
  453. return []
  454. }
  455. },
  456. listRealLength() {
  457. return this.list.length + this.uploadStatusList.filter((item) => {
  458. return item.status === 'SUCCESS'
  459. }).length
  460. },
  461. listLocalLength() {
  462. return this.list.length + this.uploadStatusList.length
  463. },
  464. needLongPolling() {
  465. return this.uploadStatusList.some((item) => {
  466. return item.status === 'LOADING' && item.ifKnowProgress === false
  467. })
  468. },
  469. },
  470. watch: {
  471. searchKey: {
  472. handler: function () {
  473. if (this.currentMaterialType === this.materialType) {
  474. this.refreshMaterialList()
  475. }
  476. },
  477. immediate: false,
  478. },
  479. currentMaterialType: {
  480. handler: function (newVal) {
  481. if (newVal === this.materialType && this.list.length === 0) {
  482. this.refreshMaterialList()
  483. }
  484. },
  485. immediate: false,
  486. },
  487. needLongPolling: {
  488. handler: function (newVal) {
  489. if (!newVal) {
  490. clearInterval(this.longPollingIntervalId)
  491. this.longPollingIntervalId = null
  492. } else {
  493. clearInterval(this.longPollingIntervalId)
  494. this.longPollingIntervalId = null
  495. this.longPollingIntervalId = setInterval(() => {
  496. this.fileUploadLongPollingCb(this.uploadStatusList);
  497. }, 3000);
  498. }
  499. },
  500. immediate: true,
  501. },
  502. },
  503. methods: {
  504. selectItem(item, v) {
  505. item.materialType = this.materialType // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
  506. if (this.isMultiSelection) {
  507. if (v) {
  508. this.select.push(item)
  509. } else {
  510. const toDeleteIdx = this.select.findIndex((eachSelect) => {
  511. return eachSelect.id === item.id
  512. })
  513. if (toDeleteIdx >= 0) {
  514. this.select.splice(toDeleteIdx, 1)
  515. }
  516. }
  517. } else {
  518. this.select.splice(0, this.select.length)
  519. if (v) {
  520. this.select.push(item)
  521. }
  522. }
  523. },
  524. requestMoreData() {
  525. this.isRequestingMoreData = true
  526. const latestUsedSearchKey = this.searchKey
  527. let getListFn = null
  528. let params = null
  529. if (this.materialType === '3D') {
  530. if (!this.searchKey) {
  531. getListFn = getSceneList
  532. params = {
  533. pathLevel2Id: this.folderPath[1]?.id,
  534. folderId: this.currentFolderId,
  535. pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
  536. pageSize: config.PAGE_SIZE,
  537. searchKey: this.searchKey,
  538. }
  539. } else {
  540. getListFn = searchInAllScenes
  541. params = {
  542. searchKey: this.searchKey
  543. }
  544. }
  545. } else {
  546. getListFn = getMaterialList
  547. params = {
  548. dirId: this.currentFolderId,
  549. pageNum: Math.floor(this.listRealLength / config.PAGE_SIZE) + 1,
  550. pageSize: config.PAGE_SIZE,
  551. searchKey: this.searchKey,
  552. type: this.materialType,
  553. }
  554. }
  555. getListFn(params, (data) => {
  556. const newData = data.data.list.map((i) => {
  557. if (i.fileSize) {
  558. i.fileSize = changeByteUnit(Number(i.fileSize));
  559. } else {
  560. i.fileSize = ''
  561. }
  562. this.materialItemCustomProcess(i)
  563. return i;
  564. });
  565. this.list = this.list.concat(newData)
  566. if (this.listRealLength === data.data.total) {
  567. this.hasMoreData = false
  568. }
  569. this.isRequestingMoreData = false
  570. this.latestUsedSearchKey = latestUsedSearchKey
  571. }, () => {
  572. this.isRequestingMoreData = false
  573. this.latestUsedSearchKey = latestUsedSearchKey
  574. });
  575. },
  576. refreshMaterialList: debounce(function (type) {
  577. this.isRequestingMoreData = false
  578. this.hasMoreData = true
  579. this.list = []
  580. if (this.canUpload) {
  581. let filterResult = this.uploadStatusList.filter((item) => {
  582. return item.status === 'LOADING'
  583. })
  584. const capitalizedMaterialType = capitalize(this.materialType)
  585. this.$store.commit(`setUploadStatusList${capitalizedMaterialType}`, filterResult)
  586. }
  587. this.requestMoreData()
  588. }, 500, false),
  589. onFileInputChange(e) {
  590. e.files.forEach(async (eachFile, i) => {
  591. if (
  592. this.fileInputAcceptType.indexOf(eachFile.type) <= -1
  593. ) {
  594. console.log('格式不对!');
  595. setTimeout(() => {
  596. this.$msg({
  597. message: `“${eachFile.name}”${this.fileInputFailString}`,
  598. type: "warning",
  599. });
  600. }, i * 100);
  601. return;
  602. }
  603. if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
  604. setTimeout(() => {
  605. this.$msg({
  606. message: `“${eachFile.name}”${this.$i18n.t(`gather.too_long_word`)}`,
  607. type: "warning",
  608. });
  609. }, i * 100);
  610. return;
  611. }
  612. const customCheckRes = await this.fileInputCustomCheck(eachFile, i)
  613. if (!customCheckRes) {
  614. return
  615. }
  616. let itemInUploadList = {
  617. title: eachFile.name,
  618. ifKnowProgress: true,
  619. progress: 0,
  620. status: 'LOADING',
  621. statusText: this.$i18n.t(`gather.uploading_material`),
  622. uid: `u_${this.$randomWord(true, 8, 8)}`,
  623. abortHandler: null,
  624. backendId: '', // 只用于全景图上传
  625. parentFolderId: this.currentFolderId,
  626. };
  627. itemInUploadList.abortHandler = uploadMaterial(
  628. {
  629. dirId: this.currentFolderId,
  630. file: eachFile,
  631. tempId: itemInUploadList.uid,
  632. type: this.materialType,
  633. },
  634. (response) => { // 上传成功
  635. if (response.code !== 0) {
  636. console.error('上传接口响应异常:', response);
  637. return
  638. }
  639. console.log('上传成功');
  640. if (this.fileUploadLongPollingCb) {
  641. itemInUploadList.statusText = this.fileUploadLongPollingStatusText
  642. itemInUploadList.ifKnowProgress = false
  643. itemInUploadList.backendId = response.data.id
  644. } else {
  645. itemInUploadList.status = 'SUCCESS'
  646. if (response.data.fileSize) {
  647. response.data.fileSize = changeByteUnit(Number(response.fileSize));
  648. } else {
  649. response.data.fileSize = ''
  650. }
  651. itemInUploadList.successInfo = response.data
  652. }
  653. },
  654. (err) => {
  655. if (err.statusText === 'abort') { // 用户取消了上传任务。
  656. console.log('用户取消了任务!');
  657. const index = this.uploadStatusList.findIndex((eachItem) => {
  658. return eachItem.uid === itemInUploadList.uid
  659. })
  660. this.uploadStatusList.splice(index, 1)
  661. } else {
  662. console.log('上传失败!');
  663. itemInUploadList.status = 'FAIL'
  664. itemInUploadList.statusText = this.$i18n.t(`gather.material_upload_fail`)
  665. }
  666. },
  667. (progress) => {
  668. console.log('进度:', progress);
  669. itemInUploadList.progress = progress
  670. }
  671. )
  672. this.uploadStatusList.unshift(itemInUploadList);
  673. })
  674. },
  675. onClickRow(e) {
  676. const checkboxNodeList = e.currentTarget.getElementsByClassName('selection-click-target')
  677. if (checkboxNodeList && checkboxNodeList[0]) {
  678. checkboxNodeList[0].click()
  679. }
  680. },
  681. onClickUpload() {
  682. checkUserSize({}, (data) => {
  683. //判断已用是否大于3G
  684. if ((data.data / 1024 / 1024) > 3) {
  685. this.$alert({ content: this.$i18n.t('tips_code.FAILURE_3024')});
  686. } else {
  687. this.$refs['file-input'].click()
  688. }
  689. })
  690. },
  691. },
  692. mounted() {
  693. },
  694. beforeDestroy() {
  695. if (this.canUpload) {
  696. const capitalizedMaterialType = capitalize(this.materialType)
  697. this.$store.commit(`setUploadStatusList${capitalizedMaterialType}`, this.uploadStatusList.filter((item) => {
  698. return item.status === 'LOADING'
  699. }))
  700. }
  701. }
  702. }
  703. </script>
  704. <style lang="less" scoped>
  705. .material-list {
  706. position: relative;
  707. .ellipsis {
  708. text-overflow: ellipsis;
  709. overflow: hidden;
  710. white-space: nowrap;
  711. width: 100%;
  712. display: inline-block;
  713. }
  714. .crumbs {
  715. margin-top: 10px;
  716. }
  717. // @table-height: 420px;
  718. // @table-head-row-height: 40px;
  719. // @table-border-size: 1px;
  720. @table-height: 420px;
  721. @table-head-row-height: 0px;
  722. @table-border-size: 0px;
  723. .table {
  724. margin-top: 10px;
  725. // border: @table-border-size solid #EBEDF0;
  726. width: 100%;
  727. height: @table-height;
  728. // >.table-head-row {
  729. // width: 100%;
  730. // height: @table-head-row-height;
  731. // background: #F5F7FA;
  732. // color: #646566;
  733. // .table-head {
  734. // font-size: 16px;
  735. // line-height: @table-head-row-height;
  736. // height: 100%;
  737. // display: inline-block;
  738. // &:nth-of-type(1) {
  739. // color: transparent;
  740. // }
  741. // }
  742. // }
  743. >.table-body {
  744. height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
  745. overflow: auto;
  746. display: inline-block;
  747. width: 100%;
  748. .table-body-row {
  749. height: 50px;
  750. // border-bottom: 1px solid #EBEDF0;
  751. display: flex;
  752. align-items: center;
  753. border-radius: 4px;
  754. cursor: pointer;
  755. &:hover {
  756. background: #F7F8FA;
  757. }
  758. >.table-data {
  759. font-size: 14px;
  760. line-height: 50px;
  761. height: 100%;
  762. color: #323233;
  763. &:nth-of-type(1) {
  764. width: 50px;
  765. }
  766. &:nth-of-type(2) {
  767. width: 96px;
  768. }
  769. &:nth-of-type(3) {
  770. width: calc(100% - 50px - 96px);
  771. }
  772. &:last-of-type {
  773. padding-right: 10px;
  774. }
  775. >.list-img {
  776. position: relative;
  777. height: 100%;
  778. display: inline-block;
  779. width: 100%;
  780. >img,
  781. .audio-player {
  782. position: absolute;
  783. top: 50%;
  784. transform: translateY(-50%);
  785. width: 40px;
  786. height: 40px;
  787. object-fit: cover;
  788. &.folderIcon {
  789. object-fit: contain;
  790. }
  791. }
  792. }
  793. > .name:not(.searchRes) {
  794. display: inline-block;
  795. height: 100%;
  796. width: 100%;
  797. display: flex;
  798. align-items: center;
  799. > .name-inner {
  800. flex: 0 0 auto;
  801. display: inline-block;
  802. height: 100%;
  803. width: 50%;
  804. }
  805. > .upload-status {
  806. flex: 0 0 auto;
  807. display: inline-block;
  808. height: 100%;
  809. margin-left: 20px;
  810. }
  811. }
  812. > .name.searchRes {
  813. height: 100%;
  814. width: 100%;
  815. display: flex;
  816. flex-direction: column;
  817. justify-content: center;
  818. align-items: flex-start;
  819. line-height: initial;
  820. > .name-inner {
  821. flex: 0 0 auto;
  822. display: inline-block;
  823. width: 100%;
  824. }
  825. > .parent-info {
  826. > .parent-name {
  827. color: @color;
  828. }
  829. }
  830. }
  831. > .name:not(.upload-status-wrap):hover {
  832. > .name-inner {
  833. width: 100%;
  834. }
  835. }
  836. }
  837. }
  838. .no-more-data {
  839. margin-top: 16px;
  840. margin-bottom: 16px;
  841. text-align: center;
  842. font-size: 12px;
  843. color: #969799;
  844. }
  845. }
  846. >.no-data {
  847. height: calc(@table-height - @table-head-row-height - @table-border-size - @table-border-size);
  848. width: 100%;
  849. position: relative;
  850. >div {
  851. position: absolute;
  852. top: 50%;
  853. left: 50%;
  854. transform: translate(-50%, -50%);
  855. text-align: center;
  856. >img {
  857. width: 116px;
  858. }
  859. >span {
  860. margin-top: 20px;
  861. display: block;
  862. font-size: 14px;
  863. color: #646566;
  864. }
  865. >a {
  866. >button {
  867. margin-top: 20px;
  868. }
  869. }
  870. }
  871. }
  872. }
  873. .checkbox {
  874. width: 100%;
  875. height: 100%;
  876. }
  877. .btns {
  878. left: 0;
  879. margin-top: 29px;
  880. .upload-btn {
  881. display: flex;
  882. align-items: center;
  883. >span {
  884. display: inline-block;
  885. margin-right: 4px;
  886. }
  887. i.tool-tip-for-editor {
  888. font-size: 12px;
  889. transform: scale(0.923) translateY(1px);
  890. cursor: default;
  891. }
  892. }
  893. }
  894. }
  895. .material-list.dark {
  896. .ellipsis {
  897. }
  898. .crumbs {
  899. }
  900. .table {
  901. // border: @table-border-size solid #EBEDF0;
  902. // >.table-head-row {
  903. // background: #F5F7FA;
  904. // color: #646566;
  905. // .table-head {
  906. // &:nth-of-type(1) {
  907. // color: transparent;
  908. // }
  909. // }
  910. // }
  911. >.table-body {
  912. .table-body-row {
  913. // border-bottom: 1px solid #EBEDF0;
  914. &:hover {
  915. background: #252526;
  916. }
  917. >.table-data {
  918. color: #fff;
  919. >.list-img {
  920. >img,
  921. .audio-player {
  922. &.folderIcon {
  923. }
  924. }
  925. }
  926. }
  927. }
  928. }
  929. >.no-data {
  930. >div {
  931. >img {
  932. }
  933. >span {
  934. color: rgba(255, 255, 255, 0.6);
  935. }
  936. >a {
  937. >button {
  938. }
  939. }
  940. }
  941. }
  942. }
  943. .checkbox {
  944. }
  945. .btns {
  946. .upload-btn {
  947. >span {
  948. }
  949. i.tool-tip-for-editor {
  950. }
  951. }
  952. }
  953. }
  954. </style>