package.vue 5.3 KB

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