package.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="isLoadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="onLoadMore"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center">
  11. <img
  12. class="logo"
  13. src="https://static.caimei365.com/www/authentic/pc/ldm-logo-rect.png"
  14. />
  15. <div class="name mt-2">
  16. Bring you into a new era<br />
  17. of high-tech non-invasive beauty care
  18. </div>
  19. </div>
  20. <div class="page-content">
  21. <div class="list">
  22. <div
  23. class="section flex justify-between items-center"
  24. v-for="item in list"
  25. :key="item.fileId"
  26. >
  27. <div class="info">
  28. <div class="name" v-text="item.fileName"></div>
  29. <div class="download" @click="downloadLink(item, $event)">
  30. 点击下载
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 列表为空 -->
  36. <SimpleEmpty
  37. v-if="!total && !isRequest"
  38. description="敬请期待~"
  39. ></SimpleEmpty>
  40. </div>
  41. </van-list>
  42. </div>
  43. </template>
  44. <script>
  45. import { mapGetters } from 'vuex'
  46. import downloadLink from '@/utils/download-link'
  47. import { debounce } from '~/utils'
  48. export default {
  49. layout: 'app-ldm',
  50. data() {
  51. return {
  52. isLoadingMore: true,
  53. finished: false,
  54. isRequest: true,
  55. listQuery: {
  56. fileType: 2,
  57. fileTitle: '',
  58. authUserId: '',
  59. pageNum: 1,
  60. pageSize: 4,
  61. },
  62. list: [],
  63. total: 0,
  64. }
  65. },
  66. computed: {
  67. ...mapGetters(['userInfo']),
  68. },
  69. mounted() {
  70. this.fetchList()
  71. },
  72. methods: {
  73. // 下载方法
  74. downloadLink(item, $event) {
  75. const url = `${process.env.BASE_URL}/download/file?ossName=${item.fileDownloadUrl}&fileName=${item.fileName}`
  76. downloadLink(url, $event)
  77. },
  78. // 获取列表
  79. fetchList: debounce(async function () {
  80. try {
  81. this.isLoadingMore = true
  82. this.listQuery.authUserId = this.userInfo.authUserId
  83. const res = await this.$http.api.getFileList(this.listQuery)
  84. this.list = [...this.list, ...res.data.list]
  85. this.finished = !res.data.hasNextPage
  86. this.total = res.data.total
  87. this.isLoadingMore = false
  88. this.listQuery.pageNum += 1
  89. } catch (error) {
  90. console.log(error)
  91. }
  92. }, 400),
  93. // 加载更多
  94. onLoadMore() {
  95. this.fetchList()
  96. },
  97. },
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. /* scss中可以用mixin来扩展 */
  102. @mixin ellipsis($line: 1) {
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. display: -webkit-box;
  106. -webkit-line-clamp: $line;
  107. -webkit-box-orient: vertical;
  108. }
  109. @media screen and (min-width: 768px) {
  110. .page-top {
  111. height: 466px;
  112. .logo {
  113. height: 61px;
  114. width: 311px;
  115. display: block;
  116. }
  117. .name {
  118. font-size: 19px;
  119. color: #221815;
  120. margin-top: 80px;
  121. text-align: center;
  122. line-height: 36px;
  123. text-transform: uppercase;
  124. }
  125. }
  126. .page-content {
  127. width: 973px;
  128. margin: 0 auto;
  129. .list {
  130. .section {
  131. position: relative;
  132. padding: 32px 16px;
  133. background: #fff;
  134. border-bottom: 1px solid #d8d8d8;
  135. &:first-child {
  136. border-top: 1px solid #d8d8d8;
  137. }
  138. .info {
  139. .name {
  140. width: 800px;
  141. font-size: 19px;
  142. color: #404040;
  143. line-height: 1.5;
  144. text-align: justify;
  145. @include ellipsis(1);
  146. }
  147. .download {
  148. position: absolute;
  149. right: 16px;
  150. bottom: 50%;
  151. transform: translateY(50%);
  152. font-size: 16px;
  153. color: #0080ed;
  154. cursor: pointer;
  155. &::after {
  156. content: '>';
  157. margin-left: 8px;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. @media screen and (max-width: 768px) {
  166. .page-top {
  167. height: 76.4vw;
  168. .logo {
  169. height: 11.5vw;
  170. width: 59vw;
  171. display: block;
  172. }
  173. .name {
  174. font-size: 3.5vw;
  175. color: #221815;
  176. margin-top: 15vw;
  177. text-align: center;
  178. line-height: 6.6vw;
  179. text-transform: uppercase;
  180. }
  181. }
  182. .page-content {
  183. .list {
  184. .section {
  185. position: relative;
  186. padding: 6vw 2.6vw;
  187. margin: 0 4vw;
  188. background: #fff;
  189. border-bottom: 0.1vw solid #d8d8d8;
  190. &:first-child {
  191. border-top: 0.1vw solid #d8d8d8;
  192. }
  193. .info {
  194. .name {
  195. width: 66vw;
  196. font-size: 3.6vw;
  197. color: #404040;
  198. line-height: 1.5;
  199. text-align: justify;
  200. @include ellipsis(1);
  201. }
  202. .download {
  203. position: absolute;
  204. right: 2.6vw;
  205. bottom: 50%;
  206. transform: translateY(50%);
  207. font-size: 3vw;
  208. color: #0080ed;
  209. cursor: pointer;
  210. &::after {
  211. content: '>';
  212. margin-left: 8px;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. </style>