package.vue 5.2 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="download(item, $event)">
  30. 点击下载
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 列表为空 -->
  36. <LdmEmpty v-if="!total && !isRequest" name="ldm-empty.png"></LdmEmpty>
  37. </div>
  38. </van-list>
  39. </div>
  40. </template>
  41. <script>
  42. import { mapGetters } from 'vuex'
  43. import downloadFile from '~/utils/donwload-tools'
  44. import { debounce } from '~/utils'
  45. export default {
  46. layout: 'app-ldm',
  47. data() {
  48. return {
  49. isLoadingMore: true,
  50. finished: false,
  51. isRequest: true,
  52. listQuery: {
  53. fileType: 2,
  54. fileTitle: '',
  55. authUserId: '',
  56. pageNum: 1,
  57. pageSize: 10,
  58. },
  59. list: [],
  60. total: 0,
  61. }
  62. },
  63. computed: {
  64. ...mapGetters(['userInfo']),
  65. },
  66. mounted() {
  67. this.fetchList()
  68. },
  69. methods: {
  70. // 下载方法
  71. download(item, $event) {
  72. const url = `${process.env.BASE_URL}/download/file?ossName=${item.fileDownloadUrl}&fileName=${item.fileName}`
  73. downloadFile(url, item.fileName, this, $event)
  74. },
  75. // 获取列表
  76. fetchList: debounce(async function () {
  77. try {
  78. this.isLoadingMore = true
  79. this.listQuery.authUserId = this.userInfo.authUserId
  80. const res = await this.$http.api.getFileList(this.listQuery)
  81. this.list = [...this.list, ...res.data.list]
  82. this.finished = !res.data.hasNextPage
  83. this.total = res.data.total
  84. this.isLoadingMore = false
  85. this.listQuery.pageNum += 1
  86. this.isRequest = false
  87. } catch (error) {
  88. console.log(error)
  89. }
  90. }, 400),
  91. // 加载更多
  92. onLoadMore() {
  93. this.fetchList()
  94. },
  95. },
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. /* scss中可以用mixin来扩展 */
  100. @mixin ellipsis($line: 1) {
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. display: -webkit-box;
  104. -webkit-line-clamp: $line;
  105. -webkit-box-orient: vertical;
  106. }
  107. @media screen and (min-width: 768px) {
  108. .page-top {
  109. height: 466px;
  110. .logo {
  111. height: 61px;
  112. width: 311px;
  113. display: block;
  114. background: #fff;
  115. }
  116. .name {
  117. font-size: 19px;
  118. color: #221815;
  119. margin-top: 80px;
  120. text-align: center;
  121. line-height: 36px;
  122. text-transform: uppercase;
  123. }
  124. }
  125. .page-content {
  126. width: 973px;
  127. margin: 0 auto;
  128. .list {
  129. .section {
  130. position: relative;
  131. padding: 32px 16px;
  132. background: #fff;
  133. border-bottom: 1px solid #d8d8d8;
  134. &:first-child {
  135. border-top: 1px solid #d8d8d8;
  136. }
  137. .info {
  138. .name {
  139. width: 800px;
  140. font-size: 19px;
  141. color: #404040;
  142. line-height: 1.5;
  143. text-align: justify;
  144. @include ellipsis(1);
  145. }
  146. .download {
  147. position: absolute;
  148. right: 16px;
  149. bottom: 50%;
  150. transform: translateY(50%);
  151. font-size: 16px;
  152. color: #0080ed;
  153. cursor: pointer;
  154. &::after {
  155. content: '>';
  156. margin-left: 8px;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. @media screen and (max-width: 768px) {
  165. .page-top {
  166. height: 76.4vw;
  167. .logo {
  168. height: 11.5vw;
  169. width: 59vw;
  170. display: block;
  171. background: #fff;
  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>