123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template>
- <div class="page">
- <van-list
- v-model="isLoadingMore"
- :finished="finished"
- :immediate-check="false"
- :finished-text="total ? '没有更多了' : ''"
- @load="onLoadMore"
- >
- <div class="page-top flex flex-col justify-center items-center">
- <img
- class="logo"
- src="https://static.caimei365.com/www/authentic/pc/ldm-logo-rect.png"
- />
- <div class="name mt-2">
- Bring you into a new era<br />
- of high-tech non-invasive beauty care
- </div>
- </div>
- <div class="page-content">
- <div class="list">
- <div
- class="section flex justify-between items-center"
- v-for="item in list"
- :key="item.fileId"
- >
- <div class="info">
- <div class="name" v-text="item.fileName"></div>
- <div class="download" @click="download(item, $event)">
- 点击下载
- </div>
- </div>
- </div>
- </div>
- <!-- 列表为空 -->
- <LdmEmpty v-if="!total && !isRequest" name="ldm-empty.png"></LdmEmpty>
- </div>
- </van-list>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import downloadFile from '~/utils/donwload-tools'
- import { debounce } from '~/utils'
- export default {
- layout: 'app-ldm',
- data() {
- return {
- isLoadingMore: true,
- finished: false,
- isRequest: true,
- listQuery: {
- fileType: 2,
- fileTitle: '',
- authUserId: '',
- pageNum: 1,
- pageSize: 10,
- },
- list: [],
- total: 0,
- }
- },
- computed: {
- ...mapGetters(['userInfo']),
- },
- mounted() {
- this.fetchList()
- },
- methods: {
- // 下载方法
- download(item, $event) {
- const url = `${process.env.BASE_URL}/download/file?ossName=${item.fileDownloadUrl}&fileName=${item.fileName}`
- downloadFile(url, item.fileName, this, $event)
- },
- // 获取列表
- fetchList: debounce(async function () {
- try {
- this.isLoadingMore = true
- this.listQuery.authUserId = this.userInfo.authUserId
- const res = await this.$http.api.getFileList(this.listQuery)
- this.list = [...this.list, ...res.data.list]
- this.finished = !res.data.hasNextPage
- this.total = res.data.total
- this.isLoadingMore = false
- this.listQuery.pageNum += 1
- this.isRequest = false
- } catch (error) {
- console.log(error)
- }
- }, 400),
- // 加载更多
- onLoadMore() {
- this.fetchList()
- },
- },
- }
- </script>
- <style scoped lang="scss">
- /* scss中可以用mixin来扩展 */
- @mixin ellipsis($line: 1) {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: $line;
- -webkit-box-orient: vertical;
- }
- @media screen and (min-width: 768px) {
- .page-top {
- height: 466px;
- .logo {
- height: 61px;
- width: 311px;
- display: block;
- background: #fff;
- }
- .name {
- font-size: 19px;
- color: #221815;
- margin-top: 80px;
- text-align: center;
- line-height: 36px;
- text-transform: uppercase;
- }
- }
- .page-content {
- width: 973px;
- margin: 0 auto;
- .list {
- .section {
- position: relative;
- padding: 32px 16px;
- background: #fff;
- border-bottom: 1px solid #d8d8d8;
- &:first-child {
- border-top: 1px solid #d8d8d8;
- }
- .info {
- .name {
- width: 800px;
- font-size: 19px;
- color: #404040;
- line-height: 1.5;
- text-align: justify;
- @include ellipsis(1);
- }
- .download {
- position: absolute;
- right: 16px;
- bottom: 50%;
- transform: translateY(50%);
- font-size: 16px;
- color: #0080ed;
- cursor: pointer;
- &::after {
- content: '>';
- margin-left: 8px;
- }
- }
- }
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .page-top {
- height: 76.4vw;
- .logo {
- height: 11.5vw;
- width: 59vw;
- display: block;
- background: #fff;
- }
- .name {
- font-size: 3.5vw;
- color: #221815;
- margin-top: 15vw;
- text-align: center;
- line-height: 6.6vw;
- text-transform: uppercase;
- }
- }
- .page-content {
- .list {
- .section {
- position: relative;
- padding: 6vw 2.6vw;
- margin: 0 4vw;
- background: #fff;
- border-bottom: 0.1vw solid #d8d8d8;
- &:first-child {
- border-top: 0.1vw solid #d8d8d8;
- }
- .info {
- .name {
- width: 66vw;
- font-size: 3.6vw;
- color: #404040;
- line-height: 1.5;
- text-align: justify;
- @include ellipsis(1);
- }
- .download {
- position: absolute;
- right: 2.6vw;
- bottom: 50%;
- transform: translateY(50%);
- font-size: 3vw;
- color: #0080ed;
- cursor: pointer;
- &::after {
- content: '>';
- margin-left: 8px;
- }
- }
- }
- }
- }
- }
- }
- </style>
|