attachment.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. <template>
  2. <view class="app-page flex flex-col">
  3. <!-- 搜索区域 -->
  4. <view class="filter-wrap bg-white shadow-3">
  5. <tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue" insert-color="light-blue" :clear="true" @confirm="fnOnSearch"></tm-search>
  6. <tm-dropDownMenu :shadow="0" color="light-blue" @confirm="fnOnConfirm" :list="filterList"></tm-dropDownMenu>
  7. </view>
  8. <!-- 占位区域 -->
  9. <view style="width: 100vw;height: 184rpx;"></view>
  10. <view v-if="loading != 'success'" class="loading-wrap">
  11. <tm-skeleton model="listAvatr"></tm-skeleton>
  12. <tm-skeleton model="listAvatr"></tm-skeleton>
  13. <tm-skeleton model="listAvatr"></tm-skeleton>
  14. <tm-skeleton model="listAvatr"></tm-skeleton>
  15. </view>
  16. <view class="page-content pa-24 flex flex-col" v-else>
  17. <view v-if="dataList.length == 0" class="content-empty flex flex-center">
  18. <!-- 空布局 -->
  19. <tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无任何附件"></tm-empty>
  20. </view>
  21. <block v-else>
  22. <!-- 内容区域 -->
  23. <block v-for="(item, index) in dataList" :key="index">
  24. <tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
  25. <view class="attachment-card mb-24 flex bg-white pa-24 round-3" @click="fnShowDetail(item)">
  26. <view class="cover round-3 flex flex-center" :class="[fnGetIconClass(item.mediaType)]">
  27. <text class="icon iconfont">{{ item.suffix }}</text>
  28. </view>
  29. <!-- 内容区域 -->
  30. <view class="info pl-36">
  31. <view class="file-name text-size-m text-weight-b">{{ item.name }}</view>
  32. <view class="file-media mt-12 text-size-s text-grey-darken-1">附件类型:{{ item.mediaType }}</view>
  33. <view class="file-media mt-8 text-size-s text-grey-darken-1">附件大小:{{ item.sizeText }}</view>
  34. <view class="file-path mt-8 text-size-s text-grey-darken-1">上传日期:{{ { d: item.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}</view>
  35. </view>
  36. </view>
  37. </tm-translate>
  38. </block>
  39. <tm-flotbutton @click="fnToTopPage" :offset="[16, 80]" color="bg-gradient-light-blue-accent" size="m" icon="icon-angle-up"></tm-flotbutton>
  40. <view class="load-text ">{{ loadMoreText }}</view>
  41. </block>
  42. <!-- 弹窗详情 -->
  43. <tm-poup v-model="detail.show" position="bottom" height="80vh">
  44. <view class="poup-content">
  45. <view class="poup-head text-align-center text-weight-b text-size-g ma-24 ">附件详情</view>
  46. <scroll-view class="poup-body pa-24 pt-0" :scroll-y="true" @touchmove.stop>
  47. <view class="preview-file pl-24 pr-24">
  48. <!-- 图片预览 -->
  49. <tm-images
  50. v-if="$utils.fnCheckIsFileType('image', detail.form)"
  51. :width="700"
  52. :height="350"
  53. :round="3"
  54. :src="$utils.checkThumbnailUrl(detail.form.path)"
  55. model="aspectFill"
  56. ></tm-images>
  57. <!-- 视频 -->
  58. <video
  59. v-else-if="$utils.fnCheckIsFileType('video', detail.form)"
  60. class="round-3"
  61. style="width: 100%;height: 350rpx;"
  62. :src="$utils.checkUrl(detail.form.path)"
  63. controls
  64. ></video>
  65. <view v-else class="flex flex-center border-a-1 round-3 text-align-center text-grey-darken-1" style="height: 280rpx;background-color: #f2f2f2;">
  66. 该文件暂不支持预览
  67. </view>
  68. </view>
  69. <tm-input title="附件名称" v-model="detail.form.name" :clear="true" placeholder="请输入附件名称..."></tm-input>
  70. <tm-input :disabled="true" color="grey" title="附件类型" v-model="detail.form.mediaType"></tm-input>
  71. <tm-input :disabled="true" color="grey" title="附件位置" v-model="detail.form.type"></tm-input>
  72. <tm-input :disabled="true" color="grey" title="附件大小" v-model="detail.form.sizeText"></tm-input>
  73. <tm-input :disabled="true" color="grey" title="上传日期" v-model="detail.form.createTime"></tm-input>
  74. <tm-input
  75. :disabled="true"
  76. :vertical="true"
  77. :borderBottom="false"
  78. input-type="textarea"
  79. title="文件地址"
  80. color="grey"
  81. bg-color="grey-lighten-5"
  82. :height="120"
  83. v-model="detail.form.path"
  84. >
  85. <template v-slot:default="{ title }">
  86. {{ title }}
  87. <tm-button text theme="light-blue" size="xs" @click="$utils.copyText(detail.form.path, '复制成功!')">复制</tm-button>
  88. </template>
  89. </tm-input>
  90. </scroll-view>
  91. <view class="btn-wrap flex flex-center">
  92. <tm-button size="m" navtie-type="form" theme="bg-gradient-blue-accent" @click="fnOnUpdate()">保存</tm-button>
  93. <tm-button size="m" theme="bg-gradient-red-accent" @click="fnOnDelete()">删除</tm-button>
  94. <tm-button size="m" theme="bg-gradient-blue-grey-accent" @click="detail.show = false">关闭</tm-button>
  95. </view>
  96. </view>
  97. </tm-poup>
  98. </view>
  99. <tm-flotbutton :show-text="true" color="bg-gradient-orange-accent" @click="fnOnFlotButton"></tm-flotbutton>
  100. <tm-actionSheetMenu title="文件上传操作" @change="fnOnFileSelectActionChange" v-model="fileSelectAction.show" :actions="fileSelectAction.list"></tm-actionSheetMenu>
  101. </view>
  102. </template>
  103. <script>
  104. // #ifdef APP-PLUS
  105. const AfDocument = uni.requireNativePlugin('Aq-ChooseFile'); // 临时替代
  106. // #endif
  107. import { getAdminAccessToken } from '@/utils/auth.js';
  108. import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
  109. import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
  110. import tmDropDownMenu from '@/tm-vuetify/components/tm-dropDownMenu/tm-dropDownMenu.vue';
  111. import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
  112. import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
  113. import tmCheckbox from '@/tm-vuetify/components/tm-checkbox/tm-checkbox.vue';
  114. import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
  115. import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
  116. import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
  117. import tmUpload from '@/tm-vuetify/components/tm-upload/tm-upload.vue';
  118. import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
  119. import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
  120. import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
  121. import tmActionSheetMenu from '@/tm-vuetify/components/tm-actionSheetMenu/tm-actionSheetMenu.vue';
  122. export default {
  123. components: {
  124. tmSkeleton,
  125. tmSearch,
  126. tmDropDownMenu,
  127. tmEmpty,
  128. tmButton,
  129. tmCheckbox,
  130. tmPoup,
  131. tmForm,
  132. tmUpload,
  133. tmInput,
  134. tmImages,
  135. tmFlotbutton,
  136. tmTranslate,
  137. tmActionSheetMenu
  138. },
  139. data() {
  140. return {
  141. loading: 'loading',
  142. filterLoading: 'loading',
  143. btnOption: {
  144. actions: [
  145. {
  146. icon: 'icon-like',
  147. color: 'bg-gradient-orange-accent'
  148. },
  149. {
  150. icon: 'icon-commentdots-fill',
  151. color: 'bg-gradient-green-accent'
  152. },
  153. {
  154. icon: 'icon-share1',
  155. color: 'bg-gradient-blue-accent'
  156. }
  157. ]
  158. },
  159. filterList: [
  160. {
  161. title: '存储位置',
  162. children: [
  163. {
  164. title: '',
  165. name: 'attachmentType',
  166. model: 'radio',
  167. children: []
  168. }
  169. ]
  170. },
  171. {
  172. title: '文件类型',
  173. children: [
  174. {
  175. title: '',
  176. name: 'mediaType',
  177. model: 'radio',
  178. children: []
  179. }
  180. ]
  181. }
  182. ],
  183. queryParams: {
  184. size: 8,
  185. page: 0,
  186. attachmentType: undefined,
  187. keyword: undefined,
  188. mediaType: undefined,
  189. sort: undefined
  190. },
  191. result: {},
  192. dataList: [],
  193. total: 0,
  194. detail: {
  195. params: {},
  196. form: {},
  197. show: false
  198. },
  199. isLoadMore: false,
  200. loadMoreText: '加载中...',
  201. fileSelectAction: {
  202. show: false,
  203. list: []
  204. }
  205. };
  206. },
  207. onLoad() {
  208. this.fnSetPageTitle('附件管理');
  209. },
  210. created() {
  211. this.fnGetData();
  212. this.fnGetFilters();
  213. },
  214. onPullDownRefresh() {
  215. this.queryParams.page = 0;
  216. this.dataList = [];
  217. this.fnGetData();
  218. if (this.filterLoading != 'success') {
  219. this.fnGetFilters();
  220. }
  221. },
  222. onReachBottom(e) {
  223. if (this.result.hasNext) {
  224. this.queryParams.page += 1;
  225. this.isLoadMore = true;
  226. this.fnGetData();
  227. } else {
  228. uni.showToast({
  229. icon: 'none',
  230. title: '没有更多数据了'
  231. });
  232. }
  233. },
  234. methods: {
  235. /**
  236. * 文件大小 字节转换单位
  237. * @param size
  238. * @returns {string|*}
  239. */
  240. fnTransFileSize(size) {
  241. if (!size) return '';
  242. if (size < this.fnPow1024(1)) return size + ' B';
  243. if (size < this.fnPow1024(2)) return (size / this.fnPow1024(1)).toFixed(2) + ' KB';
  244. if (size < this.fnPow1024(3)) return (size / this.fnPow1024(2)).toFixed(2) + ' MB';
  245. if (size < this.fnPow1024(4)) return (size / this.fnPow1024(3)).toFixed(2) + ' GB';
  246. return (size / this.fnPow1024(4)).toFixed(2) + ' TB';
  247. },
  248. // 求次幂
  249. fnPow1024(num) {
  250. return Math.pow(1024, num);
  251. },
  252. fnGetIconClass(mediaType) {
  253. let _class = '';
  254. if (mediaType.indexOf('video/') != -1) {
  255. _class = 'is-video';
  256. } else if (mediaType.indexOf('image/') != -1) {
  257. _class = 'is-image';
  258. }
  259. return _class;
  260. },
  261. fnCheckIsFileType(type, attachment) {
  262. if (type == 'video') return attachment.mediaType.indexOf('video/') != -1;
  263. else if (type == 'image') return attachment.mediaType.indexOf('image/') != -1;
  264. else return false;
  265. },
  266. fnGetFilters() {
  267. this.filterLoading = 'loading';
  268. Promise.all([this.$httpApi.admin.getAttachmentsTypes(), this.$httpApi.admin.getAttachmentsMediaTypes()])
  269. .then(res => {
  270. const res1 = res[0];
  271. this.filterList[0].children[0].children = res1.data.map(item => {
  272. return {
  273. title: item,
  274. id: item
  275. };
  276. });
  277. const res2 = res[1];
  278. this.filterList[1].children[0].children = res2.data.map(item => {
  279. return {
  280. title: item,
  281. id: item
  282. };
  283. });
  284. this.filterLoading = 'success';
  285. })
  286. .catch(err => {
  287. this.filterLoading = 'error';
  288. uni.$tm.toast('搜索条件数据加载失败!');
  289. });
  290. },
  291. // 搜索区域确定
  292. fnOnConfirm(e) {
  293. this.queryParams.attachmentType = e[0].children.map(x => x.id).join('') || undefined;
  294. this.queryParams.mediaType = e[1].children.map(x => x.id).join('') || undefined;
  295. this.fnOnSearch();
  296. },
  297. fnOnSearch() {
  298. this.queryParams.page = 0;
  299. this.dataList = [];
  300. this.fnGetData();
  301. },
  302. fnGetData() {
  303. uni.showLoading({
  304. mask: true,
  305. title: '加载中...'
  306. });
  307. // 设置状态为加载中
  308. if (!this.isLoadMore) {
  309. this.loading = 'loading';
  310. }
  311. this.loadMoreText = '加载中...';
  312. this.$httpApi.admin
  313. .getAttachmentsByPage(this.queryParams)
  314. .then(res => {
  315. if (res.status == 200) {
  316. this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
  317. this.result = res.data;
  318. this.total = res.data.total;
  319. if (this.isLoadMore) {
  320. let _list = this.dataList.concat(res.data.content);
  321. this.dataList = _list.map(item => {
  322. item['sizeText'] = this.fnTransFileSize(item.size);
  323. return item;
  324. });
  325. } else {
  326. this.dataList = res.data.content.map(item => {
  327. item['sizeText'] = this.fnTransFileSize(item.size);
  328. return item;
  329. });
  330. }
  331. this.loading = 'success';
  332. } else {
  333. uni.$tm.toast('加载失败,请重试!');
  334. thi.loading = 'error';
  335. }
  336. })
  337. .catch(err => {
  338. console.error(err);
  339. uni.$tm.toast('加载失败,请重试!');
  340. this.loading = 'error';
  341. this.loadMoreText = '加载失败,请下拉刷新!';
  342. })
  343. .finally(() => {
  344. setTimeout(() => {
  345. uni.hideLoading();
  346. uni.stopPullDownRefresh();
  347. }, 300);
  348. });
  349. },
  350. // 详情
  351. fnShowDetail(item) {
  352. this.detail.params = { ...item };
  353. this.detail.form = { ...item };
  354. this.detail.show = true;
  355. },
  356. // 删除
  357. fnOnDelete() {
  358. uni.$eShowModal({
  359. title: '提示',
  360. content: `您确定要删除该附件吗?`,
  361. showCancel: true,
  362. cancelText: '否',
  363. cancelColor: '#999999',
  364. confirmText: '是',
  365. confirmColor: '#03a9f4'
  366. })
  367. .then(res => {
  368. uni.showLoading({
  369. mask: true,
  370. title: '正在删除...'
  371. });
  372. this.$httpApi.admin
  373. .deleteAttachmentById(this.detail.params.id)
  374. .then(res => {
  375. if (res.status == 200) {
  376. uni.$tm.toast('删除成功!');
  377. setTimeout(() => {
  378. this.detail.show = false;
  379. this.detail.params = {};
  380. this.detail.form = {};
  381. this.fnGetData();
  382. }, 1000);
  383. } else {
  384. uni.$tm.toast('删除失败,请重试!');
  385. }
  386. })
  387. .catch(err => {
  388. console.error(err);
  389. uni.$tm.toast('删除失败,请重试!');
  390. });
  391. })
  392. .catch(err => {});
  393. },
  394. fnOnUpdate() {
  395. if (this.detail.form.name == '') {
  396. return uni.$tm.toast('附件名称不能为空!');
  397. }
  398. uni.showLoading({
  399. mask: true,
  400. title: '正在保存...'
  401. });
  402. this.$httpApi.admin
  403. .updateAttachmentById(this.detail.params.id, this.detail.form.name)
  404. .then(res => {
  405. if (res.status == 200) {
  406. uni.$tm.toast('保存成功!');
  407. // setTimeout(() => {
  408. // this.detail.show = false;
  409. // this.detail.params = {};
  410. // this.detail.form = {};
  411. // this.fnGetData();
  412. // }, 1000);
  413. } else {
  414. uni.$tm.toast('保存失败,请重试!');
  415. }
  416. })
  417. .catch(err => {
  418. uni.$tm.toast('保存失败,请重试!');
  419. });
  420. },
  421. // 浮动按钮点击
  422. fnOnFlotButton() {
  423. // 微信小程序:提供从消息列表和媒体选择
  424. // #ifdef MP-WEIXIN
  425. this.fileSelectAction.list = ['上传照片', '上传视频', '上传文件'];
  426. // #endif
  427. // 安卓app:使用第三方上传
  428. // #ifdef APP-PLUS
  429. this.fileSelectAction.list = ['上传照片', '上传视频', '上传文件'];
  430. // #endif
  431. // h5
  432. // #ifdef H5
  433. this.fileSelectAction.list = ['上传照片', '上传视频', '上传文件'];
  434. // #endif
  435. // #ifndef H5||MP-WEIXIN||APP-PLUS
  436. this.fileSelectAction.list = ['上传照片', '上传视频'];
  437. // #endif
  438. this.fileSelectAction.show = true;
  439. },
  440. fnOnFileSelectActionChange(e) {
  441. // 微信小程序:提供从消息列表和媒体选择
  442. // #ifdef MP-WEIXIN
  443. switch (e.index) {
  444. case 0:
  445. // 上传照片
  446. uni.chooseImage({
  447. count: 1,
  448. success: res => {
  449. console.log(res);
  450. this.fnOnUploadFileByPath(res.tempFilePaths[0]);
  451. }
  452. });
  453. break;
  454. case 1:
  455. // 上传视频
  456. uni.chooseVideo({
  457. count: 1,
  458. success: res => {
  459. console.log(res);
  460. this.fnOnUploadFileByPath(res.tempFilePath);
  461. }
  462. });
  463. break;
  464. case 2:
  465. // 会话选择
  466. uni.chooseMessageFile({
  467. count: 1,
  468. success: res => {
  469. this.fnOnUploadFileByPath(res.tempFiles[0].path);
  470. }
  471. });
  472. break;
  473. }
  474. // #endif
  475. // 安卓app
  476. // #ifdef APP-PLUS
  477. switch (e.index) {
  478. case 0:
  479. // 上传照片
  480. uni.chooseImage({
  481. count: 1,
  482. success: res => {
  483. console.log(res);
  484. this.fnOnUploadFileByPath(res.tempFilePaths[0]);
  485. }
  486. });
  487. break;
  488. case 1:
  489. // 上传视频
  490. uni.chooseVideo({
  491. count: 1,
  492. success: res => {
  493. console.log(res);
  494. this.fnOnUploadFileByPath(res.tempFilePath);
  495. }
  496. });
  497. break;
  498. case 2:
  499. // 上传文件:
  500. // todo:使用第三方控件
  501. AfDocument.openMode(
  502. {
  503. size: 1,
  504. isDown: true,
  505. types: [
  506. {
  507. name: '文档',
  508. value: ['doc', 'wps', 'docx', 'xls', 'xlsx', 'pdf']
  509. },
  510. {
  511. name: '视频',
  512. value: ['mp4']
  513. },
  514. {
  515. name: '音乐',
  516. value: ['mp3', 'flac']
  517. },
  518. {
  519. name: '图片',
  520. value: ['jpg', 'png']
  521. }
  522. ]
  523. },
  524. res => {
  525. // this.data = JSON.stringify(res);
  526. this.fnOnUploadFileByFile(res[0].path);
  527. }
  528. );
  529. break;
  530. }
  531. // #endif
  532. // h5
  533. // #ifdef H5
  534. switch (e.index) {
  535. case 0:
  536. // 上传照片
  537. uni.chooseImage({
  538. count: 1,
  539. success: res => {
  540. console.log(res);
  541. this.fnOnUploadFileByPath(res.tempFilePaths[0]);
  542. }
  543. });
  544. break;
  545. case 1:
  546. // 上传视频
  547. uni.chooseVideo({
  548. count: 1,
  549. success: res => {
  550. console.log(res);
  551. this.fnOnUploadFileByPath(res.tempFilePath);
  552. }
  553. });
  554. break;
  555. case 2:
  556. // 上传文件
  557. uni.chooseFile({
  558. count: 1,
  559. success: res => {
  560. console.log(res);
  561. this.fnOnUploadFileByPath(res.tempFilePaths[0]);
  562. }
  563. });
  564. break;
  565. }
  566. // #endif
  567. // #ifndef H5||MP-WEIXIN||APP-PLUS
  568. switch (e.index) {
  569. case 0:
  570. // 上传照片
  571. uni.chooseImage({
  572. count: 1,
  573. success: res => {
  574. this.fnOnUploadFileByFile(res.tempFiles[0]);
  575. }
  576. });
  577. break;
  578. case 1:
  579. // 上传视频
  580. uni.chooseVideo({
  581. count: 1,
  582. success: res => {
  583. this.fnOnUploadFileByFile(res.tempFile);
  584. }
  585. });
  586. break;
  587. }
  588. // #endif
  589. },
  590. // 使用文件路径上传文件
  591. fnOnUploadFileByPath(path) {
  592. uni.showLoading({
  593. title: '文件上传中...',
  594. mask: true
  595. });
  596. uni.uploadFile({
  597. filePath: path,
  598. header: {
  599. 'admin-authorization': getAdminAccessToken()
  600. },
  601. url: this.$baseApiUrl + '/api/admin/attachments/upload',
  602. name: 'file',
  603. success: upladRes => {
  604. const _uploadRes = JSON.parse(upladRes.data);
  605. if (_uploadRes.status == 200) {
  606. uni.$tm.toast('文件上传成功!');
  607. setTimeout(() => {
  608. this.fnGetData();
  609. }, 1000);
  610. } else {
  611. uni.$tm.toast(_uploadRes.message);
  612. }
  613. },
  614. fail: err => {
  615. uni.$tm.toast(err.message);
  616. }
  617. });
  618. },
  619. // 使用文件对象上传文件
  620. fnOnUploadFileByFile(file) {
  621. uni.showLoading({
  622. title: '文件上传中...',
  623. mask: true
  624. });
  625. uni.uploadFile({
  626. // #ifdef H5
  627. file: file,
  628. // #endif
  629. // #ifndef H5
  630. files: [file],
  631. // #endif
  632. header: {
  633. 'admin-authorization': getAdminAccessToken()
  634. },
  635. url: this.$baseApiUrl + '/api/admin/attachments/upload',
  636. name: 'file',
  637. success: upladRes => {
  638. const _uploadRes = JSON.parse(upladRes.data);
  639. if (_uploadRes.status == 200) {
  640. uni.$tm.toast('文件上传成功!');
  641. setTimeout(() => {
  642. this.fnGetData();
  643. }, 1000);
  644. } else {
  645. uni.$tm.toast(_uploadRes.message);
  646. }
  647. },
  648. fail: err => {
  649. uni.$tm.toast(err.message);
  650. }
  651. });
  652. }
  653. }
  654. };
  655. </script>
  656. <style lang="scss" scoped>
  657. .app-page {
  658. width: 100vw;
  659. min-height: 100vh;
  660. }
  661. .loading-wrap {
  662. padding: 24rpx;
  663. }
  664. .filter-wrap {
  665. position: fixed;
  666. left: 0;
  667. right: 0;
  668. /* #ifdef H5 */
  669. top: 88rpx;
  670. /* #endif */
  671. /* #ifndef H5 */
  672. top: 0;
  673. /* #endif */
  674. width: 100vw;
  675. z-index: 6;
  676. }
  677. .page-content {
  678. }
  679. .content-empty {
  680. width: 100vw;
  681. height: 65vh;
  682. }
  683. .attachment-card {
  684. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
  685. .cover {
  686. width: 170rpx;
  687. height: 160rpx;
  688. background-color: rgb(104, 136, 151);
  689. // box-shadow: 0 6rpx 10rpx rgba(51, 154, 204, 0.2);
  690. &.is-video {
  691. background-color: rgb(3, 174, 252);
  692. }
  693. &.is-image {
  694. background-color: #1cbcb4;
  695. }
  696. .icon {
  697. font-size: 40rpx;
  698. color: #fff;
  699. }
  700. .thumbnai {
  701. width: 100%;
  702. height: 100%;
  703. box-sizing: border-box;
  704. box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
  705. border: 6rpx solid #fff;
  706. }
  707. }
  708. .info {
  709. width: 0;
  710. flex-grow: 1;
  711. .time-icon {
  712. font-size: 24rpx;
  713. }
  714. }
  715. }
  716. .poup-body {
  717. box-sizing: border-box;
  718. height: 66vh;
  719. }
  720. .poup-content {
  721. width: 100%;
  722. overflow: hidden;
  723. }
  724. .btn-wrap {
  725. width: 100%;
  726. }
  727. .file-name {
  728. white-space: nowrap;
  729. overflow: hidden;
  730. text-overflow: ellipsis;
  731. word-wrap: break-word;
  732. word-break: break-all;
  733. }
  734. </style>